Bug 211414

Summary: performance.getEntriesByType('resource') does not include script 404 responses
Product: WebKit Reporter: Eli Grey (:sephr) <bugmail>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: achristensen, beidson, bfulgham, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
HTML script element-initiated request with 404 response (comparing Firefox, Safari, Chrome, and Edge)
none
HTML img element-initiated request with 404 response (comparing Firefox, Safari, Chrome, and Edge) none

Description Eli Grey (:sephr) 2020-05-04 17:19:48 PDT
Created attachment 398439 [details]
HTML script element-initiated request with 404 response (comparing Firefox, Safari, Chrome, and Edge)

This is equivalent to the following Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=883400

Steps to reproduce the problem:
1. Load a page that requests a script that responds with a status code of 404.
2. Open Console in Developer Tools
3. Enter "var urls = []; window.performance.getEntriesByType('resource').forEach(function(r){urls.push(r.name)});"
4. The URL returning the 404 will not be displayed in the list of URLs

What is the expected behavior?
The URL returning the 404 should be displayed in the list of URLs.

See the attached screenshots to see how Safari treats 404s from different request initiator types. Firefox is the only browser that implements this correctly.
Comment 1 Eli Grey (:sephr) 2020-05-04 17:21:55 PDT
Created attachment 398440 [details]
HTML img element-initiated request with 404 response (comparing Firefox, Safari, Chrome, and Edge)

This screenshot shows how Safari correctly includes 404 responses from <img> elements, but not <script> elements.
Comment 2 Radar WebKit Bug Importer 2020-05-06 15:02:06 PDT
<rdar://problem/62947219>
Comment 3 Eli Grey (:sephr) 2020-05-06 16:34:19 PDT
A Chrome engineer has submitted a patch for the corresponding Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=883400#c28

This may be useful for the WebKit fix.
Comment 4 Brent Fulgham 2022-02-12 21:02:39 PST
This is actually:
<rdar://44388482>