Skip to content

Commit c41ac69

Browse files
committed
Add the Origin-Isolation header
See https://github.com/WICG/origin-isolation.
1 parent b868520 commit c41ac69

File tree

1 file changed

+184
-13
lines changed

1 file changed

+184
-13
lines changed

source

Lines changed: 184 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,6 +2460,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
24602460

24612461
<ul class="brief">
24622462
<li><dfn data-x="http-structured-header" data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html">structured header</dfn></li>
2463+
<li><dfn data-x="http-structured-header-boolean" data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html#boolean">boolean</dfn></li>
24632464
<li><dfn data-x="http-structured-header-token" data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html#token">token</dfn></li>
24642465
<li><dfn data-x="http-structured-header-parameters" data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html#param">parameters</dfn></li>
24652466
</ul>
@@ -2873,6 +2874,18 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
28732874
</dd>
28742875

28752876

2877+
<dt>WebAssembly</dt>
2878+
2879+
<dd>
2880+
<p>The following term is defined in <cite>WebAssembly JavaScript Interface</cite>: <ref
2881+
spec=WASMJS></p>
2882+
2883+
<ul class="brief">
2884+
<li><dfn data-x-href="https://webassembly.github.io/spec/js-api/#module"><code>WebAssembly.Module</code></dfn></li>
2885+
</ul>
2886+
</dd>
2887+
2888+
28762889
<dt>DOM</dt>
28772890

28782891
<dd>
@@ -76788,7 +76801,7 @@ popup4.close();</code></pre></div>
7678876801

7678976802
<li><p>Let <var>agent</var> be the result of <span
7679076803
data-x="obtain-similar-origin-window-agent">obtaining a similar-origin window agent</span> given
76791-
<var>origin</var> and <var>group</var>.</p></li>
76804+
<var>origin</var>, <var>group</var>, and false.</p></li>
7679276805

7679376806
<li>
7679476807
<p>Let <var>realm execution context</var> be the result of <span>creating a new JavaScript
@@ -77383,6 +77396,15 @@ console.assert(iframeWindow.frameElement === null);
7738377396
<p>A <span>browsing context group</span> has a <dfn data-x="bcg cross-origin
7738477397
isolated">cross-origin isolated</dfn> boolean. It is initially false.</p>
7738577398

77399+
<p>A <span>browsing context group</span> has an associated <dfn>historical agent cluster key
77400+
map</dfn>, which is a <span data-x="ordered map">map</span> of <span
77401+
data-x="origin">origins</span> to <span data-x="agent cluster key">agent cluster keys</span>. This
77402+
map is used to ensure the consistency of the <a href="#origin-isolation">origin isolation</a>
77403+
feature by recording what agent cluster keys were previously used for a given origin.</p>
77404+
77405+
<p class="note">The <span>historical agent cluster key map</span> only ever gains entries over the
77406+
lifetime of the browsing context group.</p>
77407+
7738677408
<p>To <dfn data-x="creating a new browsing context group">create a new browsing context
7738777409
group</dfn>, run these steps:</p>
7738877410

@@ -78090,6 +78112,7 @@ interface <dfn data-export="" data-dfn-type="interface">Window</dfn> : <span>Eve
7809078112
// the user agent
7809178113
readonly attribute <span>Navigator</span> <span data-x="dom-navigator">navigator</span>; <!-- IE also has window.clientInformation === window.navigator -->
7809278114
[SecureContext] readonly attribute <span>ApplicationCache</span> <span data-x="dom-applicationCache">applicationCache</span>;
78115+
readonly attribute boolean <span data-x="dom-originIsolated">originIsolated</span>;
7809378116

7809478117
// user prompts
7809578118
void <span data-x="dom-alert">alert</span>();
@@ -79730,8 +79753,8 @@ interface <dfn>BarProp</dfn> {
7973079753
data-x="concept-document-bc">browsing context</span>, and when the "<code
7973179754
data-x="document-domain-feature">document-domain</code>" feature is disabled, the setter will
7973279755
throw a <span>"<code>SecurityError</code>"</span> exception. In cases where <code
79733-
data-x="dom-crossOriginIsolated">crossOriginIsolated</code> returns true, the setter will do
79734-
nothing.</p>
79756+
data-x="dom-crossOriginIsolated">crossOriginIsolated</code> or <code
79757+
data-x="dom-originIsolated">originIsolated</code> return true, the setter will do nothing.</p>
7973579758
</dd>
7973679759
</dl>
7973779760

@@ -79792,6 +79815,9 @@ interface <dfn>BarProp</dfn> {
7979279815
<li><p>If the <span>surrounding agent</span>'s <span>agent cluster</span>'s <span>cross-origin
7979379816
isolated</span> is true, then return.</p></li>
7979479817

79818+
<li><p>If the <span>surrounding agent</span>'s <span>agent cluster</span>'s
79819+
<span>origin-isolated</span> is true, then return.</p></li>
79820+
7979579821
<li><p>Set <var>this</var>'s <span>origin</span>'s <span
7979679822
data-x="concept-origin-domain">domain</span> to the result of <span data-x="host
7979779823
parser">parsing</span> the given value.</p></li>
@@ -79840,6 +79866,66 @@ interface <dfn>BarProp</dfn> {
7984079866

7984179867

7984279868

79869+
<h4>Origin isolation</h4>
79870+
79871+
<dl class="domintro">
79872+
<dt>window . <code subdfn data-x="dom-originIsolated">originIsolated</code></dt>
79873+
79874+
<dd>
79875+
<p>Returns true if this <code>Window</code> is origin-isolated in the manner described in this
79876+
section.</p>
79877+
</dd>
79878+
</dl>
79879+
79880+
<p>A <code>Document</code> delivered over a <span>secure context</span> can opt in to origin
79881+
isolation, by using the `<code data-x="http-origin-isolation">Origin-Isolation</code>` HTTP
79882+
response header. This header is a <span data-x="http-structured-header">structured header</span>
79883+
whose value must be a <span data-x="http-structured-header-boolean">boolean</span>. <ref
79884+
spec=STRUCTURED-HEADERS></p>
79885+
79886+
<p><span w-nodev>Per the processing model in the <span data-x="create-the-document-object">create
79887+
and initialize a new <code>Document</code> object</span>, values</span><span
79888+
w-nohtml>Values</span> that are not the <span data-x="http-structured-header-boolean">structured
79889+
header boolean</span> true value (i.e., `<code data-x="">?1</code>`) will be ignored.</p>
79890+
79891+
<p>The consequences of using this header are that <span w-nodev>the resulting
79892+
<code>Document</code>'s <span>agent cluster key</span> is its <span>origin</span>, instead of the
79893+
<span data-x="obtain a site">corresponding site</span>. In terms of observable effects, this means
79894+
that </span>attempting to <a href="#relaxing-the-same-origin-restriction">relax the same-origin
79895+
restriction</a> using <code data-x="dom-document-domain">document.domain</code> will instead do
79896+
nothing, and it will not be possible to send <code>WebAssembly.Module</code> objects to
79897+
cross-origin <code>Document</code>s (even if they are <span>same site</span>). Behind the scenes,
79898+
this isolation can allow user agents to allocate implementation-specific resources corresponding
79899+
to <span data-x="agent cluster">agent clusters</span>, such as processes or threads, more
79900+
efficiently.</p>
79901+
79902+
<p>Note that within a <span>browsing context group</span>, the `<code
79903+
data-x="http-origin-isolation">Origin-Isolation</code>` header can never cause same-origin
79904+
<code>Document</code> objects to end up in different <span data-x="agent cluster">agent
79905+
clusters</span>, even if one sends the header and the other doesn't.<span w-nodev> This is
79906+
prevented by means of the <span>historical agent cluster key map</span>.</span></p>
79907+
79908+
<p class="note">This means that the <code data-x="dom-originIsolated">originIsolated</code> getter
79909+
could return false, even if the header is set, if the header was omitted on a previously-loaded
79910+
same-origin page in the same <span>browsing context group</span>. Similarly, it could return true
79911+
even when the header is not set.</p>
79912+
79913+
<p w-nodev>The <dfn><code data-x="dom-originIsolated">originIsolated</code></dfn> getter steps are
79914+
to return the <span>surrounding agent</span>'s <span>agent cluster</span>'s
79915+
<span>origin-isolated</span>.</p>
79916+
79917+
<p class="note"><code>Document</code>s for which <span>obtain a site</span> returns an
79918+
<span>origin</span> can be considered unconditionally origin-isolated; for them the header has no
79919+
effect.</p>
79920+
79921+
<p class="note">Similarly, <code>Document</code>s in a <span>cross-origin isolated</span>
79922+
<span>agent cluster</span> are automatically origin-isolated, with no need for the additional
79923+
`<code data-x="http-origin-isolation">Origin-Isolation</code>` header on top of the `<code
79924+
data-x="http-cross-origin-opener-policy">Cross-Origin-Opener-Policy</code>` and
79925+
`<code>Cross-Origin-Embedder-Policy</code>` headers used to achieve cross-origin isolation.</p>
79926+
79927+
79928+
7984379929
<h3>Sandboxing</h3>
7984479930

7984579931
<p>A <dfn data-export="">sandboxing flag set</dfn> is a set of zero or more of the following
@@ -83197,10 +83283,24 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8319783283
<p>Otherwise:</p>
8319883284

8319983285
<ol>
83286+
<li><p>Let <var>oiHeader</var> be the result of <span
83287+
data-x="concept-response-header-list-get-structured-header">getting a structured header</span>
83288+
given `<code data-x="http-origin-isolation">Origin-Isolation</code>` and "<code
83289+
data-x="">item</code>" from <var>response</var>'s <span
83290+
data-x="concept-response-header-list">header list</span>.</p></li>
83291+
83292+
<li><p>Let <var>requestsOI</var> be true if <var>oiHeader</var> is not failure,
83293+
<var>oiHeader</var> is not null, and <var>oiHeader</var>[0] is the <span
83294+
data-x="http-structured-header-boolean">boolean</span> true.</p></li>
83295+
83296+
<li><p>If <var>reservedEnvironment</var> is a <span>non-secure context</span>, or
83297+
<var>response</var>'s <span>HTTPS state</span> is "<code data-x="">deprecated</code>", then
83298+
set <var>requestsOI</var> to false.</p></li>
83299+
8320083300
<li><p>Let <var>agent</var> be the result of <span
83201-
data-x="obtain-similar-origin-window-agent">obtaining a similar-origin window agent</span> given
83202-
<var>origin</var> and <var>browsingContext</var>'s <span data-x="tlbc
83203-
group">group</span>.</p></li>
83301+
data-x="obtain-similar-origin-window-agent">obtaining a similar-origin window agent</span>
83302+
given <var>origin</var>, <var>browsingContext</var>'s <span data-x="tlbc group">group</span>,
83303+
and <var>requestsOI</var>.</p></li>
8320483304

8320583305
<li>
8320683306
<p>Let <var>realm execution context</var> be the result of <span>creating a new JavaScript
@@ -87073,10 +87173,13 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8707387173
ensure that web developers see interoperable behavior with regard to shared memory, even in the
8707487174
face of varying and changing user agent process models.</p>
8707587175

87176+
<div w-nodev>
87177+
8707687178
<p>An <span>agent cluster</span> has an associated <dfn>cross-origin isolated</dfn> (a boolean),
8707787179
which is initially false.</p>
8707887180

87079-
<div w-nodev>
87181+
<p>An <span>agent cluster</span> has an associated <dfn>origin-isolated</dfn> (a boolean), which
87182+
is initially false.</p>
8708087183

8708187184
<hr>
8708287185

@@ -87090,16 +87193,44 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8709087193
<span>origin</span>.</p>
8709187194

8709287195
<p>To <dfn data-x="obtain-similar-origin-window-agent">obtain a similar-origin window agent</dfn>,
87093-
given an <span>origin</span> <var>origin</var> and <span>browsing context group</span>
87094-
<var>group</var>, run these steps:</p>
87196+
given an <span>origin</span> <var>origin</var>, a <span>browsing context group</span>
87197+
<var>group</var>, and a boolean <var>requestsOI</var>, run these steps:</p>
8709587198

8709687199
<ol>
87097-
<li><p>Let <var>key</var> be the result of <span data-x="obtain a site">obtaining a
87098-
site</span> with <var>origin</var>.</p></li>
87200+
<li><p>Let <var>site</var> be the result of <span data-x="obtain a site">obtaining a site</span>
87201+
with <var>origin</var>.</p></li>
87202+
87203+
<li><p>Let <var>key</var> be <var>site</var>.</p></li>
8709987204

8710087205
<li><p>If <var>group</var>'s <span data-x="bcg cross-origin isolated">cross-origin
8710187206
isolated</span> is true, then set <var>key</var> to <var>origin</var>.</p></li>
8710287207

87208+
<li>
87209+
<p>If <var>group</var>'s <span>historical agent cluster key map</span>[<var>origin</var>]
87210+
<span data-x="map exists">exists</span>, then:</p>
87211+
87212+
<ol>
87213+
<li><p>Assert: if <var>group</var>'s <span data-x="bcg cross-origin isolated">cross-origin
87214+
isolated</span> is true, then <var>group</var>'s <span>historical agent cluster key
87215+
map</span>[<var>origin</var>] will be <var>origin</var>, and in that case the next step will be
87216+
a no-op. I.e., cross-origin isolation always implies origin isolation.</p></li>
87217+
87218+
<li><p>Set <var>key</var> to <var>group</var>'s <span>historical agent cluster key
87219+
map</span>[<var>origin</var>].</p></li>
87220+
</ol>
87221+
</li>
87222+
87223+
<li>
87224+
<p>Otherwise:</p>
87225+
87226+
<ol>
87227+
<li><p>If <var>requestsOI</var> is true, then set <var>key</var> to <var>origin</var>.</p></li>
87228+
87229+
<li><p>Set <var>group</var>'s <span>historical agent cluster key map</span>[<var>origin</var>]
87230+
to <var>key</var>.</p></li>
87231+
</ol>
87232+
</li>
87233+
8710387234
<li>
8710487235
<p>If <var>group</var>'s <span>agent cluster map</span>[<var>key</var>] <span data-x="map
8710587236
exists">does not exist</span>, then:</p>
@@ -87110,6 +87241,9 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8711087241
<li><p>Set <var>agentCluster</var>'s <span>cross-origin isolated</span> to <var>group</var>'s
8711187242
<span data-x="bcg cross-origin isolated">cross-origin isolated</span>.</p></li>
8711287243

87244+
<li><p>Set <var>agentCluster</var>'s <span>origin-isolated</span> to true if <var>key</var>
87245+
equals <var>origin</var>; otherwise false.</p></li>
87246+
8711387247
<li><p>Add the result of <span data-x="create an agent">creating an agent</span>, given false,
8711487248
to <var>agentCluster</var>.</p></li>
8711587249

@@ -87139,8 +87273,22 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
8713987273
<ol>
8714087274
<li><p>Let <var>agentCluster</var> be null.
8714187275

87142-
<li><p>If <var>isTopLevel</var> is true, then set <var>agentCluster</var> to a new <span>agent
87143-
cluster</span>.</p></li>
87276+
<li>
87277+
<p>If <var>isTopLevel</var> is true, then:</p>
87278+
87279+
<ol>
87280+
<li><p>Set <var>agentCluster</var> to a new <span>agent cluster</span>.</p></li>
87281+
87282+
<li>
87283+
<p>Set <var>agentCluster</var>'s <span>origin-isolated</span> to true.</p>
87284+
87285+
<p class="note">These workers/worklets can be considered to be origin-isolated. However, this
87286+
is not exposed through any APIs (in the way that <code
87287+
data-x="dom-originIsolated">originIsolated</code> exposes the origin-isolation state for
87288+
windows).</p>
87289+
</li>
87290+
</ol>
87291+
</li>
8714487292

8714587293
<li>
8714687294
<p>Otherwise:</p>
@@ -116947,6 +117095,29 @@ interface <dfn>External</dfn> {
116947117095
</dl>
116948117096

116949117097

117098+
<h3>`<dfn><code data-x="http-origin-isolation">Origin-Isolation</code></dfn>`</h3>
117099+
117100+
<p>This section describes a header for registration in the Permanent Message Header Field
117101+
Registry. <ref spec=RFC3864></p>
117102+
117103+
<dl>
117104+
<dt>Header field name:</dt>
117105+
<dd>Origin-Isolation</dd>
117106+
<dt>Applicable protocol:</dt>
117107+
<dd>http</dd>
117108+
<dt>Status:</dt>
117109+
<dd>standard</dd>
117110+
<dt>Author/Change controller:</dt>
117111+
<dd>WHATWG</dd>
117112+
<dt>Specification document(s):</dt>
117113+
<dd>
117114+
This document is the relevant specification.
117115+
</dd>
117116+
<dt>Related information:</dt>
117117+
<dd>None.</dd>
117118+
</dl>
117119+
117120+
116950117121
<h3 id="ping-from">`<dfn><code data-x="http-ping-from">Ping-From</code></dfn>`</h3>
116951117122

116952117123
<p>This section describes a header for registration in the Permanent Message Header Field

0 commit comments

Comments
 (0)