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

pfeldman at chromium.org pfeldman at chromium.org
Wed Dec 22 12:33:50 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 24e1fe31e0f82f6e012ca8eebb88f5c0825b8068
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 25 12:16:50 2010 +0000

    2010-08-24  Pavel Podivilov  <podivilov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: add "Attribute Modified" and "Node Removed" DOM breakpoints
            https://bugs.webkit.org/show_bug.cgi?id=44532
    
            Test: inspector/dom-breakpoint.html
    
            * inspector/InspectorDOMAgent.cpp:
            (WebCore::InspectorDOMAgent::setDOMBreakpoint):
            (WebCore::InspectorDOMAgent::removeDOMBreakpoint):
            (WebCore::InspectorDOMAgent::didInsertDOMNode):
            (WebCore::InspectorDOMAgent::didRemoveDOMNode):
            (WebCore::InspectorDOMAgent::didModifyDOMAttr):
            * inspector/front-end/DOMAgent.js:
            * inspector/front-end/ElementsTreeOutline.js:
    2010-08-25  Pavel Podivilov  <podivilov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: add "Attribute Modified" and "Node Removed" DOM breakpoints
            https://bugs.webkit.org/show_bug.cgi?id=44532
    
            * http/tests/inspector/debugger-test2.js:
            (initialize_DebuggerTest.InspectorTest.waitUntilPaused.pausedScript):
            (initialize_DebuggerTest.InspectorTest.waitUntilPaused):
            * http/tests/inspector/inspector-test2.js:
            (initialize_InspectorTest.):
            (initialize_InspectorTest):
            * inspector/dom-breakpoints-expected.txt:
            * inspector/dom-breakpoints.html:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66008 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c4e60f8..a9dbc95 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-08-25  Pavel Podivilov  <podivilov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: add "Attribute Modified" and "Node Removed" DOM breakpoints
+        https://bugs.webkit.org/show_bug.cgi?id=44532
+
+        * http/tests/inspector/debugger-test2.js:
+        (initialize_DebuggerTest.InspectorTest.waitUntilPaused.pausedScript):
+        (initialize_DebuggerTest.InspectorTest.waitUntilPaused):
+        * http/tests/inspector/inspector-test2.js:
+        (initialize_InspectorTest.):
+        (initialize_InspectorTest):
+        * inspector/dom-breakpoints-expected.txt:
+        * inspector/dom-breakpoints.html:
+
 2010-08-25  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Shinichiro Hamaji
diff --git a/LayoutTests/http/tests/inspector/debugger-test2.js b/LayoutTests/http/tests/inspector/debugger-test2.js
index 55f5036..528ee8f 100644
--- a/LayoutTests/http/tests/inspector/debugger-test2.js
+++ b/LayoutTests/http/tests/inspector/debugger-test2.js
@@ -41,7 +41,13 @@ InspectorTest.completeDebuggerTest = function()
 
 InspectorTest.waitUntilPaused = function(callback)
 {
-    InspectorTest._addSniffer(WebInspector, "pausedScript", callback);
+    InspectorTest._addSniffer(WebInspector, "pausedScript", pausedScript);
+
+    function pausedScript(callFrames)
+    {
+        InspectorTest.addResult("Paused at line " + callFrames[0].line + " in " + callFrames[0].functionName);
+        callback(callFrames);
+    }
 };
 
 InspectorTest.resumeExecution = function()
diff --git a/LayoutTests/http/tests/inspector/inspector-test2.js b/LayoutTests/http/tests/inspector/inspector-test2.js
index 7f5ffd1..4d8bf7b 100644
--- a/LayoutTests/http/tests/inspector/inspector-test2.js
+++ b/LayoutTests/http/tests/inspector/inspector-test2.js
@@ -35,6 +35,7 @@ InspectorTest.reloadPage = function(callback)
 InspectorTest.findDOMNode = function(root, filter, callback)
 {
     var found = false;
+    var pendingCalls = 0;
 
     if (root)
         findDOMNode(root);
@@ -55,14 +56,19 @@ InspectorTest.findDOMNode = function(root, filter, callback)
         if (filter(node)) {
             callback(node);
             found = true;
-        } else
+        } else {
+            pendingCalls += 1;
             WebInspector.domAgent.getChildNodesAsync(node, processChildren);
+        }
 
         function processChildren(children)
         {
+            pendingCalls -= 1;
+
             for (var i = 0; !found && children && i < children.length; ++i)
                 findDOMNode(children[i]);
-            if (!found && node === root)
+
+            if (!found && !pendingCalls && node == root)
                 callback(null);
         }
     }
@@ -73,6 +79,7 @@ InspectorTest._addSniffer = function(receiver, methodName, override, opt_sticky)
     var original = receiver[methodName];
     if (typeof original !== "function")
         throw ("Cannot find method to override: " + methodName);
+
     receiver[methodName] = function(var_args) {
         try {
             var result = original.apply(this, arguments);
diff --git a/LayoutTests/inspector/dom-breakpoints-expected.txt b/LayoutTests/inspector/dom-breakpoints-expected.txt
index 06d533f..93f1e9f 100644
--- a/LayoutTests/inspector/dom-breakpoints-expected.txt
+++ b/LayoutTests/inspector/dom-breakpoints-expected.txt
@@ -1,8 +1,14 @@
 Tests DOM breakpoints. Bug 42886
 
 Debugger was enabled.
-Found div element.
-Set DOM breakpoint.
-Paused at line 10 in appendElement
+Found dom node d0.
+Set subtree modified DOM breakpoint on d0.
+Paused at line 11 in appendElement
+Found dom node d1.
+Set attribute modified DOM breakpoint on d1.
+Paused at line 17 in modifyAttribute
+Found dom node d1.
+Set node removed DOM breakpoint on d1.
+Paused at line 23 in removeElement
 Debugger was disabled.
 
diff --git a/LayoutTests/inspector/dom-breakpoints.html b/LayoutTests/inspector/dom-breakpoints.html
index 40fd2a9..fbb6532 100644
--- a/LayoutTests/inspector/dom-breakpoints.html
+++ b/LayoutTests/inspector/dom-breakpoints.html
@@ -4,37 +4,87 @@
 <script src="../http/tests/inspector/debugger-test2.js"></script>
 <script>
 
-function appendElement()
+function appendElement(parentId, childId)
 {
     var child = document.createElement("div");
-    document.getElementById("d0").appendChild(child);
+    child.id = childId;
+    document.getElementById(parentId).appendChild(child);
+}
+
+function modifyAttribute(elementId, name, value)
+{
+    var element = document.getElementById(elementId);
+    element.setAttribute(name, value);
+}
+
+function removeElement(elementId)
+{
+    var element = document.getElementById(elementId);
+    element.parentNode.removeChild(element);
 }
 
 var test = function()
 {
-    InspectorTest.startDebuggerTest(startDebuggerTestCallback);
+    InspectorTest.startDebuggerTest(step1);
 
-    function startDebuggerTestCallback()
+    function step1()
     {
-        InspectorTest.findDOMNode(null, function(node) {
-            return node.getAttribute("id") === "d0";
-        }, findDOMNodeCallback);
+        findDOMNodeById("d0", step2);
     }
 
-    function findDOMNodeCallback(node)
+    function step2(node)
     {
-        InspectorTest.addResult("Found div element.");
+        InspectorTest.addResult("Found dom node d0.");
         WebInspector.domBreakpointManager.setBreakpoint(node, WebInspector.DOMBreakpoint.Types.SubtreeModified);
-        InspectorTest.addResult("Set DOM breakpoint.");
-        InspectorTest.evaluateInConsole("appendElement()");
-        InspectorTest.waitUntilPaused(waitUntilPausedCallback);
+        InspectorTest.addResult("Set subtree modified DOM breakpoint on d0.");
+        InspectorTest.evaluateInConsole("appendElement('d0', 'd1')");
+        InspectorTest.waitUntilPaused(step3.bind(null, node));
+    }
+
+    function step3(node)
+    {
+        WebInspector.domBreakpointManager.removeBreakpointsForNode(node);
+        InspectorTest.resumeExecution();
+        findDOMNodeById("d1", step4);
     }
 
-    function waitUntilPausedCallback(callFrames)
+    function step4(node)
     {
-        InspectorTest.addResult("Paused at line " + callFrames[0].line + " in " + callFrames[0].functionName);
+        InspectorTest.addResult("Found dom node d1.");
+        WebInspector.domBreakpointManager.setBreakpoint(node, WebInspector.DOMBreakpoint.Types.AttributeModified);
+        InspectorTest.addResult("Set attribute modified DOM breakpoint on d1.");
+        InspectorTest.evaluateInConsole("modifyAttribute('d1', 'className', 'foo')");
+        InspectorTest.waitUntilPaused(step5.bind(null, node));
+    }
+
+    function step5(node)
+    {
+        WebInspector.domBreakpointManager.removeBreakpointsForNode(node);
+        InspectorTest.resumeExecution();
+        findDOMNodeById("d1", step6);
+    }
+
+    function step6(node)
+    {
+        InspectorTest.addResult("Found dom node d1.");
+        WebInspector.domBreakpointManager.setBreakpoint(node, WebInspector.DOMBreakpoint.Types.NodeRemoved);
+        InspectorTest.addResult("Set node removed DOM breakpoint on d1.");
+        InspectorTest.evaluateInConsole("removeElement('d1')");
+        InspectorTest.waitUntilPaused(step7.bind(null, node));
+    }
+
+    function step7(node)
+    {
+        WebInspector.domBreakpointManager.removeBreakpointsForNode(node);
         InspectorTest.completeDebuggerTest();
     }
+
+    function findDOMNodeById(id, callback)
+    {
+        InspectorTest.findDOMNode(null, function(node) {
+            return node.getAttribute("id") === id;
+        }, callback);
+    }
 };
 
 </script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1175b88..56db3b4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-24  Pavel Podivilov  <podivilov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: add "Attribute Modified" and "Node Removed" DOM breakpoints
+        https://bugs.webkit.org/show_bug.cgi?id=44532
+
+        Test: inspector/dom-breakpoint.html
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::setDOMBreakpoint):
+        (WebCore::InspectorDOMAgent::removeDOMBreakpoint):
+        (WebCore::InspectorDOMAgent::didInsertDOMNode):
+        (WebCore::InspectorDOMAgent::didRemoveDOMNode):
+        (WebCore::InspectorDOMAgent::didModifyDOMAttr):
+        * inspector/front-end/DOMAgent.js:
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._populateTagContextMenu):
+
 2010-08-25  Satish Sampath  <satish at chromium.org>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js
