Changeset 261200 in webkit


Ignore:
Timestamp:
May 5, 2020 3:09:35 PM (4 years ago)
Author:
Devin Rousso
Message:

Web Inspector: REGRESSION(r239175): Source Maps: original source not shown when in nested folder
https://bugs.webkit.org/show_bug.cgi?id=198276

Reviewed by Joseph Pecoraro.

  • UserInterface/Views/TreeOutline.js:

(WI.TreeOutline.prototype.removeChildren):
r239175 made it so that WI.TreeOutline.prototype.removeChildren actually modified the
this.children member property array (which is not a getter), meaning that if a caller had
previously saved a reference to it before calling removeChildren(), the saved reference
would also be modified, preventing it from being of any real use afterwards. At that time,
WI.TreeOutline maintained an index value for each WI.TreeElement, which meant that it
was necessary to remove from this.children as otherwise Array.prototype.indexOf calls
would not be accurate. Since then, WI.TreeOutline has moved to using representedObject,
meaning it's no longer necessary to modify this.children.

  • UserInterface/Views/SourceCodeTreeElement.js:

(WI.SourceCodeTreeElement.prototype.onpopulate):
(WI.SourceCodeTreeElement.prototype.onpopulate.combineFolderChain): Deleted.
(WI.SourceCodeTreeElement.prototype.onpopulate.findAndCombineFolderChains): Deleted.
Drive-by: don't attempt to combine folder chains when "Group by Path" to match the rest of

the look/feel of the navigation sidebar.

  • UserInterface/Models/SourceMapResource.js:

(WI.SourceMapResource.prototype.get sourceMapDisplaySubpath):
Drive-by: fix "null" being shown as the root subpath folder when using a local server.

Location:
trunk/Source/WebInspectorUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r261198 r261200  
     12020-05-05  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: REGRESSION(r239175): Source Maps: original source not shown when in nested folder
     4        https://bugs.webkit.org/show_bug.cgi?id=198276
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * UserInterface/Views/TreeOutline.js:
     9        (WI.TreeOutline.prototype.removeChildren):
     10        r239175 made it so that `WI.TreeOutline.prototype.removeChildren` actually modified the
     11        `this.children` member property array (which is not a getter), meaning that if a caller had
     12        previously saved a reference to it before calling `removeChildren()`, the saved reference
     13        would also be modified, preventing it from being of any real use afterwards. At that time,
     14        `WI.TreeOutline` maintained an index value for each `WI.TreeElement`, which meant that it
     15        was necessary to remove from `this.children` as otherwise `Array.prototype.indexOf` calls
     16        would not be accurate. Since then, `WI.TreeOutline` has moved to using `representedObject`,
     17        meaning it's no longer necessary to modify `this.children`.
     18
     19        * UserInterface/Views/SourceCodeTreeElement.js:
     20        (WI.SourceCodeTreeElement.prototype.onpopulate):
     21        (WI.SourceCodeTreeElement.prototype.onpopulate.combineFolderChain): Deleted.
     22        (WI.SourceCodeTreeElement.prototype.onpopulate.findAndCombineFolderChains): Deleted.
     23        Drive-by: don't attempt to combine folder chains when "Group by Path" to match the rest of
     24                  the look/feel of the navigation sidebar.
     25
     26        * UserInterface/Models/SourceMapResource.js:
     27        (WI.SourceMapResource.prototype.get sourceMapDisplaySubpath):
     28        Drive-by: fix "null" being shown as the root subpath folder when using a local server.
     29
    1302020-05-05  Devin Rousso  <drousso@apple.com>
    231
  • trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js

    r251227 r261200  
    6464
    6565        // Different schemes / hosts. Return the host + path of this resource.
    66         if (resourceURLComponents.scheme !== sourceMappingBasePathURLComponents.scheme || resourceURLComponents.host !== sourceMappingBasePathURLComponents.host)
    67             return resourceURLComponents.host + (resourceURLComponents.port ? (":" + resourceURLComponents.port) : "") + resourceURLComponents.path;
     66        if (resourceURLComponents.scheme !== sourceMappingBasePathURLComponents.scheme || resourceURLComponents.host !== sourceMappingBasePathURLComponents.host) {
     67            let subpath = "";
     68            if (resourceURLComponents.host) {
     69                subpath += resourceURLComponents.host;
     70                if (resourceURLComponents.port)
     71                    subpath += ":" + resourceURLComponents.port;
     72                subpath += resourceURLComponents.path;
     73            } else {
     74                // Remove the leading "/" so there isn't an empty folder.
     75                subpath += resourceURLComponents.path.substring(1);
     76            }
     77            return subpath;
     78        }
    6879
    6980        // Same host, but not a subpath of the base. This implies a ".." in the relative path.
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js

    r253591 r261200  
    125125        }
    126126
    127         for (var i = 0; i < this.children.length; ++i)
    128             findAndCombineFolderChains(this.children[i], null);
     127        if (WI.settings.resourceGroupingMode.value === WI.Resource.GroupingMode.Type) {
     128            for (let child of this.children)
     129                findAndCombineFolderChains(child);
     130        }
    129131    }
    130132
  • trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js

    r260613 r261200  
    371371    removeChildren(suppressOnDeselect)
    372372    {
    373         while (this.children.length) {
    374             let child = this.children[0];
     373        for (let child of this.children) {
    375374            child.deselect(suppressOnDeselect);
    376375
     
    387386            child.previousSibling = null;
    388387
    389             this.children.shift();
    390 
    391388            if (treeOutline)
    392389                treeOutline.dispatchEventToListeners(WI.TreeOutline.Event.ElementRemoved, {element: child});
    393390        }
     391
     392        this.children = [];
    394393    }
    395394
Note: See TracChangeset for help on using the changeset viewer.