Skip to content

Commit

Permalink
[giow] (0) Make structured clone handle getters.
Browse files Browse the repository at this point in the history
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=12101

git-svn-id: http://svn.whatwg.org/webapps@6185 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 3, 2011
1 parent 45c598c commit bae275e
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 54 deletions.
52 changes: 35 additions & 17 deletions complete.html
Expand Up @@ -8462,14 +8462,19 @@ <h4 id=safe-passing-of-structured-data><span class=secno>2.8.5 </span>Safe passi

<li><p>Let <var title="">output</var> be the value resulting from
calling the <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> with
<var title="">input</var> and <var title="">memory</var>.</li>
<var title="">input</var> as the "<var title="">input</var>"
argument, <var title="">memory</var> as the "<var title="">memory</var>" argument, and zero as the "<var title="">depth</var>" argument.</li>

<li><p>Return <var title="">output</var>.</li>

</ol><p>The <dfn id=internal-structured-cloning-algorithm>internal structured cloning algorithm</dfn> is always
called with two arguments, <var title="">input</var> and <var title="">memory</var>, and its behavior is as follows:</p>
called with three arguments, <var title="">input</var>, <var title="">memory</var>, and <var title="">depth</var>, and its
behavior is as follows:</p>

<ol><li><p>If <var title="">input</var> is the source object of a pair
<ol><li><p>If <var title="">depth</var> is greater than 1, return null
and abort these steps.</li>

<li><p>If <var title="">input</var> is the source object of a pair
of objects in <var title="">memory</var>, then return the
destination object in that pair of objects and abort these
steps.</li>
Expand Down Expand Up @@ -8555,9 +8560,17 @@ <h4 id=safe-passing-of-structured-data><span class=secno>2.8.5 </span>Safe passi
object, then, for each enumerable property in <var title="">input</var>, add a new property to <var title="">output</var> having the same name, and having a value
created from invoking the <a href=#internal-structured-cloning-algorithm>internal structured cloning
algorithm</a> recursively with the value of the property as the
"<var title="">input</var>" argument and <var title="">memory</var> as the "<var title="">memory</var>"
argument. The order of the properties in the <var title="">input</var> and <var title="">output</var> objects must
be the same.</p>
"<var title="">input</var>" argument, <var title="">memory</var>
as the "<var title="">memory</var>" argument, and <span title=""><var title="">depth</var>+<var title="">newDepth</var></span> as the "<var title="">depth</var>"
argument, where <var title="">newDepth</var> is zero except if
obtaining the value of the property involved executing script, in
which case it is one (1). The order of the properties in the <var title="">input</var> and <var title="">output</var> objects must
be the same, and any properties that involve running script must
be processed in that same order. If obtaining the value of the
property involved executing script, and that script threw an
uncaught exception, then abort the overall <a href=#structured-clone>structured
clone</a> algorithm, with that exception being passed through
to the caller.</p>

<p class=note>This does not walk the prototype chain.</p>

Expand Down Expand Up @@ -62730,7 +62743,7 @@ <h4 id=the-history-interface><span class=secno>6.4.2 </span>The <code><a href=#h
<p>When either of these methods is invoked, the user agent must run
the following steps:</p>

<ol><li><p>Let <var title="">clone data</var> be a <a href=#structured-clone>structured
<ol><li><p>Let <var title="">cloned data</var> be a <a href=#structured-clone>structured
clone</a> of the specified <var title="">data</var>. If this
throws an exception, then rethrow that exception and abort these
steps.</li>
Expand Down Expand Up @@ -62827,8 +62840,10 @@ <h4 id=the-history-interface><span class=secno>6.4.2 </span>The <code><a href=#h

<li>

<p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to
another <a href=#structured-clone>structured clone</a> of the specified <var title="">data</var>.</p>
<p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to a
<a href=#structured-clone>structured clone</a> of <var title="">cloned
data</var>.</p> <!-- it's a clone of /cloned data/, not /data/,
so that there's no risk of running scripts again -->

</li>

Expand Down Expand Up @@ -71816,6 +71831,7 @@ <h5 id=the-datatransferitems-interface><span class=secno>8.7.3.1 </span>The <cod
</dd>

