bug 677088 - [Java] NullPointerException in GeckoApp.onNewIntent() r=dougt
authorBrad Lassey <blassey@mozilla.com>
Sun, 07 Aug 2011 23:30:32 -0400
changeset 73989 d9d5fbe6e0f2a30cf6caf2c2d1a33991e3e7a9a9
parent 73988 5f5c92568eb8bba09ad0a4bca20ee1ab7d806995
child 73990 4ee36bb66230b5b7b0e6878c57a1bb497fb2eb9a
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersdougt
bugs677088
milestone8.0a1
bug 677088 - [Java] NullPointerException in GeckoApp.onNewIntent() r=dougt
embedding/android/GeckoApp.java
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -63,16 +63,18 @@ import android.database.*;
 import android.provider.*;
 import android.telephony.*;
 
 abstract public class GeckoApp
     extends Activity
 {
     public static final String ACTION_ALERT_CLICK = "org.mozilla.gecko.ACTION_ALERT_CLICK";
     public static final String ACTION_ALERT_CLEAR = "org.mozilla.gecko.ACTION_ALERT_CLEAR";
+    public static final String ACTION_WEBAPP      = "org.mozilla.gecko.WEBAPP";
+    public static final String ACTION_DEBUG       = "org.mozilla.gecko.DEBUG";
 
     public static FrameLayout mainLayout;
     public static GeckoSurfaceView surfaceView;
     public static GeckoApp mAppContext;
     public static boolean mFullscreen = false;
     public static File sGREDir = null;
     static Thread mLibLoadThread = null;
     public Handler mMainHandler;
@@ -292,17 +294,17 @@ abstract public class GeckoApp
     protected void onNewIntent(Intent intent) {
         if (checkLaunchState(LaunchState.GeckoExiting)) {
             // We're exiting and shouldn't try to do anything else just incase
             // we're hung for some reason we'll force the process to exit
             System.exit(0);
             return;
         }
         final String action = intent.getAction();
-        if ("org.mozilla.gecko.DEBUG".equals(action) &&
+        if (ACTION_DEBUG.equals(action) &&
             checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitButton)) {
             final Button launchButton = new Button(this);
             launchButton.setText("Launch"); // don't need to localize
             launchButton.setOnClickListener(new Button.OnClickListener() {
                 public void onClick (View v) {
                     // hide the button so we can't be launched again
                     mainLayout.removeView(launchButton);
                     setLaunchState(LaunchState.Launching);
@@ -319,17 +321,17 @@ abstract public class GeckoApp
             String uri = intent.getDataString();
             GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
             Log.i("GeckoApp","onNewIntent: "+uri);
         }
         else if (Intent.ACTION_MAIN.equals(action)) {
             Log.i("GeckoApp", "Intent : ACTION_MAIN");
             GeckoAppShell.sendEventToGecko(new GeckoEvent(""));
         }
-        else if (action.equals("org.mozilla.gecko.WEBAPP")) {
+        else if (ACTION_WEBAPP.equals(action)) {
             String uri = intent.getStringExtra("args");
             GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
             Log.i("GeckoApp","Intent : WEBAPP - " + uri);
         }
     }
 
     @Override
     public void onPause()