index 16d87ae..38f12ae 100644
Binary files a/WebCore/English.lproj/localizedStrings.js and b/WebCore/English.lproj/localizedStrings.js differ
diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp
index 7385335..b8ae047 100644
--- a/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/WebCore/inspector/InspectorDOMAgent.cpp
@@ -199,9 +199,12 @@ public:
 };
 
 enum DOMBreakpointType {
-    DOMBreakpointTypeSubtreeModified = 0
+    SubtreeModified = 0,
+    AttributeModified,
+    NodeRemoved
 };
 
+const uint32_t inheritableDOMBreakpointTypesMask = (1 << SubtreeModified);
 const int domBreakpointDerivedTypeShift = 16;
 
 }
@@ -742,8 +745,10 @@ void InspectorDOMAgent::setDOMBreakpoint(long nodeId, long type)
 
     uint32_t rootBit = 1 << type;
     m_breakpoints.set(node, m_breakpoints.get(node) | rootBit);
-    for (Node* child = innerFirstChild(node); child; child = innerNextSibling(child))
-        updateSubtreeBreakpoints(child, rootBit, true);
+    if (rootBit & inheritableDOMBreakpointTypesMask) {
+        for (Node* child = innerFirstChild(node); child; child = innerNextSibling(child))
+            updateSubtreeBreakpoints(child, rootBit, true);
+    }
 }
 
 void InspectorDOMAgent::removeDOMBreakpoint(long nodeId, long type)
@@ -758,11 +763,11 @@ void InspectorDOMAgent::removeDOMBreakpoint(long nodeId, long type)
         m_breakpoints.set(node, mask);
     else
         m_breakpoints.remove(node);
-    if (mask & (rootBit << domBreakpointDerivedTypeShift))
-        return;
 
-    for (Node* child = innerFirstChild(node); child; child = innerNextSibling(child))
-        updateSubtreeBreakpoints(child, rootBit, false);
+    if ((rootBit & inheritableDOMBreakpointTypesMask) && !(mask & (rootBit << domBreakpointDerivedTypeShift))) {
+        for (Node* child = innerFirstChild(node); child; child = innerNextSibling(child))
+            updateSubtreeBreakpoints(child, rootBit, false);
+    }
 }
 
 String InspectorDOMAgent::documentURLString(Document* document) const
