1. 7.3 Origin
      1. 7.3.1 Relaxing the same-origin restriction
      2. 7.3.2 Origin isolation
    2. 7.4 Sandboxing
    3. 7.5 Cross-origin opener policies
      1. 7.5.1 The headers
      2. 7.5.2 Browsing context group switches due to cross-origin opener policy
      3. 7.5.3 Reporting
    4. 7.6 Cross-origin embedder policies
      1. 7.6.1 The headers
      2. 7.6.2 Embedder policy checks

7.3 Origin

Origins are the fundamental currency of the web's security model. Two actors in the web platform that share an origin are assumed to trust each other and to have the same authority. Actors with differing origins are considered potentially hostile versus each other, and are isolated from each other to varying degrees.

For example, if Example Bank's web site, hosted at bank.example.com, tries to examine the DOM of Example Charity's web site, hosted at charity.example.org, a "SecurityError" DOMException will be raised.


An origin is one of the following:

An opaque origin

An internal value, with no serialization it can be recreated from (it is serialized as "null" per serialization of an origin), for which the only meaningful operation is testing for equality.

A tuple origin

A tuple consists of:

Origins can be shared, e.g., among multiple Document objects. Furthermore, origins are generally immutable. Only the domain of a tuple origin can be changed, and only through the document.domain API.

The effective domain of an origin origin is computed as follows:

  1. If origin is an opaque origin, then return null.

  2. If origin's domain is non-null, then return origin's domain.

  3. Return origin's host.

7.3.1 Relaxing the same-origin restriction

Document/domain

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer4+
Firefox Android4+Safari iOS1+Chrome Android18+WebView Android1+Samsung Internet1.0+Opera Android12.1+
document . domain [ = domain ]

Returns the current domain used for security checks.

Can be set to a value that removes subdomains, to change the origin's domain to allow pages on other subdomains of the same domain (if they do the same thing) to access each other. This enables pages on different hosts of a domain to synchronously access each other's DOMs.

In sandboxed iframes, Documents with opaque origins, Documents without a browsing context, and when the "document-domain" feature is disabled, the setter will throw a "SecurityError" exception. In cases where crossOriginIsolated or originIsolated return true, the setter will do nothing.

Avoid using the document.domain setter. It undermines the security protections provided by the same-origin policy. This is especially acute when using shared hosting; for example, if an untrusted third party is able to host an HTTP server at the same IP address but on a different port, then the same-origin protection that normally protects two different sites on the same host will fail, as the ports are ignored when comparing origins after the document.domain setter has been used.

Because of these security pitfalls, this feature is in the process of being removed from the web platform. (This is a long process that takes many years.)

Instead, use postMessage() or MessageChannel objects to communicate across origins in a safe manner.

7.3.2 Origin isolation

window . originIsolated

Returns true if this Window is origin-isolated in the manner described in this section.

A Document delivered over a secure context can opt in to origin isolation, by using the `Origin-Isolation` HTTP response header. This header is a structured header whose value must be a boolean. [STRUCTURED-FIELDS]

Values that are not the structured header boolean true value (i.e., `?1`) will be ignored.

The consequences of using this header are that attempting to relax the same-origin restriction using document.domain will instead do nothing, and it will not be possible to send WebAssembly.Module objects to cross-origin Documents (even if they are same site). Behind the scenes, this isolation can allow user agents to allocate implementation-specific resources corresponding to agent clusters, such as processes or threads, more efficiently.

Note that within a browsing context group, the `Origin-Isolation` header can never cause same-origin Document objects to end up in different agent clusters, even if one sends the header and the other doesn't.

This means that the originIsolated getter can return false, even if the header is set, if the header was omitted on a previously-loaded same-origin page in the same browsing context group. Similarly, it can return true even when the header is not set.

Documents with an opaque origin can be considered unconditionally origin-isolated; for them the header has no effect.

Similarly, Documents in a cross-origin isolated agent cluster are automatically origin-isolated. The `Origin-Isolation` header might be useful as an additional hint to implementations about resource allocation, since the `Cross-Origin-Opener-Policy` and `Cross-Origin-Embedder-Policy` headers used to achieve cross-origin isolation are more about ensuring that everything in the same address space opts in to being there. But adding it would have no additional observable effects on author code.

