Fix document.queryCommandEnabled('cut'/'copy') to return true always

RESOLVED FIXED in Firefox 41

Status

()

Core
DOM
RESOLVED FIXED
3 years ago
a year ago

People

(Reporter: Ehsan, Assigned: Nika)

Tracking

(Depends on: 2 bugs, {dev-doc-complete})

unspecified
mozilla41
dev-doc-complete
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox41 fixed)

Details

Attachments

(1 attachment, 3 obsolete attachments)

(Reporter)

Description

3 years ago
We should probably return false for now for paste as opposed to throwing when IsEditingOnAfterFlush() returns false.
While you're looking at and thinking of this, comments on the (feas|desir)ability of https://github.com/w3c/clipboard-apis/issues/4 would be very welcome ;)
(Reporter)

Comment 2

3 years ago
(In reply to Hallvord R. M. Steen [:hallvors] from comment #1)
> While you're looking at and thinking of this, comments on the
> (feas|desir)ability of https://github.com/w3c/clipboard-apis/issues/4 would
> be very welcome ;)

See bug 596764.  :-)
(Assignee)

Updated

3 years ago
Blocks: 1012662
(Assignee)

Comment 3

3 years ago
Created attachment 8604214 [details] [diff] [review]
Always return true form document.queryCommandEnabled('cut'/'copy')
Attachment #8604214 - Flags: review?(ehsan)
(Assignee)

Updated

3 years ago
See Also: → bug 1161721
(Assignee)

Updated

3 years ago
Duplicate of this bug: 1161721
(Assignee)

Comment 5

3 years ago
Created attachment 8604327 [details] [diff] [review]
Always return true from document.queryCommandEnabled('cut'/'copy')

Acknowledge now-failing browserscope tests
Attachment #8604214 - Attachment is obsolete: true
Attachment #8604214 - Flags: review?(ehsan)
Attachment #8604327 - Flags: review?(ehsan)
(Reporter)

Comment 6

3 years ago
Comment on attachment 8604327 [details] [diff] [review]
Always return true from document.queryCommandEnabled('cut'/'copy')

Review of attachment 8604327 [details] [diff] [review]:
-----------------------------------------------------------------

::: editor/libeditor/tests/test_bug408231.html
@@ +25,2 @@
>        ["createlink", "true"],
> +      ["cut", "true"],

Can you please uncomment and fix the test for paste further down this array?
Attachment #8604327 - Flags: review?(ehsan) → review+
Keywords: dev-doc-needed
(Assignee)

Comment 7

3 years ago
Created attachment 8605330 [details] [diff] [review]
Always return true from document.queryCommandEnabled('cut'/'copy')

Un-commented and fixed queryCommandEnabled() test for 'paste'.

The other tests for paste aren't fixed by this patch (they throw).
Attachment #8604327 - Attachment is obsolete: true
(Assignee)

Updated

3 years ago
Attachment #8605330 - Flags: review?(ehsan)
(Reporter)

Updated

3 years ago
Attachment #8605330 - Flags: review?(ehsan) → review+
One moment.. did we consider returning "true" only in a thread that's user-triggered (i.e. allowed to open a popup) and "false" otherwise?
Flags: needinfo?(ehsan)
(Reporter)

Comment 9

3 years ago
(In reply to Hallvord R. M. Steen [:hallvors] from comment #8)
> One moment.. did we consider returning "true" only in a thread that's
> user-triggered (i.e. allowed to open a popup) and "false" otherwise?

Oh, thanks for noticing this.  Yes, we should definitely return false when we are not handling the user input.  Michael, do you mind making that change, please?
Flags: needinfo?(ehsan)
(Reporter)

Comment 10

3 years ago
Comment on attachment 8605330 [details] [diff] [review]
Always return true from document.queryCommandEnabled('cut'/'copy')

r- as per comment 9.
Attachment #8605330 - Flags: review+ → review-
http://jsfiddle.net/213ov2ah/ tests queryCommandEnabled() for copy and cut - non-user-initiated and user-initiated.
(Assignee)

Comment 12

3 years ago
Created attachment 8610170 [details] [diff] [review]
Return true from document.queryCommandEnabled('cut'/'copy') when in privileged or user-initiated code

New patch which now only returns true when in privileged or user-initiated code.

New try in progress: https://treeherder.mozilla.org/#/jobs?repo=try&revision=8b6e1e3067e6
Attachment #8605330 - Attachment is obsolete: true
Attachment #8610170 - Flags: review?(ehsan)
(Reporter)

Updated

3 years ago
Attachment #8610170 - Flags: review?(ehsan) → review+
(Assignee)

Updated

3 years ago
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/0431f570160d
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox41: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41

Updated

3 years ago
Depends on: 1178047
Depends on: 1211191

Updated

a year ago
Depends on: 1327385

Updated

a year ago
Depends on: 1327828

Updated

a year ago
Depends on: 1328027

Updated

a year ago
Depends on: 1328028

Updated

a year ago
Depends on: 1328029

Updated

a year ago
Depends on: 1271897
You need to log in before you can comment on or make changes to this bug.