1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_bug645699.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +// ---------------------------------------------------------------------------- 1.5 +// Tests installing an unsigned add-on through an InstallTrigger call in web 1.6 +// content. This should be blocked by the whitelist check. 1.7 +// This verifies bug 645699 1.8 +function test() { 1.9 + Harness.installConfirmCallback = confirm_install; 1.10 + Harness.installBlockedCallback = allow_blocked; 1.11 + Harness.installsCompletedCallback = finish_test; 1.12 + Harness.setup(); 1.13 + 1.14 + var pm = Services.perms; 1.15 + pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION); 1.16 + 1.17 + gBrowser.selectedTab = gBrowser.addTab(); 1.18 + gBrowser.loadURI(TESTROOT + "bug645699.html"); 1.19 +} 1.20 + 1.21 +function allow_blocked(installInfo) { 1.22 + is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window"); 1.23 + is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri"); 1.24 + return false; 1.25 +} 1.26 + 1.27 +function confirm_install(window) { 1.28 + ok(false, "Should not see the install dialog"); 1.29 + return false; 1.30 +} 1.31 + 1.32 +function finish_test(count) { 1.33 + is(count, 0, "0 Add-ons should have been successfully installed"); 1.34 + Services.perms.remove("addons.mozilla.org", "install"); 1.35 + 1.36 + gBrowser.removeCurrentTab(); 1.37 + Harness.finish(); 1.38 +} 1.39 +// ----------------------------------------------------------------------------