7.4 Sandboxing

A sandboxing flag set is a set of zero or more of the following flags, which are used to restrict the abilities that potentially untrusted resources have:

The sandboxed navigation browsing context flag

This flag prevents content from navigating browsing contexts other than the sandboxed browsing context itself (or browsing contexts further nested inside it), auxiliary browsing contexts (which are protected by the sandboxed auxiliary navigation browsing context flag defined next), and the top-level browsing context (which is protected by the sandboxed top-level navigation without user activation browsing context flag and sandboxed top-level navigation with user activation browsing context flag defined below).

If the sandboxed auxiliary navigation browsing context flag is not set, then in certain cases the restrictions nonetheless allow popups (new top-level browsing contexts) to be opened. These browsing contexts always have one permitted sandboxed navigator, set when the browsing context is created, which allows the browsing context that created them to actually navigate them. (Otherwise, the sandboxed navigation browsing context flag would prevent them from being navigated even if they were opened.)

The sandboxed auxiliary navigation browsing context flag

This flag prevents content from creating new auxiliary browsing contexts, e.g. using the target attribute or the window.open() method.

The sandboxed top-level navigation without user activation browsing context flag

This flag prevents content from navigating their top-level browsing context and prevents content from closing their top-level browsing context. It is consulted only when the sandboxed browsing context's active window does not have transient activation.

When the sandboxed top-level navigation without user activation browsing context flag is not set, content can navigate its top-level browsing context, but other browsing contexts are still protected by the sandboxed navigation browsing context flag and possibly the sandboxed auxiliary navigation browsing context flag.

The sandboxed top-level navigation with user activation browsing context flag

This flag prevents content from navigating their top-level browsing context and prevents content from closing their top-level browsing context. It is consulted only when the sandboxed browsing context's active window has transient activation.

As with the sandboxed top-level navigation without user activation browsing context flag, this flag only affects the top-level browsing context; if it is not set, other browsing contexts might still be protected by other flags.

The sandboxed plugins browsing context flag

This flag prevents content from instantiating plugins, whether using the embed element, the object element, or through navigation of their nested browsing context, unless those plugins can be secured.

The sandboxed origin browsing context flag

This flag forces content into a unique origin, thus preventing it from accessing other content from the same origin.

This flag also prevents script from reading from or writing to the document.cookie IDL attribute, and blocks access to localStorage.

The sandboxed forms browsing context flag

This flag blocks form submission.

The sandboxed pointer lock browsing context flag

This flag disables the Pointer Lock API. [POINTERLOCK]

The sandboxed scripts browsing context flag

This flag blocks script execution.

The sandboxed automatic features browsing context flag

This flag blocks features that trigger automatically, such as automatically playing a video or automatically focusing a form control.

The sandboxed document.domain browsing context flag

This flag prevents content from using the document.domain setter.

The sandbox propagates to auxiliary browsing contexts flag

This flag prevents content from escaping the sandbox by ensuring that any auxiliary browsing context it creates inherits the content's active sandboxing flag set.

The sandboxed modals flag

This flag prevents content from using any of the following features to produce modal dialogs:

The sandboxed orientation lock browsing context flag

This flag disables the ability to lock the screen orientation. [SCREENORIENTATION]

The sandboxed presentation browsing context flag

This flag disables the Presentation API. [PRESENTATION]

The sandboxed downloads browsing context flag

This flag prevents content from initiating or instantiating downloads, whether through downloading hyperlinks or through navigation that gets handled as a download.

When the user agent is to parse a sandboxing directive, given a string input, a sandboxing flag set output, it must run the following steps:

  1. Split input on ASCII whitespace, to obtain tokens.

  2. Let output be empty.

  3. Add the following flags to output:


Every top-level browsing context has a popup sandboxing flag set, which is a sandboxing flag set. When a browsing context is created, its popup sandboxing flag set must be empty. It is populated by the rules for choosing a browsing context and the obtain a browsing context to use for a navigation response algorithm.

Every iframe element has an iframe sandboxing flag set, which is a sandboxing flag set. Which flags in an iframe sandboxing flag set are set at any particular time is determined by the iframe element's sandbox attribute.

