Bug 826146 - Add a pref-controlled install confirmation override for automation. r=sicking

This commit is contained in:
Bobby Holley 2013-01-04 10:21:31 -08:00
Родитель ecb358d581
Коммит 83c1284aff
2 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -1382,9 +1382,17 @@ this.DOMApplicationRegistry = {
sendError("INVALID_SECURITY_LEVEL");
} else {
app.etag = xhr.getResponseHeader("Etag");
// We allow bypassing the install confirmation process to facilitate
// automation.
let prefName = "dom.mozApps.auto_confirm_install";
if (Services.prefs.prefHasUserValue(prefName) &&
Services.prefs.getBoolPref(prefName)) {
this.confirmInstall(aData);
} else {
Services.obs.notifyObservers(aMm, "webapps-ask-install",
JSON.stringify(aData));
}
}
} else {
sendError("MANIFEST_URL_ERROR");
}

Просмотреть файл

@ -713,6 +713,14 @@ SpecialPowersAPI.prototype = {
}
},
// Disables the app install prompt for the duration of this test. There is
// no need to re-enable the prompt at the end of the test.
//
// The provided callback is invoked once the prompt is disabled.
autoConfirmAppInstall: function(cb) {
this.pushPrefEnv({set: [['dom.mozApps.auto_confirm_install', true]]}, cb);
},
addObserver: function(obs, notification, weak) {
var obsvc = Cc['@mozilla.org/observer-service;1']
.getService(Ci.nsIObserverService);