summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpinstall/browser_navigateaway3.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpinstall/browser_navigateaway3.js')
-rw-r--r--toolkit/mozapps/extensions/test/xpinstall/browser_navigateaway3.js43
1 files changed, 40 insertions, 3 deletions
diff --git a/toolkit/mozapps/extensions/test/xpinstall/browser_navigateaway3.js b/toolkit/mozapps/extensions/test/xpinstall/browser_navigateaway3.js
index 3948d5649..7f55a65fe 100644
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_navigateaway3.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_navigateaway3.js
@@ -2,9 +2,46 @@
// Tests that navigating to a new origin cancels ongoing installs.
// Block the modal install UI from showing.
-Services.prefs.setBoolPref(PREF_CUSTOM_CONFIRMATION_UI, true);
+let InstallPrompt = {
+ confirm: function(aBrowser, aUri, aInstalls, aCount) {
+ },
+
+ QueryInterface: XPCOMUtils.generateQI([Ci.amIWebInstallPrompt]),
+
+ classID: Components.ID("{405f3c55-241f-40df-97f1-a6e60e250ec5}"),
+
+ factory: {
+ registrar: Components.manager.QueryInterface(Ci.nsIComponentRegistrar),
+
+ register: function() {
+ this.registrar.registerFactory(InstallPrompt.classID, "InstallPrompt",
+ "@mozilla.org/addons/web-install-prompt;1",
+ this);
+ },
+
+ unregister: function() {
+ this.registrar.unregisterFactory(InstallPrompt.classID, this);
+ },
+
+ // nsIFactory
+ createInstance: function(aOuter, aIID) {
+ if (aOuter) {
+ throw Components.Exception("Class does not allow aggregation",
+ Components.results.NS_ERROR_NO_AGGREGATION);
+ }
+ return InstallPrompt.QueryInterface(aIID);
+ },
+
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory])
+ }
+};
function test() {
+ InstallPrompt.factory.register();
+ registerCleanupFunction(() => {
+ InstallPrompt.factory.unregister();
+ });
+
Harness.downloadProgressCallback = download_progress;
Harness.installEndedCallback = install_ended;
Harness.installsCompletedCallback = finish_test;
@@ -14,7 +51,7 @@ function test() {
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
- "Unsigned XPI": TESTROOT + "amosigned.xpi"
+ "Unsigned XPI": TESTROOT + "unsigned.xpi"
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
@@ -31,7 +68,7 @@ function install_ended(install, addon) {
function finish_test(count) {
is(count, 0, "No add-ons should have been successfully installed");
- Services.perms.remove(makeURI("http://example.com"), "install");
+ Services.perms.remove("http://example.com", "install");
gBrowser.removeCurrentTab();
Harness.finish();