Bug 212850

Summary: Web Inspector: XHR request with same URL as main resource will hide the main resource request
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description Devin Rousso 2020-06-05 15:22:35 PDT
# STEPS TO REPRODUCE
1. inspect <https://webkit.org>
2. evaluate `var xhr = new XMLHttpRequest(); xhr.open('POST', location.href, true); xhr.send();` in the Console
 => icon of main resource in Sources Tab changes to match XHR, but no new resource is shown
3. repeat step 2
 => new resource appears, but main resource still shows incorrectly
Comment 1 Devin Rousso 2020-06-05 15:24:17 PDT
Created attachment 401208 [details]
Patch
Comment 2 Devin Rousso 2020-06-05 15:48:07 PDT
<rdar://problem/33072149>
Comment 3 Devin Rousso 2020-06-05 15:49:33 PDT
Comment on attachment 401208 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=401208&action=review

> Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js:-975
> -            // 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;

I personally think that this is possibly a scary change, but at the same time I do think that this code is somewhat nonsensical, and my own local testing from browsing around the web didn't see any impact AFAICT.
Comment 4 BJ Burg 2020-06-09 12:56:19 PDT
Comment on attachment 401208 [details]
Patch

Can a test be written for this behavior? It seems not specific to the UI.
Comment 5 Devin Rousso 2020-06-09 14:53:37 PDT
Created attachment 401477 [details]
Patch
Comment 6 BJ Burg 2020-06-10 09:13:30 PDT
Comment on attachment 401477 [details]
Patch

r=me, thank you
Comment 7 EWS 2020-06-10 09:20:52 PDT
Committed r262842: <https://trac.webkit.org/changeset/262842>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401477 [details].