[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

pfeldman at chromium.org pfeldman at chromium.org
Fri Feb 26 22:19:50 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 3a6b235e53ed21ddb6968e5193619a7d3a30f581
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Feb 15 10:20:48 2010 +0000

    2010-02-14  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: XPathResult objects are not expanded in console.
    
            https://bugs.webkit.org/show_bug.cgi?id=34926
    
            * inspector/front-end/InjectedScript.js:
            (injectedScriptConstructor):
            * inspector/front-end/ObjectPropertiesSection.js:
            (WebInspector.ObjectPropertiesSection.prototype.updateProperties):
            (WebInspector.ObjectPropertiesSection.CompareProperties):
            (WebInspector.ObjectPropertyTreeElement.prototype.update):
            * inspector/front-end/Section.js:
            (WebInspector.Section):
            * inspector/front-end/inspector.css:
    
            Tests:
            * inspector/console-dir-expected.txt:
            * inspector/console-dir.html:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54769 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index bc90926..79ae0ea 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-02-14  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: XPathResult objects are not expanded in console.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34926
+
+        * inspector/console-dir-expected.txt:
+        * inspector/console-dir.html:
+
 2010-02-15  Philippe Normand  <pnormand at igalia.com>
 
         media/video-display-aspect-ratio.html fails
diff --git a/LayoutTests/inspector/console-dir-expected.txt b/LayoutTests/inspector/console-dir-expected.txt
index 0779ba5..5e93107 100644
--- a/LayoutTests/inspector/console-dir-expected.txt
+++ b/LayoutTests/inspector/console-dir-expected.txt
@@ -1,9 +1,26 @@
-CONSOLE MESSAGE: line 9: [object HTMLDocument]
-CONSOLE MESSAGE: line 10: test1,test2
-CONSOLE MESSAGE: line 11: [object NodeList]
+CONSOLE MESSAGE: line 9: test1,test2
+CONSOLE MESSAGE: line 10: [object NodeList]
+CONSOLE MESSAGE: line 11: [object XPathResult]
 Tests that console logging dumps proper messages.
 
-console-dir.html:9HTMLDocument
-console-dir.html:10Array
-console-dir.html:11NodeList
+Array
+>>> 0 = "test1"
+>>> 1 = "test2"
+>>> length = 2
+>>> __proto__ = Array
+NodeList
+>>> 0 = HTMLHtmlElement
+>>> constructor = NodeListConstructor
+>>> length = 1
+>>> __proto__ = NodeListPrototype
+XPathResult
+>>> booleanValue = Error: TYPE_ERR: DOM XPath Exception 52
+>>> constructor = XPathResultConstructor
+>>> invalidIteratorState = false
+>>> numberValue = Error: TYPE_ERR: DOM XPath Exception 52
+>>> resultType = 4
+>>> singleNodeValue = Error: TYPE_ERR: DOM XPath Exception 52
+>>> snapshotLength = Error: TYPE_ERR: DOM XPath Exception 52
+>>> stringValue = Error: TYPE_ERR: DOM XPath Exception 52
+>>> __proto__ = XPathResultPrototype
 
diff --git a/LayoutTests/inspector/console-dir.html b/LayoutTests/inspector/console-dir.html
index edd8d9e..f0177ab 100755
--- a/LayoutTests/inspector/console-dir.html
+++ b/LayoutTests/inspector/console-dir.html
@@ -6,11 +6,56 @@
 
 function doit()
 {
-    console.dir(document);
     console.dir(["test1", "test2"]);
     console.dir(document.childNodes);
+    console.dir(document.evaluate("//head", document, null, XPathResult.ANY_TYPE, null));
 
-    dumpConsoleMessages();
+    expandAndDumpConsoleMessages();
+}
+
+function expandAndDumpConsoleMessages(noNotifyDone) {
+    function callback(result)
+    {
+        for (var i = 0; i < result.length; ++i) {
+            output(result[i].title);
+            var properties = result[i].properties;
+            for (var j = 0; properties && j < properties.length; ++j)
+                output(">>> " + properties[j].name + " = " + properties[j].value.description);
+        }
+        if (!noNotifyDone)
+            notifyDone();
+    }
+    evaluateInWebInspector("frontend_expandAndDumpConsoleMessages", callback);
+}
+
+function frontend_expandAndDumpConsoleMessages(testController)
+{
+    // Need test to be async to expand console objects.
+    testController.waitUntilDone();
+    var messages = WebInspector.console.messages;
+    for (var i = 0; i < messages.length; ++i) {
+        var element = messages[i].toMessageElement();
+        var node = element.traverseNextNode(element);
+        while (node) {
+            if (node.sectionForTest) {
+                messages[i].section = node.sectionForTest;
+                node.sectionForTest.expanded = true;
+                break;
+            }
+            node = node.traverseNextNode(element);
+        }
+    }
+
+    testController.runAfterPendingDispatches(function() {
+        var messages = WebInspector.console.messages;
+        var result = [];
+        for (var i = 0; i < messages.length; ++i) {
+            var section = messages[i].section;
+            if (section)
+                result.push({ title: section.titleElement.textContent, properties: section.propertiesForTest});
+        }
+        testController.notifyDone(result);
+    });
 }
 
 </script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bc40712..42ab182 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-02-14  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: XPathResult objects are not expanded in console.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34926
+
+        * inspector/front-end/InjectedScript.js:
+        (injectedScriptConstructor):
+        * inspector/front-end/ObjectPropertiesSection.js:
+        (WebInspector.ObjectPropertiesSection.prototype.updateProperties):
+        (WebInspector.ObjectPropertiesSection.CompareProperties):
+        (WebInspector.ObjectPropertyTreeElement.prototype.update):
+        * inspector/front-end/Section.js:
+        (WebInspector.Section):
+        * inspector/front-end/inspector.css:
+
 2010-02-10  Philippe Normand  <pnormand at igalia.com>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index 95867c4..5a9e524 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -487,23 +487,30 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbre
         return false;
 
     var properties = [];
+    var propertyNames = ignoreHasOwnProperty ? InjectedScript._getPropertyNames(object) : Object.getOwnPropertyNames(object);
+    if (!ignoreHasOwnProperty && object.__proto__)
+        propertyNames.push("__proto__");
 
     // Go over properties, prepare results.
-    for (var propertyName in object) {
-        if (!ignoreHasOwnProperty && "hasOwnProperty" in object && !object.hasOwnProperty(propertyName))
-            continue;
+    for (var i = 0; i < propertyNames.length; ++i) {
+        var propertyName = propertyNames[i];
 
         var property = {};
         property.name = propertyName;
         property.parentObjectProxy = objectProxy;
         var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
         if (!property.isGetter) {
-            var childObject = object[propertyName];
-            var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, abbreviate);
-            childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : [];
-            childObjectProxy.path.push(propertyName);
-            childObjectProxy.protoDepth = objectProxy.protoDepth || 0;
-            property.value = childObjectProxy;
+            try {
+                var childObject = object[propertyName];
+                var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, abbreviate);
+                childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : [];
+                childObjectProxy.path.push(propertyName);
+                childObjectProxy.protoDepth = objectProxy.protoDepth || 0;
+                property.value = childObjectProxy;
+            } catch(e) {
+                property.value = { description: e.toString() };
+                property.isError = true;
+            }
         } else {
             // FIXME: this should show something like "getter" (bug 16734).
             property.value = { description: "\u2014" }; // em dash
@@ -571,24 +578,25 @@ InjectedScript.setOuterHTML = function(nodeId, value, expanded)
     return InjectedScriptHost.pushNodePathToFrontend(newNode, expanded, false);
 }
 
-InjectedScript._getPropertyNames = function(object, resultSet)
+InjectedScript._populatePropertyNames = function(object, resultSet)
 {
-    if (Object.getOwnPropertyNames) {
-        for (var o = object; o; o = o.__proto__) {
-            try {
-                var names = Object.getOwnPropertyNames(o);
-                for (var i = 0; i < names.length; ++i)
-                    resultSet[names[i]] = true;
-            } catch (e) {
-            }
+    for (var o = object; o; o = o.__proto__) {
+        try {
+            var names = Object.getOwnPropertyNames(o);
+            for (var i = 0; i < names.length; ++i)
+                resultSet[names[i]] = true;
+        } catch (e) {
         }
-    } else {
-        // Chromium doesn't support getOwnPropertyNames yet.
-        for (var name in object)
-            resultSet[name] = true;
     }
 }
 
+InjectedScript._getPropertyNames = function(object, resultSet)
+{
+    var propertyNameSet = {};
+    InjectedScript._populatePropertyNames(object, propertyNameSet);
+    return Object.keys(propertyNameSet);
+}
+
 InjectedScript.getCompletions = function(expression, includeInspectorCommandLineAPI, callFrameId)
 {
     var props = {};
@@ -605,7 +613,7 @@ InjectedScript.getCompletions = function(expression, includeInspectorCommandLine
                 // Evaluate into properties in scope of the selected call frame.
                 var scopeChain = callFrame.scopeChain;
                 for (var i = 0; i < scopeChain.length; ++i)
-                    InjectedScript._getPropertyNames(scopeChain[i], props);
+                    InjectedScript._populatePropertyNames(scopeChain[i], props);
             }
         } else {
             if (!expression)
@@ -613,7 +621,7 @@ InjectedScript.getCompletions = function(expression, includeInspectorCommandLine
             expressionResult = InjectedScript._evaluateOn(InjectedScript._window().eval, InjectedScript._window(), expression);
         }
         if (typeof expressionResult == "object")
-            InjectedScript._getPropertyNames(expressionResult, props);
+            InjectedScript._populatePropertyNames(expressionResult, props);
         if (includeInspectorCommandLineAPI)
             for (var prop in InjectedScript._window().console._inspectorCommandLineAPI)
                 if (prop.charAt(0) !== '_')
diff --git a/WebCore/inspector/front-end/ObjectPropertiesSection.js b/WebCore/inspector/front-end/ObjectPropertiesSection.js
index 6d71090..f06a14d 100644
--- a/WebCore/inspector/front-end/ObjectPropertiesSection.js
+++ b/WebCore/inspector/front-end/ObjectPropertiesSection.js
@@ -77,6 +77,7 @@ WebInspector.ObjectPropertiesSection.prototype = {
             var infoElement = new TreeElement(title, null, false);
             this.propertiesTreeOutline.appendChild(infoElement);
         }
+        this.propertiesForTest = properties;
     }
 }
 
@@ -86,6 +87,10 @@ WebInspector.ObjectPropertiesSection.CompareProperties = function(propertyA, pro
 {
     var a = propertyA.name;
     var b = propertyB.name;
+    if (a === "__proto__")
+        return 1;
+    if (b === "__proto__")
+        return -1;
 
     // if used elsewhere make sure to
     //  - convert a and b to strings (not needed here, properties are all strings)
@@ -174,7 +179,9 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
         this.valueElement.className = "value";
         this.valueElement.textContent = this.property.value.description;
         if (this.property.isGetter)
-           this.valueElement.addStyleClass("dimmed");
+            this.valueElement.addStyleClass("dimmed");
+        if (this.property.isError)
+            this.valueElement.addStyleClass("error");
 
         this.listItemElement.removeChildren();
 
diff --git a/WebCore/inspector/front-end/Section.js b/WebCore/inspector/front-end/Section.js
index 394f86d..7710192 100644
--- a/WebCore/inspector/front-end/Section.js
+++ b/WebCore/inspector/front-end/Section.js
@@ -31,6 +31,7 @@ WebInspector.Section = function(title, subtitle)
 {
     this.element = document.createElement("div");
     this.element.className = "section";
+    this.element.sectionForTest = this;
 
     this.headerElement = document.createElement("div");
     this.headerElement.className = "header";
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index 53f1e4b..dc49d6f 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -1577,6 +1577,10 @@ li.editing .swatch, li.editing .enabled-button,  li.editing-sub-part .delete-but
     color: rgb(100, 100, 100);
 }
 
+.section .properties .value.error {
+    color: red;
+}
+
 .section .properties .number, .event-properties .number {
     color: blue;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list