New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 800742 link

Starred by 4 users

Issue metadata

Status: ExternalDependency
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

clipboardData is null inside clipboardEvent, when the event is created using ClipboardEvent constructor

Reported by sandip.g...@gmail.com, Jan 10 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36

Steps to reproduce the problem:
1. //Run the javascript code below
2. var pasteEvent = new ClipboardEvent('paste');
3. console.log(pasteEvent.clipboardData);

What is the expected behavior?
The clipboardData attribute of the ClipboardEvent object should be an instance of the DataTransfer interface, as mentioned in w3c documentation --> https://w3c.github.io/clipboard-apis/#widl-ClipboardEvent-clipboardData

What went wrong?
clipboardData is null, when the event is created using ClipboardEvent constructor (i.e. new ClipboardEvent('paste'))

Did this work before? N/A 

Chrome version: 63.0.3239.132  Channel: stable
OS Version: 10.0
Flash Version:
 
Labels: Needs-Triage-M63

Comment 2 by tkent@chromium.org, Jan 11 2018

Components: -Blink Blink>DataTransfer
Cc: vamshi.k...@techmahindra.com
Labels: Needs-Feedback Triaged-ET
Able to reproduce the issue on reported chrome version 63.0.3239.132 and on the latest canary 65.0.3315.0 using windows 10. For further investigation of the issue we have checked the same on M50(50.0.2661.0) but we are seeing a different console error output, which is neither "an instance of the DataTransfer interface" . Attaching the screen shots of both behaviours.

@Reporter: Could you please have a look at the provided screen shots and let us know the good behavior. It would be highly helpful if provided with a screenshot of expected behavior, which helps us to triage the issue further in a better way.

Thanks! 
800742 M50.PNG
463 KB View Download
800742 recent builds.PNG
31.2 KB View Download
Reagrding the error screenshot regarding version 50.0.2661.0: Creation of ClipboardEvent using the constructor (i.e. new ClipboardEvent('paste')) might not have been supported in version 50.0.2661.0. Therefore, it might not be termed as a bug in that version.

But in version 65.0.3315.0, it is supported. Therefore, a DataTransfer instance should have been available through clipboardData attribute. It is presently available in Firefox, version 57.0.4. Therefore, accepting their implementation as the expected behavior, attaching the screenshot
firefox-clipboardevent.jpg
61.0 KB View Download
Project Member

Comment 5 by sheriffbot@chromium.org, Jan 11 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "vamshi.kommuri@techmahindra.com" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: sc00335...@techmahindra.com
Labels: M-65 OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on reported chrome version 63.0.3239.132 and on the latest canary 65.0.3315.0 using windows 10, Ubuntu 14.04 and Mac 10.13.1.

Till M58 "Illegal Constructor" error is seen in while pasting in devtools. But from M-59 we are seeing "null". Hence considering this issue as Non-Regression and marking as Untriaged.

Comment 7 by jsb...@chromium.org, Jan 19 2018

Cc: lunalu@chromium.org garykac@chromium.org
Status: ExternalDependency (was: Untriaged)
"The clipboardData attribute of the ClipboardEvent object should be an instance of the DataTransfer interface, as mentioned in w3c documentation"

The IDL type is:

readonly attribute DataTransfer? clipboardData;

Where the '?' sigil indicates 'nullable', so null is a perfectly valid value. The prose says "The clipboardData attribute is an instance of the DataTransfer interface..." which contradicts the IDL.

The spec doesn't actually say how the clipboardData on the event gets populated when synthetic clipboard events are constructed. The code example in the spec does assume that clipboardData is populated, though.

I'm guessing the spec needs "If eventInitDict is not given, or eventInitDict's clipboardData dictionary member is null, then initialize clipboardData to a newly created DataTransfer object."

In that case, how can clipboardData be null? I'll file a spec bug.

Comment 8 by jsb...@chromium.org, Jan 19 2018

Owner: garykac@chromium.org
Filed https://github.com/w3c/clipboard-apis/issues/64

We can align with Firefox easily enough, but let's confirm the desired behavior.

Comment 9 Deleted

Just to document for anyone else who comes across this issue while trying to use TypeScript with Chromium: 
It's currently impossible to create a ClipboardEvent and then add data to it when using TypeScript + Chromium due to a combination of this issue and the fact that TypeScript currently does not follow the W3C spec for the ClipboardEventInit interface. I have filed an issue and PR with the TypeScript project to update the interface: https://github.com/Microsoft/TypeScript/issues/28998

Sign in to add a comment