Bug 1467679 - Restore the devtools.toolbox.host value if this value is unexpected. r?gl
Bug 1192642 introduced new host type. If updating to this version, previous
preference value will be unexpected. This patch will restore this preference to
default value if this pref is unexpected value.
MozReview-Commit-ID: LO3R6fFHWh6
--- a/devtools/client/framework/toolbox-host-manager.js
+++ b/devtools/client/framework/toolbox-host-manager.js
@@ -39,16 +39,21 @@ let ID_COUNTER = 1;
function ToolboxHostManager(target, hostType, hostOptions) {
this.target = target;
this.frameId = ID_COUNTER++;
if (!hostType) {
hostType = Services.prefs.getCharPref(LAST_HOST);
+ if (!Hosts[hostType]) {
+ // If the preferences value is unexpected, restore to the default value.
+ Services.prefs.clearUserPref(LAST_HOST);
+ hostType = Services.prefs.getCharPref(LAST_HOST);
+ }
}
this.host = this.createHost(hostType, hostOptions);
this.hostType = hostType;
}
ToolboxHostManager.prototype = {
async create(toolId) {
await this.host.create();