Skip to content

modulepreload in Link header & early hints#7862

Open
noamr wants to merge 8 commits intowhatwg:mainfrom
noamr:modulepreload-header
Open

modulepreload in Link header & early hints#7862
noamr wants to merge 8 commits intowhatwg:mainfrom
noamr:modulepreload-header

Conversation

@noamr
Copy link
Copy Markdown
Collaborator

@noamr noamr commented Apr 26, 2022

@noamr
Copy link
Copy Markdown
Collaborator Author

noamr commented Apr 26, 2022

This has a few issues that are not fleshed out yet, but it expresses the idea of fetching the top-level imported module, and continue the module script preload (e.g. potentially loading the dependencies) once the document is initialized.

Copy link
Copy Markdown
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems very promising. To me it brings up that we have a few stages to investigate:

  • Shouldn't referrerpolicy apply to allow preload early hints? Fix that first?
  • Do a refactoring editorial PR turning things into a switch statement
  • Then we're set up to add modulepreload

noamr added a commit to noamr/html that referenced this pull request May 27, 2022
In preparation for supporting [modulepreload](whatwg#7862) in link headers.

- Parse `referrerpolicy` from link headers
- Add referrer policy and nonce to link processing optinos
@noamr
Copy link
Copy Markdown
Collaborator Author

noamr commented May 30, 2022

  • Shouldn't referrerpolicy apply to allow preload early hints? Fix that first?

#7961

  • Do a refactoring editorial PR turning things into a switch statement

Done!

@noamr noamr force-pushed the modulepreload-header branch from 5db34e6 to 7dac51e Compare June 4, 2022 10:51
@noamr noamr changed the title WIP: modulepreload in early hints modulepreload in Link header & early hints Jun 4, 2022
Copy link
Copy Markdown
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty good. Given how messy the script-fetching stuff is right now, I'm happy to take this approach, and maybe me or you or someone can clean up the script fetching later.

I'll file an issue with how to clean up the script fetching where we can discuss, if you're interested.

@noamr
Copy link
Copy Markdown
Collaborator Author

noamr commented Jun 17, 2022

@domenic: additional review? :)

Copy link
Copy Markdown
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This architecture looks good

@noamr noamr force-pushed the modulepreload-header branch from 3377f07 to 9c62b0f Compare June 18, 2022 06:16
Copy link
Copy Markdown
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one last thing, then we're good. Although I guess multi-implementer support is still unclear... maybe @codehag can help answer whether Mozilla would support merging this into the spec?

source Outdated
<li><p>If <var>options</var>'s <span data-x="link options destination">destination</span> is not
a <span data-x="concept-request-destination">destination</span>, then return null.</p></li>
<li><p>If <var>options</var>'s <span data-x="link options as">as</span> is not a <span
data-x="concept-request-destination">destination</span>, then return null.</p></li>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want to test against (and link to) potential destination, not destination.

@codehag
Copy link
Copy Markdown

codehag commented Jun 22, 2022

I will need some time to review this fully -- we currently do not implement this afaik. I will try to find some time.

<li><p>If <var>request</var>'s <span data-x="concept-request-destination">destination</span> is
"<code data-x="">worker</code>", "<code data-x="">sharedworker</code>", or "<code
data-x="">serviceworker</code>", then set <var>request</var>'s <span
data-x="concept-request-mode">mode</span> to "<code data-x="">same-origin</code>".</p></li>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I realized worker destination when dealing with the main thread modulepreload is kind of odd. Same applies link elements.

@domenic
Copy link
Copy Markdown
Member

domenic commented Jul 24, 2023

@noamr would you be up for rebasing or recreating this? Sorry we let it fall through the cracks. The script-fetching stuff should be much nicer these days though.

@naveedahmed1
Copy link
Copy Markdown

Any update on this?

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

Development

Successfully merging this pull request may close these issues.

Early hints and modulepreload

5 participants