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

"Record & Tuple" proposal HTML serialization support #6958

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nicolo-ribaudo
Copy link
Contributor

@nicolo-ribaudo nicolo-ribaudo commented Aug 13, 2021

This PR lets the record/tuple/box primitives, introduced by the Record & Tuple proposal, be serialized and de-serialized by the structured clone algorithm. It also adds serialization support for their wrapper objects.

I'm marking this as a draft PR because:

Ref to early review of this proposal: w3ctag/design-reviews#518


  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chrome: …
    • Firefox: …
    • Safari: …

(See WHATWG Working Mode: Changes for more details.)


💥 Error: Wattsi server error 💥

PR Preview failed to build. (Last tried on Aug 13, 2021, 9:49 AM UTC).

More

PR Preview relies on a number of web services to run. There seems to be an issue with the following one:

🚨 Wattsi Server - Wattsi Server is the web service used to build the WHATWG HTML spec.

🔗 Related URL

Parsing MDN data...
Parsing...
Generating HTML variant...
Error: Multiple definitions for term "record" Parent of first says: "The List and              Record specification types", parent of second says: "The Record type"
Error: Multiple definitions for term "tuple" Parent of first says: "tuple", parent of second says: "The Tuple type"
Error: Multiple definitions for term "record" Parent of first says: "The Record type", parent of second says: "The Record object type"
Error: Multiple definitions for term "tuple" Parent of first says: "The Tuple type", parent of second says: "The Tuple object type"
Error: Multiple definitions for term "box" Parent of first says: "The Box type", parent of second says: "The Box object type"
Error count: 5
Saving index-html
Splitting...
Saving index.html
Saving introduction.html
Saving infrastructure.html
Saving common-microsyntaxes.html
Saving urls-and-fetching.html
Saving common-dom-interfaces.html
Saving structured-data.html
Saving dom.html
Saving semantics.html
Saving sections.html
Saving grouping-content.html
Saving text-level-semantics.html
Saving links.html
Saving edits.html
Saving embedded-content.html
Saving images.html
Saving iframe-embed-object.html
Saving media.html
Saving image-maps.html
Saving embedded-content-other.html
Saving tables.html
Saving forms.html
Saving input.html
Saving form-elements.html
Saving form-control-infrastructure.html
Saving interactive-elements.html
Saving scripting.html
Saving canvas.html
Saving custom-elements.html
Saving semantics-other.html
Saving microdata.html
Saving interaction.html
Saving dnd.html
Saving browsers.html
Saving window-object.html
Saving origin.html
Saving history.html
Saving browsing-the-web.html
Saving webappapis.html
Saving dynamic-markup-insertion.html
Saving timers-and-user-prompts.html
Saving system-state.html
Saving imagebitmap-and-animations.html
Saving comms.html
Saving server-sent-events.html
Saving web-sockets.html
Saving web-messaging.html
Saving workers.html
Saving worklets.html
Saving webstorage.html
Saving syntax.html
Saving parsing.html
Saving named-characters.html
Saving xhtml.html
Saving rendering.html
Saving obsolete.html
Saving iana.html
Saving indices.html
Saving references.html
Saving acknowledgements.html
Generating DEV variant...
Error: Multiple definitions for term "record" Parent of first says: "The List and              Record specification types", parent of second says: "The Record type"
Error: Multiple definitions for term "tuple" Parent of first says: "tuple", parent of second says: "The Tuple type"
Error: Multiple definitions for term "record" Parent of first says: "The Record type", parent of second says: "The Record object type"
Error: Multiple definitions for term "tuple" Parent of first says: "The Tuple type", parent of second says: "The Tuple object type"
Error: Multiple definitions for term "box" Parent of first says: "The Box type", parent of second says: "The Box object type"
Error count: 5
Splitting...
Saving index.html
Saving introduction.html
Saving infrastructure.html
Saving common-microsyntaxes.html
Saving urls-and-fetching.html
Saving common-dom-interfaces.html
Saving structured-data.html
Saving dom.html
Saving semantics.html
Saving sections.html
Saving grouping-content.html
Saving text-level-semantics.html
Saving links.html
Saving edits.html
Saving embedded-content.html
Saving images.html
Saving iframe-embed-object.html
Saving media.html
Saving image-maps.html
Saving embedded-content-other.html
Saving tables.html
Saving forms.html
Saving input.html
Saving form-elements.html
Saving form-control-infrastructure.html
Saving interactive-elements.html
Saving scripting.html
Saving canvas.html
Saving custom-elements.html
Saving semantics-other.html
Saving microdata.html
Saving interaction.html
Saving dnd.html
Saving browsers.html
Saving window-object.html
Saving origin.html
Saving history.html
Saving browsing-the-web.html
Saving webappapis.html
Saving dynamic-markup-insertion.html
Saving timers-and-user-prompts.html
Saving system-state.html
Saving imagebitmap-and-animations.html
Saving comms.html
Saving server-sent-events.html
Saving web-sockets.html
Saving web-messaging.html
Saving workers.html
Saving worklets.html
Saving webstorage.html
Saving syntax.html
Saving named-characters.html
Saving xhtml.html
Saving obsolete.html
Saving indices.html
Saving references.html
Saving acknowledgements.html
Generating SNAP variant...
Error: Multiple definitions for term "record" Parent of first says: "The List and              Record specification types", parent of second says: "The Record type"
Error: Multiple definitions for term "tuple" Parent of first says: "tuple", parent of second says: "The Tuple type"
Error: Multiple definitions for term "record" Parent of first says: "The Record type", parent of second says: "The Record object type"
Error: Multiple definitions for term "tuple" Parent of first says: "The Tuple type", parent of second says: "The Tuple object type"
Error: Multiple definitions for term "box" Parent of first says: "The Box type", parent of second says: "The Box object type"
Error count: 5
Saving index-snap



