Bug 1168662 - Add EXTRA_APPLICATION_ID to all outgoing Intents. r=margaret
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 12 Jun 2015 16:30:20 -0700
changeset 279713 afa30c80a16a5c12fc361f405c2eb3614fd927ca
parent 279712 cb07547fd9ab75510d3d56e16d4e477d8da4cec0
child 279714 44d354ade75c8f7604ba76b0d427e6cc76405a51
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1168662
milestone41.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 1168662 - Add EXTRA_APPLICATION_ID to all outgoing Intents. r=margaret
mobile/android/base/GeckoAppShell.java
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -95,16 +95,17 @@ import android.net.Uri;
 import android.os.Bundle;
 import android.os.Environment;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
 import android.os.MessageQueue;
 import android.os.SystemClock;
 import android.os.Vibrator;
+import android.provider.Browser;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.Base64;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.ContextThemeWrapper;
 import android.view.HapticFeedbackConstants;
@@ -1173,16 +1174,21 @@ public class GeckoAppShell
                                    final String action,
                                    final String title) {
 
         final Intent intent = getOpenURIIntentInner(context, targetURI, mimeType, action, title);
 
         if (intent != null) {
             // Only handle applications which can accept arbitrary data from a browser.
             intent.addCategory(Intent.CATEGORY_BROWSABLE);
+
+            // Some applications use this field to return to the same browser after processing the
+            // Intent. While there is some danger (e.g. denial of service), other major browsers already
+            // use it and so it's the norm.
+            intent.putExtra(Browser.EXTRA_APPLICATION_ID, GeckoApp.class.getPackage().getName());
         }
 
         return intent;
     }
 
     private static Intent getOpenURIIntentInner(final Context context,  final String targetURI,
             final String mimeType, final String action, final String title) {