Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An event handler for <link rel=preload as=json>? #10940

Open
allstarschh opened this issue Jan 22, 2025 · 2 comments
Open

An event handler for <link rel=preload as=json>? #10940

allstarschh opened this issue Jan 22, 2025 · 2 comments

Comments

@allstarschh
Copy link

allstarschh commented Jan 22, 2025

What is the issue with the HTML Standard?

In #10212, preload for json modules is disallowed in <link rel=preload>. (Which will use rel=modulepreload in #10233)
However, should there be an event handler (either 'error' or 'load') to indicate this <link> has been processed?

In current spec, the translate a preload destination will return null for "json",
which will make the preload will have a null request and return in step 4.

If request is null, then return.

Then back to the caller, fetch and process the link resource,
the preload in step 3 doesn't call the processResponse because it bailed out early, so neither the event handler 'error' nor 'load' will be called.

Is this behavior correct?

As the wpt preload-type-match.html expects the 'load' handler for <link rel=preload as=json> will be called.

It looks like there's a bug either in the HTML spec or in the WPT.

CCing @noamr

@noamr
Copy link
Collaborator

noamr commented Jan 22, 2025

I believe that this is an implementation/WPT bug... The preload spec was written after implementations so there were several of these mismatches around. This specific test was more about content-types, it's probably an oversight and those as values should have been fetch

@allstarschh
Copy link
Author

allstarschh commented Jan 23, 2025

Thanks for the clarification, @noamr.
Also, I am wondering, should an event handler be called for the case as=json?

Before #10212, the preload will reach fetch, see step 11 of preload
so a handler will be called.
Now with #10212 landed, it will return early since the request is null, but the operation just returns silently without providing any information about the link element with as=json, isn't this also an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants