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鈥檒l 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 1 commit
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Feedback
  • Loading branch information
shivanigithub committed Nov 19, 2019
commit f83487dc53d03022c3ab561b65c0fbad85681ba3
43 changes: 25 additions & 18 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -78367,6 +78367,18 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
<li><p>Return <var>url</var>'s <span data-x="concept-url-origin">origin</span>.</p></li>
</ol>

<p>To <dfn data-x="determining the top-level origin">determine the top-level origin</dfn>, given
<span>browsing context</span> <var>browsingContext</var>:</p>

shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
<ol>
<li><p>If <var>browsingContext</var> is a <span>top-level browsing context</span>, then return
the result of <span>determining the origin</span>.</p></li>

<li><p>If <var>browsingContext</var> is a <span>child browsing context</span>, then return the
result of <span>determining the origin</span> of the <span>top-level browsing context</span> of
<var>browsingContext</var>.</p></li>
</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>
Expand Down Expand Up @@ -78414,19 +78426,8 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
</ul>
</li>

<li><p>Let <var>top-level origin</var> be the result of <dfn data-x="determining the top-level origin">
determining the top-level origin</dfn>, given <var>browsingContext</var>:
<ul>
<li><p>If <var>browsingContext</var> is a <span>top-level browsing context</span>, then return
<var>origin</var>.</p></li>

<li><p>If <var>browsingContext</var> is a <span>child browsing context</span>, then return the
result of <span>determining the origin</span> of the <span>top-level browsing context</span> of
<var>browsingContext</var>.</p></li>
</ul>

<li><p><span>Set up a window environment settings object</span> with <var>realm execution
domenic marked this conversation as resolved.
Show resolved Hide resolved
context</var>, <var>top-level origin</var> and let <var>settingsObject</var> be the result.</p></li>
context</var> and let <var>settingsObject</var> be the result.</p></li>
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved

<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 @@ -80556,8 +80557,9 @@ 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
<span>environment</span> <var>reserved environment</var>, it must run the following steps:</p>
given a <span>JavaScript execution context</span> <var>execution context</var>, an optional
<span>environment</span> <var>reserved environment</var> and an optional <span>top-level
origin</span> <var>top-level origin</var>, it must run the following steps:</p>

<ol>
<li><p>Let <var>realm</var> be the value of <var>execution context</var>'s Realm
Expand Down Expand Up @@ -80639,8 +80641,8 @@ interface <dfn>BarProp</dfn> {
<dt>The <span data-x="concept-settings-object-top-level-origin">top-level origin</span></dt>
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
<dd>

shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
<p>Return the result of <span>determining the top-level origin</span> of <var>window</var>'s <span
data-x="concept-document-window">associated <code>Document</code></span>.</p>
<p>Return the the top-level origin of <var>window</var>'s
<span data-x="concept-document-window">associated <code>Document</code></span>.</p>

</dd>

Expand Down Expand Up @@ -84134,8 +84136,12 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
</ul>
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.

</li>

<li><p>Let <var>top-level origin</var> be the result of <span>determining the top-level origin
</span>

<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>reservedEnvironment</var>, if present and <var>top-level origin</var>.
shivanigithub marked this conversation as resolved.
Show resolved Hide resolved
</p></li>
</ol>
</li>

Expand Down Expand Up @@ -88309,7 +88315,8 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {

<dd>

<p>A top-level <span>origin</span> used in security checks.</p>
<p>The <span>origin</span> of the top-level browsing context at the time
this settings object was set up.</p>

</dd>

Expand Down