gecko/xpinstall/tests/browser_enabled3.js

36 lines
1.3 KiB
JavaScript
Raw Normal View History

// Load in the test harness
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
2010-09-30 17:10:19 -07:00
var rootDir = getRootDirectory(window.location.href);
scriptLoader.loadSubScript(rootDir + "harness.js", this);
// ----------------------------------------------------------------------------
// Test whether an InstallTrigger.install call fails when xpinstall is disabled
function test() {
waitForExplicitFinish();
2010-04-03 00:36:55 -07:00
Services.prefs.setBoolPref("xpinstall.enabled", false);
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": TESTROOT + "unsigned.xpi"
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
// Allow the in-page load handler to run first
executeSoon(page_loaded);
}, true);
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function page_loaded() {
2010-04-03 00:36:55 -07:00
Services.prefs.clearUserPref("xpinstall.enabled");
var doc = gBrowser.contentDocument;
is(doc.getElementById("return").textContent, "false", "installTrigger should have not been enabled");
gBrowser.removeCurrentTab();
finish();
}
// ----------------------------------------------------------------------------