<!--DND-v4: (might want to prevent duplicates like for strings; see above)
[make sure that the cloning happens before any side-effects can happen]
<dt>Otherwise

<dd>
Expand Down Expand Up @@ -71906,7 +71922,7 @@ <h5 id=the-datatransferitem-interface><span class=secno>8.7.3.2 </span>The <code
</dd>

<!-- DND-v4:
<dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsFile">getAsFile</code>()</dt>
<dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsObject">getAsObject</code>()</dt>
<dd>

<p>Invokes the callback with the cloned object data as the argument, if <span>the drag data item kind</span> is <i>Plain Unicode string</i> or <i>Object</i>.</p>
Expand Down Expand Up @@ -80170,13 +80186,6 @@ <h4 id=message-ports><span class=secno>11.5.3 </span>Message ports</h4>
(if any), then throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code>
exception.</li>

<li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is not entangled), then abort these
steps.</li>
<!-- we don't raise an exception if there is no target port because
this can happen at a moment's notice. we don't return false because
if the port is _about_ to be closed, the message might not be
listened for anyway. -->

<li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
cancelable, and has no default action.</li>
Expand Down Expand Up @@ -80222,6 +80231,15 @@ <h4 id=message-ports><span class=secno>11.5.3 </span>Message ports</h4>

</ol></li>

