[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Wed Apr 7 23:24:09 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 8acaaec2566a0239b9a4143f6f41d72f7aed3937
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 5 20:13:29 2009 +0000

    2009-11-05  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            REGRESSION: Web Inspector doesn't show CSS rules properly for iframes
    
            https://bugs.webkit.org/show_bug.cgi?id=30884
    
            Test: inspector/styles-iframe.html
    
            * inspector/front-end/DOMAgent.js:
            (WebInspector.DOMNode):
            * inspector/front-end/InjectedScript.js:
            (InjectedScript.getStyles):
            (InjectedScript.getComputedStyle):
            (InjectedScript.addStyleSelector):
            * inspector/front-end/TestController.js:
            (WebInspector.TestController.prototype.notifyDone):
            (WebInspector.TestController.prototype.runAfterPendingDispatches):
            (WebInspector.evaluateForTestInFrontend.invokeMethod):
            (WebInspector.evaluateForTestInFrontend):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50574 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4a7e44e..dde2622 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,29 @@
+i2009-11-05  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        REGRESSION: Web Inspector doesn't show CSS rules properly for iframes
+
+        https://bugs.webkit.org/show_bug.cgi?id=30884
+
+        * inspector/console-dir.html:
+        * inspector/console-dirxml.html:
+        * inspector/console-format-collections-expected.txt:
+        * inspector/console-format-collections.html:
+        * inspector/console-format.html:
+        * inspector/console-tests.html:
+        * inspector/elements-panel-structure-expected.txt:
+        * inspector/elements-panel-structure.html:
+        * inspector/evaluate-in-frontend.js:
+        ():
+        (expandDOMSubtree.processChildren):
+        (expandDOMSubtree):
+        (dumpConsoleMessages):
+        * inspector/resources/styles-iframe-data.html: Added.
+        * inspector/styles-iframe-expected.txt: Added.
+        * inspector/styles-iframe.html: Added.
+        * platform/qt/Skipped:
+
 2009-11-05  Dimitri Glazkov  <dglazkov at chromium.org>
 
         Reviewed by Geoffrey Garen.
diff --git a/LayoutTests/inspector/console-dir.html b/LayoutTests/inspector/console-dir.html
index 6618ad4..31ccd86 100755
--- a/LayoutTests/inspector/console-dir.html
+++ b/LayoutTests/inspector/console-dir.html
@@ -12,10 +12,10 @@ function doit()
     function callback(result)
     {
         for (var i = 0; i < result.length; ++i)
-            output(result[i]);
+            output(result[i].text);
         notifyDone();
     }
-    evaluateInWebInspector("dumpMessages()", callback);
+    evaluateInWebInspector("dumpConsoleMessages", callback);
 }
 
 </script>
@@ -26,17 +26,6 @@ function doit()
 Tests that console logging dumps proper messages.
 </p>
 
-<div id="frontend-script" style="display:none">
-function dumpMessages()
-{
-    var result = [];
-    var messages = WebInspector.console.messages;
-    for (var i = 0; i < messages.length; ++i)
-        result.push(messages[i].toMessageElement().textContent.replace(/\u200b/g, ""));
-    return result;
-}
-</div>
-
 <div id="output">
 </div>
 
diff --git a/LayoutTests/inspector/console-dirxml.html b/LayoutTests/inspector/console-dirxml.html
index ebd6c4c..80ebfef 100755
--- a/LayoutTests/inspector/console-dirxml.html
+++ b/LayoutTests/inspector/console-dirxml.html
@@ -10,10 +10,10 @@ function doit()
     function callback(result)
     {
         for (var i = 0; i < result.length; ++i)
-            output(result[i]);
+            output(result[i].text);
         notifyDone();
     }
-    evaluateInWebInspector("dumpMessages()", callback);
+    evaluateInWebInspector("dumpConsoleMessages", callback);
 }
 
 </script>
@@ -24,17 +24,6 @@ function doit()
 Tests that console logging dumps proper messages.
 </p>
 
-<div id="frontend-script" style="display:none">
-function dumpMessages()
-{
-    var result = [];
-    var messages = WebInspector.console.messages;
-    for (var i = 0; i < messages.length; ++i)
-        result.push(messages[i].toMessageElement().textContent.replace(/\u200b/g, ""));
-    return result;
-}
-</div>
-
 <div id="output">
 </div>
 
