Bug 1326937 - Avoid an exception due to a missing sidebar; r=bgrins
MozReview-Commit-ID: EuyrE4ZBYen
--- a/devtools/client/webconsole/jsterm.js
+++ b/devtools/client/webconsole/jsterm.js
@@ -581,16 +581,21 @@ JSTerm.prototype = {
* option is not used, then the variables view opens in the sidebar.
* - autofocus: optional boolean, |true| if you want to give focus to
* the variables view window after open, |false| otherwise.
* @return object
* A promise object that is resolved when the variables view has
* opened. The new variables view instance is given to the callbacks.
*/
openVariablesView: function (options) {
+ // Bail out if the side bar doesn't exist.
+ if (!this.hud.document.querySelector("#webconsole-sidebar")) {
+ return Promise.resolve(null);
+ }
+
let onContainerReady = (window) => {
let container = window.document.querySelector("#variables");
let view = this._variablesView;
if (!view || options.targetElement) {
let viewOptions = {
container: container,
hideFilterInput: options.hideFilterInput,
};