error event doesn't fire for link elements with rel="preload"
Categories
(Core :: DOM: Networking, defect, P2)
Tracking
()
People
(Reporter: gudvinr+bugzilla, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged][necko-priority-next])
Attachments
(1 file)
16.89 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0
Steps to reproduce:
Example page code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy"
content="frame-src http://example.com;">
<title>Redir Test</title>
<link rel="preload" href="http://example.com/notfound.html" as="fetch" id="nf-preload"
onload="console.log('inline onload');"
onerror="console.log('inline onerror');"
>
<script>
const np = document.getElementById("nf-preload");
np.addEventListener('load', (evt) => { console.log("load listener", evt) });
np.addEventListener('error', (evt) => { console.log("error listener", evt) });
</script>
</head>
<body>
</body>
</html>
Actual results:
I am seeing in console:
inline onload redir_test.html:1:9
load listener redir_test.html:19:52
But GET https://example.com/notfound.html
returns 500.
Same will happen if you use https://examplecom/notfound.html (domain that doesn't resolve)
Expected results:
What should've happen and what spec (https://html.spec.whatwg.org/multipage/links.html#link-type-preload) says is error event being fired instead.
At the very least, onload event should not be fired because no load is actually being done at all.
In attachment, there is a screenshot from Chrome which does what you expect.
Comment 1•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•1 year ago
|
Updated•1 year ago
|
Description
•