Bug 1351964 - Use UI thread for "Tabs:TabsOpened" event. r=sebastian, a=lizzard
authorJim Chen <nchen@mozilla.com>
Wed, 05 Apr 2017 14:23:44 -0400
changeset 379461 3fb6a3a1295455248faa371fc75ebfa1d9c277e3
parent 379460 5dbbaedfc0fb1443434130658e9249dcbea618a9
child 379462 db49c7b778064599f028d5b3a96cda1deb257e5d
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian, lizzard
bugs1351964
milestone53.0
Bug 1351964 - Use UI thread for "Tabs:TabsOpened" event. r=sebastian, a=lizzard Use the UI thread for handling "Tabs:TabsOpened", so we don't race with other tab events that are already handled on the UI thread.
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -1745,21 +1745,21 @@ public abstract class GeckoApp
         // site loaded from the intent is on top (last loaded) and selected with all other tabs
         // being opened behind it. We process the tab queue first and request a callback from the JS - the
         // listener will open the url from the intent as normal when the tab queue has been processed.
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
                 if (TabQueueHelper.TAB_QUEUE_ENABLED && TabQueueHelper.shouldOpenTabQueueUrls(GeckoApp.this)) {
 
-                    getAppEventDispatcher().registerGeckoThreadListener(new BundleEventListener() {
+                    getAppEventDispatcher().registerUiThreadListener(new BundleEventListener() {
                         @Override
                         public void handleMessage(String event, GeckoBundle message, EventCallback callback) {
                             if ("Tabs:TabsOpened".equals(event)) {
-                                getAppEventDispatcher().unregisterGeckoThreadListener(this, "Tabs:TabsOpened");
+                                getAppEventDispatcher().unregisterUiThreadListener(this, "Tabs:TabsOpened");
                                 openTabsRunnable.run();
                             }
                         }
                     }, "Tabs:TabsOpened");
                     TabQueueHelper.openQueuedUrls(GeckoApp.this, getProfile(), TabQueueHelper.FILE_NAME, true);
                 } else {
                     openTabsRunnable.run();
                 }