If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.


💥 Error: Wattsi server error 💥

PR Preview failed to build. (Last tried on Jul 1, 2022, 9:43 AM UTC).

More

PR Preview relies on a number of web services to run. There seems to be an issue with the following one:

🚨 Wattsi Server - Wattsi Server is the web service used to build the WHATWG HTML spec.

🔗 Related URL

Parsing MDN data...
Parsing...
Generating HTML variant...
Error: Multiple definitions for term "record" Parent of first says: "The List and              Record specification types", parent of second says: "The Record type"
Error: Multiple definitions for term "tuple" Parent of first says: "tuple", parent of second says: "The Tuple type"
Error: Multiple definitions for term "record" Parent of first says: "The Record type", parent of second says: "The Record object type"
Error: Multiple definitions for term "tuple" Parent of first says: "The Tuple type", parent of second says: "The Tuple object type"
Error: Multiple definitions for term "box" Parent of first says: "The Box type", parent of second says: "The Box object type"
Error count: 5
Saving index-html
Splitting...
Saving index.html
Saving introduction.html
Saving infrastructure.html
Saving common-microsyntaxes.html
Saving urls-and-fetching.html
Saving common-dom-interfaces.html
Saving structured-data.html
Saving dom.html
Saving semantics.html
Saving sections.html
Saving grouping-content.html
Saving text-level-semantics.html
Saving links.html
Saving edits.html
Saving embedded-content.html
Saving images.html
Saving iframe-embed-object.html
Saving media.html
Saving image-maps.html
Saving embedded-content-other.html
Saving tables.html
Saving forms.html
Saving input.html
Saving form-elements.html
Saving form-control-infrastructure.html
Saving interactive-elements.html
Saving scripting.html
Saving canvas.html
Saving custom-elements.html
Saving semantics-other.html
Saving microdata.html
Saving interaction.html
Saving dnd.html
Saving browsers.html
Saving window-object.html
Saving origin.html
Saving history.html
Saving browsing-the-web.html
Saving webappapis.html
Saving dynamic-markup-insertion.html
Saving timers-and-user-prompts.html
Saving system-state.html
Saving imagebitmap-and-animations.html
Saving comms.html
Saving server-sent-events.html
Saving web-messaging.html
Saving workers.html
Saving worklets.html
Saving webstorage.html
Saving syntax.html
Saving parsing.html
Saving named-characters.html
Saving xhtml.html
Saving rendering.html
Saving obsolete.html
Saving iana.html
Saving indices.html
Saving references.html
Saving acknowledgements.html
Generating DEV variant...
Error: Multiple definitions for term "record" Parent of first says: "The List and              Record specification types", parent of second says: "The Record type"
Error: Multiple definitions for term "tuple" Parent of first says: "tuple", parent of second says: "The Tuple type"
Error: Multiple definitions for term "record" Parent of first says: "The Record type", parent of second says: "The Record object type"
Error: Multiple definitions for term "tuple" Parent of first says: "The Tuple type", parent of second says: "The Tuple object type"
Error: Multiple definitions for term "box" Parent of first says: "The Box type", parent of second says: "The Box object type"
Error count: 5
Splitting...
Saving index.html
Saving introduction.html
Saving infrastructure.html
Saving common-microsyntaxes.html
Saving urls-and-fetching.html
Saving common-dom-interfaces.html
Saving structured-data.html
Saving dom.html
Saving semantics.html
Saving sections.html
Saving grouping-content.html
Saving text-level-semantics.html
Saving links.html
Saving edits.html
Saving embedded-content.html
Saving images.html
Saving iframe-embed-object.html
Saving media.html
Saving image-maps.html
Saving embedded-content-other.html
Saving tables.html
Saving forms.html
Saving input.html
Saving form-elements.html
Saving form-control-infrastructure.html
Saving interactive-elements.html
Saving scripting.html
Saving canvas.html
Saving custom-elements.html
Saving semantics-other.html
Saving microdata.html
Saving interaction.html
Saving dnd.html
Saving browsers.html
Saving window-object.html
Saving origin.html
Saving history.html
Saving browsing-the-web.html
Saving webappapis.html
Saving dynamic-markup-insertion.html
Saving timers-and-user-prompts.html
Saving system-state.html
Saving imagebitmap-and-animations.html
Saving comms.html
Saving server-sent-events.html
Saving web-messaging.html
Saving workers.html
Saving worklets.html
Saving webstorage.html
Saving syntax.html
Saving named-characters.html
Saving xhtml.html
Saving obsolete.html
Saving indices.html
Saving references.html
Saving acknowledgements.html
Generating SNAP variant...
Error: Multiple definitions for term "record" Parent of first says: "The List and              Record specification types", parent of second says: "The Record type"
Error: Multiple definitions for term "tuple" Parent of first says: "tuple", parent of second says: "The Tuple type"
Error: Multiple definitions for term "record" Parent of first says: "The Record type", parent of second says: "The Record object type"
Error: Multiple definitions for term "tuple" Parent of first says: "The Tuple type", parent of second says: "The Tuple object type"
Error: Multiple definitions for term "box" Parent of first says: "The Box type", parent of second says: "The Box object type"
Error count: 5
Saving index-snap



