[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

podivilov at chromium.org podivilov at chromium.org
Sun Feb 20 23:54:17 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit d2e8a307c89a4840a662782aafcc7b7ee672c104
Author: podivilov at chromium.org <podivilov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 26 18:24:19 2011 +0000

    2011-01-25  Pavel Podivilov  <podivilov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
            https://bugs.webkit.org/show_bug.cgi?id=53072
    
            * inspector/console-substituted-expected.txt: Added.
            * inspector/console-substituted.html: Added.
    2011-01-25  Pavel Podivilov  <podivilov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
            https://bugs.webkit.org/show_bug.cgi?id=53072
    
            Test: inspector/console-substituted.html
    
            * inspector/InjectedScriptSource.js:
            (.):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76699 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 974bef2..94971e4 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-25  Pavel Podivilov  <podivilov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
+        https://bugs.webkit.org/show_bug.cgi?id=53072
+
+        * inspector/console-substituted-expected.txt: Added.
+        * inspector/console-substituted.html: Added.
+
 2011-01-26  Ryosuke Niwa  <rniwa at webkit.org>
 
         Layout test missing expectation after 58524
diff --git a/LayoutTests/inspector/console-substituted-expected.txt b/LayoutTests/inspector/console-substituted-expected.txt
new file mode 100644
index 0000000..ca54092
--- /dev/null
+++ b/LayoutTests/inspector/console-substituted-expected.txt
@@ -0,0 +1,5 @@
+Tests that evaluate in console works even if window.console is substituted or deleted. Bug 53072
+
+1
+2
+
diff --git a/LayoutTests/inspector/console-substituted.html b/LayoutTests/inspector/console-substituted.html
new file mode 100755
index 0000000..80531af
--- /dev/null
+++ b/LayoutTests/inspector/console-substituted.html
@@ -0,0 +1,56 @@
+<html>
+<head>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
+<script>
+
+function deleteConsole()
+{
+    window.console = undefined;
+}
+
+function substituteConsole()
+{
+    window.console = {
+        get _commandLineAPI() { return undefined; },
+        set _commandLineAPI() {}
+    };
+}
+
+var test = function()
+{
+    InspectorTest.evaluateInConsole("deleteConsole()", step1);
+
+    function step1()
+    {
+        InspectorTest.evaluateInConsole("1", step2);
+    }
+
+    function step2(result)
+    {
+        InspectorTest.addResult(result);
+        InspectorTest.evaluateInConsole("substituteConsole()", step3);
+    }
+
+    function step3(result)
+    {
+        InspectorTest.evaluateInConsole("2", step4);
+    }
+
+    function step4(result)
+    {
+        InspectorTest.addResult(result);
+        InspectorTest.completeTest();
+    }
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests that evaluate in console works even if window.console is substituted or deleted.
+<a href="https://bugs.webkit.org/show_bug.cgi?id=53072">Bug 53072</a>
+</p>
+
+</body>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index c205fe9..599e8ad 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-25  Pavel Podivilov  <podivilov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: evaluate in console may not work when window.console is substituted or deleted.
+        https://bugs.webkit.org/show_bug.cgi?id=53072
+
+        Test: inspector/console-substituted.html
+
+        * inspector/InjectedScriptSource.js:
+        (.):
+
 2011-01-26  Carlos Garcia Campos  <cgarcia at igalia.com>
 
         Reviewed by Martin Robinson.
diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js
index 050b582..b7caa34 100644
--- a/Source/WebCore/inspector/InjectedScriptSource.js
+++ b/Source/WebCore/inspector/InjectedScriptSource.js
@@ -253,16 +253,18 @@ InjectedScript.prototype = {
         // Only install command line api object for the time of evaluation.
         // Surround the expression in with statements to inject our command line API so that
         // the window object properties still take more precedent than our API functions.
-        inspectedWindow.console._commandLineAPI = this._commandLineAPI;
+        if (inspectedWindow.console)
+            inspectedWindow.console._commandLineAPI = this._commandLineAPI;
     
         // We don't want local variables to be shadowed by global ones when evaluating on CallFrame.
         if (!isEvalOnCallFrame)
             expression = "with (window) {\n" + expression + "\n} ";
         if (injectCommandLineAPI)
-            expression = "with (window ? window.console._commandLineAPI : {}) {\n" + expression + "\n}";
+            expression = "with ((window && window.console && window.console._commandLineAPI) || {}) {\n" + expression + "\n}";
         var value = evalFunction.call(object, expression);
     
-        delete inspectedWindow.console._commandLineAPI;
+        if (inspectedWindow.console)
+            delete inspectedWindow.console._commandLineAPI;
     
         // When evaluating on call frame error is not thrown, but returned as a value.
         if (this._type(value) === "error")

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list