Every Document has an active sandboxing flag set, which is a sandboxing flag set. When the Document is created, its active sandboxing flag set must be empty. It is populated by the navigation algorithm.

Every resource that is obtained by the navigation algorithm has a forced sandboxing flag set, which is a sandboxing flag set. A resource by default has no flags set in its forced sandboxing flag set, but other specifications can define that certain flags are set.

In particular, the forced sandboxing flag set is used by Content Security Policy. [CSP]


To determine the creation sandboxing flags for a browsing context browsing context, given null or an element embedder, return the union of the flags that are present in the following sandboxing flag sets:

After creation, the sandboxing flags for a browsing context browsing context are the result of determining the creation sandboxing flags given browsing context and browsing context's container.

7.5 Cross-origin opener policies

A cross-origin opener policy value 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. The possible values are:

"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 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.

"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.

A cross-origin opener policy consists of:

To match cross-origin opener policy values, given a cross-origin opener policy value A, an origin originA, a cross-origin opener policy value B, and an origin originB:

  1. If A is "unsafe-none" and B is "unsafe-none", then return true.

  2. If A is "unsafe-none" or B is "unsafe-none", then return false.

  3. If A is B and originA is same origin with originB, then return true.

  4. Return false.

7.5.1 The headers

A Document's cross-origin opener policy is derived from the `Cross-Origin-Opener-Policy` and the `Cross-Origin-Opener-Policy-Report-Only` HTTP response headers. These headers are structured headers whose value must be a token. [STRUCTURED-FIELDS]

The valid token values are the opener policy values. The token may also have attached parameters; of these, the "report-to" parameter can have a valid URL string identifying an appropriate reporting endpoint. [REPORTING]

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 given a response response and an environment reservedEnvironment:

  1. Let policy be a new cross-origin opener policy.

  2. If reservedEnvironment is a non-secure context, then return policy.

  3. Let value be the result of getting a structured field value given `Cross-Origin-Opener-Policy` and "item" from response's header list.

  4. If parsedItem is not null, then:

    1. If parsedItem[0] is "same-origin", then:

      1. Let coep be the result of obtaining a cross-origin embedder policy from response.

      2. If coep's value is "require-corp", then set policy's value to "same-origin-plus-COEP".

      3. Otherwise, set policy's value to "same-origin".

    2. If parsedItem[0] is "same-origin-allow-popups", then set policy's value to "same-origin-allow-popups".

    3. If parsedItem[1]["report-to"] exists and it is a string, then set policy's reporting endpoint to parsedItem[1]["report-to"].

  5. Set parsedItem to the result of getting a structured field value given `Cross-Origin-Opener-Policy-Report-Only` and "item" from response's header list.

  6. If parsedItem is not null, then:

    1. If parsedItem[0] is "same-origin", then:

      1. Let coep be the result of obtaining a cross-origin embedder policy from response.

      2. If coep's value is "require-corp" or coep's report-only value is "require-corp", then set policy's report-only value to "same-origin-plus-COEP".

        Report only COOP also considers report-only COEP to assign the special "same-origin-plus-COEP" value. This allows developers more freedom in the order of deployment of COOP and COEP.

      3. Otherwise, set policy's report-only value to "same-origin".

    2. If parsedItem[0] is "same-origin-allow-popups", then set policy's report-only value to "same-origin-allow-popups".

    3. If parsedItem[1]["report-to"] exists and it is a string, then set policy's report-only reporting endpoint to parsedItem[1]["report-to"].

  7. Return policy.

7.5.2 Browsing context group switches due to cross-origin opener policy

To check if COOP values require a browsing context group switch, given a boolean isInitialAboutBlank, two origins responseOrigin, activeDocumentNavigationOrigin, and two cross-origin opener policy values responseCOOPValue and activeDocumentCOOPValue:

  1. If the result of matching activeDocumentCOOPValue, activeDocumentNavigationOrigin, responseCOOPValue, and responseOrigin is true, return false.

  2. If all of the following are true:

    then return false.

  3. Return true.

