2009-02-12 16:35:03 +03:00
|
|
|
// Load in the test harness
|
|
|
|
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
|
|
|
.getService(Components.interfaces.mozIJSSubScriptLoader);
|
2010-10-01 04:10:19 +04:00
|
|
|
|
|
|
|
var rootDir = getRootDirectory(window.location.href);
|
|
|
|
scriptLoader.loadSubScript(rootDir + "harness.js", this);
|
2009-02-12 16:35:03 +03:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Tests installing an unsigned add-on through an installChrome call in web
|
|
|
|
// content. This should be blocked by the whitelist check.
|
|
|
|
// This verifies bug 252830
|
|
|
|
function test() {
|
|
|
|
Harness.installBlockedCallback = allow_blocked;
|
|
|
|
Harness.installsCompletedCallback = finish_test;
|
|
|
|
Harness.setup();
|
|
|
|
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
|
|
gBrowser.loadURI(TESTROOT + "installchrome.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
|
|
|
|
}
|
|
|
|
|
2009-04-16 18:50:21 +04:00
|
|
|
function allow_blocked(installInfo) {
|
|
|
|
is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window");
|
|
|
|
is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri");
|
2009-02-12 16:35:03 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function finish_test() {
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
Harness.finish();
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|