From 06b4d8a61d8f431f85681b709e03dabcfad1eb89 Mon Sep 17 00:00:00 2001
From: clamy The following terms are defined in Structured Field Values for HTTP: The following terms are defined in MIME Sniffing: The following algorithm is defined in Secure Contexts: The following algorithms are defined in Secure Contexts: The following features is defined in Cooperative Scheduling of Background Tasks:
+ The following features are defined in Cooperative Scheduling of Background Tasks:
The following features are defined in Cross-Origin Embedder Policy: Link
` header
+
+
@@ -2506,6 +2514,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
@@ -3923,6 +3933,19 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
+
+ Cross-Origin-Embedder-Policy
` header
@@ -9013,9 +9036,12 @@ partial interface Document {
data-dfn-for="Document">feature policy, which is a feature policy, which is initially empty.
The Document
has a module map, which is a module map,
- initially empty.
The Document
has a module map,
+ which is a module map, initially empty.
The Document
has a cross-origin opener
+ policy, which is a cross-origin opener policy, initially "unsafe-none
".
DocumentOrShadowRoot
interfaceLet coop be "unsafe-none
".
If creator is non-null and creator's origin is + same origin with creator's relevant settings object's + top-level origin, then set coop to creator's browsing context's top-level browsing context's + active document's cross-origin opener + policy.
Let document be a new Document
, marked as an HTML document in quirks mode, whose content type is "text/html
",
origin is origin, active sandboxing flag set is
sandboxFlags, feature policy is
- feature policy, and which is both ready for post-load tasks and
- completely loaded immediately.
Ensure that document has a single child html
node, which itself
has two empty child nodes: a head
element, and a body
element.
A browsing context group has a cross-origin isolated boolean. It is initially false.
+ +The impact of cross-origin + isolated is under discussion in issue + #4734.
+To create a new browsing context group, run these steps:
@@ -77467,6 +77510,29 @@ console.assert(iframeWindow.frameElement === null);If current's top-level browsing context's active
+ document's cross-origin opener policy is
+ "same-origin
" or "same-origin-plus-COEP
", then:
Let currentDocument be current's active + document.
If currentDocument's origin is not same origin
+ with currentDocument's relevant settings object's top-level
+ origin, then set noopener to true and name to "_blank
".
In the presence of a cross-origin opener policy, nested + documents that are cross-origin with their top-level browsing context's active document + always set noopener to true.
+Set new to true.
If noopener is true, then set chosen to the result @@ -79900,6 +79966,215 @@ interface BarProp { +
A cross-origin opener policy allows a document which is navigated to in a + top-level browsing context to force the creation of a new top-level browsing + context, and a corresponding group. It has one of the + following values:
+ +unsafe-none
"This is the (current) default and means that the document will occupy the same + top-level browsing context as its predecessor, unless that document specified a + different cross-origin opener policy.
same-origin-allow-popups
"This forces the creation of a new top-level browsing context for the + document, unless its predecessor specified the same cross-origin opener policy and + they are same origin.
same-origin
"This behaves the same as "same-origin-allow-popups
", with the addition any
+ auxiliary browsing context created needs to contain same origin
+ documents that also have the same cross-origin opener policy or it will appear
+ closed to the opener.
same-origin-plus-COEP
"This behaves the same as "same-origin
", with the
+ addition that it sets the (new) top-level browsing context's group's cross-origin isolated to
+ true.
"same-origin-plus-COEP
" cannot
+ be directly set via the `Cross-Origin-Opener-Policy
` header, but results
+ from a combination of setting both `Cross-Origin-Opener-Policy: same-origin
` and `Cross-Origin-Embedder-Policy: require-corp
` together.
To match cross-origin opener policies, given a + cross-origin opener policy A, an origin originA, a + cross-origin opener policy B, and an origin + originB:
+ +If A is "unsafe-none
" and B
+ is "unsafe-none
", then return true.
If A is "unsafe-none
" or B is
+ "unsafe-none
", then return false.
If A is B and originA is same origin with + originB, then return true.
Return false.
A Document
's cross-origin opener
+ policy is derived from the `Cross-Origin-Opener-Policy
` HTTP response header.
+ This header is a structured header whose value must
+ be a token.
The valid token values are "unsafe-none
", "same-origin-allow-popups
", and "same-origin
".
Per the processing model described below, user agents will ignore this header if + it contains an invalid value. Likewise, user agents will ignore this header if the value cannot be + parsed as a token.
+ +To obtain a cross-origin opener policy from a response response:
+ +Let securityState be the result of executing Is url potentially + trustworthy? on response's url.
If securityState is "Not Trustworthy
", then return
+ "unsafe-none
".
Let value be the result of getting a structured header
+ given `Cross-Origin-Opener-Policy
` and
+ "item
" from response's header list.
If value is failure or null, then return "unsafe-none
".
If value[0] is not "same-origin
" or
+ "same-origin-allow-popups
", then return
+ "unsafe-none
".
If value[0] is "same-origin
", then:
Let coep be the result of obtaining a cross-origin embedder + policy from response.
If coep is "require-corp
", then return "same-origin-plus-COEP
".
Return value[0].
To check if a response requires a + browsing context group switch, given a browsing context + browsingContext, an origin responseOrigin and a + cross-origin opener policy responseCOOP, run the followign steps:
+ +Let activeDocumentNavigationOrigin be browsingContext's active + document's origin.
Let activeDocumentCOOP be browsingContext's active + document's cross-origin opener + policy.
Let isInitialAboutBlank be false.
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.
If the result of matching + activeDocumentCOOP, activeDocumentNavigationOrigin, + responseCOOP and responseOrigin is true, then return false.
If all of the following are true:
+ +isInitialAboutBlank
activeDocumentCOOP is "same-origin-allow-popups
".
responseCOOP is "unsafe-none
".
then return false.
+Return true.
To obtain a browsing context to use for a + navigation response, given a browsing context + browsingContext, a sandboxing flag set sandboxFlags, and a + cross-origin opener policy navigationCOOP:
+ +Assert browsingContext is a top-level browsing context.
Let newBrowsingContext be the result of creating a new top-level browsing + context.
If navigationCOOP is "same-origin-plus-COEP
", then set
+ newBrowsingContext's group's cross-origin isolated to true.
If sandboxFlags is not empty, then:
+Assert: navigationCOOP is "unsafe-none
".
Set newBrowsingContext's sandboxing flag set to + sandboxFlags.
Discard browsingContext.
+ +This does not close browsingContext's group, unless browsingContext was its sole top-level browsing + context.
+Return newBrowsingContext.
The impact of swapping browsing context groups following a navigation is not + defined. It is currently under discussion in issue #5350.
+ + +While true:
@@ -81911,6 +82194,43 @@ interface Location { // but see also url, finalSandboxFlags, + incumbentNavigationOrigin, and activeDocumentNavigationOrigin.If browsingContext is a top-level browsing context, then:
+ +Set responseCOOP to the result of obtaining a + cross-origin opener policy given response and + responseOrigin.
If sandboxFlags is not empty and responseCOOP is not "unsafe-none
", then set response to an
+ appropriate network error and return.
This results in a network error as one cannot simultaneously provide a + clean slate to a response using cross-origin opener policy and sandbox the result of + navigating to that response.
+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.
If response does not have a location URL or the Location { // but see also mailto: URLs and such.
If response is a network error, then break.
An explicitly supported XML MIME type is an XML MIME type for which @@ -82293,18 +82623,16 @@ interface Location { // but see also request request, a response response, a browsing context browsingContext, a sandboxing flag set - sandboxFlags, two origins - incumbentNavigationOrigin, activeDocumentNavigationOrigin, and null or an - environment reservedEnvironment:
+ finalSandboxFlags, three origins origin, + incumbentNavigationOrigin, activeDocumentNavigationOrigin, null or an + environment reservedEnvironment, a cross-origin opener policy + navigationCOOP, and a boolean browsingContextSwitchNeeded:Let finalSandboxFlags be the union of sandboxFlags and - response's forced sandboxing flag set.
Let origin be the result of determining the origin given - browsingContext, request's url, - finalSandboxFlags, incumbentNavigationOrigin, and - activeDocumentNavigationOrigin. +
If browsingContextSwitchNeeded is true, set browsingContext to the + result of the obtain a browsing context to use + for a navigation response algorithm, given browsingContext, + finalSandboxFlagSet, and navigationCOOP.
Let featurePolicy be the result of creating a feature policy from a
@@ -82316,7 +82644,7 @@ interface Location { // but see also document.domain has been used
for the browsingContext container
document, then its origin cannot be same origin-domain with
- >origin, because these steps run before the document is created, so it
+ origin, because these steps run before the document is created, so it
cannot itself yet have used document.domain
. Note
that this means that Feature Policy checks are less permissive compared to doing a same
origin check instead.
Set document's URL to creationURL.
text/event-stream
resources.
+ Cross-Origin-Opener-Policy
`This section describes a header for registration in the Permanent Message Header Field + Registry.
+ +Ping-From
`This section describes a header for registration in the Permanent Message Header Field @@ -120496,6 +120848,9 @@ INSERT INTERFACES HERE
multipart/x-mixed-replace
"When an HTML document is to be loaded, given a - browsingContext, request, response, sandboxFlags, - incumbentNavigationOrigin, activeDocumentNavigationOrigin, and - environment, the user agent must queue a task on the networking task - source to:
+ browsingContext, request, response, finalSandboxFlags, + finalResponseOrigin, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, environment, responseCOOP, and + browsingContextSwitchNeeded the user agent must queue a task on the + networking task source to:Let document be the result of creating and initializing a Document
object providing "html
", "text/html
",
- request, response, browsingContext, sandboxFlags,
- incumbentNavigationOrigin, activeDocumentNavigationOrigin, and
- environment.
Create an HTML parser and associate it with the document. Each @@ -82963,16 +82966,18 @@ new PaymentRequest(…); // Allowed to use
When faced with displaying an XML file inline, provided browsingContext,
- request, response, sandboxFlags,
- incumbentNavigationOrigin, activeDocumentNavigationOrigin, and
- environment, user agents must follow the requirements defined in XML and
- Namespaces in XML, XML Media Types, DOM, and other relevant
- specifications to create and initialize a
- Document
object providing "xml
", type,
- request, response, browsingContext, sandboxFlags,
- incumbentNavigationOrigin, activeDocumentNavigationOrigin, and
- environment. It must also create and a corresponding XML parser.
Document
object providing "xml
",
+ type, request, response, browsingContext,
+ finalSandboxFlags, finalResponseOrigin incumbentNavigationOrigin,
+ activeDocumentNavigationOrigin, environment, responseCOOP. and
+ browsingContextSwitchNeeded. It must also create and a corresponding XML
+ parser.
At the time of writing, the XML specification community had not actually yet specified how XML and the DOM interact.
@@ -83017,18 +83022,20 @@ new PaymentRequest(…); // Allowed to useWhen a plain text document is to be loaded, provided a browsingContext, - request, response, sandboxFlags, - incumbentNavigationOrigin, activeDocumentNavigationOrigin, and - environment, the user agent must queue a task on the networking task - source to: + request, response, finalSandboxFlags, + finalResponseOrigin, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, environment,responseCOOP, and + browsingContextSwitchNeeded the user agent must queue a task on the + networking task source to:
Let document be the result of creating and initialize a Document
object
providing "html
", type, request,
- response, browsingContext, sandboxFlags,
- incumbentNavigationOrigin, activeDocumentNavigationOrigin, and
- environment.
Create an HTML parser and associate it with the document. Act as if the tokenizer had emitted a start tag token with the tag name "pre" followed by a single @@ -83096,17 +83103,19 @@ new PaymentRequest(…); // Allowed to use
When an image, video, or audio resource is to be loaded, provided a browsingContext, - request, response, sandboxFlags, - incumbentNavigationOrigin, activeDocumentNavigationOrigin, and - environment, the user agent should: + request, response, finalSandboxFlags, + finalResponseOrigin, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, environment, responseCOOP, + browsingContextSwitchNeeded, the user agent should:
Let document be the result of creating and initialize a Document
object
providing "html
", type, request,
- response, browsingContext, sandboxFlags,
- incumbentNavigationOrigin, activeDocumentNavigationOrigin, and
- environment.
Append an html
element to document.
When a resource that requires an external resource to be rendered is to be loaded, provided a browsingContext, request, response, sandboxFlags, - incumbentNavigationOrigin, activeDocumentNavigationOrigin, and - environment, the user agent should: + finalResponseOrigin, incumbentNavigationOrigin, + activeDocumentNavigationOrigin, environment, responseCOOP, and + browsingContextSwitchNeeded, the user agent should:
Let document be the result of creating and initialize a Document
object
providing "html
", type, request,
- response, browsingContext, sandboxFlags,
- incumbentNavigationOrigin, activeDocumentNavigationOrigin, and
- environment.
Mark document as being a plugin document
Run process a navigate response with null, resource, - navigationType, the source browsing context, - browsingContext, sandboxFlags, incumbentNavigationOrigin, - activeDocumentNavigationOrigin, and null.
Let finalSandboxFlags be the union of browsingContext's + sandboxing flag set and resource's forced sandboxing flag + set.
Let responseOrigin be the result of determining the origin + given browsingContext, request's url, finalSandboxFlags, + incumbentNavigationOrigin, and activeDocumentNavigationOrigin.
Let responseCOOP be "unsafe-none
".
Let browsingContextSwitchNeeded be false.
If browsingContext is a top-level browsing context, then:
+ +Set responseCOOP to the result of obtaining a + cross-origin opener policy given resource and + responseOrigin.
If sandboxFlags is not empty and responseCOOP is not "unsafe-none
", then set resource to an
+ appropriate network error and proceed.
Set browsingContexSwitchNeeded be the result of checking if the response requires a + browsing context group switch given browsingContext, + responseOrigin, and responseCOOP.
Run process a navigate response with null, resource, + navigationType, the source browsing context, + browsingContext, finalSandboxFlags, responseOrigin, + incumbentNavigationOrigin, activeDocumentNavigationOrigin, null, + responseCOOP, and browsingContextSwitchNeeded.
So for example a If resource is a response
Assert browsingContext is not a top-level browsing
+ context. Let finalSandboxFlags be the union of browsingContext's
sandboxing flag set and resource's forced sandboxing flag
set.
+
If sandboxFlags is not empty and responseCOOP is not "unsafe-none
", then set resource to an
- appropriate network error and proceed.
Set browsingContexSwitchNeeded be the result of checking if the response requires a - browsing context group switch given browsingContext, - responseOrigin, and responseCOOP.
Run process a navigate response with null, resource,
navigationType, the source browsing context,
browsingContext, finalSandboxFlags, responseOrigin,
From 68534cd5aaa54b3b0bd0f2d81d1e143b8e83d9d3 Mon Sep 17 00:00:00 2001
From: Anne van Kesteren
Let activeDocumentCOOP be browsingContext's active - document's cross-origin opener + document's cross-origin opener policy.
Let isInitialAboutBlank be false.
Assert browsingContext is a top-level browsing context.
Assert: browsingContext is a top-level browsing context.
Let newBrowsingContext be the result of creating a new top-level browsing context.
Assert browsingContext is not a top-level browsing
+ Assert: browsingContext is not a top-level browsing
context. Let finalSandboxFlags be the union of browsingContext's
sandboxing flag set and resource's forced sandboxing flag
@@ -82032,8 +82034,8 @@ interface Location { // but see also cross-origin opener
- policy, and false.
So for example a To process a navigate fetch, given a request request, two browsing contexts sourceBrowsingContext and browsingContext, - a string navigationType, and two origins - incumbentNavigationOrigin and activeDocumentNavigationOrigin, run these - steps:
+ a string navigationType, a sandboxing flag set sandboxFlags, + and two origins incumbentNavigationOrigin and + activeDocumentNavigationOrigin, run these steps:Let response be null.
Otherwise, if response has a location URL that is a URL, run the @@ -82360,9 +82363,10 @@ interface Location { // but see also process a navigate response, given null or a Location { // but see also browsing contexts source and browsingContext, a sandboxing flag set finalSandboxFlags, three origins finalResponseOrigin, - incumbentNavigationOrigin and activeDocumentNavigationOrigin, a + incumbentNavigationOrigin, and activeDocumentNavigationOrigin, a cross-origin opener policy responseCOOP, a boolean browsingContextSwitchNeeded, and null or an environment reservedEnvironment, run these steps:
From 2ecb2433039e8c47d3e447795b06f86a72260897 Mon Sep 17 00:00:00 2001 From: Domenic Denicolasame-origin
"This behaves the same as "same-origin-allow-popups
", with the addition any
- auxiliary browsing context created needs to contain same origin
+ data-x="coop-same-origin-allow-popups">same-origin-allow-popups", with the addition that
+ any auxiliary browsing context created needs to contain same origin
documents that also have the same cross-origin opener policy or it will appear
closed to the opener.
Return false.
Cross-Origin-Opener-Policy
`
+ headerA To check if a response requires a
browsing context group switch, given a browsing context
browsingContext, an origin responseOrigin and a
- cross-origin opener policy responseCOOP, run the followign steps:Document
's cross-origin opener
policy is derived from the `BarProp {
Let activeDocumentNavigationOrigin be browsingContext's active @@ -80186,7 +80187,8 @@ interface BarProp { href="https://github.com/whatwg/html/issues/5350">whatwg/html issue #5350
Cross-Origin-Opener-Policy
` header or navigation.
+ data-x="http-cross-origin-opener-policy">Cross-Origin-Opener-Policy` header or
+ navigation.
A top-level browsing context has an associated browsing session which is a @@ -82000,7 +82002,8 @@ interface Location { // but see also url, finalSandboxFlags, incumbentNavigationOrigin, and activeDocumentNavigationOrigin.
-Let responseCOOP be "unsafe-none
".
Let responseCOOP be "unsafe-none
".
Let browsingContextSwitchNeeded be false.
Let responseCOOP be "unsafe-none
".
While true:
@@ -82234,7 +82238,7 @@ interface Location { // but see also obtaining a @@ -82243,17 +82247,17 @@ interface Location { // but see also unsafe-none", then set response to an - appropriate network error and return. + data-x="coop-unsafe-none">unsafe-none", then set response to an + appropriate network error and break. -This results in a network error as one cannot simultaneously provide a - clean slate to a response using cross-origin opener policy and sandbox the result of +
This results in a network error as one cannot simultaneously provide a + clean slate to a response using cross-origin opener policy and sandbox the result of navigating to that response.
Let responseRequiresBrowsingContexGroupSwitch be the result of checking if the response requires a - browsing context group switch given browsingContext, + data-x="check-browsing-context-group-switch-response">checking if the response requires a + browsing context group switch given browsingContext, responseOrigin, and responseCOOP.
If responseRequiresBrowsingContextGroupSwitch is true, set @@ -82272,8 +82276,6 @@ interface Location { // but see also mailto: URLs and such.
If response is a network error, then break.
Discard browsingContext.
-This does not close browsingContext's This has no effect on browsingContext's group, unless browsingContext was its sole top-level browsing - context.
+ context. In that case, the user agent might delete the browsing context + group which no longer contains any browsing + contexts.Return newBrowsingContext.
The impact of swapping browsing context groups following a navigation is not - defined. It is currently under discussion in issue #5350.
From 2803530daa3d2008e8cc8ae6ad0a8581437b6e5a Mon Sep 17 00:00:00 2001 From: Anne van KesterenIf responseRequiresBrowsingContextGroupSwitch is true, set