Bug 1252650 - Send event response even if GeckoApp is not active; r=me
authorJim Chen <nchen@mozilla.com>
Wed, 20 Apr 2016 15:06:13 -0400
changeset 332033 f69911bd0bc2ce6fb0b4a2a825de0fcd092f3ef6
parent 332032 1573298fe6c2f66f91f3d7aac41446a517e3d382
child 332034 1d6411584d7b5515be877eb65324e3deefc8b1be
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1252650
milestone48.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 1252650 - Send event response even if GeckoApp is not active; r=me Enable sending event response when Gecko state is PROFILE_READY. This happens when Gecko is loaded in the background and GeckoApp is not active. This is safe because it's only a response to an event from Gecko, so there is definitely a listener for the response on the Gecko side already. r=me for a trivial change.
mobile/android/base/java/org/mozilla/gecko/EventDispatcher.java
--- a/mobile/android/base/java/org/mozilla/gecko/EventDispatcher.java
+++ b/mobile/android/base/java/org/mozilla/gecko/EventDispatcher.java
@@ -347,17 +347,18 @@ public final class EventDispatcher {
             final JSONObject wrapper = new JSONObject();
             wrapper.put(GUID, message.getString(GUID));
             wrapper.put("status", status);
             wrapper.put("response", response);
 
             if (ThreadUtils.isOnGeckoThread()) {
                 GeckoAppShell.syncNotifyObservers(topic, wrapper.toString());
             } else {
-                GeckoAppShell.notifyObservers(topic, wrapper.toString());
+                GeckoAppShell.notifyObservers(topic, wrapper.toString(),
+                                              GeckoThread.State.PROFILE_READY);
             }
         } catch (final JSONException e) {
             Log.e(LOGTAG, "Unable to send response", e);
         }
     }
 
     private static class GeckoEventCallback implements EventCallback {
         private final String guid;
@@ -392,16 +393,17 @@ public final class EventDispatcher {
                 final JSONObject wrapper = new JSONObject();
                 wrapper.put(GUID, guid);
                 wrapper.put("status", status);
                 wrapper.put("response", response);
 
                 if (ThreadUtils.isOnGeckoThread()) {
                     GeckoAppShell.syncNotifyObservers(topic, wrapper.toString());
                 } else {
-                    GeckoAppShell.notifyObservers(topic, wrapper.toString());
+                    GeckoAppShell.notifyObservers(topic, wrapper.toString(),
+                                                  GeckoThread.State.PROFILE_READY);
                 }
             } catch (final JSONException e) {
                 Log.e(LOGTAG, "Unable to send response for: " + type, e);
             }
         }
     }
 }