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 290791 c1f0341f9055edd241c8de6663aab14209a766b5
parent 290790 369755dd7d41e76cb409514debb8e62be71ee205
child 290792 bc86e440410d9a6ce93c8f41f37fc4f94ee404da
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalker
bugs1257178
milestone48.0a1
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);
               }
             };