1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_empty.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 +// ---------------------------------------------------------------------------- 1.5 +// Test whether an install fails when there is no install script present. 1.6 +function test() { 1.7 + Harness.downloadFailedCallback = download_failed; 1.8 + Harness.installsCompletedCallback = finish_test; 1.9 + Harness.setup(); 1.10 + 1.11 + var pm = Services.perms; 1.12 + pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION); 1.13 + 1.14 + var triggers = encodeURIComponent(JSON.stringify({ 1.15 + "Empty XPI": TESTROOT + "empty.xpi" 1.16 + })); 1.17 + gBrowser.selectedTab = gBrowser.addTab(); 1.18 + gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers); 1.19 +} 1.20 + 1.21 +function download_failed(install) { 1.22 + is(install.error, AddonManager.ERROR_CORRUPT_FILE, "Install should fail"); 1.23 +} 1.24 + 1.25 +function finish_test(count) { 1.26 + is(count, 0, "No add-ons should have been installed"); 1.27 + Services.perms.remove("example.com", "install"); 1.28 + 1.29 + gBrowser.removeCurrentTab(); 1.30 + Harness.finish(); 1.31 +}