Bug 1257178 - Prevent "this._input is undefined" exception when developer toolbar is hidden early. r=jwalker
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 29 Mar 2016 06:28:17 -0700
changeset 290926 c1f0341f9055edd241c8de6663aab14209a766b5
parent 290925 369755dd7d41e76cb409514debb8e62be71ee205
child 290927 bc86e440410d9a6ce93c8f41f37fc4f94ee404da
push id74432
push userkwierso@gmail.com
push dateThu, 31 Mar 2016 20:08:46 +0000
treeherdermozilla-inbound@bccb11375f2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalker
bugs1257178
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 1257178 - Prevent "this._input is undefined" exception when developer toolbar is hidden early. r=jwalker
devtools/client/shared/developer-toolbar.js
--- a/devtools/client/shared/developer-toolbar.js
+++ b/devtools/client/shared/developer-toolbar.js
@@ -499,16 +499,20 @@ DeveloperToolbar.prototype.show = functi
           Services.obs.addObserver(this._devtoolsLoaded, "devtools-loaded", false);
 
           this._element.hidden = false;
 
           if (focus) {
             // If the toolbar was just inserted, the <textbox> may still have
             // its binding in process of being applied and not be focusable yet
             let waitForBinding = () => {
+              // Bail out if the toolbar has been destroyed in the meantime
+              if (!this._input) {
+                return;
+              }
               // mInputField is a xbl field of <xul:textbox>
               if (typeof this._input.mInputField != "undefined") {
                 this._input.focus();
                 this._notify(NOTIFICATIONS.SHOW);
               } else {
                 this._input.ownerDocument.defaultView.setTimeout(waitForBinding, 50);
               }
             };