[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

yurys at chromium.org yurys at chromium.org
Wed Dec 22 13:22:39 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 78c505b9d1b0dd5761fbbbfbfd6a9d0c42a0d333
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 13 13:39:58 2010 +0000

    2010-09-13  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: upstream testExpandScope debugger test
            https://bugs.webkit.org/show_bug.cgi?id=45260
    
            Test that scope sections in Scripts panel are expandable and
            contain correct data.
    
            * inspector/debugger-expand-scope-expected.txt: Added.
            * inspector/debugger-expand-scope.html: Added.
            * platform/chromium/inspector/debugger-expand-scope-expected.txt: Added.
    2010-09-13  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: upstream testExpandScope debugger test
            https://bugs.webkit.org/show_bug.cgi?id=45260
    
            Test: inspector/debugger-expand-scope.html
    
            * inspector/front-end/InjectedScript.js: return "Arguments" as class name for arguments variable in v8.
            (injectedScriptConstructor.):
    2010-09-13  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: upstream testExpandScope debugger test
            https://bugs.webkit.org/show_bug.cgi?id=45260
    
            * src/js/DebuggerScript.js: copy scope variables into a new object, but for global scope object,
            with statement parameter and catch block exception variable pass the object itself to the injected
            script.
            * src/js/Tests.js: moved testExpandScope to LayoutTests
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67385 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 5387389..5d91a42 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-13  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: upstream testExpandScope debugger test
+        https://bugs.webkit.org/show_bug.cgi?id=45260
+
+        Test that scope sections in Scripts panel are expandable and
+        contain correct data.
+
+        * inspector/debugger-expand-scope-expected.txt: Added.
+        * inspector/debugger-expand-scope.html: Added.
+        * platform/chromium/inspector/debugger-expand-scope-expected.txt: Added.
+
 2010-09-13  Pavel Podivilov  <podivilov at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/LayoutTests/inspector/debugger-expand-scope-expected.txt b/LayoutTests/inspector/debugger-expand-scope-expected.txt
new file mode 100644
index 0000000..1ce8ae0
--- /dev/null
+++ b/LayoutTests/inspector/debugger-expand-scope-expected.txt
@@ -0,0 +1,25 @@
+
+Test that sections representing scopes of the current call frame are expandable and contain correct data.
+
+Debugger was enabled.
+Evaluated script in console.
+Script execution paused.
+
+Dump scope sections:
+- Local
+  arguments: Arguments[1]
+  innerFunctionLocalVar: 2012
+  this: DOMWindow
+  x: 2010
+- DOMWindowWith Block
+  innerFunction: function innerFunction(x) {
+- Closure
+  arguments: Arguments[1]
+  makeClosureLocalVar: "local.TextParam"
+  n: "TextParam"
+- DOMWindowGlobal
+  <section collapsed>
+
+Script execution resumed.
+Debugger was disabled.
+
diff --git a/LayoutTests/inspector/debugger-expand-scope.html b/LayoutTests/inspector/debugger-expand-scope.html
new file mode 100755
index 0000000..2ddc71c
--- /dev/null
+++ b/LayoutTests/inspector/debugger-expand-scope.html
@@ -0,0 +1,81 @@
+<html>
+<head>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
+<script src="../http/tests/inspector/debugger-test2.js"></script>
+<script>
+
+function makeClosure(n) {
+  var makeClosureLocalVar = 'local.' + n;
+  return function innerFunction(x) {
+    var innerFunctionLocalVar = x + 2;
+    debugger;
+    return n + makeClosureLocalVar + x + innerFunctionLocalVar;
+  }
+}
+
+function testFunction() {
+  var f = makeClosure('TextParam');
+  f(2010);
+}
+
+
+function test()
+{
+    var scriptToEvaluate = "setTimeout(testFunction, 0)";
+
+    InspectorTest.startDebuggerTest(step1);
+
+    function step1()
+    {
+        InspectorTest.evaluateInConsole(scriptToEvaluate, InspectorTest.addResult.bind(InspectorTest, "Evaluated script in console."));
+        InspectorTest.waitUntilPaused(step2);
+    }
+
+    function step2()
+    {
+        // Expand all but global scopes. Expanding global scope takes for too long
+        // so we keep it collapsed.
+        var sections = WebInspector.currentPanel.sidebarPanes.scopechain.sections;
+        // global scope is always the last one.
+        for (var i = 0; i < sections.length - 1; i++)
+            sections[i].expand();
+        InspectorTest.runAfterPendingDispatches(step3);
+    }
+
+    function step3()
+    {
+        var sections = WebInspector.currentPanel.sidebarPanes.scopechain.sections;
+        InspectorTest.addResult("");
+        InspectorTest.addResult("Dump scope sections:");
+        for (var i = 0; i < sections.length; i++) {
+            var section = sections[i];
+            InspectorTest.addResult("- " + section.headerElement.textContent);
+            if (!section.expanded) {
+                InspectorTest.addResult("  <section collapsed>");
+                continue;
+            }
+            var properties = section.propertiesForTest;
+            if (properties) {
+                for (var j = 0; j < properties.length; j++) {
+                    var p = properties[j];
+                    InspectorTest.addResult("  " + p.name + ": " + p.value.description);
+                }
+            } else
+                InspectorTest.addResult("  <no properties>");
+        }
+        InspectorTest.addResult("");
+        InspectorTest.completeDebuggerTest();
+    }
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<input type='button' onclick='testFunction()' value='Test'/>
+<p>
+Test that sections representing scopes of the current call frame are expandable
+and contain correct data.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium/inspector/debugger-expand-scope-expected.txt b/LayoutTests/platform/chromium/inspector/debugger-expand-scope-expected.txt
new file mode 100755
index 0000000..70dad5c
--- /dev/null
+++ b/LayoutTests/platform/chromium/inspector/debugger-expand-scope-expected.txt
@@ -0,0 +1,19 @@
+Test that sections representing scopes of the current call frame are expandable and contain correct data.
+
+Debugger was enabled.
+Evaluated script in console.
+Script execution paused.
+
+Dump scope sections:
+- Local
+  innerFunctionLocalVar: 2012
+  this: DOMWindow
+  x: 2010
+- Closure
+  makeClosureLocalVar: "local.TextParam"
+  n: "TextParam"
+- DOMWindowGlobal
+  <section collapsed>
+
+Script execution resumed.
+Debugger was disabled.
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c67bc2e..7ad587f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-13  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: upstream testExpandScope debugger test
+        https://bugs.webkit.org/show_bug.cgi?id=45260
+
+        Test: inspector/debugger-expand-scope.html
+
+        * inspector/front-end/InjectedScript.js: return "Arguments" as class name for arguments variable in v8.
+        (injectedScriptConstructor.):
+
 2010-09-13  Mario Sanchez Prada  <msanchez at igalia.com>
 
         Reviewed by Martin Robinson.
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index d4e3d80..5544ed5 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -464,6 +464,10 @@ InjectedScript.prototype = {
             return str.replace(/^\[object (.*)\]$/i, "$1");
         } else {
             // V8
+            if (isFinite(obj.length) && typeof obj.callee === "function") {
+                // Arguments.constructor === Object in V8
+                return "Arguments";
+            }
             return obj.constructor && obj.constructor.name || "Object";
         }
     },
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index ade61ca..749e160 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-13  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: upstream testExpandScope debugger test
+        https://bugs.webkit.org/show_bug.cgi?id=45260
+
+        * src/js/DebuggerScript.js: copy scope variables into a new object, but for global scope object,
+        with statement parameter and catch block exception variable pass the object itself to the injected
+        script.
+        * src/js/Tests.js: moved testExpandScope to LayoutTests
+
 2010-09-13  Hans Wennborg  <hans at chromium.org>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js
index 5a8a7bf..5eb482b 100644
--- a/WebKit/chromium/src/js/DebuggerScript.js
+++ b/WebKit/chromium/src/js/DebuggerScript.js
@@ -228,13 +228,32 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame)
     for (var i = 0; i < frameMirror.scopeCount(); i++) {
         var scopeMirror = frameMirror.scope(i);
         var scopeObjectMirror = scopeMirror.scopeObject();
-        var properties = scopeObjectMirror.properties();
-        var scopeObject = {};
-        for (var j = 0; j < properties.length; j++)
-            scopeObject[properties[j].name()] = properties[j].value_;
-        // Reset scope object prototype to null so that the proto properties
-        // don't appear in th local scope section.
-        scopeObject.__proto__ = null;
+
+        var scopeObject;
+        switch (scopeMirror.scopeType()) {
+        case ScopeType.Local:
+        case ScopeType.Closure:
+            // For transient objects we create a "persistent" copy that contains
+            // the same properties.
+            scopeObject = {};
+            // Reset scope object prototype to null so that the proto properties
+            // don't appear in the local scope section.
+            scopeObject.__proto__ = null;
+            var properties = scopeObjectMirror.properties();
+            for (var j = 0; j < properties.length; j++) {
+                var name = properties[j].name();
+                if (name.charAt(0) === ".")
+                    continue; // Skip internal variables like ".arguments"
+                scopeObject[name] = properties[j].value_;
+            }
+            break;
+        case ScopeType.Global:
+        case ScopeType.With:
+        case ScopeType.Catch:
+            scopeObject = scopeMirror.details_.object();
+            break;
+        }
+
         scopeType.push(scopeMirror.scopeType());
         scopeChain.push(scopeObject);
     }
diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js
index 2233463..5cebb52 100644
--- a/WebKit/chromium/src/js/Tests.js
+++ b/WebKit/chromium/src/js/Tests.js
@@ -953,230 +953,6 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb
 
 
 /**
- * Gets a XPathResult matching given xpath.
- * @param {string} xpath
- * @param {number} resultType
- * @param {Node} opt_ancestor Context node. If not specified documentElement
- *     will be used
- * @return {XPathResult} Type of returned value is determined by "resultType" parameter
- */
-
-TestSuite.prototype._evaluateXpath = function(xpath, resultType, opt_ancestor)
-{
-    if (!opt_ancestor)
-        opt_ancestor = document.documentElement;
-    try {
-        return document.evaluate(xpath, opt_ancestor, null, resultType, null);
-    } catch(e) {
-        this.fail('Error in expression: "' + xpath + '".' + e);
-    }
-};
-
-
-/**
- * Gets first Node matching given xpath.
- * @param {string} xpath
- * @param {Node} opt_ancestor Context node. If not specified documentElement
- *     will be used
- * @return {?Node}
- */
-TestSuite.prototype._findNode = function(xpath, opt_ancestor)
-{
-    var result = this._evaluateXpath(xpath, XPathResult.FIRST_ORDERED_NODE_TYPE, opt_ancestor).singleNodeValue;
-    this.assertTrue(!!result, "Cannot find node on path: " + xpath);
-    return result;
-};
-
-
-/**
- * Gets a text matching given xpath.
- * @param {string} xpath
- * @param {Node} opt_ancestor Context node. If not specified documentElement
- *     will be used
- * @return {?string}
- */
-TestSuite.prototype._findText = function(xpath, opt_ancestor)
-{
-    var result = this._evaluateXpath(xpath, XPathResult.STRING_TYPE, opt_ancestor).stringValue;
-    this.assertTrue(!!result, "Cannot find text on path: " + xpath);
-    return result;
-};
-
-
-/**
- * Gets an iterator over nodes matching given xpath.
- * @param {string} xpath
- * @param {Node} opt_ancestor Context node. If not specified, documentElement
- *     will be used
- * @return {XPathResult} Iterator over the nodes
- */
-TestSuite.prototype._nodeIterator = function(xpath, opt_ancestor)
-{
-    return this._evaluateXpath(xpath, XPathResult.ORDERED_NODE_ITERATOR_TYPE, opt_ancestor);
-};
-
-
-/**
- * Checks the scopeSectionDiv against the expectations.
- * @param {Node} scopeSectionDiv The section div
- * @param {Object} expectations Expectations dictionary
- */
-TestSuite.prototype._checkScopeSectionDiv = function(scopeSectionDiv, expectations)
-{
-    var scopeTitle = this._findText('./div[@class="header"]/div[@class="title"]/text()', scopeSectionDiv);
-    this.assertEquals(expectations.title, scopeTitle, "Unexpected scope section title.");
-    if (!expectations.properties)
-        return;
-    this.assertTrue(scopeSectionDiv.hasStyleClass("expanded"), 'Section "' + scopeTitle + '" is collapsed.');
-
-    var propertyIt = this._nodeIterator("./ol/li", scopeSectionDiv);
-    var propertyLi;
-    var foundProps = [];
-    while (propertyLi = propertyIt.iterateNext()) {
-        var name = this._findText('./span[@class="name"]/text()', propertyLi);
-        var value = this._findText('./span[@class="value"]/text()', propertyLi);
-        this.assertTrue(!!name, 'Invalid variable name: "' + name + '"');
-        this.assertTrue(name in expectations.properties, "Unexpected property: " + name);
-        this.assertEquals(expectations.properties[name], value, 'Unexpected "' + name + '" property value.');
-        delete expectations.properties[name];
-        foundProps.push(name + " = " + value);
-    }
-
-    // Check that all expected properties were found.
-    for (var p in expectations.properties)
-        this.fail('Property "' + p + '" was not found in scope "' + scopeTitle + '". Found properties: "' + foundProps.join(",") + '"');
-};
-
-
-/**
- * Expands scope sections matching the filter and invokes the callback on
- * success.
- * @param {function(WebInspector.ObjectPropertiesSection, number):boolean}
- *     filter
- * @param {Function} callback
- */
-TestSuite.prototype._expandScopeSections = function(filter, callback)
-{
-    var sections = WebInspector.currentPanel.sidebarPanes.scopechain.sections;
-
-    var toBeUpdatedCount = 0;
-    function updateListener() {
-        --toBeUpdatedCount;
-        if (toBeUpdatedCount === 0) {
-            // Report when all scopes are expanded and populated.
-            callback();
-        }
-    }
-
-    // Global scope is always the last one.
-    for (var i = 0; i < sections.length - 1; i++) {
-        var section = sections[i];
-        if (!filter(sections, i))
-            continue;
-        ++toBeUpdatedCount;
-        var populated = section.populated;
-
-        this._hookGetPropertiesCallback(updateListener,
-            function() {
-                section.expand();
-                if (populated) {
-                    // Make sure "updateProperties" callback will be called at least once
-                    // after it was overridden.
-                    section.update();
-                }
-            });
-    }
-};
-
-
-/**
- * Tests that scopes can be expanded and contain expected data.
- */
-TestSuite.prototype.testExpandScope = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html"]);
-
-    this._waitForScriptPause(
-        {
-            functionsOnStack: ["innerFunction", "handleClick", ""],
-            lineNumber: 8,
-            lineText: "    debugger;"
-        },
-        expandAllSectionsExceptGlobal);
-
-    // Expanding Global scope takes for too long so we skeep it.
-    function expandAllSectionsExceptGlobal() {
-        test._expandScopeSections(function(sections, i) {
-            return i < sections.length - 1;
-        },
-        examineScopes /* When all scopes are expanded and populated check them. */);
-    }
-
-    // Check scope sections contents.
-    function examineScopes() {
-        var scopeVariablesSection = test._findNode('//div[@id="scripts-sidebar"]/div[div[@class="title"]/text()="Scope Variables"]');
-        var expectedScopes = [
-            {
-                title: "Local",
-                properties: {
-                    x:"2009",
-                    innerFunctionLocalVar:"2011",
-                    "this": "DOMWindow",
-                }
-            },
-            {
-                title: "Closure",
-                properties: {
-                    n: '"TextParam"',
-                    makeClosureLocalVar: '"local.TextParam"',
-                }
-            },
-            {
-                title: "Global",
-            },
-        ];
-        var it = test._nodeIterator('./div[@class="body"]/div', scopeVariablesSection);
-        var scopeIndex = 0;
-        var scopeDiv;
-        while (scopeDiv = it.iterateNext()) {
-            test.assertTrue(scopeIndex < expectedScopes.length, "Too many scopes.");
-            test._checkScopeSectionDiv(scopeDiv, expectedScopes[scopeIndex]);
-            ++scopeIndex;
-        }
-        test.assertEquals(expectedScopes.length, scopeIndex, "Unexpected number of scopes.");
-
-        test.releaseControl();
-    }
-
-    test.takeControl();
-};
-
-
-/**
- * Returns child tree element for a property with given name.
- * @param {TreeElement} parent Parent tree element.
- * @param {string} childName
- * @param {string} objectPath Path to the object. Will be printed in the case
- *     of failure.
- * @return {TreeElement}
- */
-TestSuite.prototype._findChildProperty = function(parent, childName, objectPath)
-{
-    var children = parent.children;
-    for (var i = 0; i < children.length; i++) {
-        var treeElement = children[i];
-        var property = treeElement.property;
-        if (property.name === childName)
-            return treeElement;
-    }
-    this.fail('Cannot find property "' + childName + '" in ' + objectPath);
-};
-
-
-/**
  * Executes the 'code' with InjectedScriptAccess.getProperties overriden
  * so that all callbacks passed to InjectedScriptAccess.getProperties are
  * extended with the "hook".

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list