To check if enforcing report-only COOP would require a browsing context group switch, given a boolean isInitialAboutBlank, two origins responseOrigin, activeDocumentNavigationOrigin, and two cross-origin opener policies responseCOOP and activeDocumentCOOP:

  1. If the result of checking if COOP values require a browsing context group switch given isInitialAboutBlank, sandboxFlags, responseOrigin, activeDocumentNavigationOrigin, responseCOOP's report-only value and activeDocumentCOOPReportOnly's report-only value is false, then return false.

    Matching report-only policies allows a website to specify the same report-only cross-origin opener policy on all its pages and not receive violation reports for navigations between these pages.

  2. If the result of checking if COOP values require a browsing context group switch given isInitialAboutBlank, sandboxFlags, responseOrigin, activeDocumentNavigationOrigin, responseCOOP's value and activeDocumentCOOPReportOnly's report-only value is true, then return true.

  3. If the result of checking if COOP values require a browsing context group switch given isInitialAboutBlank, sandboxFlags, responseOrigin, activeDocumentNavigationOrigin, responseCOOP's report-only value and activeDocumentCOOPReportOnly's value is true, then return true.

  4. Return false.

A cross-origin opener policy enforcement result is a struct with the following items:

To enforce a response's cross-origin opener policy, given a browsing context browsingContext, a URL responseURL, an origin responseOrigin, a cross-origin opener policy responseCOOP, a cross-origin opener policy enforcement result currentCOOPEnforcementResult, and a referrer referrer:

  1. Let newCOOPEnforcementResult be a new cross-origin opener policy enforcement result whose needs a browsing context group switch is currentCOOPEnforcementResult's needs a browsing context group switch, would need a browsing context group switch due to report-only is currentCOOPEnforcementResult's would need a browsing context group switch due to report-only, url is responseURL, origin is responseOrigin, coop is responseCOOP, and current context is navigation source is true.

  2. Let isInitialAboutBlank be false.

  3. 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.

  4. If isInitialAboutBlank is true and browsingContext's initial URL is null, set browsingContext's initial URL to responseURL.

  5. If the result of checking if COOP values require a browsing context group switch given isInitialAboutBlank, currentCOOPEnforcementResult's cross-origin opener policy's value, currentCOOPEnforcementResult's origin, responseCOOP's value, and responseOrigin is true, then:

    1. Set newCOOPEnforcementResult's needs a browsing context group switch to true.

    2. If browsingContext's group's browsing context set's size is greater than 1, then:

      1. Queue a violation report for browsing context group switch when navigating to a COOP response with responseCOOP, "enforce", responseURL, currentCOOPEnforcementResult's url, currentCOOPEnforcementResult's origin, responseOrigin, and referrer.

      2. Queue a violation report for browsing context group switch when navigating away from a COOP response with activeDocumentCOOP, "enforce", currentCOOPEnforcementResult's url, responseURL, currentCOOPEnforcementResult's origin, responseOrigin, and currentCOOPEnforcementResult's current context is navigation source.

  6. If the result of checking if enforcing report-only COOP would require a browsing context group switch given isInitialAboutBlank, responseOrigin, currentCOOPEnforcementResult's origin, responseCOOP, and currentCOOPEnforcementResult's cross-origin opener policy, is true, then:

    1. Set result's would need a browsing context group switch due to report-only to true.

    2. If browsingContext's group's browsing context set's size is greater than 1, then:

      1. Queue a violation report for browsing context group switch when navigating to a COOP response with responseCOOP, "reporting", responseURL, currentCOOPEnforcementResult's url, currentCOOPEnforcementResult's origin, responseOrigin,and referrer.

      2. Queue a violation report for browsing context group switch when navigating away from a COOP response with activeDocumentCOOP, "reporting", currentCOOPEnforcementResult's url, responseURL, currentCOOPEnforcementResult's origin, responseOrigin, and currentCOOPEnforcementResult's current context is navigation source.

  7. Return newCOOPEnforcementResult.

