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

joepeck at webkit.org joepeck at webkit.org
Wed Apr 7 23:09:28 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 883729f76eae97ef88de8a84bb9a81f80ec852e7
Author: joepeck at webkit.org <joepeck at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 27 19:37:56 2009 +0000

    2009-10-27  Joseph Pecoraro  <joepeck at webkit.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: Pretty Print all HTML Collection Types like we do for NodeList
            https://bugs.webkit.org/show_bug.cgi?id=30709
    
            Test: inspector/console-format-collections.html
    
            * inspector/front-end/InjectedScript.js:
            (Object.type): check for instances of HTMLCollection like we do for NodeList
            * inspector/front-end/inspector.js: added WebInspector.pendingDispatches counter
            (WebInspector.dispatch): increment and decrement dispatch counter
            (WebInspector.runAfterPendingDispatches): run when there are no more dispatches
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50168 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 050c87d..6f25578 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-27  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Pretty Print all HTML Collection Types like we do for NodeList
+        https://bugs.webkit.org/show_bug.cgi?id=30709
+
+        * inspector/console-format-collections-expected.txt: Added.
+        * inspector/console-format-collections.html: Added.
+        * inspector/evaluate-in-frontend.js: Changed innerHTML to DOM elements instead.
+
 2009-10-27  Adele Peterson  <adele at apple.com>
 
         Test for <rdar://problem/7269075> REGRESSION (Safari 4.0.3-ToT): After pressing Shift-PageDown, pressing Shift-Up 
diff --git a/LayoutTests/inspector/console-format-collections-expected.txt b/LayoutTests/inspector/console-format-collections-expected.txt
new file mode 100644
index 0000000..80f1be4
--- /dev/null
+++ b/LayoutTests/inspector/console-format-collections-expected.txt
@@ -0,0 +1,15 @@
+CONSOLE MESSAGE: line 14: [object NodeList]
+CONSOLE MESSAGE: line 18: [object HTMLCollection]
+CONSOLE MESSAGE: line 22: [object HTMLOptionsCollection]
+CONSOLE MESSAGE: line 26: [object HTMLAllCollection]
+CONSOLE MESSAGE: line 30: [object HTMLCollection]
+CONSOLE MESSAGE: line 34: [object NodeList]
+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: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
new file mode 100644
index 0000000..35a96df
--- /dev/null
+++ b/LayoutTests/inspector/console-format-collections.html
@@ -0,0 +1,79 @@
+<html>
+<head>
+<script src="evaluate-in-frontend.js"></script>
+<script>
+
+function doit()
+{
+    var formElement = document.getElementById("f");
+    var selectElement = document.getElementById("sel");
+    var spanElement = document.getElementById("span");
+
+    // NodeList
+    var nodelist = document.getElementsByTagName("select");
+    console.log(nodelist);
+
+    // HTMLCollection
+    var htmlcollection = document.head.children;
+    console.log(htmlcollection);
+
+    // HTMLOptionsCollection
+    var options = selectElement.options;
+    console.log(options);
+
+    // HTMLAllCollection
+    var all = document.all;
+    console.log(all);
+
+    // HTMLFormControlsCollection (currently shows HTMLCollection)
+    var formControls = formElement.elements;
+    console.log(formControls);
+
+    // RadioNodeList (currently shows NodeList)
+    var radioNodeList = formElement.x;
+    console.log(radioNodeList);
+
+    evaluateInWebInspector("dumpMessages", function(result) {
+        for (var i = 0; i < result.length; ++i)
+            output(result[i]);
+        notifyDone();
+    });
+}
+
+</script>
+</head>
+
+<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>
+        </select>
+        <input type="radio" name="x" value="x1" /> x1
+        <input type="radio" name="x" value="x2" /> x2
+    </form>
+</div>
+
+<div id="frontend-script" style="display:none">
+function dumpMessages(testController)
+{
+    testController.waitUntilDone();
+    WebInspector.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>
+
+</body>
+</html>
diff --git a/LayoutTests/inspector/evaluate-in-frontend.js b/LayoutTests/inspector/evaluate-in-frontend.js
index 1a4e7ab..79b2cb1 100755
--- a/LayoutTests/inspector/evaluate-in-frontend.js
+++ b/LayoutTests/inspector/evaluate-in-frontend.js
@@ -46,7 +46,6 @@ function evaluateInWebInspector(script, callback)
         if (window.layoutTestController)
             layoutTestController.evaluateInWebInspector(callId, script);
     }, 0);
-
 }
 
 function notifyDone()
@@ -62,7 +61,8 @@ function notifyDone()
 function output(text)
 {
     var output = document.getElementById("output");
-    output.innerHTML += text + "<BR>";
+    output.appendChild(document.createTextNode(text));
+    output.appendChild(document.createElement("br"));
 }
 
 window.didEvaluateForTestInFrontend = function(callId, jsonResult)
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d376eeb..9be5fa2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2009-10-27  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Pretty Print all HTML Collection Types like we do for NodeList
+        https://bugs.webkit.org/show_bug.cgi?id=30709
+
+        Test: inspector/console-format-collections.html
+
+        * inspector/front-end/InjectedScript.js:
+        (Object.type): check for instances of HTMLCollection like we do for NodeList
+        * inspector/front-end/inspector.js: added WebInspector.pendingDispatches counter
+        (WebInspector.dispatch): increment and decrement dispatch counter
+        (WebInspector.runAfterPendingDispatches): run when there are no more dispatches
+
 2009-10-27  Kelly Norton  <knorton at google.com>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index b912a28..3bed8da 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -1158,6 +1158,8 @@ Object.type = function(obj)
         return "regexp";
     if (obj instanceof win.NodeList)
         return "array";
+    if (obj instanceof win.HTMLCollection || obj instanceof win.HTMLAllCollection)
+        return "array";
     if (obj instanceof win.Error)
         return "error";
     return type;
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 4eea946..da6697c 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -374,6 +374,7 @@ WebInspector.loaded = function()
     document.body.addStyleClass("platform-" + platform);
 
     this._loadPreferences();
+    this.pendingDispatches = 0;
 
     this.drawer = new WebInspector.Drawer();
     this.console = new WebInspector.ConsoleView(this.drawer);
@@ -497,10 +498,22 @@ WebInspector.dispatch = function() {
     function delayDispatch()
     {
         WebInspector[methodName].apply(WebInspector, parameters);
+        WebInspector.pendingDispatches--;
     }
+    WebInspector.pendingDispatches++;
     setTimeout(delayDispatch, 0);
 }
 
+WebInspector.runAfterPendingDispatches = function(callback)
+{
+    if (WebInspector.pendingDispatches === 0) {
+        callback();
+        return;
+    }
+
+    setTimeout(WebInspector.runAfterPendingDispatches, 0, callback);
+}
+
 WebInspector.windowUnload = function(event)
 {
     InspectorController.windowUnloading();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list