Bug 1531295 - Ignore the SelectedOneOffButtonChanged event when the popup is closed. r=dao
authorDrew Willcoxon <adw@mozilla.com>
Wed, 06 Mar 2019 08:25:44 +0000
changeset 520436 5bda26248e68d20a06d197584b020e63ed091bf1
parent 520435 acbeb5adfef5580412f74d1fe9cfbc689ee8d44e
child 520437 a902fdf8f03ca2a1a502fd30077a7197bf79140e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1531295
milestone67.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 1531295 - Ignore the SelectedOneOffButtonChanged event when the popup is closed. r=dao The SelectedOneOffButtonChanged event can fire when the popup is closed, so we should ignore it then. browser_switchTab_decodeuri.js hits this, as Mark says in the bug. The stack is: _on_SelectedOneOffButtonChanged@resource:///modules/UrlbarView.jsm:569:131 handleEvent@resource:///modules/UrlbarView.jsm:298:23 dispatchEvent@chrome://browser/content/search/search-one-offs.js:147:20 set selectedButton@chrome://browser/content/search/search-one-offs.js:306:10 _on_popuphidden/<@chrome://browser/content/search/search-one-offs.js:1281:7 Alternatively we could modify the selectedButton setter in the one offs not to fire the event when the popup is closed. However, theoretically someone could be interested in listening for the selected button change even then, so I think it's better to modify the listener here. Differential Revision: https://phabricator.services.mozilla.com/D22204
browser/components/urlbar/UrlbarView.jsm
--- a/browser/components/urlbar/UrlbarView.jsm
+++ b/browser/components/urlbar/UrlbarView.jsm
@@ -561,17 +561,17 @@ class UrlbarView {
       this.oneOffSearchButtons.telemetryOrigin = null;
       this.oneOffSearchButtons.style.display = "none";
       this.oneOffSearchButtons.textbox = null;
       this.oneOffSearchButtons.view = null;
     }
   }
 
   _on_SelectedOneOffButtonChanged() {
-    if (!this._queryContext) {
+    if (!this.isOpen || !this._queryContext) {
       return;
     }
 
     // Update all search suggestion results to use the newly selected engine, or
     // if no engine is selected, revert to their original engines.
     let engine =
       this._oneOffSearchButtons.selectedButton &&
       this._oneOffSearchButtons.selectedButton.engine;