Title: [262842] trunk
Revision
262842
Author
drou...@apple.com
Date
2020-06-10 09:20:48 -0700 (Wed, 10 Jun 2020)

Log Message

Web Inspector: XHR request with same URL as main resource will hide the main resource request
https://bugs.webkit.org/show_bug.cgi?id=212850
<rdar://problem/33072149>

Reviewed by Brian Burg.

Source/WebInspectorUI:

* UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype._addNewResourceToFrameOrTarget):
When creating a new resource, don't re-use the frame's main resource if the URL matches.

LayoutTests:

* inspector/network/request-main-url.html: Added.
* inspector/network/request-main-url-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262841 => 262842)


--- trunk/LayoutTests/ChangeLog	2020-06-10 16:02:46 UTC (rev 262841)
+++ trunk/LayoutTests/ChangeLog	2020-06-10 16:20:48 UTC (rev 262842)
@@ -1,3 +1,14 @@
+2020-06-10  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: XHR request with same URL as main resource will hide the main resource request
+        https://bugs.webkit.org/show_bug.cgi?id=212850
+        <rdar://problem/33072149>
+
+        Reviewed by Brian Burg.
+
+        * inspector/network/request-main-url.html: Added.
+        * inspector/network/request-main-url-expected.txt: Added.
+
 2020-06-10  Youenn Fablet  <you...@apple.com>
 
         REGRESSION(r262798): fast/mediastream/media-stream-track-interrupted.html is failing

Added: trunk/LayoutTests/inspector/network/request-main-url-expected.txt (0 => 262842)


--- trunk/LayoutTests/inspector/network/request-main-url-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/network/request-main-url-expected.txt	2020-06-10 16:20:48 UTC (rev 262842)
@@ -0,0 +1,9 @@
+Tests that an XMLHttpRequest resource gives us JSON text even if it is marked as having blob content.
+
+
+== Running test suite: Network.RequestMainURL
+-- Running test case: Network.RequestMainURL.XHR
+PASS: Should have two resources for the main URL.
+PASS: First resource should be main resource.
+PASS: Second resource should be XHR.
+

Added: trunk/LayoutTests/inspector/network/request-main-url.html (0 => 262842)


--- trunk/LayoutTests/inspector/network/request-main-url.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/network/request-main-url.html	2020-06-10 16:20:48 UTC (rev 262842)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function createXHR() {
+    let xhr = new XMLHttpRequest;
+    xhr.open("GET", location.href, true);
+    xhr.send();
+}
+
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("Network.RequestMainURL");
+
+    suite.addTestCase({
+        name: "Network.RequestMainURL.XHR",
+        description: "Ensure an XMLHttpRequest for the main URL creates a new resource.",
+        async test() {
+            await Promise.all([
+                WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
+                InspectorTest.evaluateInPage(`createXHR()`),
+            ]);
+
+            let mainResource = WI.networkManager.mainFrame.mainResource;
+            let resources = Array.from(WI.networkManager.resourcesForURL(mainResource.url));
+            InspectorTest.expectEqual(resources.length, 2, "Should have two resources for the main URL.");
+            InspectorTest.expectEqual(resources[0], mainResource, "First resource should be main resource.");
+            InspectorTest.expectEqual(resources[1].type, WI.Resource.Type.XHR, "Second resource should be XHR.");
+        },
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests that an XMLHttpRequest resource gives us JSON text even if it is marked as having blob content.</p>
+</body>
+</html>

Modified: trunk/Source/WebInspectorUI/ChangeLog (262841 => 262842)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-06-10 16:02:46 UTC (rev 262841)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-06-10 16:20:48 UTC (rev 262842)
@@ -1,3 +1,15 @@
+2020-06-10  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: XHR request with same URL as main resource will hide the main resource request
+        https://bugs.webkit.org/show_bug.cgi?id=212850
+        <rdar://problem/33072149>
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Controllers/NetworkManager.js:
+        (WI.NetworkManager.prototype._addNewResourceToFrameOrTarget):
+        When creating a new resource, don't re-use the frame's main resource if the URL matches.
+
 2020-06-09  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: allow multiple resources for a given URL

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js (262841 => 262842)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js	2020-06-10 16:02:46 UTC (rev 262841)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js	2020-06-10 16:20:48 UTC (rev 262842)
@@ -972,10 +972,7 @@
 
         let frame = this.frameForIdentifier(frameIdentifier);
         if (frame) {
-            // This is a new request for an existing frame, which might be the main resource or a new resource.
-            if (resourceOptions.type === "Document" && frame.mainResource.url ="" url && frame.loaderIdentifier === resourceOptions.loaderIdentifier)
-                resource = frame.mainResource;
-            else if (resourceOptions.type === "Document" && frame.provisionalMainResource && frame.provisionalMainResource.url ="" url && frame.provisionalLoaderIdentifier === resourceOptions.loaderIdentifier)
+            if (resourceOptions.type === InspectorBackend.Enum.Page.ResourceType.Document && frame.provisionalMainResource && frame.provisionalMainResource.url ="" url && frame.provisionalLoaderIdentifier === resourceOptions.loaderIdentifier)
                 resource = frame.provisionalMainResource;
             else {
                 resource = new WI.Resource(url, resourceOptions);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to