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

Infer a speculation rule's source from the other keys #295

Merged
merged 4 commits into from
Jan 11, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions speculation-rules.bs
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,14 @@ add the following step
To <dfn>parse a speculation rule</dfn> given a [=map=] |input|, a [=document=] |document|, and a [=URL=] |baseURL|, perform the following steps. They return a [=speculation rule=] or null.

1. If |input| has any [=map/key=] other than "`source`", "`urls`", "`where`", "`requires`", "`target_hint`","`referrer_policy`", "`relative_to`", "`eagerness`", and "`expects_no_vary_search`" then return null.
1. If |input|["`source`"] does not [=map/exist=] or is neither the [=string=] "`list`" nor the [=string=] "`document`", then return null.
1. Let |source| be |input|["`source`"].
1. Let |source| be null.
1. If |input|["`source`"] exists, then:
1. Set |source| to |input|["`source`"].
1. Otherwise, if |input|["`urls`"] [=map/exists=] and |input|["`where`"] does not [=map/exist=], then:
1. Set |source| to "`list`".
1. Otherwise, if |input|["`where`"] [=map/exists=] and |input|["`urls`"] does not [=map/exist=], then:
1. Set |source| to "`document`".
1. If |source| is neither the [=string=] "`list`" nor the [=string=] "`document`", then return null.
1. Let |urls| be an empty [=list=].
1. Let |predicate| be null.
1. If |source| is "`list`":
Expand Down