Closed Bug 917681 Opened 11 years ago Closed 10 years ago

[e10s] Context menu for text selection does not work

Categories

(Firefox :: Menus, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 30

People

(Reporter: playwatch, Assigned: billm)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 (Beta/Release)
Build ID: 20130917030214

Steps to reproduce:

Go in any page with some text.
Select any text and right click.


Actual results:

The general context menu for web pages appears.


Expected results:

The correct context menu should have appeared.
(The one with copy, select all ,etc.)
Component: Untriaged → Menus
Version: 26 Branch → Trunk
Blocks: fxe10s
Attached patch context-menu-selection (obsolete) — Splinter Review
The problem is that we're trying to get the focus element in the context menu, but all we get in the parent process is the <browser> element. We already have some code from the findbar that gets the focus element in the content process using CPOWs. Since we already use CPOWs for the context menu, it makes sense to use CPOWs for the focus too.

This patch moves the CPOW code for focus from findbar.xml into BrowserUtils.jsm. Then I changed the context menu code to use that code. It seems to work.
Assignee: nobody → wmccloskey
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8384206 - Flags: review?(felipc)
Attached patch context-menu-selection v2 (obsolete) — Splinter Review
Oops, forgot qref.
Attachment #8384206 - Attachment is obsolete: true
Attachment #8384206 - Flags: review?(felipc)
Attachment #8384207 - Flags: review?(felipc)
Not really related to this patch, but it seems wrong to me that the context menu code is using the focused window - seems to me it should be using the window that the context menu is in (not that it should ever be possible for that to be different?).
Comment on attachment 8384207 [details] [diff] [review]
context-menu-selection v2

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

I'm not sure if the conversion from document.commandDispatcher.focused{window|element} -> focusManager.focused{window|element} is correct. The commandDispatcher is tied to a specific document (a browser.xul), but the focusManager is global..  So "focused" in commandDispatcher really means "the active element/child window in this document" vs. globally.

Maybe that doesn't matter for a popupmenu situation, but if that function in BrowserUtils gets used more it'd be good for it to be tied to the originating window somehow. Thoughts?
Attachment #8384207 - Flags: review?(felipc)
Yeah, I had to change this to use document.commandDispatcher or else it wouldn't pass tests.
Attachment #8384207 - Attachment is obsolete: true
Attachment #8390654 - Flags: review?(felipc)
Comment on attachment 8390654 [details] [diff] [review]
context-menu-selection v3

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

::: browser/base/content/browser.js
@@ +4830,5 @@
>    // selections of more than 150 characters aren't useful
>    const kMaxSelectionLen = 150;
>    const charLen = Math.min(aCharLen || kMaxSelectionLen, kMaxSelectionLen);
> +
> +  let [element, focusedWindow] = BrowserUtils.getFocusSync(document);

can you test if this would break popup menus from the browser UI? in the non-e10s case, document.commandDispatcher would return the xul window if the focus was not in a child <browser>, and with BrowserUtils we will be always returning something related to the child content.. So I think it will..
Comment on attachment 8390654 [details] [diff] [review]
context-menu-selection v3

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

Ignore previous comment
Attachment #8390654 - Flags: review?(felipc) → review+
https://hg.mozilla.org/mozilla-central/rev/7d192442dfca
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 30
Keywords: verifyme
Verified fixed on Windows 7 64bit, 32bit using the latest Aurora, build ID: 20140424004002.
Status: RESOLVED → VERIFIED
Keywords: verifyme
Depends on: 1168243
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: