Closed Bug 1162952 Opened 9 years ago Closed 9 years ago

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

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: nika)

References

(Depends on 2 open bugs)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 3 obsolete files)

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 ;)
(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.  :-)
See Also: → 1161721
Acknowledge now-failing browserscope tests
Attachment #8604214 - Attachment is obsolete: true
Attachment #8604214 - Flags: review?(ehsan)
Attachment #8604327 - Flags: review?(ehsan)
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+
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
Attachment #8605330 - Flags: review?(ehsan)
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)
(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)
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.
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)
Attachment #8610170 - Flags: review?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/0431f570160d
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Depends on: 1178047
Depends on: 1211191
Depends on: 1327385
Depends on: 1327828
Depends on: 1328027
Depends on: 1328028
Depends on: 1328029
Depends on: 1271897
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: