Title: [142594] trunk
Revision
142594
Author
yu...@chromium.org
Date
2013-02-12 01:20:48 -0800 (Tue, 12 Feb 2013)

Log Message

Web Inspector: stack trace is cut at native bind if inspector is closed
https://bugs.webkit.org/show_bug.cgi?id=109427

Reviewed by Pavel Feldman.

Source/WebCore:

Only top frame is collected instead of full stack trace when inspector
front-end is closed to avoid expensive operations when exceptions are
thrown.

Test: http/tests/inspector-enabled/console-exception-while-no-inspector.html

* inspector/InspectorConsoleAgent.cpp:
(WebCore::InspectorConsoleAgent::addMessageToConsole):

LayoutTests:

Test that stack trace for uncaught exceptions is collected when inspector
front-end is closed.

* http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt: Added.
* http/tests/inspector-enabled/console-exception-while-no-inspector.html: Added.
* platform/chromium/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (142593 => 142594)


--- trunk/LayoutTests/ChangeLog	2013-02-12 08:47:41 UTC (rev 142593)
+++ trunk/LayoutTests/ChangeLog	2013-02-12 09:20:48 UTC (rev 142594)
@@ -1,3 +1,17 @@
+2013-02-11  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: stack trace is cut at native bind if inspector is closed
+        https://bugs.webkit.org/show_bug.cgi?id=109427
+
+        Reviewed by Pavel Feldman.
+
+        Test that stack trace for uncaught exceptions is collected when inspector
+        front-end is closed.
+
+        * http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt: Added.
+        * http/tests/inspector-enabled/console-exception-while-no-inspector.html: Added.
+        * platform/chromium/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt: Added.
+
 2013-02-12  Jochen Eisinger  <joc...@chromium.org>
 
         [chromium] move webrtc mocks to testrunner library

Added: trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt (0 => 142594)


--- trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt	2013-02-12 09:20:48 UTC (rev 142594)
@@ -0,0 +1,6 @@
+CONSOLE MESSAGE: 2013
+Tests that console will NOT contain stack trace for exception thrown when inspector front-end was closed. Bug 109427.
+
+SUCCESS: message doesn't have stack trace
+TEST COMPLETE.
+
Property changes on: trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector.html (0 => 142594)


--- trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector.html	2013-02-12 09:20:48 UTC (rev 142594)
@@ -0,0 +1,65 @@
+<html>
+<head>
+<script src=""
+<script>
+function throwException() {
+    throw 2013;
+}
+
+function baz()
+{
+    throwException();
+}
+
+function bar(callback)
+{
+    callback()
+}
+
+function foo()
+{
+    bar(baz.bind(this));
+}
+
+
+function handleLoaded()
+{
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+    setTimeout(showInspectorAndRunTest, 0);
+    foo();
+}
+
+
+function showInspectorAndRunTest()
+{
+    if (window.testRunner)
+        testRunner.showWebInspector();
+    runTest();
+}
+
+function test()
+{
+    if (WebInspector.console.messages.length !== 1)
+        InspectorTest.addResult("FAIL: found too many console messages: " + WebInspector.console.messages.length);
+
+    var message = WebInspector.console.messages[0];
+    var stack = message.stackTrace;
+    if (stack)
+        InspectorTest.addResult("FAIL: found message with stack trace");
+    else
+        InspectorTest.addResult("SUCCESS: message doesn't have stack trace");
+
+    InspectorTest.addResult("TEST COMPLETE.");
+    InspectorTest.completeTest();
+}
+
+</script>
+
+</head>
+<body _onload_="handleLoaded()">
+<p>
+Tests that console will NOT contain stack trace for exception thrown when inspector front-end was closed. <a href="" 109427.</a>
+</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/platform/chromium/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt (0 => 142594)


--- trunk/LayoutTests/platform/chromium/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt	2013-02-12 09:20:48 UTC (rev 142594)
@@ -0,0 +1,6 @@
+CONSOLE MESSAGE: line 6: Uncaught 2013
+Tests that console will NOT contain stack trace for exception thrown when inspector front-end was closed. Bug 109427.
+
+SUCCESS: message doesn't have stack trace
+TEST COMPLETE.
+
Property changes on: trunk/LayoutTests/platform/chromium/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (142593 => 142594)


--- trunk/Source/WebCore/ChangeLog	2013-02-12 08:47:41 UTC (rev 142593)
+++ trunk/Source/WebCore/ChangeLog	2013-02-12 09:20:48 UTC (rev 142594)
@@ -1,3 +1,19 @@
+2013-02-11  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: stack trace is cut at native bind if inspector is closed
+        https://bugs.webkit.org/show_bug.cgi?id=109427
+
+        Reviewed by Pavel Feldman.
+
+        Only top frame is collected instead of full stack trace when inspector
+        front-end is closed to avoid expensive operations when exceptions are
+        thrown.
+
+        Test: http/tests/inspector-enabled/console-exception-while-no-inspector.html
+
+        * inspector/InspectorConsoleAgent.cpp:
+        (WebCore::InspectorConsoleAgent::addMessageToConsole):
+
 2013-02-12  Kent Tamura  <tk...@chromium.org>
 
         INPUT_MULTIPLE_FIELDS_UI: Mouse click not on sub-fields in multiple fields input  should not move focus

Modified: trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp (142593 => 142594)


--- trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp	2013-02-12 08:47:41 UTC (rev 142593)
+++ trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp	2013-02-12 09:20:48 UTC (rev 142594)
@@ -188,7 +188,8 @@
         clearMessages(&error);
     }
 
-    addConsoleMessage(adoptPtr(new ConsoleMessage(!isWorkerAgent(), source, type, level, message, scriptId, lineNumber, state, requestIdentifier)));
+    bool canGenerateCallStack = !isWorkerAgent() && m_frontend;
+    addConsoleMessage(adoptPtr(new ConsoleMessage(canGenerateCallStack, source, type, level, message, scriptId, lineNumber, state, requestIdentifier)));
 }
 
 Vector<unsigned> InspectorConsoleAgent::consoleMessageArgumentCounts()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to