To obtain a browsing context to use for a navigation response, given a browsing contexts browsingContext, a sandboxing flag set sandboxFlags, a cross-origin opener policy navigationCOOP, and a cross-origin opener policy enforcement result coopEnforcementResult:

  1. Assert: browsingContext is a top-level browsing context.

  2. If coopEnforcementResult's needs a browsing context group switch is false, then:

    1. If coopEnforcementResult's would need a browsing context group switch due to report-only is true, set browsing context's virtual browsing context group ID to a new unique identifier.

    2. Return browsingContext.

  3. Let newBrowsingContext be the result of creating a new top-level browsing context.

  4. If navigationCOOP's value is "same-origin-plus-COEP", then set newBrowsingContext's group's cross-origin isolated to true.

  5. If sandboxFlags is not empty, then:

    1. Assert navigationCOOP's value is "unsafe-none".

    2. Assert: newBrowsingContext's popup sandboxing flag set is empty.

    3. Set newBrowsingContext's popup sandboxing flag set to a clone of sandboxFlags.

  6. Discard browsingContext.

    This has no effect on browsingContext's group, unless browsingContext was its sole top-level browsing context. In that case, the user agent might delete the browsing context group which no longer contains any browsing contexts.

  7. Return newBrowsingContext.

The impact of swapping browsing context groups following a navigation is not fully defined. It is currently under discussion in issue #5350.

7.5.3 Reporting

An accessor-accessed relationship is an enum that describes the relationship between two browsing contexts between which an access happened. It can take the following values:

accessor is opener

The accessor browsing context or one of its ancestors is the opener browsing context of the accessed browsing context's top-level browsing context.

accessor is openee

The accessed browsing context or one of its ancestors is the opener browsing context of the accessor browsing context's top-level browsing context.

none

There is no opener relationship between the accessor browsing context, the accessor browsing context, or any of their ancestors.

To check if an access between two browsing contexts should be reported, given two browsing contexts accessor and accessed, a JavaScript property name P, and an environment settings object environment:

  1. If P is not a cross-origin accessible window property name, then return.

  2. If accessor's active document's origin or any of its ancestors' active document's origins are not same origin with ancestor's top-level browsing context's active document's origin, or if accessed's active document's origin or any of its ancestors' active document's origins are not same origin with accessed's top-level browsing context's active document's origin, then return.

    This avoids leaking information about cross-origin iframes to a top level frame with cross-origin opener policy reporting

  3. If accessor's top-level browsing context's virtual browsing context group ID is accessed's top-level browsing context's virtual browsing context group ID, then return.

  4. Let accessorAccessedRelationship be a new accessor-accessed relationship with value none.

  5. If accessed's top-level browsing context's opener browsing context is accessor or an ancestor of accessor, then set accessorAccessedRelationship to accessor is opener.

  6. If accessor's top-level browsing context's opener browsing context is accessed or an ancestor of accessed, then set accessorAccessedRelationship to accessor is openee.

  7. Queue violation reports for accesses, given accessorAccessedRelationship, accessor's top-level browsing context's active document's cross-origin opener policy, accessed's top-level browsing context's active document's cross-origin opener policy, accessor's active document's URL, accessed's active document's URL, accessor's top-level browsing context's initial URL, accessed's top-level browsing context's initial URL, accessor's active document's origin, accessed's active document's origin, accessor's top-level browsing context's opener origin at creation, accessed's top-level browsing context's opener origin at creation, accessor's top-level browsing context's active document's referrer, accessed's top-level browsing context's active document's referrer, P, and environment.

To sanitize a URL to send in a report given a URL url:

  1. Let sanitizedURL be a copy of url.

  2. Set the username given sanitizedURL and the empty string.

  3. Set the password given sanitizedURL and the empty string.

  4. Return the serialization of sanitizedURL with the exclude fragment flag set.

To queue a violation report for browsing context group switch when navigating to a COOP response given a cross-origin opener policy coop, a string disposition, a URL coopURL, a URL previousResponseURL, two origins coopOrigin and previousResponseOrigin, and a referrer referrer:

  1. If coop's reporting endpoint is null, return.

  2. Let coopValue be coop's value.

  3. If disposition is "reporting", then set coopValue to coop's report-only value.

  4. Let serializedReferrer be an empty string

  5. If referrer is a URL, set serializedReferrer to the serialization of referrer.

  6. Let body be a new object containing the following properties:

    keyvalue
    dispositiondisposition
    effectivePolicycoopValue
    previousResponseURLIf coopOrigin and previousResponseOrigin are same origin this is the sanitization of previousResponseURL, null otherwise.
    referrerserializedReferrer
    type"navigation-to-response"
  7. Queue body as "coop" for coop's reporting endpoint with coopURL.

