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 because the source michael@0: // is not whitelisted, even though the target is. michael@0: function test() { 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: var triggers = encodeURIComponent(JSON.stringify({ michael@0: "Unsigned XPI": TESTROOT2 + "unsigned.xpi" michael@0: })); michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers); 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 finish_test() { michael@0: Services.perms.remove("example.org", "install"); michael@0: michael@0: gBrowser.removeCurrentTab(); michael@0: Harness.finish(); michael@0: }