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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Drew Willcoxon 2019-03-06 08:25:44 +00:00
parent 554777b1d1
commit 07c118b07a

View file

@ -566,7 +566,7 @@ class UrlbarView {
}
_on_SelectedOneOffButtonChanged() {
if (!this._queryContext) {
if (!this.isOpen || !this._queryContext) {
return;
}