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

This commit is contained in:
Bobby Holley 2013-01-03 18:27:43 -08:00
parent c3088a801a
commit 96f2bec98f
2 changed files with 16 additions and 2 deletions

View File

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

View File

@ -719,6 +719,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);