Closed
Bug 1365599
Opened 6 years ago
Closed 6 years ago
Make Tabs use the window event dispatcher rather than global when dispatching messages
Categories
(GeckoView :: General, enhancement)
Tracking
(firefox56 fixed)
RESOLVED
FIXED
mozilla56
Tracking | Status | |
---|---|---|
firefox56 | --- | fixed |
People
(Reporter: droeh, Assigned: droeh)
Details
Attachments
(1 file, 1 obsolete file)
8.70 KB,
patch
|
jchen
:
review+
|
Details | Diff | Splinter Review |
We run into a race condition when trying to use GeckoView for things other than Fennec: if we run (eg) a GV-based custom tab before Fennec is launched, and then launch Fennec, we see "dead tabs" in Fennec because Tabs sends "Tab:Load" and "Tab:Selected" messages before Fennec has registered listeners for them in browser.js. Under the assumption that there is only one GeckoApp, we can fix this by sending those messages on the window event dispatcher.
Assignee | ||
Comment 1•6 years ago
|
||
As mentioned in the summary, this switches Tabs over to using the window event dispatcher for some messages. This will likely break GeckoApp-based custom tabs and PWAs, so I'm looking to land simultaneously with GV-based custom tabs and PWAs.
Attachment #8868557 -
Flags: review?(nchen)
Comment 2•6 years ago
|
||
Comment on attachment 8868557 [details] [diff] [review] tabs-dispatcher.patch Review of attachment 8868557 [details] [diff] [review]: ----------------------------------------------------------------- I see an existing bug that this patch should fix. When `Tabs.attachToContext()` is called again, we actually return early because the application context is the same. We should stop doing that, so that we can set a new EventDispatcher/LayerView. Also, we should add something like `detachFromContext` to free the `mLayerView` instance that's kept around even after GeckoApp is destroyed. ::: mobile/android/base/java/org/mozilla/gecko/Tabs.java @@ +107,5 @@ > private static final AtomicInteger sTabId = new AtomicInteger(0); > private volatile boolean mInitialTabsAdded; > > private Context mAppContext; > + private GeckoApp mGeckoApp; Only keep the EventDispatcher instance instead of the whole GeckoApp @@ +184,5 @@ > Log.w(LOGTAG, "The application context has changed!"); > } > > mAppContext = appContext; > + mGeckoApp = (GeckoApp) context; Pass in EventDispatcher as an argument
Attachment #8868557 -
Flags: review?(nchen) → feedback+
Assignee | ||
Comment 3•6 years ago
|
||
Updated to address feedback.
Attachment #8868557 -
Attachment is obsolete: true
Assignee | ||
Comment 4•6 years ago
|
||
Comment on attachment 8869032 [details] [diff] [review] tabs-dispatcher.patch Forgot to flag for review.
Attachment #8869032 -
Flags: review?(nchen)
Comment 5•6 years ago
|
||
Comment on attachment 8869032 [details] [diff] [review] tabs-dispatcher.patch Review of attachment 8869032 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/base/java/org/mozilla/gecko/Tabs.java @@ +178,2 @@ > > + if (mAppContext != null && mAppContext != appContext) { Just remove this block. @@ +205,5 @@ > } > > + public void detachFromContext() { > + mLayerView = null; > + mEventDispatcher = null; We shouldn't clear `mEventDispatcher` here because I think it's still possible for the tab events to be dispatched after detaching.
Attachment #8869032 -
Flags: review?(nchen) → review+
Pushed by droeh@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/b94150e0a299 Make Tabs use the window event dispatcher rather than global in some instances. r=jchen
Comment 7•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b94150e0a299
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Assignee | ||
Comment 8•6 years ago
|
||
Reopening; we backed this out in bug 1369393 and will re-land in 56.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Pushed by droeh@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/7d1994e5846c Make Tabs use the window event dispatcher rather than global in some instances. r=jchen
![]() |
||
Comment 10•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7d1994e5846c
Status: REOPENED → RESOLVED
Closed: 6 years ago → 6 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Updated•6 years ago
|
status-firefox55:
fixed → ---
Target Milestone: Firefox 55 → Firefox 56
Updated•5 years ago
|
Product: Firefox for Android → GeckoView
Updated•5 years ago
|
Target Milestone: Firefox 56 → mozilla56
You need to log in
before you can comment on or make changes to this bug.
Description
•