Skip to content
Permalink
Browse files

Fix calls to InitializeHostDefinedRealm

Fixes #3784.
  • Loading branch information...
TimothyGu authored and domenic committed Jul 28, 2018
1 parent db6d0df commit 39c948ba5ec55677e209bc4fc631636f1e8e2baf
Showing with 38 additions and 53 deletions.
  1. +38 −53 source
91 source
<li><p>Let <var>browsingContext</var> be a new <span>browsing context</span>.</p></li>

<li>
<p>Call the JavaScript <span
data-x="js-InitializeHostDefinedRealm">InitializeHostDefinedRealm()</span> abstract operation
with the following customizations:</p>
<p>Let <var>realm execution context</var> be the result of <span>creating a new JavaScript
realm</span> with the following customizations:</p>

<ul>
<li><p>For the global object, create a new <code>Window</code> object
<var>window</var>.</p></li>
<li><p>For the global object, create a new <code>Window</code> object.</p></li>

<li><p>For the global <b>this</b> value, use <var>browsingContext</var>'s
<li><p>For the global <b>this</b> binding, use <var>browsingContext</var>'s
<code>WindowProxy</code> object.</li>
</ul>
</li>

<li>
<p>Let <var>realm execution context</var> be the <span>running JavaScript execution
context</span>.</p>

<p class="note">This is the <span>JavaScript execution context</span> created in the previous
step.</p>
</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>


<ol>
<li>
<p>Call the JavaScript <span
data-x="js-InitializeHostDefinedRealm">InitializeHostDefinedRealm()</span> abstract operation
with the following customizations:</p>
<p>Let <var>realm execution context</var> be the result of <span>creating a new JavaScript
realm</span> with the following customizations:</p>

<ul>
<li><p>For the global object, create a new <code>Window</code> object.</p></li>

<li><p>For the global <b>this</b> value, use <var>browsingContext</var>'s
<li><p>For the global <b>this</b> binding, use <var>browsingContext</var>'s
<code>WindowProxy</code> object.</p></li>
</ul>
</li>

<li>
<p>Let <var>realm execution context</var> be the <span>running JavaScript execution
context</span>.</p>

<p class="note">This is the <span>JavaScript execution context</span> created in the previous
step.</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>
</ol>
field of a <span>JavaScript realm</span>.</p>

<p class="note">In this specification, all <span data-x="JavaScript realm">JavaScript
realms</span> are <span data-x="js-InitializeHostDefinedRealm">initialized</span> with <span
realms</span> are <span data-x="creating a new JavaScript realm">created</span> with <span
data-x="global object">global objects</span> that are either <code>Window</code> or
<code>WorkerGlobalScope</code> objects.</p>

Realm's global object</dfn>.</p></li>

<li><p>Each <span>global object</span> in this specification is created during the <span
data-x="js-InitializeHostDefinedRealm">initialization</span> of a corresponding <span>JavaScript
data-x="creating a new JavaScript realm">creation</span> of a corresponding <span>JavaScript
realm</span>, known as <dfn data-x="concept-global-object-realm" data-export="" data-lt="Realm"
data-dfn-for="global object">the global object's Realm</dfn>.</p></li>

settings object">the environment settings object's global object</dfn>.</p></li>
</ul>

<p>To <dfn data-x="creating a new JavaScript realm">create a new JavaScript realm</dfn>,
optionally with instructions to create a global object or a global <b>this</b> binding (or both),
the following steps are taken:</p>

<ol>
<li><p>Perform <span data-x="js-InitializeHostDefinedRealm">InitializeHostDefinedRealm</span>()
with the provided customizations for creating the global object and the global <b>this</b>
binding.</p></li>

<li>
<p>Let <var>realm execution context</var> be the <span>running JavaScript execution
context</span>.</p>

<p class="note">This is the <span>JavaScript execution context</span> created in the previous
step.</p>
</li>

<li><p>Remove <var>realm execution context</var> from the <span>JavaScript execution context
stack</span>.</p></li>

<li><p>Return <var>realm execution context</var>.</p></li>
</ol>

<hr>

<p>When defining algorithm steps throughout this specification, it is often important to indicate
<var>document</var>, without firing any mutation events.</p></li>

<li>
<p>Call the JavaScript <span
data-x="js-InitializeHostDefinedRealm">InitializeHostDefinedRealm()</span> abstract operation
with the following customizations:</p>
<p>Let <var>realm execution context</var> be the result of <span>creating a new JavaScript
realm</span> with the following customizations:</p>

<ul>
<li><p>For the global object, create a new <code>Window</code> object
<var>window</var>.</p></li>

<li><p>For the global <b>this</b> value, use <var>document</var>'s <span>browsing
<li><p>For the global <b>this</b> binding, use <var>document</var>'s <span>browsing
context</span>'s associated <code>WindowProxy</code>.</p></li>
</ul>

<p class="&#x0058;&#x0058;&#x0058;">This is not universally implemented and can perhaps be
removed; see <a href="https://github.com/whatwg/html/issues/1698">issue #1698</a>.</p>
</li>

<li>
<p>Let <var>realm execution context</var> be the <span>running JavaScript execution
context</span>.</p>

<p class="note">This is the <span>JavaScript execution context</span> created in the previous
step.</p>
</li>

<li><p><span>Set up a window environment settings object</span> with <var>realm execution
context</var>.</p></li>

nested worker), then set <var>parent worker global scope</var> to <var>owner</var>.</p></li>

<li>
<p>Call the JavaScript <span
data-x="js-InitializeHostDefinedRealm">InitializeHostDefinedRealm()</span> abstract
operation with the following customizations:</p>
<p>Let <var>realm execution context</var> be the result of <span>creating a new JavaScript
realm</span> with the following customizations:</p>

<ul>
<li><p>For the global object, if <var>is shared</var> is true, create a new
</ul>
</li>

<li>
<p>Let <var>realm execution context</var> be the <span>running JavaScript execution
context</span>.</p>

<p class="note">This is the <span>JavaScript execution context</span> created in the previous
step.</p>
</li>

<li>
<p>Let <var>worker global scope</var> be the <span data-x="concept-realm-global">global
object</span> of <var>realm execution context</var>'s Realm component.

<p class="note">This is the <code>DedicatedWorkerGlobalScope</code> or
<code>SharedWorkerGlobalScope</code> object created when calling <span
data-x="js-InitializeHostDefinedRealm">InitializeHostDefinedRealm</span>.</p>
<code>SharedWorkerGlobalScope</code> object created in the previous step.</p>
</li>

<li><p><span>Set up a worker environment settings object</span> with <var>realm execution

0 comments on commit 39c948b

Please sign in to comment.
You can’t perform that action at this time.