To queue a violation report for browsing context group switch when navigating away from a COOP response given a cross-origin opener policy coop, a string disposition, a URL coopURL, a URL nextResponseURL, two origins coopOrigin and nextResponseOrigin, and a boolean isCOOPResponseNavigationSource:

  1. If coop's reporting endpoint is null, return.

  2. Let coopValue be coop's value.

  3. If disposition is "reporting", then set coopValue to coop's report-only value.

  4. Let body be a new object containing the following properties:

    keyvalue
    dispositiondisposition
    effectivePolicycoopValue
    nextResponseURLIf coopOrigin and nextResponseOrigin are same origin or isCOOPResponseNavigationSource is true, this is the sanitization of previousResponseURL, null otherwise.
    type"navigation-to-response"
  5. Queue body as "coop" for coop's reporting endpoint with coopURL.

To queue violation reports for accesses, given an accessor-accessed relationship accessorAccessedRelationship, two cross-origin opener policies accessorCOOP and accessedCOOP, four URLs accessorURL, accessedURL, accessorInitialURL, accessedInitialURL, four origins accessorOrigin, accessedOrigin, accessorCreatorOrigin and accessedCreatorOrigin, two referrers accessorReferrer and accessedReferrer, a string propertyName, and an environment settings object environment:

  1. If coop's reporting endpoint is null, return.

  2. Let coopValue be coop's value.

  3. If disposition is "reporting", then set coopValue to coop's report-only value.

  4. If accessorAccessedRelationship is accessor is opener:

    1. Queue a violation report for access to an opened window, given accessorCOOP, accessorURL, accessedURL, accessedInitialURL, accessorOrigin, accessedOrigin, accessedCreatorOrigin, propertyName, and environment.

    2. Queue a violation report for access from the opener, given accessedCOOP, accessedURL, accessorURL, accessedOrigin, accessorOrigin, propertyName, and accessedReferrer.

  5. Otherwise, if accessorAccessedRelationship is accessor is openee:

    1. Queue a violation report for access to the opener, given accessorCOOP, accessorURL, accessedURL, accessorOrigin, accessedOrigin, propertyName, accessorReferrer, and environment.

    2. Queue a violation report for access from an opened window, given accessedCOOP, accessedURL, accessorURL, accessorInitialURL, accessedOrigin, accessorOrigin, accessorCreatorOrigin, and propertyName.

  6. Otherwise:

    1. Queue a violation report for access to another window, given accessorCOOP, accessorURL, accessedURL, accessorOrigin, accessedOrigin, propertyName, and environment

    2. Queue a violation report for access from another window, given accessedCOOP, accessedURL, accessorURL, accessedOrigin, accessorOrigin, and propertyName.

To queue a violation report for access to the opener, given a cross-origin opener policy coop, two URLs coopURL and openerURL, two origins coopOrigin and openerOrigin, a string propertyName, a referrer referrer, and an environment settings object environment:

  1. Let sourceFile, lineNumber and columnNumber be the relevant script URL and problematic position which triggered this report.

  2. Let serializedReferrer be an empty string

  3. If referrer is a URL, set serializedReferrer to the serialization of referrer.

  4. Let body be a new object containing the following properties:

    keyvalue
    disposition"reporting"
    effectivePolicycoop's report-only value
    propertypropertyName
    openerURLIf coopOrigin and openerOrigin are same origin, this is the sanitization of openerURL, null otherwise.
    referrerserializedReferrer
    sourceFilesourceFile
    lineNumberlineNumber
    columnNumbercolumnNumber
    type"access-to-opener"
  5. Queue body as "coop" for coop's reporting endpoint with coopURL and environment.

To queue a violation report for access to an opened window, given a cross-origin opener policy coop, three URLs coopURL, openedWindowURL and initialWindowURL, three origins coopOrigin, openedWindowOrigin, and openerInitialOrigin,a string propertyName, and an environment settings object environment:

  1. Let sourceFile, lineNumber and columnNumber be the relevant script URL and problematic position which triggered this report.

  2. Let body be a new object containing the following properties:

    keyvalue
    disposition"reporting"
    effectivePolicycoop's report-only value
    propertypropertyName
    openedWindowURLIf coopOrigin and openedWindowOrigin are same origin, this is the sanitization of openedWindowURL, null otherwise.
    openedWindowInitialURLIf coopOrigin and openerInitialOrigin are same origin, this is the sanitization of initialWindowURL, null otherwise.
    sourceFilesourceFile
    lineNumberlineNumber
    columnNumbercolumnNumber
    type"access-to-opener"
  3. Queue body as "coop" for coop's reporting endpoint with coopURL and environment.

To queue a violation report for access to another window, given a cross-origin opener policy coop, two URLs coopURL and otherURL, two origins coopOrigin and otherOrigin, a string propertyName, and an environment settings object environment:

  1. Let sourceFile, lineNumber and columnNumber be the relevant script URL and problematic position which triggered this report.

  2. Let body be a new object containing the following properties:

    keyvalue
    disposition"reporting"
    effectivePolicycoop's report-only value
    propertypropertyName
    otherURLIf coopOrigin and otherOrigin are same origin, this is the sanitization of otherURL, null otherwise.
    sourceFilesourceFile
    lineNumberlineNumber
    columnNumbercolumnNumber
    type"access-to-opener"
  3. Queue body as "coop" for coop's reporting endpoint with coopURL and environment.

To queue a violation report for access from the opener, given a cross-origin opener policy coop, two URLs coopURL and openerURL, two origins coopOrigin and openerOrigin, a string propertyName, and a referrer referrer:

  1. If coop's reporting endpoint is null, return.

  2. Let serializedReferrer be an empty string

  3. If referrer is a URL, set serializedReferrer to the serialization of referrer.

  4. Let body be a new object containing the following properties:

    keyvalue
    disposition"reporting"
    effectivePolicycoop's report-only value
    propertypropertyName
    openerURLIf coopOrigin and openerOrigin are same origin, this is the sanitization of openerURL, null otherwise.
    referrerserializedReferrer
    type"access-to-opener"
  5. Queue body as "coop" for coop's reporting endpoint with coopURL.

To queue a violation report for access from an opened window, given a cross-origin opener policy coop, three URLs coopURL, openedWindowURL and initialWindowURL, three origins coopOrigin, openedWindowOrigin, and openerInitialOrigin, and a string propertyName:

  1. If coop's reporting endpoint is null, return.

  2. Let body be a new object containing the following properties:

    keyvalue
    disposition"reporting"
    effectivePolicycoopValue
    propertycoop's report-only value
    openedWindowURLIf coopOrigin and openedWindowOrigin are same origin, this is the sanitization of openedWindowURL, null otherwise.
    openedWindowInitialURLIf coopOrigin and openerInitialOrigin are same origin, this is the sanitization of initialWindowURL, null otherwise.
    type"access-to-opener"
  3. Queue body as "coop" for coop's reporting endpoint with coopURL.

To queue a violation report for access from another window, given a cross-origin opener policy coop, two URLs coopURL and otherURL, two origins coopOrigin and otherOrigin, and a string propertyName:

  1. If coop's reporting endpoint is null, return.

  2. Let body be a new object containing the following properties:

    keyvalue
    disposition"reporting"
    effectivePolicycoop's report-only value
    propertypropertyName
    otherURLIf coopOrigin and otherOrigin are same origin, this is the sanitization of otherURL, null otherwise.
    typeaccess-to-opener
  3. Queue body as "coop" for coop's reporting endpoint with coopURL.

7.6 Cross-origin embedder policies

An embedder policy value controls the fetching of cross-origin resources without explicit permission from resource owners. There are two such values:

"unsafe-none"

This is the default value. When this value is used, cross-origin resources can be fetched without giving explicit permission through the CORS protocol or the `Cross-Origin-Resource-Policy` header.

"require-corp"

When this value is used, fetching cross-origin resources requires the server's explicit permission through the CORS protocol or the `Cross-Origin-Resource-Policy` header.

An embedder policy consists of:

