bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

Return false from document.queryCommandSupported("paste") if calling execCommand("paste") will fail

RESOLVED FIXED in Firefox 41

Status

()

Core
DOM
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: Ehsan, Assigned: Nika)

Tracking

({dev-doc-complete})

unspecified
mozilla41
dev-doc-complete
Points:
---

Firefox Tracking Flags

(firefox41 fixed)

Details

Attachments

(1 attachment, 3 obsolete attachments)

(Reporter)

Description

3 years ago
We currently just return true if we can translate the command name to an internal command name, but for paste we need to check to make sure that paste can actually succeed (IOW that the caller has chrome privileges.)
(Changing summary slightly because I think that's what you meant..)
Summary: Return false from document.queryCommandSupported("paste") if calling execCommand("paste") fails → Return false from document.queryCommandSupported("paste") if calling execCommand("paste") will fail
(Reporter)

Comment 2

3 years ago
Yep, thanks!
(Assignee)

Updated

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

Updated

3 years ago
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1162952
(Assignee)

Comment 4

3 years ago
oops - queryCommandSupported != queryCommandEnabled
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
(Assignee)

Comment 5

3 years ago
Created attachment 8604250 [details] [diff] [review]
Return false from document.queryCommandSupported for restricted commands
Attachment #8604250 - Flags: review?(ehsan)
(Assignee)

Comment 6

3 years ago
Created attachment 8604329 [details] [diff] [review]
Return false from document.queryCommandSupported for restricted commands

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

Comment 7

3 years ago
Comment on attachment 8604329 [details] [diff] [review]
Return false from document.queryCommandSupported for restricted commands

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

Looks good, but we need to have an explicit test for this too.  Can you please add one?  Ideally, the test would be in two parts, one would be a mochitest-plain, testing non-privileged callers of execCommand, and one would be a mochitest-chrome, testing the privileged callers of execCommand.
Attachment #8604329 - Flags: review?(ehsan) → feedback+
Keywords: dev-doc-needed
(Assignee)

Comment 8

3 years ago
Created attachment 8605321 [details] [diff] [review]
Return false from document.queryCommandSupported for restricted commands

Added an explicit test for the feature. Instead of using both mochitest-basic and mochitest-chrome, I decided to use SpecialPowers.wrap(document) to get a privileged call. Hopefully that's an acceptable test.
Attachment #8604329 - Attachment is obsolete: true
Attachment #8605321 - Flags: review?(ehsan)
(Reporter)

Updated

3 years ago
Attachment #8605321 - Flags: review?(ehsan) → review+
Comment hidden (typo)
(Assignee)

Comment 10

3 years ago
(In reply to Michael Layzell [:mystor] from comment #9)
> try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=ec92cce1ffcb

Ignore that - wrong bug
(Assignee)

Comment 11

3 years ago
try (includes patches for other bugs): https://treeherder.mozilla.org/#/jobs?repo=try&revision=b3ba5f9e6cc5
Keywords: checkin-needed
this failed to apply:

renamed 1161721 -> 0001-Bug-1161721-Return-false-from-document.queryCommandS.patch
applying 0001-Bug-1161721-Return-false-from-document.queryCommandS.patch
patching file dom/tests/mochitest/general/mochitest.ini
Hunk #1 FAILED at 100
1 out of 1 hunks FAILED -- saving rejects to file dom/tests/mochitest/general/mochitest.ini.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working directory
errors during apply, please fix and refresh 0001-Bug-1161721-Return-false-from-document.queryCommandS.patch

can you take a look, thanks!
Flags: needinfo?(michael)
Keywords: checkin-needed
(Assignee)

Comment 13

3 years ago
Created attachment 8608705 [details] [diff] [review]
0001-Bug-1161721-Return-false-from-document.queryCommandS.patch

Sorry - I've rebased the patch onto mozilla-central.
Attachment #8605321 - Attachment is obsolete: true
Flags: needinfo?(michael)
(Assignee)

Updated

3 years ago
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/6635e368ea9e
Status: REOPENED → RESOLVED
Last Resolved: 3 years ago3 years ago
status-firefox41: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.