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

COOP: modify redirects handling #5739

Merged
merged 2 commits into from
Sep 10, 2020
Merged
Changes from all 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
82 changes: 55 additions & 27 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -80464,18 +80464,33 @@ interface <dfn>BarProp</dfn> {

<h4>Browsing context group switches due to cross-origin opener policy</h4>

<p>To <dfn data-x="check-browsing-context-group-switch-response">check if a response requires a
browsing context group switch</dfn>, given a <span>browsing context</span>
<var>browsingContext</var>, an <span>origin</span> <var>responseOrigin</var> and a
<span>cross-origin opener policy</span> <var>responseCOOP</var>:</p>
<p>A <dfn data-x="coop-enforcement-result">cross-origin opener policy enforcement result</dfn> is
a <span>struct</span> with the following <span data-x="struct item">items</span>:</p>

<ol>
<li><p>Let <var>activeDocumentNavigationOrigin</var> be <var>browsingContext</var>'s <span>active
document</span>'s <span>origin</span>.</p></li>
<ul>
<li><p>A boolean <dfn data-x="coop-enforcement-bcg-switch">needs a browsing context group
switch</dfn>.</p></li>

<li><p>Let <var>activeDocumentCOOP</var> be <var>browsingContext</var>'s <span>active
document</span>'s <span data-x="concept-document-coop">cross-origin opener
policy</span>.</p></li>
<li><p>An <span>origin</span> <dfn data-x="coop-enforcement-origin">origin</dfn>.</p></li>

<li><p>A <span>cross-origin opener policy</span> <dfn
data-x="coop-enforcement-coop">cross-origin opener policy</dfn>.</p></li>
</ul>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to call this current origin or origin? The term used is not consistent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just origin will be simpler. I have changed the name here and below.

<p>To <dfn data-x="coop-enforce">enforce a response's cross-origin opener policy</dfn>, given a
<span>browsing context</span> <var>browsingContext</var>, an <span>origin</span>
<var>responseOrigin</var>, a <span>cross-origin opener policy</span> <var>responseCOOP</var>, and
a <span data-x="coop-enforcement-result">cross-origin opener policy enforcement result</span>
<var>currentCOOPEnforcementResult</var>:</p>

<ol>
<li><p>Let <var>newCOOPEnforcementResult</var> be a new <span
data-x="coop-enforcement-result">cross-origin opener policy enforcement result</span> whose <span
data-x="coop-enforcement-bcg-switch">needs a browsing context group switch</span> is
<var>currentCOOPEnforcementResult</var>'s <span data-x="coop-enforcement-bcg-switch">needs a
browsing context group switch</span>, <span data-x="coop-enforcement-origin">origin</span> is
<var>responseOrigin</var>, and <span data-x="coop-enforcement-coop">cross-origin opener
policy</span> is <var>responseCOOP</var>.</p></li>

<li><p>Let <var>isInitialAboutBlank</var> be false.</p></li>

Expand All @@ -80485,26 +80500,34 @@ interface <dfn>BarProp</dfn> {
<var>isInitialAboutBlank</var> to true.</p></li>

<li><p>If the result of <span data-x="matching-coop">matching</span>
<var>activeDocumentCOOP</var>, <var>activeDocumentNavigationOrigin</var>,
<var>responseCOOP</var> and <var>responseOrigin</var> is true, then return false.</p></li>
<var>currentCOOPEnforcementResult</var>'s <span
data-x="coop-enforcement-coop">cross-origin opener policy</span>,
<var>currentCOOPEnforcementResult</var>'s <span
data-x="coop-enforcement-origin">origin</span>,
<var>responseCOOP</var>, and <var>responseOrigin</var> is true, then return
<var>newCOOPEnforcementResult</var>.</p></li>

<li>
<p>If all of the following are true:</p>

<ul>
<ul class="brief">
<li><p><var>isInitialAboutBlank</var></p></li>

<li><p><var>activeDocumentCOOP</var> is "<code
data-x="coop-same-origin-allow-popups">same-origin-allow-popups</code>".</p></li>
<li><p><var>currentCOOPEnforcementResult</var>'s <span
data-x="coop-enforcement-coop">cross-origin opener policy</span> is "<code
data-x="coop-same-origin-allow-popups">same-origin-allow-popups</code>"</p></li>

<li><p><var>responseCOOP</var> is "<code
data-x="coop-unsafe-none">unsafe-none</code>".</p></li>
data-x="coop-unsafe-none">unsafe-none</code>"</p></li>
</ul>

<p>then return false.</p>
<p>then return <var>newCOOPEnforcementResult</var>.</p>
</li>

<li><p>Return true.</p></li>
<li><p>Set <var>newCOOPEnforcementResult</var>'s <span data-x="coop-enforcement-bcg-switch">needs
a browsing context group switch</span> to true.</p></li>

<li><p>Return <var>newCOOPEnforcementResult</var>.</p></li>
</ol>

<p>To <dfn data-x="obtain-browsing-context-navigation">obtain a browsing context to use for a
Expand Down Expand Up @@ -82880,7 +82903,14 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface

<li><p>Let <var>responseOrigin</var> be null.

<li><p>Let <var>browsingContextSwitchNeeded</var> be false.</p></li>
<li><p>Let <var>coopEnforcementResult</var> be a new <span
data-x="coop-enforcement-result">cross-origin opener policy enforcement result</span> whose <span
data-x="coop-enforcement-bcg-switch">needs a browsing context group switch</span> is false, <span
data-x="coop-enforcement-origin">origin</span> is <var>browsingContext</var>'s
<span>active document</span>'s <span>origin</span>, and <span
data-x="coop-enforcement-coop">cross-origin opener policy</span> is <var>browsingContext</var>'s
<span>active document</span>'s <span data-x="concept-document-coop">cross-origin opener
policy</span>.</p></li>

<li><p>Let <var>finalSandboxFlags</var> be an empty <span>sandboxing flag set</span>.</p></li>

Expand Down Expand Up @@ -82999,13 +83029,10 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
navigating to that response.</p>
</li>

<li><p>Let <var>responseRequiresBrowsingContexGroupSwitch</var> be the result of <span
data-x="check-browsing-context-group-switch-response">checking if the response requires a
browsing context group switch</span> given <var>browsingContext</var>,
<var>responseOrigin</var>, and <var>responseCOOP</var>.</p></li>

<li><p>If <var>responseRequiresBrowsingContextGroupSwitch</var> is true, set
<var>browsingContextSwitchNeeded</var> to true.</p></li>
<li><p>Set <var>coopEnforcementResult</var> to the result of <span
data-x="coop-enforce">enforcing the response's cross-origin opener policy</span> given
<var>browsingContext</var>, <var>responseOrigin</var>, <var>responseCOOP</var>, and
<var>coopEnforcementResult</var>.</p></li>
</ol>
</li>

Expand Down Expand Up @@ -83137,7 +83164,8 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
<var>reservedEnvironment</var>, <span data-x="navigation-params-browsing-context">browsing
context</span> is <var>browsingContext</var>, <span
data-x="navigation-params-bc-switch-needed">browsing context switch needed</span> is
<var>browsingContextSwitchNeeded</var>, and <span data-x="navigation-params-hh">history
<var>coopEnforcementResult</var>'s <span data-x="coop-enforcement-bcg-switch">needs a browsing
context group switch</span>, and <span data-x="navigation-params-hh">history
handling</span> is <var>historyHandling</var>.</p></li>

<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>, the
Expand Down