Bug 1460601 - Fix up Prompt.jsm Dispatcher retrieval. r?jchen draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 14 May 2018 22:39:42 +0200
changeset 795013 739744d4e169b1911c4e82fc8451f7fd00530a28
parent 794946 f32b2ab2569c8d7c7b34382775131f27fbfad19c
child 795454 92eb23878450b9782db79af9b44be8a2f72e75c5
child 795478 380db16d400a570e0fb7b063ba25faadd4c6fb65
push id109830
push usermozilla@buttercookie.de
push dateMon, 14 May 2018 20:40:39 +0000
reviewersjchen
bugs1460601, 1459298
milestone62.0a1
Bug 1460601 - Fix up Prompt.jsm Dispatcher retrieval. r?jchen Forgotten in bug 1459298. MozReview-Commit-ID: ANOK5Mp709K
mobile/android/modules/Prompt.jsm
--- a/mobile/android/modules/Prompt.jsm
+++ b/mobile/android/modules/Prompt.jsm
@@ -177,18 +177,24 @@ Prompt.prototype = {
 
   show: function(callback) {
     this.callback = callback;
     log("Sending message");
     this._innerShow();
   },
 
   _innerShow: function() {
-    let dispatcher = GeckoViewUtils.getDispatcherForWindow(this.window) ||
-                     GeckoViewUtils.getActiveDispatcher();
+    let dispatcher;
+    if (this.window) {
+      dispatcher = GeckoViewUtils.getDispatcherForWindow(this.window);
+    }
+    if (!dispatcher) {
+      [dispatcher] = GeckoViewUtils.getActiveDispatcherAndWindow();
+    }
+
     dispatcher.sendRequestForResult(this.msg).then((data) => {
       if (this.callback) {
         this.callback(data);
       }
     });
   },
 
   _setListItems: function(aItems) {