diff --git a/LayoutTests/inspector/console-format-collections-expected.txt b/LayoutTests/inspector/console-format-collections-expected.txt
index 80f1be4..9e4e86d 100644
--- a/LayoutTests/inspector/console-format-collections-expected.txt
+++ b/LayoutTests/inspector/console-format-collections-expected.txt
@@ -9,7 +9,7 @@ Tests that console nicely formats HTML Collections and NodeLists.
 console-format-collections.html:14[<select id="sel" name="sel">]
 console-format-collections.html:18[<script src="evaluate-in-frontend.js">, <script>]
 console-format-collections.html:22[<option value="1">one</option>, <option value="2">two</option>]
-console-format-collections.html:26[<html>, <head>, <script src="evaluate-in-frontend.js">, <script>, <body onload="onload()">, <p> Tests that console nicely formats HTML Collections and NodeLists. </p>, <div style="display:none">, <form id="f">, <select id="sel" name="sel">, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">, <div id="frontend-script" style="display:none">, <div id="output">]
+console-format-collections.html:26[<html>, <head>, <script src="evaluate-in-frontend.js">, <script>, <body onload="onload()">, <p> Tests that console nicely formats HTML Collections and NodeLists. </p>, <div style="display:none">, <form id="f">, <select id="sel" name="sel">, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">, <div id="output">]
 console-format-collections.html:30[<select id="sel" name="sel">, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
 console-format-collections.html:34[<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
 
diff --git a/LayoutTests/inspector/console-format-collections.html b/LayoutTests/inspector/console-format-collections.html
index 93154b9..b53faf8 100644
--- a/LayoutTests/inspector/console-format-collections.html
+++ b/LayoutTests/inspector/console-format-collections.html
@@ -33,9 +33,9 @@ function doit()
     var radioNodeList = formElement.x;
     console.log(radioNodeList);
 
-    evaluateInWebInspector("dumpMessages", function(result) {
+    evaluateInWebInspector("dumpConsoleMessages", function(result) {
         for (var i = 0; i < result.length; ++i)
-            output(result[i]);
+            output(result[i].text);
         notifyDone();
     });
 }
@@ -58,20 +58,6 @@ Tests that console nicely formats HTML Collections and NodeLists.
     </form>
 </div>
 
-<div id="frontend-script" style="display:none">
-function dumpMessages(testController)
-{
-    testController.waitUntilDone();
-    testController.runAfterPendingDispatches(function() {
-        var result = [];
-        var messages = WebInspector.console.messages;
-        for (var i = 0; i < messages.length; ++i)
-            result.push(messages[i].toMessageElement().textContent.replace(/\u200b/g, ""));
-        testController.notifyDone(result);
-    });
-}
-</div>
-
 <div id="output">
 </div>
 
diff --git a/LayoutTests/inspector/console-format.html b/LayoutTests/inspector/console-format.html
index 69e534f..c9ea027 100755
--- a/LayoutTests/inspector/console-format.html
+++ b/LayoutTests/inspector/console-format.html
@@ -17,10 +17,10 @@ function doit()
     function callback(result)
     {
         for (var i = 0; i < result.length; ++i)
-            output(result[i]);
+            output(result[i].text);
         notifyDone();
     }
-    evaluateInWebInspector("dumpMessages", callback);
+    evaluateInWebInspector("dumpConsoleMessages", callback);
 }
 
 </script>
@@ -31,22 +31,6 @@ function doit()
 Tests that console logging dumps proper messages.
 </p>
 
-<div id="frontend-script" style="display:none">
-function dumpMessages(testController)
-{
-    // Array formatting is deferred due to the async InjectedScriptAccess.getProperties call.
-    // Queue message log dump in order to see proper result.
-    testController.waitUntilDone();
-    setTimeout(function() {
-        var result = [];
-        var messages = WebInspector.console.messages;
-        for (var i = 0; i < messages.length; ++i)
-            result.push(messages[i].toMessageElement().textContent);
-        testController.notifyDone(result);
-    }, 0);
-}
-</div>
-
 <div id="output">
 </div>
 
diff --git a/LayoutTests/inspector/console-tests.html b/LayoutTests/inspector/console-tests.html
index 7fc1494..49c0a30 100755
--- a/LayoutTests/inspector/console-tests.html
+++ b/LayoutTests/inspector/console-tests.html
@@ -25,7 +25,7 @@ function doit()
         }
         notifyDone();
     }
-    evaluateInWebInspector("dumpMessages()", callback);
+    evaluateInWebInspector("dumpConsoleMessages", callback);
 }
 
 </script>
@@ -36,19 +36,6 @@ function doit()
 Tests that console logging dumps proper messages.
 </p>
 
-<div id="frontend-script" style="display:none">
-function dumpMessages()
-{
-    var result = [];
-    var messages = WebInspector.console.messages;
-    for (var i = 0; i < messages.length; ++i) {
-        var element = messages[i].toMessageElement();
-        result.push({ text: element.textContent.replace(/\u200b/g, ""), clazz: element.getAttribute("class")});
-    }
-    return result;
-}
-</div>
-
 <div id="output">
 </div>
 
diff --git a/LayoutTests/inspector/elements-panel-structure-expected.txt b/LayoutTests/inspector/elements-panel-structure-expected.txt
index b206f12..2285f99 100644
--- a/LayoutTests/inspector/elements-panel-structure-expected.txt
+++ b/LayoutTests/inspector/elements-panel-structure-expected.txt
@@ -4,4 +4,9 @@ Tests that elements panel shows dom tree structure.
 <html>
 <head>
 <body onload="onload()">
+<p>Tests that elements panel shows dom tree structure.
+</p>
+<div id="frontend-script" style="display:none">
+<pre id="output">
+</body>
 </html>
diff --git a/LayoutTests/inspector/elements-panel-structure.html b/LayoutTests/inspector/elements-panel-structure.html
index 040e5c1..c9744e8 100755
--- a/LayoutTests/inspector/elements-panel-structure.html
+++ b/LayoutTests/inspector/elements-panel-structure.html
@@ -8,10 +8,10 @@ function doit()
     function callback(result)
     {
         var output = document.getElementById("output");
-        output.textContent = result.replace(/\u200b/g, "").replace(/\n/g, "").replace(/<p>.*<\/body>/g, "").replace(/</g, "\n<");
+        output.textContent = result.replace(/\u200b/g, "").replace(/\n/g, "").replace(/</g, "\n<");
         notifyDone();
     }
-    evaluateInWebInspector("WebInspector.panels.elements.treeOutline.element.textContent", callback);
+    evaluateInWebInspector("dumpElements", callback);
 }
 
 </script>
