-
Notifications
You must be signed in to change notification settings - Fork 43
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
[Spec] Overhaul 'restricting the text fragment' section #239
Conversation
57aa8ac
to
54b5a07
Compare
@annevk does this look right? In particular, I noticed that the "create and initialize a Document object" steps already check the source origin but in "navigate" we snapshot the source origin so I'm guessing it can change and the existing case for about:blank is special? |
b401390
to
b012092
Compare
sec-fetch-site was being checked for 'none' to indicate that a navigation was initiated from browser UI. However, we cannot inspect request headers from this part of the algorithm. Instead, the navigate algorithm now has a userInvolvement parameter which provides this information explicitly. Plumb that into navigation params and use it instead. Additionally, this change removes the top-level browsing context check from the document's text directive user activation flag since that's a confusing place to check it. Instead, move it to where this flag is being read and remove a (now-obviously) redundant check below.
`sec-fetch-site: same-origin` was being checked to tell if a navigation was initiated by a different origin. However, request headers can't be inspected at this point of the algorithm. Plumb through the initiatorOrigin parameter when loading a document and compare that with navigation params's origin field, using the `is same site` steps.
The main change in this commit is that enables same-document navigations (with restrictions) by moving the security checks to also happen from the navigate to fragment. As part of this, we do a fairly substantial clean up and refresh of the 'restricting a text fragment' section. The summarized high level changes: * Split out the restrictions into a single set of 'check if a text directive can be scrolled' steps, taking the necessary input as parameters. * Remove the 'allow text fragment scroll` flag on Document, instead computing this value and passing it through various steps into 'scroll to the fragment'. * The restriction is placed only on the 'scroll to the fragment' steps, meaning the text directive is still the 'indicated part' and can remain highlighted. Partially addresses WICG#240
b012092
to
81c42d9
Compare
Ping - I've built a bit more on top of this so it no longer performs the checks in the 'create and initialize a document object' steps. (Please see also questions in whatwg/html#8282 (comment), if you'd rather review once this is "ready" for PR into HTML I can do that too) |
@annevk in the interest of making progress, and since I have a number of other changes and fixes that are blocked on this, I'm going to merge this as-is. This will still be reviewed as part of the HTML PR. Happy to make changes post-merge if you find any. |
The spec was using the
sec-fetch-site
request header to determine the initiator properties of the navigation, to use in security restrictions. However, request headers are appended only just prior to performing the fetch, this part of the algorithm operates on a clone of the request without headers so this doesn't work.This PR fixes the issues and rearranges the checks to occur in the
finalize a cross document navigation
andnavigate to a fragment
steps, also enabling text directives from a same-document navigation (the behavior in both Safari and Chrome, see #240).Fixes #179
Preview | Diff