Title: [213565] trunk/Source/WebInspectorUI
Revision
213565
Author
[email protected]
Date
2017-03-07 21:18:35 -0800 (Tue, 07 Mar 2017)

Log Message

Web Inspector: DOM Tree broken if an element has a "debounce" attribute
https://bugs.webkit.org/show_bug.cgi?id=169336
<rdar://problem/30899430>

Patch by Joseph Pecoraro <[email protected]> on 2017-03-07
Reviewed by Brian Burg.

* UserInterface/Models/DOMNode.js:
(WebInspector.DOMNode):
(WebInspector.DOMNode.prototype.getAttribute):
(WebInspector.DOMNode.prototype.removeAttribute.mycallback):
(WebInspector.DOMNode.prototype.removeAttribute):
Convert the attributes map to an actual Map to avoid name collisions
with Object.prototype properties.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (213564 => 213565)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-03-08 04:49:26 UTC (rev 213564)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-03-08 05:18:35 UTC (rev 213565)
@@ -1,3 +1,19 @@
+2017-03-07  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: DOM Tree broken if an element has a "debounce" attribute
+        https://bugs.webkit.org/show_bug.cgi?id=169336
+        <rdar://problem/30899430>
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Models/DOMNode.js:
+        (WebInspector.DOMNode):
+        (WebInspector.DOMNode.prototype.getAttribute):
+        (WebInspector.DOMNode.prototype.removeAttribute.mycallback):
+        (WebInspector.DOMNode.prototype.removeAttribute):
+        Convert the attributes map to an actual Map to avoid name collisions
+        with Object.prototype properties.
+
 2017-03-07  Chris Dumez  <[email protected]>
 
         Drop non-standard MessageEvent.webkitInitMessageEvent()

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js (213564 => 213565)


--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js	2017-03-08 04:49:26 UTC (rev 213564)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js	2017-03-08 05:18:35 UTC (rev 213565)
@@ -57,7 +57,7 @@
             this.ownerDocument = doc;
 
         this._attributes = [];
-        this._attributesMap = {};
+        this._attributesMap = new Map;
         if (payload.attributes)
             this._setAttributesPayload(payload.attributes);
 
@@ -387,7 +387,7 @@
 
     getAttribute(name)
     {
-        var attr = this._attributesMap[name];
+        let attr = this._attributesMap.get(name);
         return attr ? attr.value : undefined;
     }
 
@@ -411,7 +411,7 @@
         function mycallback(error, success)
         {
             if (!error) {
-                delete this._attributesMap[name];
+                this._attributesMap.delete(name);
                 for (var i = 0; i < this._attributes.length; ++i) {
                     if (this._attributes[i].name === name) {
                         this._attributes.splice(i, 1);
@@ -669,7 +669,7 @@
     _setAttributesPayload(attrs)
     {
         this._attributes = [];
-        this._attributesMap = {};
+        this._attributesMap = new Map;
         for (var i = 0; i < attrs.length; i += 2)
             this._addAttribute(attrs[i], attrs[i + 1]);
     }
@@ -735,14 +735,14 @@
 
     _addAttribute(name, value)
     {
-        var attr = {name, value, _node: this};
-        this._attributesMap[name] = attr;
+        let attr = {name, value, _node: this};
+        this._attributesMap.set(name, attr);
         this._attributes.push(attr);
     }
 
     _setAttribute(name, value)
     {
-        var attr = this._attributesMap[name];
+        let attr = this._attributesMap.get(name);
         if (attr)
             attr.value = value;
         else
@@ -751,10 +751,10 @@
 
     _removeAttribute(name)
     {
-        var attr = this._attributesMap[name];
+        let attr = this._attributesMap.get(name);
         if (attr) {
             this._attributes.remove(attr);
-            delete this._attributesMap[name];
+            this._attributesMap.delete(name);
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to