@@ -23,6 +23,14 @@ Tests that elements panel shows dom tree structure.
 </p>
 
 <div id="frontend-script" style="display:none">
+function dumpElements(testController)
+{
+    testController.waitUntilDone();
+    expandDOMSubtree(WebInspector.domAgent.document);
+    testController.runAfterPendingDispatches(function() {
+        testController.notifyDone(WebInspector.panels.elements.treeOutline.element.textContent);
+    });
+}
 </div>
 
 <pre id="output">
diff --git a/LayoutTests/inspector/evaluate-in-frontend.js b/LayoutTests/inspector/evaluate-in-frontend.js
index 79b2cb1..ac3f998 100755
--- a/LayoutTests/inspector/evaluate-in-frontend.js
+++ b/LayoutTests/inspector/evaluate-in-frontend.js
@@ -21,12 +21,11 @@ function onload()
 {
     if (ignoreLoad)
         return;
-    var callId = lastCallId++;
-    setTimeout(function() {
-        if (window.layoutTestController)
-            layoutTestController.evaluateInWebInspector(callId, document.getElementById("frontend-script").textContent);
-        doit();
-    }, 0);
+
+    var toInject = expandDOMSubtree.toString() + "\n" + dumpConsoleMessages.toString();
+    if (document.getElementById("frontend-script"))
+        toInject += "\n" + document.getElementById("frontend-script").textContent;
+    evaluateInWebInspector(toInject, doit);
 
     // Make sure web inspector window is closed before the test is interrupted.
     setTimeout(function() {
@@ -72,3 +71,26 @@ window.didEvaluateForTestInFrontend = function(callId, jsonResult)
         delete callbacks[callId];
     }
 };
+
+// Injected utility functions.
+
+function expandDOMSubtree(node)
+{
+    function processChildren(children)
+    {
+       for (var i = 0; children && i < children.length; ++i)
+           expandDOMSubtree(children[i]);
+    }
+    WebInspector.domAgent.getChildNodesAsync(node, processChildren);
+}
+
+function dumpConsoleMessages()
+{
+    var result = [];
+    var messages = WebInspector.console.messages;
+    for (var i = 0; i < messages.length; ++i) {
+        var element = messages[i].toMessageElement();
+        result.push({ text: element.textContent.replace(/\u200b/g, ""), clazz: element.getAttribute("class")});
+    }
+    return result;
+}
diff --git a/LayoutTests/inspector/resources/styles-iframe-data.html b/LayoutTests/inspector/resources/styles-iframe-data.html
new file mode 100755
index 0000000..0f4966b
--- /dev/null
+++ b/LayoutTests/inspector/resources/styles-iframe-data.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css" media="screen">
+  body { background:green; }
+</style>
+<script>
+function iframeOnload()
+{
+    window.parent.iframeLoaded = true;
+}
+</script>
+</head>
+
+<body onload="iframeOnload()">
+</body>
+
+</html>
diff --git a/LayoutTests/inspector/styles-iframe-expected.txt b/LayoutTests/inspector/styles-iframe-expected.txt
new file mode 100644
index 0000000..a8a9f97
--- /dev/null
+++ b/LayoutTests/inspector/styles-iframe-expected.txt
@@ -0,0 +1,10 @@
+Tests that proper (and different) styles are returned for body elements of main document and iframe.
+
+
+Style: 0
+{"margin":"8px"}
+{"background":"blue"}
+Style: 1
+{"margin":"8px"}
+{"background":"green"}
+
diff --git a/LayoutTests/inspector/styles-iframe.html b/LayoutTests/inspector/styles-iframe.html
new file mode 100755
index 0000000..16f35c1
--- /dev/null
+++ b/LayoutTests/inspector/styles-iframe.html
@@ -0,0 +1,99 @@
+<html>
+<head>
+
+<style type="text/css" media="screen">
+  body { background:blue; }
+</style>
+
+<script src="evaluate-in-frontend.js"></script>
+<script>
+
+function runAfterIframeIsLoaded(continuation)
+{
+    function step()
+    {
+        if (!window.iframeLoaded)
+            setTimeout(step, 100);
+        else
+            continuation();
+    }
+    setTimeout(step, 100);
+}
+
+function doit()
+{
+    runAfterIframeIsLoaded(function() {
+        function callback(result)
+        {
+            for (var i = 0; i < result.length; ++i) {
+                output("Style: " + i);
+                var matchedRules = result[i].matchedCSSRules;
+                for (var j = 0; matchedRules && j < matchedRules.length; ++j) {
+                    output(JSON.stringify(matchedRules[j].style.shorthandValues));
+                }
+            }
+            notifyDone();
+        }
+        evaluateInWebInspector("dumpStyles", callback);
+    });
+}
+
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+Tests that proper (and different) styles are returned for body elements of main document and iframe.
+</p>
+
+<iframe src='resources/styles-iframe-data.html'></iframe>
+
+<div id="frontend-script" style="display:none">
+
+function dumpStyles(testController)
+{
+    testController.waitUntilDone();
+
+    expandDOMSubtree(WebInspector.domAgent.document);
+
+    testController.runAfterPendingDispatches(function() {
+        dumpStylesContinuation(testController);
+    });
+}
+
+function dumpStylesContinuation(testController)
+{
+    // 1. Get styles for body, store them in mainStyles var.
+    var bodyId = WebInspector.domAgent.document.body.id;
+    var mainStyles = null;
+    function mainFrameCallback(styles) {
+        mainStyles = styles;
+    }
+    InjectedScriptAccess.getStyles(bodyId, false, mainFrameCallback);
+
+    // 2. Find iframe node
+    var innerMapping = WebInspector.domAgent._idToDOMNode;
+    var iframeBodyId = null;
+
+    for (var nodeId in innerMapping) {
+        if (innerMapping[nodeId].nodeName === "IFRAME")
+            iframeBodyId = innerMapping[nodeId].firstChild.lastChild.id;
+    }
+    if (typeof iframeBodyId !== "number") {
+        testController.notifyDone(["No iframe node found"]);
+        return;
+    }
+
+    // 3. Get styles for iframe's body, return them together with main styles.
+    function iframeCallback(styles) {
+        testController.notifyDone([mainStyles, styles]);
+    }
+    InjectedScriptAccess.getStyles(iframeBodyId, false, iframeCallback);
+}
+</div>
+
+<div id="output">
+</div>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 90c69b3..f93cdf5 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -118,6 +118,7 @@ fast/text/find-hidden-text.html
 inspector/console-format-collections.html
 inspector/css-syntax-highlight.html
 inspector/javascript-syntax-highlight.html
+inspector/styles-iframe.html
 inspector/timeline-trivial.html
 inspector/uncaught-dom1-exception.html
 inspector/uncaught-dom3-exception.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f7d3ebd..2946967 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2009-11-05  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        REGRESSION: Web Inspector doesn't show CSS rules properly for iframes
+
+        https://bugs.webkit.org/show_bug.cgi?id=30884
+
+        Test: inspector/styles-iframe.html
+
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.DOMNode):
+        * inspector/front-end/InjectedScript.js:
+        (InjectedScript.getStyles):
+        (InjectedScript.getComputedStyle):
+        (InjectedScript.addStyleSelector):
+        * inspector/front-end/TestController.js:
+        (WebInspector.TestController.prototype.notifyDone):
+        (WebInspector.TestController.prototype.runAfterPendingDispatches):
+        (WebInspector.evaluateForTestInFrontend.invokeMethod):
+        (WebInspector.evaluateForTestInFrontend):
+
 2009-11-05  Vitaly Repeshko  <vitalyr at chromium.org>
 
         Reviewed by Geoffrey Garen and Dimitri Glazkov.
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 7f9b5b6..0c8cc15 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -770,6 +770,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
         // resetScriptObjects should be called before database and DOM storage
         // resources are cleared so that it has a chance to unbind them.
         resetScriptObjects();
+
 #if ENABLE(DATABASE)
         m_databaseResources.clear();
 #endif
diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js
index 25ffafa..252b5f8 100644
--- a/WebCore/inspector/front-end/DOMAgent.js
+++ b/WebCore/inspector/front-end/DOMAgent.js
@@ -61,9 +61,10 @@ WebInspector.DOMNode = function(doc, payload) {
     this._matchedCSSRules = [];
 
     if (this.nodeType == Node.ELEMENT_NODE) {
-        if (this.nodeName == "HTML")
+        // HTML and BODY from internal iframes should not overwrite top-level ones.
+        if (!this.ownerDocument.documentElement && this.nodeName === "HTML")
             this.ownerDocument.documentElement = this;
-        if (this.nodeName == "BODY")
+        if (!this.ownerDocument.body && this.nodeName === "BODY")
             this.ownerDocument.body = this;
     }
 }
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index 3ba09a1..7c933e7 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -59,7 +59,8 @@ InjectedScript.getStyles = function(nodeId, authorOnly)
     var node = InjectedScript._nodeForId(nodeId);
     if (!node)
         return false;
-    var matchedRules = InjectedScript._window().getMatchedCSSRules(node, "", authorOnly);
+    var defaultView = node.ownerDocument.defaultView;
+    var matchedRules = defaultView.getMatchedCSSRules(node, "", authorOnly);
     var matchedCSSRules = [];
     for (var i = 0; matchedRules && i < matchedRules.length; ++i)
         matchedCSSRules.push(InjectedScript._serializeRule(matchedRules[i]));
