This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24687 - DataCue: clarify that .data should be a clone of data argument and not a pointer
Summary: DataCue: clarify that .data should be a clone of data argument and not a pointer
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Silvia Pfeiffer
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-16 20:59 UTC by Silvia Pfeiffer
Modified: 2014-03-17 11:53 UTC (History)
6 users (show)

See Also:


Attachments

Description Silvia Pfeiffer 2014-02-16 20:59:47 UTC
The spec for the DataCue constructor says "The data argument sets the raw data of the text track cue." Brendan reads "sets" as "=" and "someObject.data = someArrayBuffer" won't create a copy.

See thread at: http://lists.w3.org/Archives/Public/public-html/2014Feb/0032.html

We probably need to say that .data is a "structured clone" of the data parameter object (referring to "2.7.6 Safe passing of structured data").
Comment 1 Boris Zbarsky 2014-03-05 13:39:01 UTC
Why do you need to structured clone?  If the argument is an arraybuffer, you can just explicitly make a copy of its data (basically by calling the canonical ArrayBuffer.prototype.slice on it, with 0 as argument).

Unless you're _trying_ to preserve the at-the-time-of-call expandos as well?  I would argue that's not worth it, and is in fact undesirable.
Comment 2 Silvia Pfeiffer 2014-03-06 07:14:18 UTC
(In reply to Boris Zbarsky from comment #1)
> Why do you need to structured clone?  If the argument is an arraybuffer, you
> can just explicitly make a copy of its data (basically by calling the
> canonical ArrayBuffer.prototype.slice on it, with 0 as argument).
> 
> Unless you're _trying_ to preserve the at-the-time-of-call expandos as well?
> I would argue that's not worth it, and is in fact undesirable.

Do you think, though, that copying the data is the right approach? See the example in the thread of strange side effects if we don't do it.

Maybe making .data read-only would be a better approach.
Comment 3 Robert O'Callahan (Mozilla) 2014-03-06 09:50:05 UTC
It's probably OK to just copy the data since we're not likely to be dealing with large volumes or high performance requirements.
Comment 4 Boris Zbarsky 2014-03-06 15:37:24 UTC
Copying the data makes sense to me here.
Comment 5 Silvia Pfeiffer 2014-03-17 11:53:08 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the Editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this document:

   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description:
https://github.com/w3c/html/commit/d2c026552f2b13a23053aa86a460423cd7628f38
Rationale: Added a clarification to make a copy of the data in the constructor.