Changeset 245167 in webkit


Ignore:
Timestamp:
May 9, 2019 5:32:09 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Uncaught Exception: null is not an object (evaluating 'resource.parentFrame.securityOrigin')
https://bugs.webkit.org/show_bug.cgi?id=196572
<rdar://problem/49578338>

Reviewed by Timothy Hatcher.

  • UserInterface/Views/SourcesNavigationSidebarPanel.js:

(WI.SourcesNavigationSidebarPanel.prototype._addResource):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r245166 r245167  
     12019-05-09  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Uncaught Exception: null is not an object (evaluating 'resource.parentFrame.securityOrigin')
     4        https://bugs.webkit.org/show_bug.cgi?id=196572
     5        <rdar://problem/49578338>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Views/SourcesNavigationSidebarPanel.js:
     10        (WI.SourcesNavigationSidebarPanel.prototype._addResource):
     11
    1122019-05-09  Devin Rousso  <drousso@apple.com>
    213
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js

    r245060 r245167  
    669669                if (resource.urlComponents.port)
    670670                    origin += ":" + resource.urlComponents.port;
    671             } else
     671            } else if (resource.parentFrame)
    672672                origin = resource.parentFrame.securityOrigin;
    673673
    674             let frameTreeElement = this._originTreeElementMap.get(origin);
    675             if (!frameTreeElement) {
    676                 frameTreeElement = new WI.FolderTreeElement(origin, origin === resource.parentFrame.securityOrigin ? resource.parentFrame : null);
    677                 this._originTreeElementMap.set(origin, frameTreeElement);
    678 
    679                 let index = insertionIndexForObjectInListSortedByFunction(frameTreeElement, this._resourcesTreeOutline.children, this._boundCompareTreeElements);
    680                 this._resourcesTreeOutline.insertChild(frameTreeElement, index);
     674            let parentTreeElement = null;
     675            if (origin) {
     676                let frameTreeElement = this._originTreeElementMap.get(origin);
     677                if (!frameTreeElement) {
     678                    frameTreeElement = new WI.FolderTreeElement(origin, origin === resource.parentFrame.securityOrigin ? resource.parentFrame : null);
     679                    this._originTreeElementMap.set(origin, frameTreeElement);
     680
     681                    let index = insertionIndexForObjectInListSortedByFunction(frameTreeElement, this._resourcesTreeOutline.children, this._boundCompareTreeElements);
     682                    this._resourcesTreeOutline.insertChild(frameTreeElement, index);
     683                }
     684
     685                let subpath = resource.urlComponents.path;
     686                if (subpath && subpath[0] === "/")
     687                    subpath = subpath.substring(1);
     688
     689                parentTreeElement = frameTreeElement.createFoldersAsNeededForSubpath(subpath);
     690            } else {
     691                parentTreeElement = this._resourcesTreeOutline;
    681692            }
    682693
     
    687698                resourceTreeElement = new WI.ResourceTreeElement(resource, resource, {allowDirectoryAsName: true, hideOrigin: true});
    688699
    689             let subpath = resource.urlComponents.path;
    690             if (subpath && subpath[0] === "/")
    691                 subpath = subpath.substring(1);
    692 
    693             let parent = frameTreeElement.createFoldersAsNeededForSubpath(subpath);
    694             let index = insertionIndexForObjectInListSortedByFunction(resourceTreeElement, parent.children, this._boundCompareTreeElements);
    695             parent.insertChild(resourceTreeElement, index);
     700            let index = insertionIndexForObjectInListSortedByFunction(resourceTreeElement, parentTreeElement.children, this._boundCompareTreeElements);
     701            parentTreeElement.insertChild(resourceTreeElement, index);
    696702        }
    697703
Note: See TracChangeset for help on using the changeset viewer.