Web Inspector: [v8] building call frame info for location-less internal script functi...
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Sep 2011 09:29:31 +0000 (09:29 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Sep 2011 09:29:31 +0000 (09:29 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@95083 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/debugger/debugger-pause-in-internal-expected.txt [new file with mode: 0644]
LayoutTests/inspector/debugger/debugger-pause-in-internal.html [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/debugger/debugger-pause-in-internal-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/DebuggerScript.js
Source/WebCore/bindings/v8/ScriptDebugServer.cpp

index 85fb0b6..15e32dd 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-13  Pavel Feldman  <pfeldman@google.com>
+
+        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.
+
+        * 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.
+
 2011-09-14  Fumitoshi Ukai  <ukai@chromium.org>
 
         Unreviewed, update chromium test expecations.
diff --git a/LayoutTests/inspector/debugger/debugger-pause-in-internal-expected.txt b/LayoutTests/inspector/debugger/debugger-pause-in-internal-expected.txt
new file mode 100644 (file)
index 0000000..bb4ab90
--- /dev/null
@@ -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.
+
diff --git a/LayoutTests/inspector/debugger/debugger-pause-in-internal.html b/LayoutTests/inspector/debugger/debugger-pause-in-internal.html
new file mode 100644 (file)
index 0000000..9d51189
--- /dev/null
@@ -0,0 +1,50 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/debugger-test.js"></script>
+<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>
diff --git a/LayoutTests/platform/chromium/inspector/debugger/debugger-pause-in-internal-expected.txt b/LayoutTests/platform/chromium/inspector/debugger/debugger-pause-in-internal-expected.txt
new file mode 100644 (file)
index 0000000..475e7ca
--- /dev/null
@@ -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.
+
index 226382f..94574c6 100644 (file)
@@ -1,3 +1,17 @@
+2011-09-13  Pavel Feldman  <pfeldman@google.com>
+
+        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.
+
+        Test: inspector/debugger/debugger-pause-in-internal.html
+
+        * bindings/v8/DebuggerScript.js:
+        ():
+        * bindings/v8/ScriptDebugServer.cpp:
+        (WebCore::ScriptDebugServer::currentCallFrame):
+
 2011-09-14  Ben Wells  <benwells@chromium.org>
 
         Large canvas fills should not crash or create unnecessarily large image buffers
index 372ae60..79dda71 100644 (file)
@@ -264,8 +264,8 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame)
 
     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,
index 1f0be61..37433ef 100644 (file)
@@ -251,8 +251,11 @@ ScriptValue ScriptDebugServer::currentCallFrame()
     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<JavaScriptCallFrame> currentCallFrame = JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<v8::Object>::Cast(currentCallFrameV8));
     v8::Context::Scope contextScope(m_pausedContext);
     return ScriptValue(toV8(currentCallFrame.release()));