Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Make preload headers work for fetches created by workers #115

Open
annevk opened this issue Dec 15, 2017 · 13 comments
Open

Make preload headers work for fetches created by workers #115

annevk opened this issue Dec 15, 2017 · 13 comments
Labels

Comments

@annevk
Copy link
Member

annevk commented Dec 15, 2017

Given the header it seems this should also work for workers. Would require a bit more abstracting in the prose.

@Krinkle
Copy link
Member

Krinkle commented Sep 27, 2018

@annevk Do you mean the fetch for a worker's script, or fetches created from within a worker?

I'm not very familiar with how workers are defined, but from the title ("Documents only?") it sounds like it might imply that preload is limited to navigation requests. If that's what you meant, then per #92 I believe it's been established already to also apply to other fetches from a browsing context. That might mean workers are still not covered, though. Not sure :)

@annevk
Copy link
Member Author

annevk commented Sep 28, 2018

Preloading "fetches created from within a worker".

@yoavweiss yoavweiss changed the title Documents only? Make preload headers work for fetches created by workers Oct 15, 2018
@noamr
Copy link
Contributor

noamr commented Feb 15, 2022

While it sounds like it should work, I wonder how useful it would be in practice.
Unlike loading HTML, the loading process of a worker is simple, so loading things at the beginning of the worker is trivial.
Are any implementors interested in this?

@annevk
Copy link
Member Author

annevk commented Mar 1, 2022

It seems that for module workers that might not necessarily be the case, but I'm not sure if preload is the best way to identify "nested" modules.

cc @domenic

@domenic
Copy link
Contributor

domenic commented Mar 1, 2022

For module workers I'd expect using modulepreload.

@noamr
Copy link
Contributor

noamr commented Mar 2, 2022

One thing to consider here is that link headers work for subresources - e.g. a script can specify another script to preload in the context of the document by sending a link header. If worker scripts have a preload link - perhaps they should also be treated as subresources of the document and the document itself should handle those headers?

@annevk
Copy link
Member Author

annevk commented Mar 2, 2022

I'm not sure what you mean. A worker is roughly equivalent to a document as far as all kinds of things are concerned.

(To be clear, I'm okay with not adding this feature as there might not be much need or demand for it.)

@noamr
Copy link
Contributor

noamr commented Mar 2, 2022

I'm not sure what you mean. A worker is roughly equivalent to a document as far as all kinds of things are concerned.

I meant that perhaps when a worker has a link header, it should be loaded in the context of the owner document as if the worker was a subresource

(To be clear, I'm okay with not adding this feature as there might not be much need or demand for it.)

@annevk
Copy link
Member Author

annevk commented Mar 4, 2022

I see. No that would not be appropriate. Note that workers might also be owned by other workers and some do not have an owner document at all (or do not have a stable owner document).

@domenic for a worker to use modulepreload it would have to be the worker that uses it, right? Otherwise the lookup ends up failing. I guess that's not currently defined as a thing as Link headers are not defined.

@noamr
Copy link
Contributor

noamr commented Mar 4, 2022

I see. No that would not be appropriate. Note that workers might also be owned by other workers and some do not have an owner document at all (or do not have a stable owner document).

@domenic for a worker to use modulepreload it would have to be the worker that uses it, right? Otherwise the lookup ends up failing. I guess that's not currently defined as a thing as Link headers are not defined.

I'm currently working on link headers here, but it doesn't yet specify link headers on subresources, only as part of navigation. I'd have to make the right check there to show that workers are not treated as "subresources" in that scenario.

@annevk
Copy link
Member Author

annevk commented Mar 4, 2022

Fetch calls out workers as non-subresources (though they are not navigations either). Maybe we should have "environment request" as a concept, though thus far we haven't needed it concretely I think.

@noamr
Copy link
Contributor

noamr commented Mar 4, 2022

Fetch calls out workers as non-subresources (though they are not navigations either). Maybe we should have "environment request" as a concept, though thus far we haven't needed it concretely I think.

Great, that definition would do for now.

@yoavweiss
Copy link
Contributor

Discussion continues at whatwg/html#7889

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants