Bug 840574 - Clear the selected tab's applicationId on user action. r=margaret
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 30 Apr 2015 16:09:47 -0700
changeset 242401 95a7cebd3385ab748d9f312d6867f554254b8643
parent 242400 e665a4452667a863893d8b4d23194dab610a2d53
child 242402 abc82c17827305670522281c6e3703db667a6005
push id28693
push userkwierso@gmail.com
push dateWed, 06 May 2015 03:23:28 +0000
treeherdermozilla-central@f938222ff4ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs840574
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 840574 - Clear the selected tab's applicationId on user action. r=margaret
mobile/android/base/BrowserApp.java
mobile/android/base/Tab.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -2229,16 +2229,24 @@ public class BrowserApp extends GeckoApp
         // visible instead.
         //
         // Here we call hideHomePager for the second time with the URL to be loaded so that
         // hideHomePager is called with the correct state for the upcoming page load.
         //
         // Expected to be fixed by bug 915825.
         hideHomePager(url);
         loadUrlOrKeywordSearch(url);
+        clearSelectedTabApplicationId();
+    }
+
+    private void clearSelectedTabApplicationId() {
+        final Tab selected = Tabs.getInstance().getSelectedTab();
+        if (selected != null) {
+            selected.setApplicationId(null);
+        }
     }
 
     private void loadUrlOrKeywordSearch(final String url) {
         // Don't do anything if the user entered an empty URL.
         if (TextUtils.isEmpty(url)) {
             return;
         }
 
@@ -3567,16 +3575,17 @@ public class BrowserApp extends GeckoApp
     @Override
     public void onUrlOpen(String url, EnumSet<OnUrlOpenListener.Flags> flags) {
         if (flags.contains(OnUrlOpenListener.Flags.OPEN_WITH_INTENT)) {
             Intent intent = new Intent(Intent.ACTION_VIEW);
             intent.setData(Uri.parse(url));
             startActivity(intent);
         } else if (!maybeSwitchToTab(url, flags)) {
             openUrlAndStopEditing(url);
+            clearSelectedTabApplicationId();
         }
     }
 
     // HomePager.OnUrlOpenInBackgroundListener
     @Override
     public void onUrlOpenInBackground(final String url, EnumSet<OnUrlOpenInBackgroundListener.Flags> flags) {
         if (url == null) {
             throw new IllegalArgumentException("url must not be null");
--- a/mobile/android/base/Tab.java
+++ b/mobile/android/base/Tab.java
@@ -45,17 +45,17 @@ public class Tab {
     private final BrowserDB mDB;
     private long mLastUsed;
     private String mUrl;
     private String mBaseDomain;
     private String mUserRequested; // The original url requested. May be typed by the user or sent by an extneral app for example.
     private String mTitle;
     private Bitmap mFavicon;
     private String mFaviconUrl;
-    private String mApplicationId;
+    private String mApplicationId; // Intended to be null after explicit user action.
 
     // The set of all available Favicons for this tab, sorted by attractiveness.
     final TreeSet<RemoteFavicon> mAvailableFavicons = new TreeSet<>();
     private boolean mHasFeeds;
     private boolean mHasOpenSearch;
     private final SiteIdentity mSiteIdentity;
     private BitmapDrawable mThumbnail;
     private final int mParentId;