Title: [98346] trunk
Revision
98346
Author
vse...@chromium.org
Date
2011-10-25 08:06:00 -0700 (Tue, 25 Oct 2011)

Log Message

Web Inspector: Debugger fails when there is an invalid watch _expression_.
https://bugs.webkit.org/show_bug.cgi?id=70718

Reviewed by Pavel Feldman.

Source/WebCore:

Test: inspector/debugger/watch-expressions-panel-switch.html

* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame):

LayoutTests:

* inspector/debugger/error-in-watch-expressions.html:
* inspector/debugger/watch-expressions-panel-switch-expected.txt: Added.
* inspector/debugger/watch-expressions-panel-switch.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98345 => 98346)


--- trunk/LayoutTests/ChangeLog	2011-10-25 14:26:59 UTC (rev 98345)
+++ trunk/LayoutTests/ChangeLog	2011-10-25 15:06:00 UTC (rev 98346)
@@ -1,3 +1,14 @@
+2011-10-25  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: Debugger fails when there is an invalid watch _expression_.
+        https://bugs.webkit.org/show_bug.cgi?id=70718
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/debugger/error-in-watch-expressions.html:
+        * inspector/debugger/watch-expressions-panel-switch-expected.txt: Added.
+        * inspector/debugger/watch-expressions-panel-switch.html: Added.
+
 2011-10-24  Pavel Podivilov  <podivi...@chromium.org>
 
         Web Inspector: fix empty line handling in source maps.

Modified: trunk/LayoutTests/inspector/debugger/error-in-watch-expressions.html (98345 => 98346)


--- trunk/LayoutTests/inspector/debugger/error-in-watch-expressions.html	2011-10-25 14:26:59 UTC (rev 98345)
+++ trunk/LayoutTests/inspector/debugger/error-in-watch-expressions.html	2011-10-25 15:06:00 UTC (rev 98346)
@@ -7,15 +7,24 @@
 
 var test = function()
 {
+    // We need to initialize scripts panel so that watch expressions section is created.
+    WebInspector.showPanel("scripts");
+
     var watchExpressionsSection = WebInspector.panels.scripts.sidebarPanes.watchExpressions.section;
-    watchExpressionsSection.addExpression();
-    watchExpressionsSection.watchExpressions[0] = "#$%";
+    watchExpressionsSection.watchExpressions = [];
+    watchExpressionsSection.watchExpressions.push("#$%");
     watchExpressionsSection.update();
+
     InspectorTest.runAfterPendingDispatches(step1);
 
     function step1()
     {
         InspectorTest.addResult(watchExpressionsSection.element.innerHTML.indexOf("watch-expressions-error-level") !== -1 ? "SUCCESS" : "FAILED");
+
+        // Clear watch expressions after execution.
+        watchExpressionsSection.watchExpressions = [];
+        watchExpressionsSection.update();
+
         InspectorTest.completeTest();
     }
 }

Added: trunk/LayoutTests/inspector/debugger/watch-expressions-panel-switch-expected.txt (0 => 98346)


--- trunk/LayoutTests/inspector/debugger/watch-expressions-panel-switch-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/debugger/watch-expressions-panel-switch-expected.txt	2011-10-25 15:06:00 UTC (rev 98346)
@@ -0,0 +1,11 @@
+Tests debugger does not fail when stopped while a panel other than scripts was opened. Both valid and invalid expressions are added to watch expressions.
+
+Bug 70718
+Script source was shown.
+Set timer for test function.
+Watch expressions updated.
+[expanded]  
+    window.document: HTMLDocument
+    windowa.document: ReferenceError: windowa is not defined
+Debugger was disabled.
+

Added: trunk/LayoutTests/inspector/debugger/watch-expressions-panel-switch.html (0 => 98346)


--- trunk/LayoutTests/inspector/debugger/watch-expressions-panel-switch.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/debugger/watch-expressions-panel-switch.html	2011-10-25 15:06:00 UTC (rev 98346)
@@ -0,0 +1,65 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+<script>
+function testFunction()
+{
+    var x = Math.sqrt(10);
+    return x;
+}
+
+var test = function()
+{
+    InspectorTest.setQuiet(true);
+
+    // We need to initialize scripts panel so that watch expressions section is created.
+    WebInspector.showPanel("scripts");
+
+    var watchExpressionsSection = WebInspector.panels.scripts.sidebarPanes.watchExpressions.section;
+    watchExpressionsSection.watchExpressions = [];
+    watchExpressionsSection.watchExpressions.push("window.document");
+    watchExpressionsSection.watchExpressions.push("windowa.document");
+    watchExpressionsSection.update();
+
+    var testName = WebInspector.mainResource.url;
+    testName = testName.substring(testName.lastIndexOf('/') + 1);
+    InspectorTest.showScriptSource(testName, didShowScriptSource);
+
+    var currentSourceFrame;
+    function didShowScriptSource(sourceFrame)
+    {
+        currentSourceFrame = sourceFrame;
+        InspectorTest.addResult("Script source was shown.");
+        InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true);
+        InspectorTest.addSniffer(WebInspector.WatchExpressionsSection.prototype, "update", watchExpressionsUpdated);
+        // Switch to another panel to test how watch expressions evaluation together with panel switching.
+        WebInspector.showPanel("network");
+        InspectorTest.runTestFunctionAndWaitUntilPaused(didPaused);
+    }
+
+    function didPaused(callFrames)
+    {
+    }
+
+    function watchExpressionsUpdated()
+    {
+        InspectorTest.addResult("Watch expressions updated.");
+        InspectorTest.dumpObjectPropertySection(watchExpressionsSection, {});
+
+        // Clear watch expressions after execution.
+        watchExpressionsSection.watchExpressions = [];
+        watchExpressionsSection.update();
+
+        InspectorTest.completeDebuggerTest();
+    }
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests debugger does not fail when stopped while a panel other than scripts was opened. Both valid and invalid expressions are added to watch expressions.</p>
+<a href="" 70718</a>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (98345 => 98346)


--- trunk/Source/WebCore/ChangeLog	2011-10-25 14:26:59 UTC (rev 98345)
+++ trunk/Source/WebCore/ChangeLog	2011-10-25 15:06:00 UTC (rev 98346)
@@ -1,3 +1,15 @@
+2011-10-25  Vsevolod Vlasov  <vse...@chromium.org>
+
+        Web Inspector: Debugger fails when there is an invalid watch _expression_.
+        https://bugs.webkit.org/show_bug.cgi?id=70718
+
+        Reviewed by Pavel Feldman.
+
+        Test: inspector/debugger/watch-expressions-panel-switch.html
+
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame):
+
 2011-10-24  Pavel Podivilov  <podivi...@chromium.org>
 
         Web Inspector: fix empty line handling in source maps.

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (98345 => 98346)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-10-25 14:26:59 UTC (rev 98345)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-10-25 15:06:00 UTC (rev 98346)
@@ -467,7 +467,8 @@
                 callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
         }
         var selectedCallFrame = this._presentationModel.selectedCallFrame;
-        selectedCallFrame.evaluate(code, objectGroup, includeCommandLineAPI, returnByValue, didEvaluate.bind(this));
+        if (selectedCallFrame)
+            selectedCallFrame.evaluate(code, objectGroup, includeCommandLineAPI, returnByValue, didEvaluate.bind(this));
     },
 
     getSelectedCallFrameVariables: function(callback)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to