Bug 1347583 - Allow third-party apps to open a tab in private browsing mode; r=sebastian
authorbrainbreaker <gautamprajapati06@gmail.com>
Mon, 24 Apr 2017 19:32:55 +0530
changeset 354553 4b90d988f654
parent 354552 7b3dff397282
child 354554 2f45a2547cb4
push id31706
push userkwierso@gmail.com
push dateMon, 24 Apr 2017 22:45:34 +0000
treeherdermozilla-central@196e7e9e2e44 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1347583
milestone55.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 1347583 - Allow third-party apps to open a tab in private browsing mode; r=sebastian MozReview-Commit-ID: 6eM3E8qm9YE
mobile/android/base/java/org/mozilla/gecko/Tabs.java
--- a/mobile/android/base/java/org/mozilla/gecko/Tabs.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Tabs.java
@@ -47,16 +47,17 @@ import android.support.v4.content.Contex
 import android.text.TextUtils;
 import android.util.Log;
 
 import static org.mozilla.gecko.Tab.TabType;
 
 public class Tabs implements BundleEventListener {
     private static final String LOGTAG = "GeckoTabs";
 
+    private static final String PRIVATE_TAB_INTENT_EXTRA = "private_tab";
     // mOrder and mTabs are always of the same cardinality, and contain the same values.
     private volatile CopyOnWriteArrayList<Tab> mOrder = new CopyOnWriteArrayList<Tab>();
 
     // A cache that maps a tab ID to an mOrder tab position.  All access should be synchronized.
     private final TabPositionCache tabPositionCache = new TabPositionCache();
 
     // All writes to mSelectedTab must be synchronized on the Tabs instance.
     // In general, it's preferred to always use selectTab()).
@@ -966,17 +967,17 @@ public class Tabs implements BundleEvent
                    final SafeIntent intent, final int flags) {
         final GeckoBundle data = new GeckoBundle();
         Tab tabToSelect = null;
         boolean delayLoad = (flags & LOADURL_DELAY_LOAD) != 0;
 
         // delayLoad implies background tab
         boolean background = delayLoad || (flags & LOADURL_BACKGROUND) != 0;
 
-        boolean isPrivate = (flags & LOADURL_PRIVATE) != 0;
+        boolean isPrivate = (flags & LOADURL_PRIVATE) != 0 || (intent != null && intent.getBooleanExtra(PRIVATE_TAB_INTENT_EXTRA, false));
         boolean userEntered = (flags & LOADURL_USER_ENTERED) != 0;
         boolean desktopMode = (flags & LOADURL_DESKTOP) != 0;
         boolean external = (flags & LOADURL_EXTERNAL) != 0;
         final boolean isFirstShownAfterActivityUnhidden = (flags & LOADURL_FIRST_AFTER_ACTIVITY_UNHIDDEN) != 0;
         final boolean customTab = (flags & LOADURL_CUSTOMTAB) != 0;
         final boolean webappTab = (flags & LOADURL_WEBAPP) != 0;
         final TabType type = customTab ? TabType.CUSTOMTAB :
             webappTab ? TabType.WEBAPP : TabType.BROWSING;