@@ -72,7 +73,7 @@ InjectedScript.getStyles = function(nodeId, authorOnly)
     }
     var result = {};
     result.inlineStyle = InjectedScript._serializeStyle(node.style, true);
-    result.computedStyle = InjectedScript._serializeStyle(InjectedScript._window().getComputedStyle(node));
+    result.computedStyle = InjectedScript._serializeStyle(defaultView.getComputedStyle(node));
     result.matchedCSSRules = matchedCSSRules;
     result.styleAttributes = styleAttributes;
     return result;
@@ -83,7 +84,7 @@ InjectedScript.getComputedStyle = function(nodeId)
     var node = InjectedScript._nodeForId(nodeId);
     if (!node)
         return false;
-    return InjectedScript._serializeStyle(InjectedScript._window().getComputedStyle(node));
+    return InjectedScript._serializeStyle(node.ownerDocument.defaultView.getComputedStyle(node));
 }
 
 InjectedScript.getInlineStyle = function(nodeId)
@@ -230,15 +231,19 @@ InjectedScript.applyStyleRuleText = function(ruleId, newContent, selectedNodeId)
 
 InjectedScript.addStyleSelector = function(newContent, selectedNodeId)
 {
-    var stylesheet = InjectedScript.stylesheet;
+    var selectedNode = InjectedScript._nodeForId(selectedNodeId);
+    if (!selectedNode)
+        return false;
+    var ownerDocument = selectedNode.ownerDocument;
+
+    var stylesheet = ownerDocument.__stylesheet;
     if (!stylesheet) {
-        var inspectedDocument = InjectedScript._window().document;
-        var head = inspectedDocument.getElementsByTagName("head")[0];
-        var styleElement = inspectedDocument.createElement("style");
+        var head = ownerDocument.getElementsByTagName("head")[0];
+        var styleElement = ownerDocument.createElement("style");
         styleElement.type = "text/css";
         head.appendChild(styleElement);
-        stylesheet = inspectedDocument.styleSheets[inspectedDocument.styleSheets.length - 1];
-        InjectedScript.stylesheet = stylesheet;
+        stylesheet = ownerDocument.styleSheets[ownerDocument.styleSheets.length - 1];
+        ownerDocument.__stylesheet = stylesheet;
     }
 
     try {
@@ -248,7 +253,6 @@ InjectedScript.addStyleSelector = function(newContent, selectedNodeId)
         return false;
     }
 
-    var selectedNode = InjectedScript._nodeForId(selectedNodeId);
     var rule = stylesheet.cssRules[stylesheet.cssRules.length - 1];
     rule.__isViaInspector = true;
 
diff --git a/WebCore/inspector/front-end/TestController.js b/WebCore/inspector/front-end/TestController.js
index 12e1ac7..2672952 100644
--- a/WebCore/inspector/front-end/TestController.js
+++ b/WebCore/inspector/front-end/TestController.js
@@ -42,7 +42,7 @@ WebInspector.TestController.prototype = {
 
     notifyDone: function(result)
     {
-        var message = typeof result === "undefined" ? "<undefined>" : JSON.stringify(result);
+        var message = typeof result === "undefined" ? "\"<undefined>\"" : JSON.stringify(result);
         InspectorController.didEvaluateForTestInFrontend(this._callId, message);
     },
 
@@ -52,7 +52,6 @@ WebInspector.TestController.prototype = {
             callback();
             return;
         }
-
         setTimeout(this.runAfterPendingDispatches.bind(this), 0, callback);
     }
 }
@@ -60,16 +59,20 @@ WebInspector.TestController.prototype = {
 WebInspector.evaluateForTestInFrontend = function(callId, script)
 {
     var controller = new WebInspector.TestController(callId);
-    try {
-        var result;
-        if (window[script] && typeof window[script] === "function")
-            result = window[script].call(this, controller);
-        else
-            result = window.eval(script);
+    function invokeMethod()
+    {
+        try {
+            var result;
+            if (window[script] && typeof window[script] === "function")
+                result = window[script].call(WebInspector, controller);
+            else
+                result = window.eval(script);
 
-        if (!controller._waitUntilDone)
-            controller.notifyDone(result);
-    } catch (e) {
-        controller.notifyDone(e.toString());
+            if (!controller._waitUntilDone)
+                controller.notifyDone(result);
+        } catch (e) {
+            controller.notifyDone(e.toString());
+        }
     }
+    controller.runAfterPendingDispatches(invokeMethod);
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list