Bug 1798319 - Implement modulepreload in early hints r=manuel,smaug,necko-reviewers,kershaw

The aEarlyHintPreloaderId parameter for StartLoad/StartLoadInternal is changed
to be a member variable of ScriptLoadRequest instead so that an initiator type
of early hints can be set for module requests. Before, ModuleLoader would always
pass in a zero value for the id since ModuleLoaderBase has no concept of early
hints when it calls StartFetch.

As a prerequisite for early hints support, this commit also implements
modulepreload in link headers (Bug 1773056).

Differential Revision: https://phabricator.services.mozilla.com/D180020
This commit is contained in:
Em Zhan
2023-06-26 10:49:53 +00:00
parent 8c76ee691a
commit 5959006756
19 changed files with 204 additions and 63 deletions

View File

@@ -369,6 +369,11 @@ class ScriptLoadRequest
// LoadContext for augmenting the load depending on the loading
// context (DOM, Worker, etc.)
RefPtr<LoadContextBase> mLoadContext;
// EarlyHintRegistrar id to connect the http channel back to the preload, with
// a default of value of 0 indicating that this request is not an early hints
// preload.
uint64_t mEarlyHintPreloaderId;
};
class ScriptLoadRequestList : private mozilla::LinkedList<ScriptLoadRequest> {