Web Inspector: allow multiple resources for a given URL
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jun 2020 20:44:14 +0000 (20:44 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jun 2020 20:44:14 +0000 (20:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=212852

Reviewed by Brian Burg.

Source/WebInspectorUI:

Previously, when a new resource is added with a URL that matches an existing resource, any
`resourceForURL` call with that URL will return the new resource instead of the old one. Now
that there is a `Multimap` of URL to resource, it is possible to pick which resource is used
instead of always using the newest one.

* UserInterface/Models/ResourceCollection.js:
(WI.ResourceCollection):
(WI.ResourceCollection.prototype.resourcesForURL): Added.
(WI.ResourceCollection.prototype._associateWithResource):
(WI.ResourceCollection.prototype._disassociateWithResource):
(WI.ResourceCollection.prototype._resourceURLDidChange):
(WI.ResourceCollection.prototype.resourceForURL): Deleted.
* UserInterface/Models/Frame.js:
(WI.Frame.prototype.resourcesForURL): Added.
(WI.Frame.prototype.resourceForURL): Deleted.
* UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype.resourcesForURL): Added.
(WI.NetworkManager.prototype.resourceRequestDidReceiveResponse):
(WI.NetworkManager.prototype._initiatorSourceCodeLocationFromPayload):
(WI.NetworkManager.prototype.resourceForURL): Deleted.

* UserInterface/Models/Script.js:
(WI.Script.prototype._resolveResource):
(WI.Script.prototype._resolveResource.isScriptResource): Added.
* UserInterface/Controllers/CSSManager.js:
(WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent):
* UserInterface/Base/Utilities.js:
(Set.prototype.find): Added.
Add utility for finding an item in a `Set` to avoid having to `Array.from`.

* UserInterface/Base/Main.js:
(WI.openURL):
(WI.sourceCodeForURL):
* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype._processRecord):
* UserInterface/Models/CallFrame.js:
(WI.CallFrame.fromPayload):
* UserInterface/Models/ConsoleMessage.js:
(WI.ConsoleMessage.prototype.get sourceCodeLocation):
* UserInterface/Models/DOMNodeStyles.js:
(WI.DOMNodeStyles.prototype.createSourceCodeLocation):
* UserInterface/Models/ScriptTimelineRecord.js:
(WI.ScriptTimelineRecord.prototype._initializeProfileFromPayload.profileNodeFromPayload):
* UserInterface/Views/ContextMenuUtilities.js:
(WI.appendContextMenuItemsForURL):
* UserInterface/Views/DOMDetailsSidebarPanel.js:
(WI.DOMDetailsSidebarPanel.prototype._mouseWasClicked):
* UserInterface/Views/SearchSidebarPanel.js:
(WI.SearchSidebarPanel.prototype.performSearch):
Use the `firstValue` instead of the implicit `lastValue` to match existing nearby usage of
`WI.DebuggerManager.prototype.scriptsForURL`, which explicitly chooses the first script.

LayoutTests:

* inspector/unit-tests/set-utilities.html:
* inspector/unit-tests/set-utilities-expected.txt:
Add test for `Set.prototype.find`.

* http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html:
Update usage of `resourceForURL` to `resourcesForURL` with `Set.prototype.firstValue`.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262806 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html
LayoutTests/inspector/unit-tests/set-utilities-expected.txt
LayoutTests/inspector/unit-tests/set-utilities.html
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Base/Utilities.js
Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js
Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
Source/WebInspectorUI/UserInterface/Models/CallFrame.js
Source/WebInspectorUI/UserInterface/Models/ConsoleMessage.js
Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
Source/WebInspectorUI/UserInterface/Models/Frame.js
Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js
Source/WebInspectorUI/UserInterface/Models/Script.js
Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js
Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js
Source/WebInspectorUI/UserInterface/Views/DOMDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js

index c73f213..566d1a8 100644 (file)
@@ -1,3 +1,17 @@
+2020-06-09  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: allow multiple resources for a given URL
+        https://bugs.webkit.org/show_bug.cgi?id=212852
+
+        Reviewed by Brian Burg.
+
+        * inspector/unit-tests/set-utilities.html:
+        * inspector/unit-tests/set-utilities-expected.txt:
+        Add test for `Set.prototype.find`.
+
+        * http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html:
+        Update usage of `resourceForURL` to `resourcesForURL` with `Set.prototype.firstValue`.
+
 2020-06-09  Youenn Fablet  <youenn@apple.com>
 
         BaseAudioSharedUnit should unmute its clients in case of suspension even if not having any audio unit
index 24642a8..d8797db 100644 (file)
@@ -24,7 +24,7 @@ function test()
         description: "Should return a valid response for the given request identifier.",
         test(resolve, reject) {
             const url = "ws://127.0.0.1:8880/websocket/tests/hybi/inspector/echo";
-            let webSocketResource = WI.networkManager.resourceForURL(url);
+            let webSocketResource = WI.networkManager.resourcesForURL(url).find((resource) => resource instanceof WI.WebSocketResource);
             if (!webSocketResource) {
                 reject("Missing WebSocket resource.");
                 return;
index 4990a8b..fbaaa58 100644 (file)
@@ -1,5 +1,10 @@
 
 == Running test suite: Set
+-- Running test case: Set.prototype.find
+PASS: Set can find a item it holds.
+PASS: Set finds the first item if the given predicate matches multiple items.
+PASS: Set returns 'undefined' when attempting to find an item if the given predicate doesn't match anything.
+
 -- Running test case: Set.prototype.pushAll
 Array:
 [1,2] => [1,2,"a1","a2"]
index c82a525..b7a8dc0 100644 (file)
@@ -8,6 +8,16 @@ function test()
     let suite = InspectorTest.createSyncSuite("Set");
 
     suite.addTestCase({
+        name: "Set.prototype.find",
+        test() {
+            let set = new Set(["a", "b"]);
+            InspectorTest.expectEqual(set.find((item) => item === "b"), "b", "Set can find a item it holds.");
+            InspectorTest.expectEqual(set.find((item) => typeof item === "string"), "a", "Set finds the first item if the given predicate matches multiple items.");
+            InspectorTest.expectEqual(set.find((item) => typeof item === "number"), undefined, "Set returns 'undefined' when attempting to find an item if the given predicate doesn't match anything.");
+        },
+    });
+
+    suite.addTestCase({
         name: "Set.prototype.pushAll",
         test() {
             function test(iterable) {
index d7ef560..3f01199 100644 (file)
@@ -1,3 +1,62 @@
+2020-06-09  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: allow multiple resources for a given URL
+        https://bugs.webkit.org/show_bug.cgi?id=212852
+
+        Reviewed by Brian Burg.
+
+        Previously, when a new resource is added with a URL that matches an existing resource, any
+        `resourceForURL` call with that URL will return the new resource instead of the old one. Now
+        that there is a `Multimap` of URL to resource, it is possible to pick which resource is used
+        instead of always using the newest one.
+
+        * UserInterface/Models/ResourceCollection.js:
+        (WI.ResourceCollection):
+        (WI.ResourceCollection.prototype.resourcesForURL): Added.
+        (WI.ResourceCollection.prototype._associateWithResource):
+        (WI.ResourceCollection.prototype._disassociateWithResource):
+        (WI.ResourceCollection.prototype._resourceURLDidChange):
+        (WI.ResourceCollection.prototype.resourceForURL): Deleted.
+        * UserInterface/Models/Frame.js:
+        (WI.Frame.prototype.resourcesForURL): Added.
+        (WI.Frame.prototype.resourceForURL): Deleted.
+        * UserInterface/Controllers/NetworkManager.js:
+        (WI.NetworkManager.prototype.resourcesForURL): Added.
+        (WI.NetworkManager.prototype.resourceRequestDidReceiveResponse):
+        (WI.NetworkManager.prototype._initiatorSourceCodeLocationFromPayload):
+        (WI.NetworkManager.prototype.resourceForURL): Deleted.
+
+        * UserInterface/Models/Script.js:
+        (WI.Script.prototype._resolveResource):
+        (WI.Script.prototype._resolveResource.isScriptResource): Added.
+        * UserInterface/Controllers/CSSManager.js:
+        (WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent):
+        * UserInterface/Base/Utilities.js:
+        (Set.prototype.find): Added.
+        Add utility for finding an item in a `Set` to avoid having to `Array.from`.
+
+        * UserInterface/Base/Main.js:
+        (WI.openURL):
+        (WI.sourceCodeForURL):
+        * UserInterface/Controllers/TimelineManager.js:
+        (WI.TimelineManager.prototype._processRecord):
+        * UserInterface/Models/CallFrame.js:
+        (WI.CallFrame.fromPayload):
+        * UserInterface/Models/ConsoleMessage.js:
+        (WI.ConsoleMessage.prototype.get sourceCodeLocation):
+        * UserInterface/Models/DOMNodeStyles.js:
+        (WI.DOMNodeStyles.prototype.createSourceCodeLocation):
+        * UserInterface/Models/ScriptTimelineRecord.js:
+        (WI.ScriptTimelineRecord.prototype._initializeProfileFromPayload.profileNodeFromPayload):
+        * UserInterface/Views/ContextMenuUtilities.js:
+        (WI.appendContextMenuItemsForURL):
+        * UserInterface/Views/DOMDetailsSidebarPanel.js:
+        (WI.DOMDetailsSidebarPanel.prototype._mouseWasClicked):
+        * UserInterface/Views/SearchSidebarPanel.js:
+        (WI.SearchSidebarPanel.prototype.performSearch):
+        Use the `firstValue` instead of the implicit `lastValue` to match existing nearby usage of
+        `WI.DebuggerManager.prototype.scriptsForURL`, which explicitly chooses the first script.
+
 2020-06-04  Tim Horton  <timothy_horton@apple.com>
 
         Work around broken system version macro
index 6e6a03f..344af52 100644 (file)
@@ -1106,9 +1106,9 @@ WI.openURL = function(url, frame, options = {})
     let simplifiedURL = removeURLFragment(url);
     if (frame) {
         // WI.Frame.resourceForURL does not check the main resource, only sub-resources. So check both.
-        resource = frame.url === simplifiedURL ? frame.mainResource : frame.resourceForURL(simplifiedURL, searchChildFrames);
+        resource = frame.url === simplifiedURL ? frame.mainResource : frame.resourcesForURL(simplifiedURL, searchChildFrames).firstValue;
     } else if (WI.sharedApp.debuggableType === WI.DebuggableType.ServiceWorker)
-        resource = WI.mainTarget.resourceCollection.resourceForURL(removeURLFragment(url));
+        resource = WI.mainTarget.resourceCollection.resourcesForURL(removeURLFragment(url)).firstValue;
 
     if (resource) {
         // Context menu selections may go through this code path; don't clobber the previously-set hint.
@@ -3060,7 +3060,7 @@ WI.linkifyElement = function(linkElement, sourceCodeLocation, options = {}) {
 
 WI.sourceCodeForURL = function(url)
 {
-    var sourceCode = WI.networkManager.resourceForURL(url);
+    let sourceCode = WI.networkManager.resourcesForURL(url).firstValue;
     if (!sourceCode) {
         sourceCode = WI.debuggerManager.scriptsForURL(url, WI.assumingMainTarget())[0];
         if (sourceCode)
index f81aee6..7e2bbdd 100644 (file)
@@ -146,6 +146,18 @@ Object.defineProperty(Map.prototype, "getOrInitialize",
     }
 });
 
+Object.defineProperty(Set.prototype, "find",
+{
+    value(predicate)
+    {
+        for (let item of this) {
+            if (predicate(item, this))
+                return item;
+        }
+        return undefined;
+    },
+});
+
 Object.defineProperty(Set.prototype, "addAll",
 {
     value(iterable)
index 91389c4..68aeaa9 100644 (file)
@@ -615,13 +615,10 @@ WI.CSSManager = class CSSManager extends WI.Object
                 return;
 
             if (!styleSheet.isInspectorStyleSheet()) {
-                representedObject = representedObject.parentFrame.resourceForURL(representedObject.url);
-                if (!representedObject)
-                    return;
-
                 // Only try to update stylesheet resources. Other resources, like documents, can contain
                 // multiple stylesheets and we don't have the source ranges to update those.
-                if (representedObject.type !== WI.Resource.Type.StyleSheet)
+                representedObject = representedObject.parentFrame.resourcesForURL(representedObject.url).find((resource) => resource.type === WI.Resource.Type.StyleSheet);
+                if (!representedObject)
                     return;
             }
 
index 9376349..b4d4ca3 100644 (file)
@@ -461,15 +461,17 @@ WI.NetworkManager = class NetworkManager extends WI.Object
         return true;
     }
 
-    resourceForURL(url)
+    resourcesForURL(url)
     {
-        if (!this._mainFrame)
-            return null;
-
-        if (this._mainFrame.mainResource.url === url)
-            return this._mainFrame.mainResource;
+        let resources = new Set;
+        if (this._mainFrame) {
+            if (this._mainFrame.mainResource.url === url)
+                resources.add(this._mainFrame.mainResource);
 
-        return this._mainFrame.resourceForURL(url, true);
+            const recursivelySearchChildFrames = true;
+            resources.addAll(this._mainFrame.resourcesForURL(url, recursivelySearchChildFrames));
+        }
+        return resources;
     }
 
     adoptOrphanedResourcesForTarget(target)
@@ -809,7 +811,7 @@ WI.NetworkManager = class NetworkManager extends WI.Object
         if (!resource) {
             var frame = this.frameForIdentifier(frameIdentifier);
             if (frame)
-                resource = frame.resourceForURL(response.url);
+                resource = frame.resourcesForURL(response.url).firstValue;
 
             // If we find the resource this way we had marked it earlier as finished via Page.getResourceTree.
             // Associate the resource with the requestIdentifier so it can be found in future loading events.
@@ -1083,7 +1085,7 @@ WI.NetworkManager = class NetworkManager extends WI.Object
         if (!url || isNaN(lineNumber) || lineNumber < 0)
             return null;
 
-        var sourceCode = WI.networkManager.resourceForURL(url);
+        let sourceCode = WI.networkManager.resourcesForURL(url).firstValue;
         if (!sourceCode)
             sourceCode = WI.debuggerManager.scriptsForURL(url, WI.mainTarget)[0];
 
index f325f59..5f5c184 100644 (file)
@@ -857,7 +857,8 @@ WI.TimelineManager = class TimelineManager extends WI.Object
         case InspectorBackend.Enum.Timeline.EventType.EvaluateScript:
             if (!sourceCodeLocation) {
                 var mainFrame = WI.networkManager.mainFrame;
-                var scriptResource = mainFrame.url === recordPayload.data.url ? mainFrame.mainResource : mainFrame.resourceForURL(recordPayload.data.url, true);
+                const recursivelySearchChildFrames = true;
+                let scriptResource = mainFrame.url === recordPayload.data.url ? mainFrame.mainResource : mainFrame.resourcesForURL(recordPayload.data.url, recursivelySearchChildFrames).lastValue;
                 if (scriptResource) {
                     // The lineNumber is 1-based, but we expect 0-based.
                     let lineNumber = recordPayload.data.lineNumber - 1;
@@ -907,7 +908,8 @@ WI.TimelineManager = class TimelineManager extends WI.Object
 
             if (!sourceCodeLocation) {
                 var mainFrame = WI.networkManager.mainFrame;
-                var scriptResource = mainFrame.url === recordPayload.data.scriptName ? mainFrame.mainResource : mainFrame.resourceForURL(recordPayload.data.scriptName, true);
+                const recursivelySearchChildFrames = true;
+                let scriptResource = mainFrame.url === recordPayload.data.scriptName ? mainFrame.mainResource : mainFrame.resourcesForURL(recordPayload.data.scriptName, recursivelySearchChildFrames).lastValue;
                 if (scriptResource) {
                     // The lineNumber is 1-based, but we expect 0-based.
                     let lineNumber = recordPayload.data.scriptLine - 1;
index 17c6d89..d453c56 100644 (file)
@@ -233,7 +233,7 @@ WI.CallFrame = class CallFrame
                     sourceCode = sourceCode.resource;
             }
             if (!sourceCode)
-                sourceCode = WI.networkManager.resourceForURL(url);
+                sourceCode = WI.networkManager.resourcesForURL(url).firstValue;
             if (!sourceCode)
                 sourceCode = WI.debuggerManager.scriptsForURL(url, target)[0];
 
index f5476b9..be7878e 100644 (file)
@@ -84,7 +84,7 @@ WI.ConsoleMessage = class ConsoleMessage
         // If that doesn't exist try to get a location from the url/line/column in the ConsoleMessage.
         // FIXME <http://webkit.org/b/76404>: Remove the string equality checks for undefined once we don't get that value anymore.
         if (this._url && this._url !== "undefined") {
-            let sourceCode = WI.networkManager.resourceForURL(this._url);
+            let sourceCode = WI.networkManager.resourcesForURL(this._url).firstValue;
             if (sourceCode) {
                 let lineNumber = this._line > 0 ? this._line - 1 : 0;
                 let columnNumber = this._column > 0 ? this._column - 1 : 0;
index 0a2926c..bffb413 100644 (file)
@@ -71,16 +71,16 @@ WI.DOMNodeStyles = class DOMNodeStyles extends WI.Object
 
         // Try to use the node to find the frame which has the correct resource first.
         if (documentNode) {
-            let mainResource = WI.networkManager.resourceForURL(documentNode.documentURL);
+            let mainResource = WI.networkManager.resourcesForURL(documentNode.documentURL).firstValue;
             if (mainResource) {
                 let parentFrame = mainResource.parentFrame;
-                sourceCode = parentFrame.resourceForURL(sourceURL);
+                sourceCode = parentFrame.resourcesForURL(sourceURL).firstValue;
             }
         }
 
         // If that didn't find the resource, then search all frames.
         if (!sourceCode)
-            sourceCode = WI.networkManager.resourceForURL(sourceURL);
+            sourceCode = WI.networkManager.resourcesForURL(sourceURL).firstValue;
 
         if (!sourceCode)
             return null;
index db1d723..eb58e55 100644 (file)
@@ -361,30 +361,22 @@ WI.Frame = class Frame extends WI.Object
         this.dispatchEventToListeners(WI.Frame.Event.AllChildFramesRemoved);
     }
 
-    resourceForURL(url, recursivelySearchChildFrames)
+    resourcesForURL(url, recursivelySearchChildFrames)
     {
-        var resource = this._resourceCollection.resourceForURL(url);
-        if (resource)
-            return resource;
+        let resources = this._resourceCollection.resourcesForURL(url);
 
         // Check the main resources of the child frames for the requested URL.
         for (let childFrame of this._childFrameCollection) {
-            resource = childFrame.mainResource;
-            if (resource.url === url)
-                return resource;
+            if (childFrame.mainResource.url === url)
+                resources.add(childFrame.mainResource);
         }
 
-        if (!recursivelySearchChildFrames)
-            return null;
-
-        // Recursively search resources of child frames.
-        for (let childFrame of this._childFrameCollection) {
-            resource = childFrame.resourceForURL(url, true);
-            if (resource)
-                return resource;
+        if (recursivelySearchChildFrames) {
+            for (let childFrame of this._childFrameCollection)
+                resources.addAll(childFrame.resourcesForURL(url, recursivelySearchChildFrames));
         }
 
-        return null;
+        return resources;
     }
 
     resourceCollectionForType(type)
index 96b1543..b2e91be 100644 (file)
@@ -31,7 +31,7 @@ WI.ResourceCollection = class ResourceCollection extends WI.Collection
         super();
 
         this._resourceType = resourceType || null;
-        this._resourceURLMap = new Map;
+        this._resourceURLMap = new Multimap;
         this._resourcesTypeMap = new Map;
     }
 
@@ -59,9 +59,9 @@ WI.ResourceCollection = class ResourceCollection extends WI.Collection
         return object.type === this._resourceType;
     }
 
-    resourceForURL(url)
+    resourcesForURL(url)
     {
-        return this._resourceURLMap.get(url) || null;
+        return this._resourceURLMap.get(url) || new Set;
     }
 
     resourceCollectionForType(type)
@@ -114,7 +114,7 @@ WI.ResourceCollection = class ResourceCollection extends WI.Collection
 
     _associateWithResource(resource)
     {
-        this._resourceURLMap.set(resource.url, resource);
+        this._resourceURLMap.add(resource.url, resource);
 
         if (!this._resourceType) {
             let resourcesCollectionForType = this.resourceCollectionForType(resource.type);
@@ -138,7 +138,7 @@ WI.ResourceCollection = class ResourceCollection extends WI.Collection
             resourcesCollectionForType.remove(resource);
         }
 
-        this._resourceURLMap.delete(resource.url);
+        this._resourceURLMap.delete(resource.url, resource);
     }
 
     _resourceURLDidChange(event)
@@ -153,8 +153,8 @@ WI.ResourceCollection = class ResourceCollection extends WI.Collection
         if (!oldURL)
             return;
 
-        this._resourceURLMap.set(resource.url, resource);
-        this._resourceURLMap.delete(oldURL);
+        this._resourceURLMap.add(resource.url, resource);
+        this._resourceURLMap.delete(oldURL, resource);
     }
 
     _resourceTypeDidChange(event)
index 657c541..8511152 100644 (file)
@@ -283,16 +283,20 @@ WI.Script = class Script extends WI.SourceCode
         if (this._target && this._target !== WI.mainTarget)
             resolver = this._target.resourceCollection;
 
+        function isScriptResource(item) {
+            return item.type === WI.Resource.Type.Document || item.type === WI.Resource.Type.Script;
+        }
+
         try {
             // Try with the Script's full URL.
-            let resource = resolver.resourceForURL(this._url);
+            let resource = resolver.resourcesForURL(this._url).find(isScriptResource);
             if (resource)
                 return resource;
 
             // Try with the Script's full decoded URL.
             let decodedURL = decodeURI(this._url);
             if (decodedURL !== this._url) {
-                resource = resolver.resourceForURL(decodedURL);
+                resource = resolver.resourcesForURL(decodedURL).find(isScriptResource);
                 if (resource)
                     return resource;
             }
@@ -300,7 +304,7 @@ WI.Script = class Script extends WI.SourceCode
             // Next try removing any fragment in the original URL.
             let urlWithoutFragment = removeURLFragment(this._url);
             if (urlWithoutFragment !== this._url) {
-                resource = resolver.resourceForURL(urlWithoutFragment);
+                resource = resolver.resourcesForURL(urlWithoutFragment).find(isScriptResource);
                 if (resource)
                     return resource;
             }
@@ -308,7 +312,7 @@ WI.Script = class Script extends WI.SourceCode
             // Finally try removing any fragment in the decoded URL.
             let decodedURLWithoutFragment = removeURLFragment(decodedURL);
             if (decodedURLWithoutFragment !== decodedURL) {
-                resource = resolver.resourceForURL(decodedURLWithoutFragment);
+                resource = resolver.resourcesForURL(decodedURLWithoutFragment).find(isScriptResource);
                 if (resource)
                     return resource;
             }
index f3944a9..d3486c3 100644 (file)
@@ -125,7 +125,7 @@ WI.ScriptTimelineRecord = class ScriptTimelineRecord extends WI.TimelineRecord
             console.assert("id" in nodePayload);
 
             if (nodePayload.url) {
-                var sourceCode = WI.networkManager.resourceForURL(nodePayload.url);
+                let sourceCode = WI.networkManager.resourcesForURL(nodePayload.url).firstValue;
                 if (!sourceCode)
                     sourceCode = WI.debuggerManager.scriptsForURL(nodePayload.url, WI.assumingMainTarget())[0];
 
index 0a35d05..f344d45 100644 (file)
@@ -208,7 +208,7 @@ WI.appendContextMenuItemsForURL = function(contextMenu, url, options = {})
         });
     }
 
-    if (WI.networkManager.resourceForURL(url)) {
+    if (WI.networkManager.resourcesForURL(url).size) {
         if (!WI.isShowingSourcesTab()) {
             contextMenu.appendItem(WI.UIString("Reveal in Sources Tab"), () => {
                 showResourceWithOptions({preferredTabType: WI.SourcesTabContentView.Type});
index 01a6e17..6f97d3a 100644 (file)
@@ -101,10 +101,12 @@ WI.DOMDetailsSidebarPanel = class DOMDetailsSidebarPanel extends WI.DetailsSideb
 
     _mouseWasClicked(event)
     {
+        let parentFrame = null;
+
         if (this._domNode && this._domNode.ownerDocument) {
-            var mainResource = WI.networkManager.resourceForURL(this._domNode.ownerDocument.documentURL);
+            let mainResource = WI.networkManager.resourcesForURL(this._domNode.ownerDocument.documentURL).firstValue;
             if (mainResource)
-                var parentFrame = mainResource.parentFrame;
+                parentFrame = mainResource.parentFrame;
         }
 
         const options = {
index 3616388..d95acbe 100644 (file)
@@ -195,7 +195,7 @@ WI.SearchSidebarPanel = class SearchSidebarPanel extends WI.NavigationSidebarPan
             if (!frame)
                 return;
 
-            var resource = frame.url === url ? frame.mainResource : frame.resourceForURL(url);
+            let resource = frame.url === url ? frame.mainResource : frame.resourcesForURL(url).firstValue;
             if (!resource)
                 return;
 
@@ -286,7 +286,7 @@ WI.SearchSidebarPanel = class SearchSidebarPanel extends WI.NavigationSidebarPan
                         continue;
 
                     // FIXME: This should use a frame to do resourceForURL, but DOMAgent does not provide a frameId.
-                    var resource = WI.networkManager.resourceForURL(domNode.ownerDocument.documentURL);
+                    let resource = WI.networkManager.resourcesForURL(domNode.ownerDocument.documentURL).firstValue;
                     if (!resource)
                         continue;