Closed Bug 1161721 Opened 10 years ago Closed 10 years ago

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

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

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 3 obsolete files)

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
Yep, thanks!
See Also: → 1162952
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
oops - queryCommandSupported != queryCommandEnabled
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Acknowledge now-failing browserscope tests
Attachment #8604250 - Attachment is obsolete: true
Attachment #8604250 - Flags: review?(ehsan)
Attachment #8604329 - Flags: review?(ehsan)
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+
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)
Attachment #8605321 - Flags: review?(ehsan) → review+
(In reply to Michael Layzell [:mystor] from comment #9) > try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=ec92cce1ffcb Ignore that - wrong bug
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
Sorry - I've rebased the patch onto mozilla-central.
Attachment #8605321 - Attachment is obsolete: true
Flags: needinfo?(michael)
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
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: