Bug 1317604 - 4. Include nsIObserver in nsAndroidBridge interfaces; r=me on CLOSED TREE
authorJim Chen <nchen@mozilla.com>
Mon, 21 Nov 2016 17:24:36 -0500
changeset 323745 9766420605fa47734038032d1b8e78e6962a4f92
parent 323744 446e2b8e175f3c6c83601e1e403f600ca5b2a4da
child 323746 4335e788e49ff83f9fa0dff8530c12fe63cb6773
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersme
bugs1317604
milestone53.0a1
Bug 1317604 - 4. Include nsIObserver in nsAndroidBridge interfaces; r=me on CLOSED TREE Follow-up to include nsIObserver in the list of interfaces implemented by QueryInterface for nsAndroidBridge. This fixes a bug where QI to nsIObserver fails when removing nsAnroidBridge observers.
widget/android/AndroidBridge.cpp
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -729,33 +729,35 @@ AndroidBridge::GetGlobalContextRef() {
     }
 
     sGlobalContext = env->NewGlobalRef(appContext);
     MOZ_ASSERT(sGlobalContext);
     return sGlobalContext;
 }
 
 /* Implementation file */
-NS_IMPL_ISUPPORTS(nsAndroidBridge, nsIAndroidEventDispatcher, nsIAndroidBridge)
+NS_IMPL_ISUPPORTS(nsAndroidBridge,
+                  nsIAndroidEventDispatcher,
+                  nsIAndroidBridge,
+                  nsIObserver)
 
 nsAndroidBridge::nsAndroidBridge()
 {
   if (jni::IsAvailable()) {
     RefPtr<widget::EventDispatcher> dispatcher = new widget::EventDispatcher();
     dispatcher->Attach(java::EventDispatcher::GetInstance(),
                        /* window */ nullptr);
     mEventDispatcher = dispatcher;
   }
 
   AddObservers();
 }
 
 nsAndroidBridge::~nsAndroidBridge()
 {
-  RemoveObservers();
 }
 
 NS_IMETHODIMP nsAndroidBridge::HandleGeckoMessage(JS::HandleValue val,
                                                   JSContext *cx)
 {
     if (val.isObject()) {
         JS::RootedObject object(cx, &val.toObject());
         AndroidBridge::Bridge()->HandleGeckoMessage(cx, object);