If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.

Copy link
Member

@Ms2ger Ms2ger left a comment

Choose a reason for hiding this comment

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

This seems reasonable.

source Outdated
<p>Otherwise, if <var>serialized</var>.[[Type]] is "record", then:</p>

<ol>
<li><p>Let <var>entries</var> be a new empty <span data-x="js-List">List.</span></p></li>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<li><p>Let <var>entries</var> be a new empty <span data-x="js-List">List.</span></p></li>
<li><p>Let <var>entries</var> be a new empty <span data-x="js-List">List</span>.</p></li>

source Outdated
@@ -8484,6 +8592,48 @@ interface <dfn interface>DOMStringList</dfn> {
<p>If <var>deep</var> is true, then:</p>

<ol>
<li>
<p> If <var>value</var> has a [[RecordData]] internal slot, then:</p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p> If <var>value</var> has a [[RecordData]] internal slot, then:</p>
<p>If <var>value</var> has a [[RecordData]] internal slot, then:</p>

source Outdated
</li>

<li>
<p> If <var>value</var> has a [[TupleData]] internal slot, then:</p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p> If <var>value</var> has a [[TupleData]] internal slot, then:</p>
<p>Otherwise, if <var>value</var> has a [[TupleData]] internal slot, then:</p>

source Outdated
</li>

<li>
<p> If <var>value</var> has a [[BoxData]] internal slot, then:</p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p> If <var>value</var> has a [[BoxData]] internal slot, then:</p>
<p>Otherwise, if <var>value</var> has a [[BoxData]] internal slot, then:</p>

source Outdated
<li><p>Set <var>serialized</var>.[[BoxData]] to <var>data</var>.</p></li>
</ol>
</li>

<li>
<p>If <var>value</var> has a [[MapData]] internal slot, then:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p>If <var>value</var> has a [[MapData]] internal slot, then:
<p>Otherwise, if <var>value</var> has a [[MapData]] internal slot, then:

source Outdated
Comment on lines 8900 to 8901
<li><p>Set <var>value</var> to a new Record object in <var>targetRealm</var> whose
[[RecordData]] internal slot value is a empty.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

I wanted to suggest something like OrdinaryObjectCreate, but it seems like that doesn't acknowledge realms, and what you've written is consistent with the rest of this algorithm, so it's fine.

source Outdated
Comment on lines 8900 to 8901
<li><p>Set <var>value</var> to a new Record object in <var>targetRealm</var> whose
[[RecordData]] internal slot value is a empty.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

"a empty"?


<ol>
<li><p>Set <var>value</var> to a new Tuple object in <var>targetRealm</var> whose
[[TupleData]] internal slot value is a empty.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

"a empty"

source Outdated

<ol>
<li><p>Set <var>value</var> to a new Box object in <var>targetRealm</var> whose
[[BoxData]] internal slot value is a empty.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

"a empty"

source Outdated
@@ -125479,6 +125769,9 @@ INSERT INTERFACES HERE
<dt id="refsJSJSONMODULES">[JSJSONMODULES]</dt>
<dd><cite><a href="https://tc39.es/proposal-json-modules/">JSON Modules</a></cite>. Ecma International.</dd>

<dt id="refsJSRECORDTUPLE">[JSRECORDTUPLE]</dt>
<dd><cite><a href="https://tc39.es/proposal-record-tuple/">Recor & Tuple</a></cite>. Ecma International.</dd>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<dd><cite><a href="https://tc39.es/proposal-record-tuple/">Recor & Tuple</a></cite>. Ecma International.</dd>
<dd><cite><a href="https://tc39.es/proposal-record-tuple/">Record & Tuple</a></cite>. Ecma International.</dd>

@nicolo-ribaudo
Copy link
Contributor Author

PR updated! I applied @Ms2ger's suggestions, and deleted support for Box since it has been removed from the R&T proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants