michael@0: // ---------------------------------------------------------------------------- michael@0: // Tests installing an unsigned add-on through an InstallTrigger call in web michael@0: // content. This should be blocked by the whitelist check. michael@0: // This verifies bug 645699 michael@0: function test() { michael@0: Harness.installConfirmCallback = confirm_install; michael@0: Harness.installBlockedCallback = allow_blocked; michael@0: Harness.installsCompletedCallback = finish_test; michael@0: Harness.setup(); michael@0: michael@0: var pm = Services.perms; michael@0: pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.loadURI(TESTROOT + "bug645699.html"); michael@0: } michael@0: michael@0: function allow_blocked(installInfo) { michael@0: is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window"); michael@0: is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri"); michael@0: return false; michael@0: } michael@0: michael@0: function confirm_install(window) { michael@0: ok(false, "Should not see the install dialog"); michael@0: return false; michael@0: } michael@0: michael@0: function finish_test(count) { michael@0: is(count, 0, "0 Add-ons should have been successfully installed"); michael@0: Services.perms.remove("addons.mozilla.org", "install"); michael@0: michael@0: gBrowser.removeCurrentTab(); michael@0: Harness.finish(); michael@0: } michael@0: // ----------------------------------------------------------------------------