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

Define top level origin of a document #4966

Merged
merged 37 commits into from
Mar 11, 2020
Merged
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
16041a9
Added top level origin definition
shivanigithub Oct 3, 2019
62eb0c6
Change link for navigation
shivanigithub Oct 3, 2019
b4981d0
Fixed parse error
shivanigithub Oct 3, 2019
f484159
Adding top level origin in the navigation section
shivanigithub Oct 10, 2019
e7f6f3e
reverted newline change
shivanigithub Oct 10, 2019
da502cf
Removing trailing whitespace
shivanigithub Oct 10, 2019
3b5fa11
Adding top level origin to environment settings
shivanigithub Oct 24, 2019
52e2d54
Added top-level origin to settings object definition
shivanigithub Oct 25, 2019
f83487d
Feedback
shivanigithub Nov 19, 2019
8d095e0
dfn for top-level origin fixed
shivanigithub Nov 19, 2019
890c4d2
return the var top-level origin
shivanigithub Nov 19, 2019
3bceaf6
Fix some formatting nits
domenic Nov 20, 2019
7b38330
top level origin made mandatory argument and added for workers
shivanigithub Dec 3, 2019
78fc264
fixed parse error
shivanigithub Dec 3, 2019
fbf9e59
format nits
shivanigithub Dec 3, 2019
2c35783
Typographical and grammar fixes
domenic Dec 4, 2019
d464974
feedback
shivanigithub Dec 17, 2019
aa0e97f
Lazy computation of top-level origin
shivanigithub Jan 13, 2020
e135536
Lazy computation of top-level origin
shivanigithub Jan 13, 2020
50ebf05
feedback
shivanigithub Jan 14, 2020
d239858
Small tweaks
domenic Jan 14, 2020
7f63f1e
Return null if discarded
shivanigithub Jan 23, 2020
5915bb0
feedback
shivanigithub Jan 23, 2020
318b1f1
Revert "feedback"
shivanigithub Jan 29, 2020
9d4d898
Revert "Return null if discarded"
shivanigithub Jan 29, 2020
1a22388
Revert "Small tweaks"
shivanigithub Jan 29, 2020
ab45aff
Revert "feedback"
shivanigithub Jan 29, 2020
fcb7d6a
Revert "Lazy computation of top-level origin"
shivanigithub Jan 29, 2020
1451bcf
Revert "Lazy computation of top-level origin"
shivanigithub Jan 29, 2020
0d3ca3a
intended top level browsing context
shivanigithub Feb 12, 2020
a2b7b8f
removing determining the top-level origin
shivanigithub Feb 13, 2020
067bba7
Numbering formatting
shivanigithub Feb 13, 2020
2a84963
parse error fix
shivanigithub Feb 13, 2020
ba3f160
Nits
domenic Feb 18, 2020
89e1fe2
feedback
shivanigithub Mar 8, 2020
bcdd0e9
add back the definition of topLevelBrowsingContext
shivanigithub Mar 9, 2020
7fe83d1
Export "obtaining an agent cluster key" too
domenic Mar 11, 2020
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
61 changes: 52 additions & 9 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -78368,8 +78368,8 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
</ol>

<p>To <dfn data-x="creating a new browsing context">create a new browsing context</dfn>, given
null or a <code>Document</code> object <var>creator</var> and <span>browsing context group</span>
<var>group</var>:</p>
null or a <code>Document</code> object <var>creator</var>, <span>browsing context group</span>
<var>group</var> and an optional <var>intendedTopLevelBrowsingContext</var>:</p>
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved

<!-- Note: Do not append the new browsing context to group as we might be creating a nested browsing
context and not a top level browsing context -->
Expand Down Expand Up @@ -78414,8 +78414,15 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
</ul>
</li>

<li><p><span>Set up a window environment settings object</span> with <var>realm execution
context</var>, and let <var>settingsObject</var> be the result.</p></li>
<li><p>Let <var>topLevelBrowsingContext</var> be <var>intendedTopLevelBrowsingContext</var> if it
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
was given, or <var>browsingContext</var> otherwise.</p></li>

<li><p>Let <var>topLevelOrigin</var> be the result of <span>determining the origin</span> of
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
<var>topLevelBrowsingContext</var>.</p></li>

<li><p>Let <var>settingsObject</var> be the result of <span data-x="set up a window environment
settings object">setting up a window environment settings object</span> given <var>realm
execution context</var> and <var>topLevelOrigin</var>.</p></li>

<li><p>Let <var>document</var> be a new <code>Document</code>, marked as an <span data-x="HTML
documents">HTML document</span> in <span>quirks mode</span>, whose <span
Expand Down Expand Up @@ -78498,10 +78505,13 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
given an element <var>element</var>:</p>

<ol>
<li><p>Let <var>browsingContext</var> be the result of <span>creating a new browsing
context</span> with <var>element</var>'s <span>node document</span> and <var>element</var>'s
<li><p>Let <var>topLevelBrowsingContext</var> be <var>element</var>'s
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
<span>node document</span>'s <span data-x="concept-document-bc">browsing context</span>'s
<span>top-level browsing context</span>'s <span data-x="tlbc group">group</span>.</p></li>
<span>top-level browsing context</span>.</p></li>

<li><p>Let <var>browsingContext</var> be the result of <span>creating a new browsing
context</span> with <var>topLevelBrowsingContext</var>'s <span data-x="tlbc group">group</span>
and <var>topLevelBrowsingContext</var>.</p></li>

<li><p>Set <var>element</var>'s <span>nested browsing context</span> to
<var>browsingContext</var>.</p></li>
Expand Down Expand Up @@ -80545,7 +80555,8 @@ interface <dfn>BarProp</dfn> {
<h4>Script settings for <code>Window</code> objects</h4>

<p>When the user agent is required to <dfn>set up a window environment settings object</dfn>,
given a <span>JavaScript execution context</span> <var>execution context</var> and an optional
given a <span>JavaScript execution context</span> <var>execution context</var>, a
<span>top-level origin</span> <var>top-level origin</var>, and an optional
<span>environment</span> <var>reserved environment</var>, it must run the following steps:</p>

<ol>
Expand Down Expand Up @@ -80625,6 +80636,13 @@ interface <dfn>BarProp</dfn> {

shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
</dd>

shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
<dt>The <span>top-level origin</span></dt>
<dd>

shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
<p>Return <var>top-level origin</var>.</p>

shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
</dd>

<dt>The <span>HTTPS state</span></dt>
<dd>

Expand Down Expand Up @@ -84115,8 +84133,12 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
</ul>
</li>

<li><p>Let <var>top-level origin</var> be the result of <span>determining the origin</span> of
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Same here, it seems using the container document would be sufficient and require less going up the tree (though it might end up with more words I suppose).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A question on how does "browsing context's top-level browsing context" work? If it's such that every browsing context has a reference to its top-level browsing context then we are not really going up the tree here, but just accessing that reference? Searching other places that invoke "browsing context's top-level browsing context", I see examples like 1, 2, 3, etc.

I am not sure how container document would be better, since container document will lead to the parent and we'll have to continue to iterate till the last parent, right?

Copy link
Member

Choose a reason for hiding this comment

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

I agree; I don't see why container document would be better. Top-level browsing context is defined straightforwardly in a way that bottoms out in container document; it's a nice abstraction on top that saves us some typing. (Explicitly: TLBC uses ancestor which uses child browsing context which uses container document.) I don't see why we would avoid using that abstraction when it gives us exactly what we want.

Copy link
Member

Choose a reason for hiding this comment

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

I think grabbing the active document of the top-level browsing context is the problematic aspect here. It might well be changing due to race conditions. Container document could become null I suppose, but that seems safer than a different document.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see how a race condition could be involved. This step is atomic. If you're worried about things spontaneously changing during a single step, both approaches seem equally problematic.

Copy link
Member

Choose a reason for hiding this comment

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

It's currently atomic because the spec is rather blind to site isolation. It also seems nicer to me if top-level origin works recursively.

the <var>browsingContext</var>'s <span>top-level browsing context</span>.</p></li>

<li><p><span>Set up a window environment settings object</span> with <var>realm execution
context</var> and <var>reservedEnvironment</var>, if present.</p></li>
context</var>, <var>top-level origin</var>, and <var>reservedEnvironment</var>, if
present.</p></li>
</ol>
</li>
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -88285,6 +88307,15 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {

</dd>

<dt>A <dfn data-export="" data-dfn-for="environment settings object">top-level origin</dfn></dt>
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved

<dd>
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved

<p>The <span>origin</span> of the <span>top-level browsing context</span> at the time
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
this settings object was set up.</p>

</dd>

<dt>An <dfn data-export="" data-dfn-for="environment settings object">HTTPS state</dfn></dt>

<dd><p>An <span>HTTPS state value</span> representing the security properties of the network
Expand Down Expand Up @@ -100668,6 +100699,18 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {

</dd>

shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
<dt>The <span>top-level origin</span></dt>
<dd>

<p>Return <var>outside settings</var>'s <span>top-level origin</span> for a dedicated
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
worker.</p>

<p class="XXX">For shared and service workers this is still undefined and is being worked on,
since such workers could be associated with multiple <span data-x="top-level browsing
context">top-level browsing contexts</span>.</p>

</dd>

<dt>The <span>HTTPS state</span></dt>
<dd>

Expand Down