Closed Bug 1300784 Opened 8 years ago Closed 8 years ago

Combine e10s and non-e10s <select> dropdown mechanisms

Categories

(Core :: Layout: Form Controls, defect, P1)

50 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
e10s + ---
firefox53 --- fixed

People

(Reporter: mconley, Assigned: wrigh517, Mentored)

References

(Depends on 1 open bug, Blocks 4 open bugs)

Details

Attachments

(4 files, 4 obsolete files)

We currently use two mechanisms for <select> dropdowns in Firefox. We have the legacy mechanism, and the newer mechanism which supports multi-process mode. We should use the multi-process mechanism, even in single-process mode, so that we only have one codepath to worry about.
jaws and I are mentoring some students from MSU that will work on this.
Blocks: 1296264, 1296270
See Also: → 1091592
I agree that having one code path for this would be good. But the current designs both have issues... They both require a widget for example. Historically, they have also been fragile and prone to security issues, such as overlapping the URL bar / other tabs. I think a much simpler and robust solution would be to render the dropdown menu as an ordinary abs.pos. frame within the page, using a 'z-index' that is guaranteed to be on top of everything else in the page (we can reserve a range of high 'z-index' values for this purpose). This means the dropdown can't overlap anything outside the viewport *by design*. It also won't require a view/widget.
Blocks: e10s-select
tracking-e10s: --- → +
Priority: -- → P1
Blocks: 1300483
Comment on attachment 8796877 [details] Bug 1300784 - Update single-process firefox to implement new e10s select-dropdown https://reviewboard.mozilla.org/r/82588/#review84574 ::: layout/forms/nsListControlFrame.cpp:144 (Diff revision 2) > mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mouseup"), > mEventListener, false); > mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mousemove"), > mEventListener, false); > > - if (XRE_IsContentProcess() && > + if (Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) { Note, this 'desktopbehavior' pref was added to differentiate between desktop and b2g select behaviors. We can remove this now that b2g is dead and just assume desktopbehavior.
Note that miguel and Fred are both working on this bug, but assigning to miguel since his machine seems to be doing the review requests.
Assignee: nobody → wrigh517
Mentor: mconley, jaws
Hey miguel / Fred, Which test was the one that was failing? I want to point Enn at it so we can figure out what's going wrong.
Flags: needinfo?(wrigh517)
Flags: needinfo?(fred.sifc)
Flags: needinfo?(wrigh517)
Flags: needinfo?(fred.sifc)
test_mousemove_correcttarget() from browser/base/content/test/general/browser_selectpopup.js fails in non e10s with this addition, I can reproduce this manually.
Hey Neil, I think you wrote (and I reviewed) the test_mousemove_correctarget test a few months back. Any idea why it'd fail when using the ContentSelectDropdown in the single-process case?
Flags: needinfo?(enndeakin)
The test is checking that the mousecapture that gets applied when a mouse event is redispatched to the content process is cleared when the select popup is opened. While the specific mouse capture being tested doesn't apply to non-e10s, the code in the test suggests that it should still work in non-e10s. I suspect it might be some code which prevents mousedown/mousemove/mouseup events from dispatching across different frames. I can't recall where this happens; probably in EventStateManager or PresShell.
Flags: needinfo?(enndeakin)
(In reply to Neil Deakin from comment #13) > The test is checking that the mousecapture that gets applied when a mouse > event is redispatched to the content process is cleared when the select > popup is opened. > > While the specific mouse capture being tested doesn't apply to non-e10s, the > code in the test suggests that it should still work in non-e10s. I suspect > it might be some code which prevents mousedown/mousemove/mouseup events from > dispatching across different frames. I can't recall where this happens; > probably in EventStateManager or PresShell. Thanks Enn. felipe, do you happen to know the area of ESM that Enn is referring to that prevents mouse events from crossing frames?
Flags: needinfo?(felipc)
Hmm no, not off the top of my head
Flags: needinfo?(felipc)
Hey Fred, miguel - is Enn's change from bug 1159301 in nsMenuPopupFrame.cpp running in the non-e10s case after the select dropdown opens?
Flags: needinfo?(wrigh517)
Depends on: 1313195
Attachment #8796877 - Attachment is obsolete: true
Attachment #8806214 - Flags: review?(mconley)
Attachment #8806214 - Flags: review?(jaws)
Comment on attachment 8806214 [details] Bug 1300784 - Update single-process firefox to implement new e10s select-dropdown https://reviewboard.mozilla.org/r/89698/#review89128 ::: layout/forms/nsListControlFrame.cpp:144 (Diff revision 1) > mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mouseup"), > mEventListener, false); > mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mousemove"), > mEventListener, false); > > - if (Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) { > + if (XRE_IsContentProcess() && I believe mconley helped us to decide to keep XRE_IsContentProcess() in here, though that might have just been around 1788
Attachment #8806214 - Attachment is obsolete: true
Attachment #8806214 - Flags: review?(mconley)
Attachment #8806214 - Flags: review?(jaws)
Attachment #8806218 - Flags: review?(mconley)
Attachment #8806218 - Flags: review?(jaws)
Comment on attachment 8806218 [details] Bug 1300784 - Update single-process firefox to implement new e10s select-dropdown https://reviewboard.mozilla.org/r/89700/#review89276 Hey Fred\_, miguel, This looks pretty good, but I think there are a few things missing: 1. I browser_selectpopup.js needs to be enabled to work in non-e10s mode. That means removing [this rule](http://searchfox.org/mozilla-central/rev/f5c9e9a249637c9abd88754c8963ecb3838475cb/browser/base/content/test/general/browser.ini#410) and then adding this before any other `add_task` in browser_selectpopup.js: ```JavaScript add_task(function* setup() { yield SpecialPowers.pushPrefEnv({ "set": [ ["dom.select_popup_in_parent.enabled", true], ] }); }); ``` This will automatically clear the pref once the test file exits. 2. See my notes below about adding a new static method for checking to see if we should be firing events or not. Thanks for your work! Glad to see this taking shape. ::: layout/forms/nsListControlFrame.cpp:144 (Diff revision 1) > - if (XRE_IsContentProcess() && > + if (Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) { > - Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) { Hm. I don't think I understand why we're only checking `browser.tabs.remote.desktopbehavior` here. We probably should fire this if we're supposed to be firing events as opposed to using the old-school widget dropdown. Perhaps part of the problem is that FireShowDropDownEvent actually has two purposes: determine if we should fire events, fire events if necessary, and return a `bool` saying whether or not events were necessary. Maybe it'd be more useful to split that up, and expose a new static method that determines whether or not we should be firing events or using the old-school widget dropdown. And then have all callers of `FireShowDropDownEvent` call that static method. If it return strue, have them then call `FireShowDropDownEvent`. Otherwise, do what they were doing when `FireShowDropDownEvent` returned `false`. That way, here, you can just check your new static method instead of us duplicating all of the checking logic all over the place. ::: layout/forms/nsListControlFrame.cpp:1782 (Diff revision 1) > if (XRE_IsContentProcess() && > - Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) { > + Preferences::GetBool("browser.tabs.remote.desktopbehavior", false) || > + Preferences::GetBool("dom.select_popup_in_parent.enabled")) I think with [C++ Operator Precedence](http://en.cppreference.com/w/cpp/language/operator_precedence), this is correct, but making the readers care about knowing operator precedence is asking for trouble. I think it'd be clearer if it was: ```cpp if ((XRE_IsContentProcess() && Preferences::GetBool("browser.tabs.remote.desktopbehaviour", false)) || Preferences::GetBool("dom.select_popup_in_parent.enabled")) { ``` And I guess that would go into the static function I suggested above. ::: modules/libpref/init/all.js:22 (Diff revision 1) > * - Dashes are delimiters; use underscores instead. > * - The first character after a period must be alphabetic. > * - Computed values (e.g. 50 * 1024) don't work. > */ > > +pref("dom.select_popup_in_parent.enabled", false); There's a DOM section that starts around line 120 - let's put this at the end of that section. ::: toolkit/content/browser-content.js:18 (Diff revision 1) > +XPCOMUtils.defineLazyModuleGetter(this, "SelectContentHelper", > + "resource://gre/modules/SelectContentHelper.jsm"); Let's keep the formatting that's been established here - so let's un-indent line 19 so that it's only 2-spaced. ::: toolkit/content/browser-content.js:1727 (Diff revision 1) > +addEventListener("mozshowdropdown", event => { > + if (!event.isTrusted) > + return; > + > + if (!SelectContentHelper.open) { > + new SelectContentHelper(event.target, this); > + } > +}); What about mozhidedropdown? And mozshowdropdown-sourcetouch? Those were in the select-child.js that you removed. ::: toolkit/content/widgets/browser.xml:1022 (Diff revision 1) > this.audioPlaybackStarted(); > break; > case "AudioPlayback:Stop": > this.audioPlaybackStopped(); > break; > + Trailing whitespace. ::: toolkit/content/widgets/remote-browser.xml:463 (Diff revision 1) > case "Forms:ShowDropDown": { > if (!this._selectParentHelper) { > this._selectParentHelper = > Cu.import("resource://gre/modules/SelectParentHelper.jsm", {}).SelectParentHelper; > } > > let menulist = document.getElementById(this.getAttribute("selectmenulist")); > menulist.menupopup.style.direction = data.direction; > this._selectParentHelper.populate(menulist, data.options, data.selectedIndex, this._fullZoom); > this._selectParentHelper.open(this, menulist, data.rect, data.isOpenedViaTouch); > break; > } Need to remove this too, no?
Attachment #8806218 - Flags: review?(mconley) → review-
Comment on attachment 8806218 [details] Bug 1300784 - Update single-process firefox to implement new e10s select-dropdown https://reviewboard.mozilla.org/r/89700/#review89780 Mike's review here is sufficient.
Attachment #8806218 - Flags: review?(jaws)
Comment on attachment 8806218 [details] Bug 1300784 - Update single-process firefox to implement new e10s select-dropdown https://reviewboard.mozilla.org/r/89700/#review89832 ::: layout/forms/nsListControlFrame.cpp:144 (Diff revision 1) > - if (XRE_IsContentProcess() && > + if (Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) { > - Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) { I like this idea a lot. I'm confused by you saying: > have all callers of `FireShowDropDownEvent` call that static method. That sounds to me like this is a caller of `FireShowDropDownEvent`... or are you talking about methods like `DropDownToggleKey` that make checks against `FireShowDropDownEvent`: ``` if (!FireShowDropDownEvent(mContent, true, false)) { ``` As so?
Attachment #8806218 - Attachment is obsolete: true
Attachment #8806893 - Attachment is obsolete: true
Blocks: 1314798
No longer blocks: 1314798
Depends on: 1314798
Depends on: 1314802
(In reply to Michael from comment #25) > Comment on attachment 8806218 [details] > Bug 1300784 - Update single-process firefox to implement new e10s > select-dropdown > > https://reviewboard.mozilla.org/r/89700/#review89832 > > ::: layout/forms/nsListControlFrame.cpp:144 > (Diff revision 1) > > - if (XRE_IsContentProcess() && > > + if (Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) { > > - Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) { > > I like this idea a lot. I'm confused by you saying: > > > have all callers of `FireShowDropDownEvent` call that static method. > > That sounds to me like this is a caller of `FireShowDropDownEvent`... or are > you talking about methods like `DropDownToggleKey` that make checks against > `FireShowDropDownEvent`: > > ``` > if (!FireShowDropDownEvent(mContent, true, false)) { > > ``` > As so? Sorry, I should have been more clear. As discussed in IRC, we want to have this method called anytime we need to decide whether or not to fire an event (like moz[show|hide]dropdown), or work with the built-in old-school widget. See DestroyFrom, for example.
Depends on: 1315132
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review90478 A number of my previous review comments still stand and haven't been addressed, so r-'ing.
Attachment #8806910 - Flags: review?(mconley) → review-
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review91620 ::: layout/forms/nsListControlFrame.cpp:144 (Diff revision 2) > mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mouseup"), > mEventListener, false); > mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mousemove"), > mEventListener, false); > > - if (XRE_IsContentProcess() && > + if (FireDropDownEvent()) { this seemed to be an appropriate, but maybe confusing name. @mconley,what do you think?
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review91770 ::: layout/forms/nsListControlFrame.cpp:144 (Diff revision 2) > mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mouseup"), > mEventListener, false); > mContent->RemoveSystemEventListener(NS_LITERAL_STRING("mousemove"), > mEventListener, false); > > - if (XRE_IsContentProcess() && > + if (FireDropDownEvent()) { Because this function doesn't actually "fire" the dropdown event, it should be renamed to ShouldFireDropDownEvent()
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review91770 > Because this function doesn't actually "fire" the dropdown event, it should be renamed to ShouldFireDropDownEvent() I concur.
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review91990 This is really close! Just one issue, beyond the naming of the static function and some indentation. Otherwise, this looks solid to me. Great work you two! ::: layout/forms/nsListControlFrame.cpp:1780 (Diff revision 2) > + return (XRE_IsContentProcess() && > + Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) || > + Preferences::GetBool("dom.select_popup_in_parent.enabled") Indentation here is a bit funky. We generally try to indent so that it's clear when something is inside a parenthesis. Example: ```C++ return (XRE_IsContentProcess() && Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) || Preferences::GetBool("dom.select_popup_in_parent.enabled", false); ``` Please don't forget to pass `false` as the second argument to `GetBool` for the `dom.select_popup_in_parent.enabled` pref, as this argument is supposed to be the "fallback" value in the event that the pref does not exist.
Attachment #8806910 - Flags: review?(mconley) → review-
Depends on: 1316722
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review92588 This looks good to me! Thanks!
Attachment #8806910 - Flags: review?(mconley) → review+
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review92590 ::: layout/forms/nsListControlFrame.cpp (Diff revision 7) > -static bool ShouldFireDropDownEvent() { > - return (XRE_IsContentProcess() && > - Preferences::GetBool("browser.tabs.remote.desktopbehavior", false)) || > - Preferences::GetBool("dom.select_popup_in_parent.enabled", false); > -} Er... actually, I'm wondering if you've made sure that this patch is based off of central. ShouldFireDropDownEvent is something you added, but in this latest patch, it appears that you've moved it. Are you sure you don't need to fold some commits together?
Attachment #8806910 - Flags: review+ → review-
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review93522 ::: layout/forms/nsListControlFrame.cpp:121 (Diff revision 7) > nsListControlFrame::~nsListControlFrame() > { > mComboboxFrame = nullptr; > } > > +static bool ShouldFireDropDownEvent() { @mconley, I moved it up here because I started having compile issues, compiler wanted this method defined before it was used in line 150
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review93628 I don't think I communicated the problem clearly. ShouldFireDropDownEvent was something you added as part of this bug. This patch moves ShouldFireDropDownEvent from one place to another. Applying this patch to central doesn't make sense because ShouldFireDropDownEvent does not exist in the tree. So this patch must be based on something that's not in the list of commits to review. What we should end up with is a single commit that adds ShouldFireDropDownEvent. Does that make sense?
Attachment #8806910 - Flags: review?(mconley) → review-
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review93830 ::: toolkit/modules/SelectParentHelper.jsm:11 (Diff revision 10) > +const {utils: Cu} = Components; > +const { AppConstants } = Cu.import("resource://gre/modules/AppConstants.jsm"); This doesn't appear to be used. Is this new?
Attachment #8806910 - Flags: review?(mconley) → review-
Blocks: 1318595
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review94702 Looking at the commit log, this looks like it's based on a good commit! Good stuff. Two things: 1) Please get rid of the unnecessary import of Services.jsm in SelectParentHelper.jsm that was added 2) Please correct the commit message so that it doesn't look like: ``` Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. r?mconley MozReview-Commit-ID: CkEOBXBfYhj *** Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. r?mconley MozReview-Commit-ID: JJTlFgLMM3i ``` and instead looks like: ``` Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. r?mconley MozReview-Commit-ID: CkEOBXBfYhj ``` Thanks! ::: toolkit/modules/SelectParentHelper.jsm:11 (Diff revision 11) > +Components.utils.import("resource://gre/modules/Services.jsm"); > + This is unused.
Attachment #8806910 - Flags: review?(mconley) → review-
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review94962 Huh - and now this patching is perma-oranging when I push to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d11394a4a493&selectedJob=31668476 Here is a test failure in the log viewer: https://treeherder.mozilla.org/logviewer.html#?job_id=31663456&repo=try Any idea what's going on?
Attachment #8806910 - Flags: review?(mconley) → review-
Depends on: 1321376
Comment on attachment 8806910 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/90176/#review94962 I've figured it out - see bug 1321376.
Comment on attachment 8824544 [details] Bug 1300784 - Combine non-e10s and e10s select dropdown implementations, preffed off. https://reviewboard.mozilla.org/r/102998/#review103554
Attachment #8824544 - Flags: review?(mconley) → review+
Comment on attachment 8824545 [details] Bug 1300784 - Follow-up: update browser_selectpopup.js to handle floating point values for bounding client rects. https://reviewboard.mozilla.org/r/103000/#review103572 ::: browser/base/content/test/general/browser_selectpopup.js:454 (Diff revision 1) > + is(Math.round(selectPopup.childNodes[60].getBoundingClientRect().bottom), > + Math.round(selectPopup.getBoundingClientRect().bottom - bpBottom), > "Popup scroll at correct position " + bpBottom); We have the isfuzzy() function which will test that two values are within some epsilon of each other. We should use that here.
Attachment #8824545 - Flags: review?(jaws) → review+
Comment on attachment 8824545 [details] Bug 1300784 - Follow-up: update browser_selectpopup.js to handle floating point values for bounding client rects. https://reviewboard.mozilla.org/r/103000/#review103572 > We have the isfuzzy() function which will test that two values are within some epsilon of each other. We should use that here. Whoa, TIL! Thanks!
ni'ing myself to land this if we finally get a green try push. Fingers crossed!
Flags: needinfo?(wrigh517) → needinfo?(mconley)
Looks like it's mostly green, but that the browser_selectpopup.js test, when enabled on non-e10s, fails intermittently. I'm going to just land this thing with the test disabled for non-e10s, and then file a follow-up to get it enabled once we solve the intermittent.
Flags: needinfo?(mconley)
Blocks: 1329991
Comment on attachment 8825420 [details] Bug 1300784 - Follow-up: Disable browser_selectpopup.js for non-e10s Linux debug builds for failing intermittently. https://reviewboard.mozilla.org/r/103586/#review104202
Attachment #8825420 - Flags: review?(mconley) → review+
Pushed by mconley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/84e26201a8ee Combine non-e10s and e10s select dropdown implementations, preffed off. r=mconley https://hg.mozilla.org/integration/autoland/rev/d75cca55d824 Follow-up: update browser_selectpopup.js to handle floating point values for bounding client rects. r=jaws https://hg.mozilla.org/integration/autoland/rev/7aca41117662 Follow-up: Disable browser_selectpopup.js for non-e10s Linux debug builds for failing intermittently. r=mconley
Pushed by archaeopteryx@coole-files.de: https://hg.mozilla.org/integration/autoland/rev/c85f27d15031 Follow-up: Disable browser_selectpopup.js on Linux for frequently failing. r=fix-these-oranges
Blocks: 1331725
I guess we want this to ride the trains.
Setting the pref dom.forms.selectSearch to true and turning off e10s does not work. Should I reopen this issue or would this call for a new bug that is blocking this one?
See Also: → 1309935
(In reply to Justin [:JW_SoftvisionQA] from comment #73) > Setting the pref dom.forms.selectSearch to true and turning off e10s does > not work. Should I reopen this issue or would this call for a new bug that > is blocking this one? Please file a new bug and mark it as blocking the search bug (bug 1309935).
(In reply to Justin [:JW_SoftvisionQA] from comment #73) > Setting the pref dom.forms.selectSearch to true and turning off e10s does > not work. Should I reopen this issue or would this call for a new bug that > is blocking this one? This is a consequence of us not having fixed bug 1331725, which turns on the menulist-powered <select> dropdown (with the search input) for non-e10s.
See Also: → 1357782
Depends on: 1453178
Summary: Combine e10s and non-e10s <select> dropdown mechanisms → e10s <select> dropdown restricted

oops, sorry, wrong bug.

Summary: e10s <select> dropdown restricted → Combine e10s and non-e10s <select> dropdown mechanisms
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: