Title: [87487] branches/chromium/742
Revision
87487
Author
apav...@chromium.org
Date
2011-05-27 02:30:59 -0700 (Fri, 27 May 2011)

Log Message

Merge 86507 - 2011-05-15  Ilya Tikhonovsky  <loi...@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: chromium renderer crash at eval in console.

        https://bugs.webkit.org/show_bug.cgi?id=60616
        Renderer of inspected page is crashing when modal dialog
        has been opened via console eval and page is reloaded.

        Test: inspector/console/console-long-eval-crash.html

        * inspector/CodeGeneratorInspector.pm:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::connectFrontend):
        (WebCore::InspectorController::dispatchMessageFromFrontend):
        * inspector/InspectorController.h:

2011-05-15  Ilya Tikhonovsky  <loi...@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: chromium renderer crash at eval in console.

        https://bugs.webkit.org/show_bug.cgi?id=60616
        Renderer of inspected page is crashing when modal dialog
        has been opened via console eval and page is reloaded.

        * inspector/console/console-long-eval-crash-expected.txt: Added.
        * inspector/console/console-long-eval-crash.html: Added.
        * platform/gtk/Skipped:
        * platform/mac-wk2/Skipped:
        * platform/qt-wk2/Skipped:
        * platform/win/Skipped:


TBR=loi...@chromium.org
Review URL: http://codereview.chromium.org/7062044

Modified Paths

Added Paths

Diff

Copied: branches/chromium/742/LayoutTests/inspector/console/console-long-eval-crash-expected.txt (from rev 86507, trunk/LayoutTests/inspector/console/console-long-eval-crash-expected.txt) (0 => 87487)


--- branches/chromium/742/LayoutTests/inspector/console/console-long-eval-crash-expected.txt	                        (rev 0)
+++ branches/chromium/742/LayoutTests/inspector/console/console-long-eval-crash-expected.txt	2011-05-27 09:30:59 UTC (rev 87487)
@@ -0,0 +1,3 @@
+Test that any long api call from the frontend will not crash the inspected page's renderer if the page is reloaded or frontend is closed in the middle.
+
+https://bugs.webkit.org/show_bug.cgi?id=60616

Copied: branches/chromium/742/LayoutTests/inspector/console/console-long-eval-crash.html (from rev 86507, trunk/LayoutTests/inspector/console/console-long-eval-crash.html) (0 => 87487)


--- branches/chromium/742/LayoutTests/inspector/console/console-long-eval-crash.html	                        (rev 0)
+++ branches/chromium/742/LayoutTests/inspector/console/console-long-eval-crash.html	2011-05-27 09:30:59 UTC (rev 87487)
@@ -0,0 +1,31 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+layoutTestController.setCanOpenWindows();
+
+function doDialog()
+{
+    layoutTestController.closeWebInspector();
+    showModalDialog('data:text/html,<script>setTimeout(close, 0);%3c/script>');
+    setTimeout(function(){layoutTestController.notifyDone();}, 0);
+}
+
+function test()
+{
+    RuntimeAgent.evaluate("doDialog()");
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Test that any long api call from the frontend will not crash the inspected page's renderer if the page is reloaded or frontend is closed in the middle.
+</p>
+<a href=""
+
+</body>
+</html>

Modified: branches/chromium/742/LayoutTests/platform/gtk/Skipped (87486 => 87487)


--- branches/chromium/742/LayoutTests/platform/gtk/Skipped	2011-05-27 09:11:30 UTC (rev 87486)
+++ branches/chromium/742/LayoutTests/platform/gtk/Skipped	2011-05-27 09:30:59 UTC (rev 87487)
@@ -1053,6 +1053,7 @@
 fast/events/show-modal-dialog-onblur-onfocus.html
 fast/events/scroll-event-during-modal-dialog.html
 fast/harness/show-modal-dialog.html
+inspector/console/console-long-eval-crash.html
 sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.2_T10.html
 sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.1_T11.html
 sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.1_T2.html

Modified: branches/chromium/742/LayoutTests/platform/mac-wk2/Skipped (87486 => 87487)


--- branches/chromium/742/LayoutTests/platform/mac-wk2/Skipped	2011-05-27 09:11:30 UTC (rev 87486)
+++ branches/chromium/742/LayoutTests/platform/mac-wk2/Skipped	2011-05-27 09:30:59 UTC (rev 87487)
@@ -1659,6 +1659,7 @@
 # WebKit2 needs showModalDialog
 fast/events/scroll-event-during-modal-dialog.html
 fast/harness/show-modal-dialog.html
+inspector/console/console-long-eval-crash.html
 
 # WebKit2 needs fullscreen support
 # https://bugs.webkit.org/show_bug.cgi?id=56318

Modified: branches/chromium/742/LayoutTests/platform/qt-wk2/Skipped (87486 => 87487)


--- branches/chromium/742/LayoutTests/platform/qt-wk2/Skipped	2011-05-27 09:11:30 UTC (rev 87486)
+++ branches/chromium/742/LayoutTests/platform/qt-wk2/Skipped	2011-05-27 09:30:59 UTC (rev 87487)
@@ -1972,6 +1972,7 @@
 
 # WebKit2 needs showModalDialog
 fast/harness/show-modal-dialog.html
+inspector/console/console-long-eval-crash.html
 
 # WebKit2 needs fullscreen support
 fullscreen/full-screen-css.html

Modified: branches/chromium/742/LayoutTests/platform/win/Skipped (87486 => 87487)


--- branches/chromium/742/LayoutTests/platform/win/Skipped	2011-05-27 09:11:30 UTC (rev 87486)
+++ branches/chromium/742/LayoutTests/platform/win/Skipped	2011-05-27 09:30:59 UTC (rev 87487)
@@ -1013,6 +1013,7 @@
 fast/events/show-modal-dialog-onblur-onfocus.html
 fast/harness/show-modal-dialog.html
 fast/events/scroll-event-during-modal-dialog.html
+inspector/console/console-long-eval-crash.html
 
 # These tests fail when showModalDialog is unsupported, even though they don't
 # rely on it directly http://webkit.org/b/53676

Modified: branches/chromium/742/Source/WebCore/inspector/CodeGeneratorInspector.pm (87486 => 87487)


--- branches/chromium/742/Source/WebCore/inspector/CodeGeneratorInspector.pm	2011-05-27 09:11:30 UTC (rev 87486)
+++ branches/chromium/742/Source/WebCore/inspector/CodeGeneratorInspector.pm	2011-05-27 09:30:59 UTC (rev 87487)
@@ -93,6 +93,9 @@
 $typeTransform{"PassRefPtr"} = {
     "forwardHeader" => "wtf/PassRefPtr.h",
 };
+$typeTransform{"RefCounted"} = {
+    "forwardHeader" => "wtf/RefCounted.h",
+};
 $typeTransform{"InspectorFrontendChannel"} = {
     "forward" => "InspectorFrontendChannel",
     "header" => "InspectorFrontendChannel.h",
@@ -213,6 +216,7 @@
 my $namespace;
 
 my $backendClassName;
+my $backendClassDeclaration;
 my $backendJSStubName;
 my %backendTypes;
 my @backendMethods;
@@ -273,10 +277,12 @@
     $frontendTypes{"PassRefPtr"} = 1;
 
     $backendClassName = "InspectorBackendDispatcher";
+    $backendClassDeclaration = "InspectorBackendDispatcher: public RefCounted<InspectorBackendDispatcher>";
     $backendJSStubName = "InspectorBackendStub";
     $backendTypes{"Inspector"} = 1;
     $backendTypes{"InspectorFrontendChannel"} = 1;
     $backendTypes{"PassRefPtr"} = 1;
+    $backendTypes{"RefCounted"} = 1;
     $backendTypes{"Object"} = 1;
 }
 
@@ -384,7 +390,8 @@
         }
         push(@function, "    ${functionName}Message->setObject(\"params\", paramsObject);");
     }
-    push(@function, "    m_inspectorFrontendChannel->sendMessageToFrontend(${functionName}Message->toJSONString());");
+    push(@function, "    if (m_inspectorFrontendChannel)");
+    push(@function, "        m_inspectorFrontendChannel->sendMessageToFrontend(${functionName}Message->toJSONString());");
     push(@function, "}");
     push(@function, "");
     push(@frontendMethodsImpl, @function);
@@ -489,7 +496,8 @@
     push(@function, "    responseMessage->setObject(\"result\", result);");
     push(@function, "");
     push(@function, "    responseMessage->setNumber(\"id\", callId);");
-    push(@function, "    m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage->toJSONString());");
+    push(@function, "    if (m_inspectorFrontendChannel)");
+    push(@function, "        m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage->toJSONString());");
     push(@function, "}");
     push(@function, "");
     push(@backendMethodsImpl, @function);
@@ -530,7 +538,8 @@
         message->setNumber("id", *callId);
     else
         message->setValue("id", InspectorValue::null());
-    m_inspectorFrontendChannel->sendMessageToFrontend(message->toJSONString());
+    if (m_inspectorFrontendChannel)
+        m_inspectorFrontendChannel->sendMessageToFrontend(message->toJSONString());
 }
 EOF
     return split("\n", $reportProtocolError);
@@ -581,6 +590,7 @@
     my $backendDispatcherBody = << "EOF";
 void ${backendClassName}::dispatch(const String& message)
 {
+    RefPtr<${backendClassName}> protect = this;
     typedef void (${backendClassName}::*CallHandler)(long callId, InspectorObject* messageObject);
     typedef HashMap<String, CallHandler> DispatchMap;
     DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, );
@@ -880,6 +890,7 @@
 sub generateHeader
 {
     my $className = shift;
+    my $classDeclaration = shift;
     my $types = shift;
     my $constructor = shift;
     my $constants = shift;
@@ -906,7 +917,7 @@
 
 typedef String ErrorString;
 
-class $className {
+class $classDeclaration {
 public:
 $constructor
 
@@ -993,6 +1004,8 @@
     push(@backendHead, @fieldInitializers);
     push(@backendHead, "    { }");
     push(@backendHead, "");
+    push(@backendHead, "    void clearFrontend() { m_inspectorFrontendChannel = 0; }");
+    push(@backendHead, "");
     push(@backendHead, "    enum CommonErrorCode {");
     push(@backendHead, "        ParseError = 0,");
     push(@backendHead, "        InvalidRequest,");
@@ -1024,7 +1037,7 @@
     undef($SOURCE);
 
     open(my $HEADER, ">$outputHeadersDir/$frontendClassName.h") || die "Couldn't open file $outputHeadersDir/$frontendClassName.h";
-    print $HEADER generateHeader($frontendClassName, \%frontendTypes, $frontendConstructor, \@frontendConstantDeclarations, \@frontendMethods, join("\n", @frontendFooter));
+    print $HEADER generateHeader($frontendClassName, $frontendClassName, \%frontendTypes, $frontendConstructor, \@frontendConstantDeclarations, \@frontendMethods, join("\n", @frontendFooter));
     close($HEADER);
     undef($HEADER);
 
@@ -1050,7 +1063,7 @@
     undef($SOURCE);
 
     open($HEADER, ">$outputHeadersDir/$backendClassName.h") || die "Couldn't open file $outputHeadersDir/$backendClassName.h";
-    print $HEADER join("\n", generateHeader($backendClassName, \%backendTypes, $backendConstructor, \@backendConstantDeclarations, \@backendMethods, join("\n", @backendFooter)));
+    print $HEADER join("\n", generateHeader($backendClassName, $backendClassDeclaration, \%backendTypes, $backendConstructor, \@backendConstantDeclarations, \@backendMethods, join("\n", @backendFooter)));
     close($HEADER);
     undef($HEADER);
 

Modified: branches/chromium/742/Source/WebCore/inspector/InspectorController.cpp (87486 => 87487)


--- branches/chromium/742/Source/WebCore/inspector/InspectorController.cpp	2011-05-27 09:11:30 UTC (rev 87486)
+++ branches/chromium/742/Source/WebCore/inspector/InspectorController.cpp	2011-05-27 09:30:59 UTC (rev 87487)
@@ -112,7 +112,7 @@
     InspectorInstrumentation::frontendCreated();
 
     ASSERT(m_inspectorClient);
-    m_inspectorBackendDispatcher = new InspectorBackendDispatcher(
+    m_inspectorBackendDispatcher = adoptRef(new InspectorBackendDispatcher(
         m_inspectorClient,
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
         m_inspectorAgent->applicationCacheAgent(),
@@ -138,7 +138,7 @@
         m_inspectorAgent->profilerAgent(),
 #endif
         m_inspectorAgent->runtimeAgent(),
-        m_inspectorAgent->timelineAgent());
+        m_inspectorAgent->timelineAgent()));
 
     if (m_startUserInitiatedDebuggingWhenFrontedIsConnected) {
         m_inspectorFrontend->inspector()->startUserInitiatedDebugging();
@@ -150,6 +150,7 @@
 {
     if (!m_inspectorFrontend)
         return;
+    m_inspectorBackendDispatcher->clearFrontend();
     m_inspectorBackendDispatcher.clear();
 
     m_inspectorAgent->disconnectFrontend();

Modified: branches/chromium/742/Source/WebCore/inspector/InspectorController.h (87486 => 87487)


--- branches/chromium/742/Source/WebCore/inspector/InspectorController.h	2011-05-27 09:11:30 UTC (rev 87486)
+++ branches/chromium/742/Source/WebCore/inspector/InspectorController.h	2011-05-27 09:30:59 UTC (rev 87487)
@@ -106,7 +106,7 @@
 
     OwnPtr<InjectedScriptManager> m_injectedScriptManager;
     OwnPtr<InspectorAgent> m_inspectorAgent;
-    OwnPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
+    RefPtr<InspectorBackendDispatcher> m_inspectorBackendDispatcher;
     OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient;
     OwnPtr<InspectorFrontend> m_inspectorFrontend;
     InspectorClient* m_inspectorClient;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to