The "coep" report type is a report type whose value is "coep". It is visible to ReportingObservers.

7.6.1 The headers

The `Cross-Origin-Embedder-Policy` and `Cross-Origin-Embedder-Policy-Report-Only` HTTP response header fields allow a server to declare an embedder policy for an environment settings object. These headers are structured headers whose values must be token. [STRUCTURED-FIELDS]

The valid token values are the embedder policy values. The token may also have attached parameters; of these, the "report-to" parameter can have a valid URL string identifying an appropriate reporting endpoint. [REPORTING]

The processing model fails open (by defaulting to "unsafe-none") in the presence of a header that cannot be parsed as a token. This includes inadvertent lists created by combining multiple instances of the `Cross-Origin-Embedder-Policy` header present in a given response:

`Cross-Origin-Embedder-Policy`Final embedder policy value
No header delivered"unsafe-none"
`require-corp`"require-corp"
`unknown-value`"unsafe-none"
`require-corp, unknown-value`"unsafe-none"
`unknown-value, unknown-value`"unsafe-none"
`unknown-value, require-corp`"unsafe-none"
`require-corp, require-corp`"unsafe-none"

(The same applies to `Cross-Origin-Embedder-Policy-Report-Only`.)


To obtain an embedder policy from a response response:

  1. Let policy be a new embedder policy.

  2. Let parsedItem be the result of getting a structured field value with `Cross-Origin-Embedder-Policy` and "item" from response's header list.

  3. If parsedItem is non-null and parsedItem[0] is "require-corp":

    1. Set policy's value to "require-corp".

    2. If parsedItem[1]["report-to"] exists, then set policy's endpoint to parsedItem[1]["report-to"].

  4. Set parsedItem to the result of getting a structured field value with `Cross-Origin-Embedder-Policy-Report-Only` and "item" from response's header list.

  5. If parsedItem is non-null and parsedItem[0] is "require-corp":

    1. Set policy's report-only value to "require-corp".

    2. If parsedItem[1]["report-to"] exists, then set policy's report-only reporting endpoint to parsedItem[1]["report-to"].

  6. Return policy.

7.6.2 Embedder policy checks

To check a navigation response's adherence to its embedder policy given a response response and a browsing context target:

  1. If target is not a child browsing context, then return true.

  2. Let responsePolicy be the result of obtaining an embedder policy from response.

  3. Let parentPolicy be target's container document's embedder policy.

  4. If parentPolicy's report-only value is "require-corp" and responsePolicy's value is "unsafe-none", then queue a cross-origin embedder policy inheritance violation with response, "navigation", parentPolicy's report only reporting endpoint, "reporting", and target's container document's relevant settings object.

  5. If parentPolicy's value is "unsafe-none" or responsePolicy's value is "require-corp", then return true.

  6. Queue a cross-origin embedder policy inheritance violation with response, "navigation", parentPolicy's reporting endpoint, "enforce", and target's container document's relevant settings object.

  7. Return false.

To check a global object's embedder policy given a WorkerGlobalScope workerGlobalScope, an environment settings object owner, and a response response:

  1. If workerGlobalScope is not a DedicatedWorkerGlobalScope object, then return true.

  2. Let policy be workerGlobalScope's embedder policy.

  3. Let ownerPolicy be owner's embedder policy.

  4. If ownerPolicy's report-only value is "require-corp" and policy's value is "unsafe-none", then queue a cross-origin embedder policy inheritance violation with response, "worker initialization", owner's policy's report only reporting endpoint, "reporting", and owner.

  5. If ownerPolicy's value is "unsafe-none" or policy's value is "require-corp", then return true.

  6. Queue a cross-origin embedder policy inheritance violation with response, "worker initialization", owner's policy's reporting endpoint, "enforce", and owner.

  7. Return false.

To queue a cross-origin embedder policy inheritance violation given a response response, a string type, a string endpoint, a string disposition, and an environment settings object settings:

  1. Let serialized be the result of serializing a response URL for reporting with response.

  2. Let body be a new object containing the following properties:

    keyvalue
    typetype
    blockedURLserialized
    dispositiondisposition
  3. Queue body as the "coep" report type for endpoint on settings.