Repository navigation
Correct management of sandboxing flag sets - #5686
Conversation
Replace ambiguous references to a browsing context property named "sandboxing flag set". Closes whatwggh-5682.
| <li><p>Set <var>newBrowsingContext</var>'s <span>sandboxing flag set</span> to | ||
| <li><p>Set <var>newBrowsingContext</var>'s <span>popup sandboxing flag set</span> to | ||
| the <span data-x="set union">union</span> of | ||
| <var>newBrowsingContext</var>'s <span>popup sandboxing flag set</span> and |
There was a problem hiding this comment.
This seems reasonable. If we go with this should we use this language in "choosing" as well? However, if the popup sandboxing flag set is always empty at this point it might be bit confusing. Is there ever a case where it is not? Setting it to the same set or a copy of the set might be more straightforward?
There was a problem hiding this comment.
I think there are cases where the new browsing context's "popup sandboxing flag
set" is non-empty. One would be when following a hyperlink whose target is
_blank from a sandboxed iframe.
Here's my rationale
I think it may be set. For example, when following a hyperlink whose target
is _blank:
- Let target and replace be the result of applying the rules for choosing a
browsing context given targetAttributeValue, source, and noopener.[...]
- Queue an element task on the DOM manipulation task source given subject
to navigate the target browsing context to request. If replace is true,
the navigation must be performed with replacement enabled. The source
browsing context must be source.
"target" should have a non-empty "popup sandboxing flag set" according to "The
rules for choosing a browsing context":
If the user agent has been configured such that in this instance it will
create a new browsing context[...]
- If sandboxingFlagSet's sandbox propagates to auxiliary browsing contexts
flag is set, then all the flags that are set in sandboxingFlagSet must be
set in chosen's popup sandboxing flag set.
So, continuing on to "navigate":
This is the step that attempts to obtain resource, if necessary. Jump to
the first appropriate substep:[...]
If resource is a request whose url's scheme is a fetch scheme
- Run process a navigate fetch given resource, the source browsing
context, browsingContext, navigationType, sandboxFlags,
incumbentNavigationOrigin, and activeDocumentNavigationOrigin.
"Process a navigate fetch":
While true:
[...]
Otherwise:
[...]
If browsingContext is a top-level browsing context, then:
[...]
- Let responseRequiresBrowsingContexGroupSwitch be the result of
checking if the response requires a browsing context group switch
given browsingContext, responseOrigin, and responseCOOP.- If responseRequiresBrowsingContextGroupSwitch is true, set
browsingContextSwitchNeeded to true.
[...]Run process a navigate response given request, response, navigationType,
the source browsing context, browsingContext, finalSandboxFlags,
responseOrigin, incumbentNavigationOrigin,
activeDocumentNavigationOrigin, responseCOOP,
browsingContextSwitchNeeded, and reservedEnvironment.
"browsingContextSwitchNeeded" should be true, according to "check if a response
requires a browsing context group switch":
- If browsingContext's only entry in its session history is the about:blank
Document that was added when browsingContext was created, then set
isInitialAboutBlank to true.
So, continuing on to "process a navigate response":
- If the user agent has been configured to process resources of the given
type using some mechanism other than rendering the content in a browsing
context, then skip this step. Otherwise, if the type is one of the
following types, jump to the appropriate entry in the following list, and
process response as described there:
- an HTML MIME type
- Follow the steps given in the HTML document section providing
browsingContext, request, response, finalSandboxFlags,
finalResponseOrigin, incumbentNavigationOrigin,
activeDocumentNavigationOrigin, reservedEnvironment, responseCOOP, and
browsingContextSwitchNeeded. Once the steps have completed, return.
From "an HTML document is to be loaded":
- Let document be the result of creating and initializing a Document object
providing "html", "text/html", request, response, browsingContext,
finalSandboxFlags, finalResponseOrigin, incumbentNavigationOrigin,
activeDocumentNavigationOrigin, environment, responseCOOP, and
browsingContextSwitchNeeded.
From "create and initialize a Document object":
- If browsingContextSwitchNeeded is true, set browsingContext to the result
of the obtain a browsing context to use for a navigation response
algorithm, given browsingContext, finalSandboxFlags, and navigationCOOP.
Does that seem right to you?
There was a problem hiding this comment.
Why would
If sandboxFlags is not empty and responseCOOP is not "unsafe-none", then set response to an appropriate network error and break.
not be hit in this scenario?
There was a problem hiding this comment.
You're right. I lost track of that value. Do you think it's reasonable to explicitly assert that fact?
The reference to "union" is no longer needed in this patch, but I'm still committed to introducing it in a follow-up.
| @@ -82283,7 +82287,7 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface | |||
| close to reality its current definition is. --> | |||
|
|
|||
| <li><p>Let <var>finalSandboxFlags</var> be the union of <var>browsingContext</var>'s | |||
There was a problem hiding this comment.
Mind if I fix that in a follow up? There are a handful of other places where it's needed, and doing that in a separate commit will keep this one a little more focused.
|
Yeah that seems fine to me (to both). @domenic should probably have a look as well. |
Replace ambiguous references to a browsing context property named
"sandboxing flag set".
Closes gh-5682.
@annevk I've attempted to implement the intention as you described it in gh-5628. I'm concerned about one aspect of it, though. The "sandboxing flags" for a browsing context is described as follows:
This patch introduces a post-creation modification of the "popup sandboxing flag set" which influences the "sandboxing flags." Should the modification of "popup sandboxing flag set" also include text to update the "sandboxing flags"?
/browsing-the-web.html ( diff )
/origin.html ( diff )