@@ -967,13 +972,14 @@ void InspectorDOMAgent::didInsertDOMNode(Node* node)
 
     if (m_breakpoints.size()) {
         Node* parent = innerParentNode(node);
-        if (hasBreakpoint(parent, DOMBreakpointTypeSubtreeModified)) {
+        if (hasBreakpoint(parent, SubtreeModified)) {
             if (!pauseOnBreakpoint())
                 return;
         }
         uint32_t mask = m_breakpoints.get(parent);
-        mask = (mask | (mask >> domBreakpointDerivedTypeShift)) & ((1 << domBreakpointDerivedTypeShift) - 1);
-        updateSubtreeBreakpoints(node, mask, true);
+        uint32_t inheritableTypesMask = (mask | (mask >> domBreakpointDerivedTypeShift)) & inheritableDOMBreakpointTypesMask;
+        if (inheritableTypesMask)
+            updateSubtreeBreakpoints(node, inheritableTypesMask, true);
     }
 
     // We could be attaching existing subtree. Forget the bindings.
@@ -1003,7 +1009,7 @@ void InspectorDOMAgent::didRemoveDOMNode(Node* node)
         return;
 
     if (m_breakpoints.size()) {
-        if (hasBreakpoint(innerParentNode(node), DOMBreakpointTypeSubtreeModified)) {
+        if (hasBreakpoint(node, NodeRemoved) || hasBreakpoint(innerParentNode(node), SubtreeModified)) {
             if (!pauseOnBreakpoint())
                 return;
         }
@@ -1043,6 +1049,11 @@ void InspectorDOMAgent::didModifyDOMAttr(Element* element)
     if (!id)
         return;
 
+    if (hasBreakpoint(element, AttributeModified)) {
+        if (!pauseOnBreakpoint())
+            return;
+    }
+
     m_frontend->attributesUpdated(id, buildArrayForElementAttributes(element));
 }
 
diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js
index d119680..0d79d51 100644
--- a/WebCore/inspector/front-end/DOMAgent.js
+++ b/WebCore/inspector/front-end/DOMAgent.js
@@ -728,11 +728,15 @@ WebInspector.DOMBreakpoint = function(node, type)
 }
 
 WebInspector.DOMBreakpoint.Types = {
-    SubtreeModified: 0
+    SubtreeModified: 0,
+    AttributeModified: 1,
+    NodeRemoved: 2
 };
 
 WebInspector.DOMBreakpoint.Labels = {};
 WebInspector.DOMBreakpoint.Labels[WebInspector.DOMBreakpoint.Types.SubtreeModified] = WebInspector.UIString("Subtree Modified");
+WebInspector.DOMBreakpoint.Labels[WebInspector.DOMBreakpoint.Types.AttributeModified] = WebInspector.UIString("Attribute Modified");
+WebInspector.DOMBreakpoint.Labels[WebInspector.DOMBreakpoint.Types.NodeRemoved] = WebInspector.UIString("Node Removed");
 
 WebInspector.DOMBreakpoint.prototype = {
     get enabled()
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index 0ec1eb3..7f48161 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -402,7 +402,7 @@ WebInspector.ElementsTreeElement.prototype = {
         var node = this.representedObject;
         if (!node.nodeName || node.nodeName.toLowerCase() !== "img")
             return;
-        
+
         function setTooltip(properties)
         {
             if (!properties)
@@ -766,8 +766,12 @@ WebInspector.ElementsTreeElement.prototype = {
             // Add debbuging-related actions
             contextMenu.appendSeparator();
 
-            contextMenu.appendItem(WebInspector.UIString("Stop on subtree modifications"),
+            contextMenu.appendItem(WebInspector.UIString("Stop on Subtree Modifications"),
                 WebInspector.domBreakpointManager.setBreakpoint.bind(WebInspector.domBreakpointManager, this.representedObject, WebInspector.DOMBreakpoint.Types.SubtreeModified));
+            contextMenu.appendItem(WebInspector.UIString("Stop on Attributes Modifications"),
+                WebInspector.domBreakpointManager.setBreakpoint.bind(WebInspector.domBreakpointManager, this.representedObject, WebInspector.DOMBreakpoint.Types.AttributeModified));
+            contextMenu.appendItem(WebInspector.UIString("Stop on Node Removal"),
+                WebInspector.domBreakpointManager.setBreakpoint.bind(WebInspector.domBreakpointManager, this.representedObject, WebInspector.DOMBreakpoint.Types.NodeRemoved));
 
             contextMenu.appendItem(WebInspector.UIString("Remove Breakpoints"),
                 WebInspector.domBreakpointManager.removeBreakpointsForNode.bind(WebInspector.domBreakpointManager, this.representedObject));

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list