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

Add the Priority Hints changes to the fetch spec #1523

Merged
merged 2 commits into from
Dec 15, 2022
Merged

Conversation

pmeenan
Copy link
Contributor

@pmeenan pmeenan commented Oct 31, 2022

This applies the specified changes from the Priority Hints spec to fetch for #1319.

The main changes are:

  • Rename the existing implementor-internal priority to internal priority.
  • Add a new priority enum to the Request and RequestInit objects.

Preview | Diff

@pmeenan
Copy link
Contributor Author

pmeenan commented Oct 31, 2022

From what I understand, Mozilla will be implementing it so I'll ping them to commit to the implementation on the issue.

@valenting
Copy link

From what I understand, Mozilla will be implementing it so I'll ping them to commit to the implementation on the issue.

That is correct. We are tracking this in https://bugzilla.mozilla.org/show_bug.cgi?id=1797715

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Thank you for working on this!

I'm not seeing the outcome of WICG/priority-hints#69 incorporated here.

We might also want to say a bit more about "internal priority".

Please also draft a commit message (as a comment) that links the appropriate HTML changes and makes it clear that all of this essentially obsoletes the Priority Hints specification. (I'm assuming that's the intent given there's no normative references.)

fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
@pmeenan
Copy link
Contributor Author

pmeenan commented Nov 11, 2022

@annevk I think I got most of the changes done and the last commit message includes the obsoleting language. I added a comment to the render-blocking issue to discuss it a bit more before we figure out what the changes mean for the spec (needless to say, this merge will wait on the outcome of that thread).

@pmeenan
Copy link
Contributor Author

pmeenan commented Nov 22, 2022

I removed priority from the exposed Request attribute interface and have it as internal-only as discussed here.

I also have render-blocking and priority both being copied along with internal-priority when constructed from an existing Request in step 12 of https://fetch.spec.whatwg.org/#dom-request (let me know if you'd rather not explicitly require that they be copied).

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

What will happen to the Priority Hints specification? Does it essentially disappear?

fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
@pmeenan
Copy link
Contributor Author

pmeenan commented Nov 28, 2022

As far as the existing Priority Hints spec goes, once both HTML and fetch are updated I'm planning on removing most of the content but leaving a placeholder with some high-level details and links to the relevant parts in the HTML and fetch specs. That way any external links in blog posts and articles will still find their way to the specs with the relevant details.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

The Request constructor is not correct:

  • It copies priority rather than internal priority.
  • When priority is given this is not taken into account. I suspect that when it's given we want to set request's priority to it and we want to set internal priority to null (so request's priority will be used upon fetching to initialize it). Or would we want to adjust internal priority instead in some manner so the existing prioritization information is taken into account?

fetch.bs Outdated Show resolved Hide resolved
@pmeenan
Copy link
Contributor Author

pmeenan commented Nov 30, 2022

Thanks, looks like I accidentally deleted internal priority instead of priority from the copy step. Should be fixed now.

I also added a step 27 to the constructor to take init's priority into account in setting internal priority (I don't think we can be more specific than that for how each browser will choose to modify or override an existing internal priority).

fetch.bs Outdated Show resolved Hide resolved
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Thanks! This looks good to me. I have a couple final nits I can take care of when merging.

Where is the corresponding HTML PR again?

Could you post a suggested commit message in a new comment that includes all the relevant details and pointers to issues/documents/PRs? You can use https://github.com/whatwg/meta/blob/main/COMMITTING.md for guidance.

I think this can be merged Wed or Thu next week assuming it all checks out.

fetch.bs Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
@pmeenan
Copy link
Contributor Author

pmeenan commented Dec 2, 2022

The HTML PR is here (#8470) (though I still have a bit of updating from Domenic's feedback and I assume a few rounds of tweaks after that before it can land).

The latest commit (afce7fc) has a commit message with the summary details of the change and links to the Issue and previous spec.

@annevk
Copy link
Member

annevk commented Dec 8, 2022

Tests:

  • Let's have a non-throwing test as well for Request and fetch(). (You can use about:blank as URL to avoid it taking up more resources than needed as I guess we cannot actually test priority that well?)
  • Maybe: test that Request doesn't have priority.
  • Fetch tests need to be inside fetch/.
  • /interfaces/priority-hints.idl needs to be removed as it'll be obsoleted by Fetch and HTML. @foolip how can we stop Priority Hints from being imported?

pmeenan and others added 2 commits December 8, 2022 12:12
- Renames the request priority concept to internal priority and "adds" priority for usage by APIs.
- Adds a new priority member to RequestInit for specifying a priority hint.

These changes combined with whatwg/html#8470 obsolete the Priority Hints specification: https://wicg.github.io/priority-hints/.

Tests: TODO.

Fixes whatwg#1319.

Co-authored-by: Anne van Kesteren <[email protected]>
@annevk
Copy link
Member

annevk commented Dec 8, 2022

The test situation still needs a bit of work, but once that is done I think this can be merged. It seems okay that HTML will be merged later as it builds on top of this.

@pmeenan
Copy link
Contributor Author

pmeenan commented Dec 12, 2022

I have a CL up with the changes to the tests (will update here after it lands). Since the effects of priority are all implementation-specific and not exposed, other than not erroring when they are set there's not much we can test.

As far as the IDL import, I pinged @foolip to see if there's a workflow to stop importing it, but I can also remove the fetch integration section from the spec which has the IDL bits (and remove the HTML part when HTML is ready to land). That should also avoid any conflicts. Main question is if I remove them before the fetch changes land or wait until they have landed and there is content to point to from the Priority Hints spec.

@foolip
Copy link
Member

foolip commented Dec 14, 2022

IDL files in WPT come from https://github.com/w3c/webref, and there's a consistency check that runs before releasing @webref/idl. In other words, you don't need to worry about a two-sided spec change making the sum of all IDL inconsistent for a period. Ideally that only lasts for a few days, but a broken set of IDL won't be imported into WPT.

Hope that helps?

@annevk annevk merged commit 06a38bc into whatwg:main Dec 15, 2022
@annevk
Copy link
Member

annevk commented Dec 15, 2022

I decided to merge this because of:

I hope @pmeenan can sort out the WPT IDL situation and make progress on the HTML PR next.

Thanks @pmeenan for your work on this feature!

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

Successfully merging this pull request may close these issues.

4 participants