<li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is not entangled), then abort these
steps.</li> <!-- we don't raise an exception if there is no
target port because this can happen at a moment's notice. we don't
return false because if the port is _about_ to be closed, the
message might not be listened for anyway. we don't do this before
the steps above because otherwise you can tell the difference (in
whether the ports have become useless, or in when the structured
clone algorithm runs scripts -->

<li><p>Add the event to the <a href=#port-message-queue>port message queue</a> of <var title="">target port</var>.</li>

</ol><!--
Expand Down
52 changes: 35 additions & 17 deletions index
Expand Up @@ -8448,14 +8448,19 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <a href=#nodelist>No

<li><p>Let <var title="">output</var> be the value resulting from
calling the <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> with
<var title="">input</var> and <var title="">memory</var>.</li>
<var title="">input</var> as the "<var title="">input</var>"
argument, <var title="">memory</var> as the "<var title="">memory</var>" argument, and zero as the "<var title="">depth</var>" argument.</li>

<li><p>Return <var title="">output</var>.</li>

</ol><p>The <dfn id=internal-structured-cloning-algorithm>internal structured cloning algorithm</dfn> is always
called with two arguments, <var title="">input</var> and <var title="">memory</var>, and its behavior is as follows:</p>
called with three arguments, <var title="">input</var>, <var title="">memory</var>, and <var title="">depth</var>, and its
behavior is as follows:</p>

<ol><li><p>If <var title="">input</var> is the source object of a pair
<ol><li><p>If <var title="">depth</var> is greater than 1, return null
and abort these steps.</li>

<li><p>If <var title="">input</var> is the source object of a pair
of objects in <var title="">memory</var>, then return the
destination object in that pair of objects and abort these
steps.</li>
Expand Down Expand Up @@ -8541,9 +8546,17 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <a href=#nodelist>No
object, then, for each enumerable property in <var title="">input</var>, add a new property to <var title="">output</var> having the same name, and having a value
created from invoking the <a href=#internal-structured-cloning-algorithm>internal structured cloning
algorithm</a> recursively with the value of the property as the
"<var title="">input</var>" argument and <var title="">memory</var> as the "<var title="">memory</var>"
argument. The order of the properties in the <var title="">input</var> and <var title="">output</var> objects must
be the same.</p>
"<var title="">input</var>" argument, <var title="">memory</var>
as the "<var title="">memory</var>" argument, and <span title=""><var title="">depth</var>+<var title="">newDepth</var></span> as the "<var title="">depth</var>"
argument, where <var title="">newDepth</var> is zero except if
obtaining the value of the property involved executing script, in
which case it is one (1). The order of the properties in the <var title="">input</var> and <var title="">output</var> objects must
be the same, and any properties that involve running script must
be processed in that same order. If obtaining the value of the
property involved executing script, and that script threw an
uncaught exception, then abort the overall <a href=#structured-clone>structured
clone</a> algorithm, with that exception being passed through
to the caller.</p>

<p class=note>This does not walk the prototype chain.</p>

Expand Down Expand Up @@ -62719,7 +62732,7 @@ x === this; // true</pre>
<p>When either of these methods is invoked, the user agent must run
the following steps:</p>

<ol><li><p>Let <var title="">clone data</var> be a <a href=#structured-clone>structured
<ol><li><p>Let <var title="">cloned data</var> be a <a href=#structured-clone>structured
clone</a> of the specified <var title="">data</var>. If this
throws an exception, then rethrow that exception and abort these
steps.</li>
Expand Down Expand Up @@ -62816,8 +62829,10 @@ x === this; // true</pre>

<li>

<p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to
another <a href=#structured-clone>structured clone</a> of the specified <var title="">data</var>.</p>
<p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to a
<a href=#structured-clone>structured clone</a> of <var title="">cloned
data</var>.</p> <!-- it's a clone of /cloned data/, not /data/,
so that there's no risk of running scripts again -->

</li>

Expand Down Expand Up @@ -71831,6 +71846,7 @@ DND-v5: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">a
</dd>

<!--DND-v4: (might want to prevent duplicates like for strings; see above)
[make sure that the cloning happens before any side-effects can happen]
<dt>Otherwise

<dd>
Expand Down Expand Up @@ -71921,7 +71937,7 @@ interface <dfn>FunctionObjectCallback</dfn> {
</dd>

<!-- DND-v4:
<dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsFile">getAsFile</code>()</dt>
<dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsObject">getAsObject</code>()</dt>
<dd>

<p>Invokes the callback with the cloned object data as the argument, if <span>the drag data item kind</span> is <i>Plain Unicode string</i> or <i>Object</i>.</p>
Expand Down Expand Up @@ -76610,13 +76626,6 @@ interface <dfn id=messagechannel>MessageChannel</dfn> {
(if any), then throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code>
exception.</li>

<li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is not entangled), then abort these
steps.</li>
<!-- we don't raise an exception if there is no target port because
this can happen at a moment's notice. we don't return false because
if the port is _about_ to be closed, the message might not be
listened for anyway. -->

<li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
cancelable, and has no default action.</li>
Expand Down Expand Up @@ -76662,6 +76671,15 @@ interface <dfn id=messagechannel>MessageChannel</dfn> {

</ol></li>

<li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is not entangled), then abort these
steps.</li> <!-- we don't raise an exception if there is no
target port because this can happen at a moment's notice. we don't
return false because if the port is _about_ to be closed, the
message might not be listened for anyway. we don't do this before
the steps above because otherwise you can tell the difference (in
whether the ports have become useless, or in when the structured
clone algorithm runs scripts -->

<li><p>Add the event to the <a href=#port-message-queue>port message queue</a> of <var title="">target port</var>.</li>

</ol><!--
Expand Down
60 changes: 40 additions & 20 deletions source
Expand Up @@ -8555,18 +8555,25 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {

<li><p>Let <var title="">output</var> be the value resulting from
calling the <span>internal structured cloning algorithm</span> with
<var title="">input</var> and <var title="">memory</var>.</p></li>
<var title="">input</var> as the "<var title="">input</var>"
argument, <var title="">memory</var> as the "<var
title="">memory</var>" argument, and zero as the "<var
title="">depth</var>" argument.</p></li>

<li><p>Return <var title="">output</var>.</p></li>

</ol>

<p>The <dfn>internal structured cloning algorithm</dfn> is always
called with two arguments, <var title="">input</var> and <var
title="">memory</var>, and its behavior is as follows:</p>
called with three arguments, <var title="">input</var>, <var
title="">memory</var>, and <var title="">depth</var>, and its
behavior is as follows:</p>

<ol>

<li><p>If <var title="">depth</var> is greater than 1, return null
and abort these steps.</p></li>

<li><p>If <var title="">input</var> is the source object of a pair
of objects in <var title="">memory</var>, then return the
destination object in that pair of objects and abort these
Expand Down Expand Up @@ -8661,11 +8668,20 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
title="">output</var> having the same name, and having a value
created from invoking the <span>internal structured cloning
algorithm</span> recursively with the value of the property as the
"<var title="">input</var>" argument and <var
title="">memory</var> as the "<var title="">memory</var>"
argument. The order of the properties in the <var
"<var title="">input</var>" argument, <var title="">memory</var>
as the "<var title="">memory</var>" argument, and <span
title=""><var title="">depth</var>+<var
title="">newDepth</var></span> as the "<var title="">depth</var>"
argument, where <var title="">newDepth</var> is zero except if
obtaining the value of the property involved executing script, in
which case it is one (1). The order of the properties in the <var
title="">input</var> and <var title="">output</var> objects must
be the same.</p>
be the same, and any properties that involve running script must
be processed in that same order. If obtaining the value of the
property involved executing script, and that script threw an
uncaught exception, then abort the overall <span>structured
clone</span> algorithm, with that exception being passed through
to the caller.</p>

<p class="note">This does not walk the prototype chain.</p>

Expand Down Expand Up @@ -71484,7 +71500,7 @@ x === this; // true</pre>

<ol>

<li><p>Let <var title="">clone data</var> be a <span>structured
<li><p>Let <var title="">cloned data</var> be a <span>structured
clone</span> of the specified <var title="">data</var>. If this
throws an exception, then rethrow that exception and abort these
steps.</p></li>
Expand Down Expand Up @@ -71605,9 +71621,10 @@ x === this; // true</pre>

<li>

<p>Set <code title="dom-history-state">history.state</code> to
another <span>structured clone</span> of the specified <var
title="">data</var>.</p>
<p>Set <code title="dom-history-state">history.state</code> to a
<span>structured clone</span> of <var title="">cloned
data</var>.</p> <!-- it's a clone of /cloned data/, not /data/,
so that there's no risk of running scripts again -->

</li>

Expand Down Expand Up @@ -82038,6 +82055,7 @@ DND-v5: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">a
</dd>

<!--DND-v4: (might want to prevent duplicates like for strings; see above)
[make sure that the cloning happens before any side-effects can happen]
<dt>Otherwise

<dd>
Expand Down Expand Up @@ -82134,7 +82152,7 @@ interface <dfn>FunctionObjectCallback</dfn> {
</dd>

<!-- DND-v4:
<dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsFile">getAsFile</code>()</dt>
<dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsObject">getAsObject</code>()</dt>
<dd>

<p>Invokes the callback with the cloned object data as the argument, if <span>the drag data item kind</span> is <i>Plain Unicode string</i> or <i>Object</i>.</p>
Expand Down Expand Up @@ -91094,14 +91112,6 @@ interface <dfn>MessageChannel</dfn> {
(if any), then throw an <code>INVALID_STATE_ERR</code>
exception.</p></li>

<li><p>If there is no <var title="">target port</var> (i.e. if <var
title="">source port</var> is not entangled), then abort these
steps.</p></li>
<!-- we don't raise an exception if there is no target port because
this can happen at a moment's notice. we don't return false because
if the port is _about_ to be closed, the message might not be
listened for anyway. -->

<li><p>Create an event that uses the <code>MessageEvent</code>
interface, with the name <code
title="event-message">message</code>, which does not bubble, is not
Expand Down Expand Up @@ -91157,6 +91167,16 @@ interface <dfn>MessageChannel</dfn> {

</li>

<li><p>If there is no <var title="">target port</var> (i.e. if <var
title="">source port</var> is not entangled), then abort these
steps.</p></li> <!-- we don't raise an exception if there is no
target port because this can happen at a moment's notice. we don't
return false because if the port is _about_ to be closed, the
message might not be listened for anyway. we don't do this before
the steps above because otherwise you can tell the difference (in
whether the ports have become useless, or in when the structured
clone algorithm runs scripts -->

<li><p>Add the event to the <span>port message queue</span> of <var
title="">target port</var>.</p></li>

Expand Down

0 comments on commit bae275e

Please sign in to comment.