Changeset 213565 in webkit


Ignore:
Timestamp:
Mar 7, 2017 9:18:35 PM (7 years ago)
Author:
commit-queue@webkit.org
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 <Joseph Pecoraro> 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.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r213543 r213565  
     12017-03-07  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: DOM Tree broken if an element has a "debounce" attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=169336
     5        <rdar://problem/30899430>
     6
     7        Reviewed by Brian Burg.
     8
     9        * UserInterface/Models/DOMNode.js:
     10        (WebInspector.DOMNode):
     11        (WebInspector.DOMNode.prototype.getAttribute):
     12        (WebInspector.DOMNode.prototype.removeAttribute.mycallback):
     13        (WebInspector.DOMNode.prototype.removeAttribute):
     14        Convert the attributes map to an actual Map to avoid name collisions
     15        with Object.prototype properties.
     16
    1172017-03-07  Chris Dumez  <cdumez@apple.com>
    218
  • trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js

    r211432 r213565  
    5858
    5959        this._attributes = [];
    60         this._attributesMap = {};
     60        this._attributesMap = new Map;
    6161        if (payload.attributes)
    6262            this._setAttributesPayload(payload.attributes);
     
    388388    getAttribute(name)
    389389    {
    390         var attr = this._attributesMap[name];
     390        let attr = this._attributesMap.get(name);
    391391        return attr ? attr.value : undefined;
    392392    }
     
    412412        {
    413413            if (!error) {
    414                 delete this._attributesMap[name];
     414                this._attributesMap.delete(name);
    415415                for (var i = 0; i < this._attributes.length; ++i) {
    416416                    if (this._attributes[i].name === name) {
     
    670670    {
    671671        this._attributes = [];
    672         this._attributesMap = {};
     672        this._attributesMap = new Map;
    673673        for (var i = 0; i < attrs.length; i += 2)
    674674            this._addAttribute(attrs[i], attrs[i + 1]);
     
    736736    _addAttribute(name, value)
    737737    {
    738         var attr = {name, value, _node: this};
    739         this._attributesMap[name] = attr;
     738        let attr = {name, value, _node: this};
     739        this._attributesMap.set(name, attr);
    740740        this._attributes.push(attr);
    741741    }
     
    743743    _setAttribute(name, value)
    744744    {
    745         var attr = this._attributesMap[name];
     745        let attr = this._attributesMap.get(name);
    746746        if (attr)
    747747            attr.value = value;
     
    752752    _removeAttribute(name)
    753753    {
    754         var attr = this._attributesMap[name];
     754        let attr = this._attributesMap.get(name);
    755755        if (attr) {
    756756            this._attributes.remove(attr);
    757             delete this._attributesMap[name];
     757            this._attributesMap.delete(name);
    758758        }
    759759    }
Note: See TracChangeset for help on using the changeset viewer.