michael@0: // ---------------------------------------------------------------------------- michael@0: // Tests installing an unsigned add-on through a navigation. Should be michael@0: // blocked since the referer 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.com/"), "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 + "unsigned.xpi", makeURI(TESTROOT2 + "test.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, TESTROOT2 + "test.html", "Install should have been triggered by the right uri"); michael@0: return false; michael@0: } michael@0: michael@0: function finish_test(count) { michael@0: is(count, 0, "No add-ons should have been installed"); michael@0: Services.perms.remove("example.com", "install"); michael@0: michael@0: gBrowser.removeCurrentTab(); michael@0: Harness.finish(); michael@0: }