summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-11 07:03:16 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-11 07:03:16 -0500
commit203eb0f61a09372310a2a8fb57e169cb3f47800b (patch)
tree8490329d3dae4de3c7ffd127bce1f65fdc009abd /toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js
parente45706ca3acbb6530419433212becc61d5953a2d (diff)
parent8f6d3dab81c7f8f97ef197e26ab9439b09735b8f (diff)
downloadUXP-ed96a7148c31f5448b81800287c09ce7169223cc.tar
UXP-ed96a7148c31f5448b81800287c09ce7169223cc.tar.gz
UXP-ed96a7148c31f5448b81800287c09ce7169223cc.tar.lz
UXP-ed96a7148c31f5448b81800287c09ce7169223cc.tar.xz
UXP-ed96a7148c31f5448b81800287c09ce7169223cc.zip
Merge branch 'ext-work'FF_Checkpoint_1
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js')
-rw-r--r--toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js b/toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js
new file mode 100644
index 000000000..105ab681e
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js
@@ -0,0 +1,33 @@
+// ----------------------------------------------------------------------------
+// Test whether an install fails when an unknown hash type is included
+// This verifies bug 302284
+function test() {
+ Harness.downloadFailedCallback = download_failed;
+ Harness.installsCompletedCallback = finish_test;
+ Harness.setup();
+
+ var pm = Services.perms;
+ pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
+
+ var triggers = encodeURIComponent(JSON.stringify({
+ "Unsigned XPI": {
+ URL: TESTROOT + "unsigned.xpi",
+ Hash: "foo:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f",
+ toString: function() { return this.URL; }
+ }
+ }));
+ gBrowser.selectedTab = gBrowser.addTab();
+ gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
+}
+
+function download_failed(install) {
+ is(install.error, AddonManager.ERROR_INCORRECT_HASH, "Install should fail");
+}
+
+function finish_test(count) {
+ is(count, 0, "No add-ons should have been installed");
+ Services.perms.remove("example.com", "install");
+
+ gBrowser.removeCurrentTab();
+ Harness.finish();
+}