Title: [95803] branches/chromium/874
Revision
95803
Author
pfeld...@chromium.org
Date
2011-09-23 07:59:31 -0700 (Fri, 23 Sep 2011)

Log Message

Merge 95083 - Web Inspector: [v8] building call frame info for location-less internal script function crashes.
https://bugs.webkit.org/show_bug.cgi?id=67991

Reviewed by Yury Semikhatsky.

Source/WebCore:

Test: inspector/debugger/debugger-pause-in-internal.html

* bindings/v8/DebuggerScript.js:
* bindings/v8/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::currentCallFrame):

LayoutTests:

* inspector/debugger/debugger-pause-in-internal-expected.txt: Added.
* inspector/debugger/debugger-pause-in-internal.html: Added.
* inspector/debugger/debugger-pause-on-exception-crash-expected.txt: Added.
* platform/chromium/inspector/debugger/debugger-pause-in-internal-expected.txt: Added.

TBR=pfeld...@chromium.org
Review URL: http://codereview.chromium.org/8017006

Modified Paths

Added Paths

Diff

Copied: branches/chromium/874/LayoutTests/inspector/debugger/debugger-pause-in-internal-expected.txt (from rev 95083, trunk/LayoutTests/inspector/debugger/debugger-pause-in-internal-expected.txt) (0 => 95803)


--- branches/chromium/874/LayoutTests/inspector/debugger/debugger-pause-in-internal-expected.txt	                        (rev 0)
+++ branches/chromium/874/LayoutTests/inspector/debugger/debugger-pause-in-internal-expected.txt	2011-09-23 14:59:31 UTC (rev 95803)
@@ -0,0 +1,12 @@
+CONSOLE MESSAGE: line 2: SyntaxError: Unexpected token ')'
+Tests that pause on exception in internal script does not crash.
+
+Debugger was enabled.
+Script source was shown.
+Script execution paused.
+Call stack:
+    0) throwException (debugger-pause-in-internal.html:9)
+    1) handleClick (debugger-pause-in-internal.html:14)
+Script execution resumed.
+Debugger was disabled.
+

Copied: branches/chromium/874/LayoutTests/inspector/debugger/debugger-pause-in-internal.html (from rev 95083, trunk/LayoutTests/inspector/debugger/debugger-pause-in-internal.html) (0 => 95803)


--- branches/chromium/874/LayoutTests/inspector/debugger/debugger-pause-in-internal.html	                        (rev 0)
+++ branches/chromium/874/LayoutTests/inspector/debugger/debugger-pause-in-internal.html	2011-09-23 14:59:31 UTC (rev 95803)
@@ -0,0 +1,50 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function throwException()
+{
+    new Function("return ()");
+}
+
+function handleClick()
+{
+    throwException();
+}
+
+var test = function()
+{
+    InspectorTest.startDebuggerTest(step1);
+
+    function step1()
+    {
+        DebuggerAgent.setPauseOnExceptions(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
+        InspectorTest.showScriptSource("debugger-pause-in-internal.html", step2);
+    }
+
+    function step2()  
+    {
+        InspectorTest.addResult("Script source was shown.");
+        InspectorTest.evaluateInPage("setTimeout(handleClick, 0)");
+        InspectorTest.waitUntilPaused(step3);
+    }
+
+    function step3(callFrames)
+    {
+        InspectorTest.captureStackTrace(callFrames);
+        InspectorTest.completeDebuggerTest();
+    }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that pause on exception in internal script does not crash.
+</p>
+
+</body>
+</html>

Copied: branches/chromium/874/LayoutTests/platform/chromium/inspector/debugger/debugger-pause-in-internal-expected.txt (from rev 95083, trunk/LayoutTests/platform/chromium/inspector/debugger/debugger-pause-in-internal-expected.txt) (0 => 95803)


--- branches/chromium/874/LayoutTests/platform/chromium/inspector/debugger/debugger-pause-in-internal-expected.txt	                        (rev 0)
+++ branches/chromium/874/LayoutTests/platform/chromium/inspector/debugger/debugger-pause-in-internal-expected.txt	2011-09-23 14:59:31 UTC (rev 95803)
@@ -0,0 +1,13 @@
+CONSOLE MESSAGE: line 2: Uncaught SyntaxError: Unexpected token )
+Tests that pause on exception in internal script does not crash.
+
+Debugger was enabled.
+Script source was shown.
+Script execution paused.
+Call stack:
+    0) Function ((internal script):(line number))
+    1) throwException (debugger-pause-in-internal.html:9)
+    2) handleClick (debugger-pause-in-internal.html:14)
+Script execution resumed.
+Debugger was disabled.
+

Modified: branches/chromium/874/Source/WebCore/bindings/v8/DebuggerScript.js (95802 => 95803)


--- branches/chromium/874/Source/WebCore/bindings/v8/DebuggerScript.js	2011-09-23 14:58:30 UTC (rev 95802)
+++ branches/chromium/874/Source/WebCore/bindings/v8/DebuggerScript.js	2011-09-23 14:59:31 UTC (rev 95803)
@@ -264,8 +264,8 @@
 
     return {
         "sourceID": sourceID,
-        "line": location.line,
-        "column": location.column,
+        "line": location ? location.line : 0,
+        "column": location ? location.column : 0,
         "functionName": functionName,
         "thisObject": thisObject,
         "scopeChain": scopeChain,

Modified: branches/chromium/874/Source/WebCore/bindings/v8/ScriptDebugServer.cpp (95802 => 95803)


--- branches/chromium/874/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2011-09-23 14:58:30 UTC (rev 95802)
+++ branches/chromium/874/Source/WebCore/bindings/v8/ScriptDebugServer.cpp	2011-09-23 14:59:31 UTC (rev 95803)
@@ -251,8 +251,11 @@
     v8::Handle<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("currentCallFrame")));
     v8::Handle<v8::Value> argv[] = { m_executionState.get() };
     v8::Handle<v8::Value> currentCallFrameV8 = currentCallFrameFunction->Call(m_debuggerScript.get(), 1, argv);
+
+    ASSERT(!currentCallFrameV8.IsEmpty());
     if (!currentCallFrameV8->IsObject())
         return ScriptValue(v8::Null());
+
     RefPtr<_javascript_CallFrame> currentCallFrame = _javascript_CallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<v8::Object>::Cast(currentCallFrameV8));
     v8::Context::Scope contextScope(m_pausedContext);
     return ScriptValue(toV8(currentCallFrame.release()));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to