Skip to content

Commit 9b22d03

Browse files
annevkdomenic
authored andcommitted
Throw for cross-origin [[Delete]] and use "SecurityError" as needed
Returning false for [[Delete]] (on Window and Location objects) would only cause its callers to throw in strict mode. Implementations however always throw. We also decided to throw "SecurityError" for [[DefineOwnProperty]] and [[Set]] (the latter through CrossOriginSet). We did not do this for all internal methods: only those where throwing was unique to their cross-origin behavior. Fixes #1726.
1 parent f7def43 commit 9b22d03

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

source

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -78365,21 +78365,17 @@ console.assert(iframeWindow.frameElement === null);
7836578365
<li><p>Assert: <var>desc</var> is not undefined.</p></li>
7836678366

7836778367
<li>
78368-
<p>If <span>IsAccessorDescriptor</span>(<var>desc</var>) is true, then:</p>
78368+
<p>If <var>desc</var>.[[Set]] is present and its value is not undefined, then:
7836978369

7837078370
<ol>
78371-
<li><p>Let <var>setter</var> be <var>desc</var>.[[Set]].</p></li>
78372-
78373-
<li><p>If <var>setter</var> is undefined, return false.</p></li>
78374-
7837578371
<li><p>Perform ? <span>Call</span>(<var>setter</var>, <var>Receiver</var>,
7837678372
«<var>V</var>»).</p></li>
7837778373

7837878374
<li><p>Return true.</p></li>
7837978375
</ol>
7838078376
</li>
7838178377

78382-
<li><p>Return false.</p></li>
78378+
<li><p>Throw a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
7838378379
</ol>
7838478380

7838578381
<h5><dfn>CrossOriginOwnPropertyKeys</dfn> ( <var>O</var> )</h5>
@@ -79329,22 +79325,28 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7932979325
)</h4>
7933079326

7933179327
<ol>
79332-
<li><p>If <var>P</var> is an <span>array index property name</span>, return false.</p></li>
79333-
7933479328
<li><p>Let <var>W</var> be the value of the
7933579329
[[<span data-x="concept-windowproxy-window">Window</span>]] internal slot of
7933679330
<b>this</b>.</p></li>
7933779331

7933879332
<li>
79339-
<p>If <span>IsPlatformObjectSameOrigin</span>(<var>W</var>) is true, then return ?
79340-
<span>OrdinaryDefineOwnProperty</span>(<var>W</var>, <var>P</var>, <var>Desc</var>).</p>
79333+
<p>If <span>IsPlatformObjectSameOrigin</span>(<var>W</var>) is true, then:
7934179334

79342-
<p class="note">This is a <span>willful violation</span> of the JavaScript specification's
79343-
<span>invariants of the essential internal methods</span> to maintain compatibility with
79344-
existing Web content. See <a href="https://github.com/tc39/ecma262/issues/672">tc39/ecma262
79345-
issue #672</a> for more information. <ref spec=JAVASCRIPT></p>
79335+
<ol>
79336+
<li><p>If <var>P</var> is an <span>array index property name</span>, return false.</p></li>
7934679337

79347-
<li><p>Return false.</p></li>
79338+
<li>
79339+
<p>Return ? <span>OrdinaryDefineOwnProperty</span>(<var>W</var>, <var>P</var>,
79340+
<var>Desc</var>).</p>
79341+
79342+
<p class="note">This is a <span>willful violation</span> of the JavaScript specification's
79343+
<span>invariants of the essential internal methods</span> to maintain compatibility with
79344+
existing Web content. See <a href="https://github.com/tc39/ecma262/issues/672">tc39/ecma262
79345+
issue #672</a> for more information. <ref spec=JAVASCRIPT></p>
79346+
</li>
79347+
</ol>
79348+
79349+
<li><p>Throw a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
7934879350
</ol>
7934979351

7935079352
<h4 id="windowproxy-get">[[Get]] ( <var>P</var>, <var>Receiver</var> )</h4>
@@ -79380,16 +79382,21 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7938079382
<h4 id="windowproxy-delete">[[Delete]] ( <var>P</var> )</h4>
7938179383

7938279384
<ol>
79383-
<li><p>If <var>P</var> is an <span>array index property name</span>, return false.</p></li>
79384-
7938579385
<li><p>Let <var>W</var> be the value of the
7938679386
[[<span data-x="concept-windowproxy-window">Window</span>]] internal slot of
7938779387
<b>this</b>.</p></li>
7938879388

79389-
<li><p>If <span>IsPlatformObjectSameOrigin</span>(<var>W</var>) is true, then return ?
79390-
<span>OrdinaryDelete</span>(<var>W</var>, <var>P</var>).</p></li>
79389+
<li>
79390+
<p>If <span>IsPlatformObjectSameOrigin</span>(<var>W</var>) is true, then:
7939179391

79392-
<li><p>Return false.</p></li>
79392+
<ol>
79393+
<li><p>If <var>P</var> is an <span>array index property name</span>, then return
79394+
false.</p></li>
79395+
79396+
<li><p>Return ? <span>OrdinaryDelete</span>(<var>W</var>, <var>P</var>).</p></li>
79397+
</ol>
79398+
79399+
<li><p>Throw a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
7939379400
</ol>
7939479401

7939579402
<h4 id="windowproxy-ownpropertykeys">[[OwnPropertyKeys]] ( )</h4>
@@ -81740,7 +81747,7 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
8174081747
</ol>
8174181748
</li>
8174281749

81743-
<li><p>Return false.</p></li>
81750+
<li><p>Throw a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
8174481751
</ol>
8174581752

8174681753
<h5 id="location-get">[[Get]] ( <var>P</var>, <var>Receiver</var> )</h5>
@@ -81769,7 +81776,7 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
8176981776
<li><p>If <span>IsPlatformObjectSameOrigin</span>(<b>this</b>) is true, then return ?
8177081777
<span>OrdinaryDelete</span>(<b>this</b>, <var>P</var>).</p></li>
8177181778

81772-
<li><p>Return false.</p></li>
81779+
<li><p>Throw a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
8177381780
</ol>
8177481781

8177581782
<h5 id="location-ownpropertykeys">[[OwnPropertyKeys]] ( )</h5>

0 commit comments

Comments
 (0)