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

@@ -88,7 +88,8 @@ ScriptLoadRequest::ScriptLoadRequest(ScriptKind aKind, nsIURI* aURI,
mScriptBytecode(),
mBytecodeOffset(0),
mURI(aURI),
mLoadContext(aContext) {
mLoadContext(aContext),
mEarlyHintPreloaderId(0) {
MOZ_ASSERT(mFetchOptions);
if (mLoadContext) {
mLoadContext->SetRequest(this);