Title: [143459] branches/chromium/1410
Revision
143459
Author
yu...@chromium.org
Date
2013-02-20 06:39:54 -0800 (Wed, 20 Feb 2013)

Log Message

Merge 142594
> 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.

TBR=yu...@chromium.org
Review URL: https://codereview.chromium.org/12324011

Modified Paths

Added Paths

Diff

Copied: branches/chromium/1410/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt (from rev 142594, trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt) (0 => 143459)


--- branches/chromium/1410/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt	                        (rev 0)
+++ branches/chromium/1410/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector-expected.txt	2013-02-20 14:39:54 UTC (rev 143459)
@@ -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.
+

Copied: branches/chromium/1410/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector.html (from rev 142594, trunk/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector.html) (0 => 143459)


--- branches/chromium/1410/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector.html	                        (rev 0)
+++ branches/chromium/1410/LayoutTests/http/tests/inspector-enabled/console-exception-while-no-inspector.html	2013-02-20 14:39:54 UTC (rev 143459)
@@ -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>

Modified: branches/chromium/1410/Source/WebCore/inspector/InspectorConsoleAgent.cpp (143458 => 143459)


--- branches/chromium/1410/Source/WebCore/inspector/InspectorConsoleAgent.cpp	2013-02-20 14:24:57 UTC (rev 143458)
+++ branches/chromium/1410/Source/WebCore/inspector/InspectorConsoleAgent.cpp	2013-02-20 14:39:54 UTC (rev 143459)
@@ -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