Closed
Bug 1208217
Opened 10 years ago
Closed 9 years ago
paste event listener doesn't fire in documents with no editor component
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
mozilla49
Tracking | Status | |
---|---|---|
firefox49 | --- | fixed |
People
(Reporter: nika, Assigned: nika)
References
Details
Attachments
(1 file, 2 obsolete files)
6.00 KB,
patch
|
enndeakin
:
review+
|
Details | Diff | Splinter Review |
Appears (at first impression) to be due to a regression after bug 1159490 (probably related to menu item fixes).
For STR see bug 1159490 comment 10 - the problem doesn't occur when there is a contenteditable node in the page.
Assignee | ||
Comment 1•10 years ago
|
||
(In reply to Michael Layzell [:mystor] from comment #0)
> Appears (at first impression) to be due to a regression after bug 1159490
> (probably related to menu item fixes).
>
> For STR see bug 1159490 comment 10 - the problem doesn't occur when there is
> a contenteditable node in the page.
Back when I filed this, I checked, and this isn't a regression, but rather a feature which I meant to add in bug 1159490 and didn't.
Updated•9 years ago
|
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Updated•9 years ago
|
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Assignee | ||
Comment 5•9 years ago
|
||
This patch whitelists the paste command in documents without an editor component. It appears to fix the problem.
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9e6b541a5663
Attachment #8752292 -
Flags: review?(bugs)
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → michael
Flags: needinfo?(michael)
Comment 6•9 years ago
|
||
Comment on attachment 8752292 [details] [diff] [review]
Enable paste event listener in documents with no editor component
My review queue is long. Enn, perhaps you could take a look at this.
Attachment #8752292 -
Flags: review?(bugs) → review?(enndeakin)
Comment 7•9 years ago
|
||
Comment on attachment 8752292 [details] [diff] [review]
Enable paste event listener in documents with no editor component
># HG changeset patch
># User Michael Layzell <michael@thelayzells.com>
>
>Bug 1208217 - Enable paste event listener in documents with no editor component, r=smaug
>
>diff --git a/dom/base/nsGlobalWindowCommands.cpp b/dom/base/nsGlobalWindowCommands.cpp
>index 110af14..f3b204f 100644
>--- a/dom/base/nsGlobalWindowCommands.cpp
>+++ b/dom/base/nsGlobalWindowCommands.cpp
>@@ -479,17 +479,18 @@ NS_IMPL_ISUPPORTS(nsClipboardCommand, nsIControllerCommand)
> nsresult
> nsClipboardCommand::IsCommandEnabled(const char* aCommandName, nsISupports *aContext, bool *outCmdEnabled)
...
>- strcmp(aCommandName, "cmd_cut"))
>+ strcmp(aCommandName, "cmd_cut") &&
>+ strcmp(aCommandName, "cmd_paste"))
> return NS_OK;
>
> nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryInterface(aContext);
> NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
>
> nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
> if (doc->IsHTMLOrXHTML()) {
> // In HTML and XHTML documents, we always want cut and copy commands to be enabled.
Update the comment here.
> *outCmdEnabled = true;
> } else {
> // Cut isn't enabled in xul documents which use nsClipboardCommand
> if (strcmp(aCommandName, "cmd_cut")) {
> *outCmdEnabled = nsCopySupport::CanCopy(doc);
> }
> }
The else clause will need to be changed. Better if it explicitly matches only the two copy commands.
> EventMessage eventMessage = eCopy;
> if (strcmp(aCommandName, "cmd_cut") == 0) {
> eventMessage = eCut;
> }
>+ if (strcmp(aCommandName, "cmd_paste") == 0) {
>+ eventMessage = ePaste;
>+ }
else if
> bool actionTaken = false;
> nsCopySupport::FireClipboardEvent(eventMessage,
> nsIClipboard::kGlobalClipboard,
> presShell, nullptr, &actionTaken);
>
> if (!strcmp(aCommandName, "cmd_copyAndCollapseToEnd")) {
> dom::Selection *sel =
While you're here can you update this to not do this last conditional block for cmd_copyAndCollapseToEnd when FireClipboardEvent returns true?
Assignee | ||
Comment 8•9 years ago
|
||
Attachment #8752870 -
Flags: review?(enndeakin)
Assignee | ||
Updated•9 years ago
|
Attachment #8752292 -
Attachment is obsolete: true
Attachment #8752292 -
Flags: review?(enndeakin)
Assignee | ||
Comment 9•9 years ago
|
||
Fix some test failures on try
Attachment #8752954 -
Flags: review?(enndeakin)
Assignee | ||
Updated•9 years ago
|
Attachment #8752870 -
Attachment is obsolete: true
Attachment #8752870 -
Flags: review?(enndeakin)
Updated•9 years ago
|
Attachment #8752954 -
Flags: review?(enndeakin) → review+
Comment 10•9 years ago
|
||
Comment 11•9 years ago
|
||
bugherder |
Status: REOPENED → RESOLVED
Closed: 9 years ago → 9 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in
before you can comment on or make changes to this bug.
Description
•