2009-02-12 05:35:03 -08:00
|
|
|
// Load in the test harness
|
|
|
|
var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
|
|
|
.getService(Components.interfaces.mozIJSSubScriptLoader);
|
|
|
|
scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Test whether an InstallTrigger.enabled is working
|
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
2010-03-13 05:25:13 -08:00
|
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
2009-02-12 05:35:03 -08:00
|
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
|
|
prefs.setBoolPref("xpinstall.enabled", false);
|
|
|
|
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
|
|
gBrowser.selectedBrowser.addEventListener("load", function() {
|
2009-04-16 07:50:21 -07:00
|
|
|
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
2009-02-12 05:35:03 -08:00
|
|
|
// Allow the in-page load handler to run first
|
|
|
|
executeSoon(page_loaded);
|
|
|
|
}, true);
|
|
|
|
gBrowser.loadURI(TESTROOT + "enabled.html");
|
|
|
|
}
|
|
|
|
|
|
|
|
function page_loaded() {
|
2010-03-13 05:25:13 -08:00
|
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
2009-02-12 05:35:03 -08:00
|
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
|
|
|
prefs.clearUserPref("xpinstall.enabled");
|
|
|
|
|
|
|
|
var doc = gBrowser.contentDocument;
|
|
|
|
is(doc.getElementById("enabled").textContent, "false", "installTrigger should have not been enabled");
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
finish();
|
|
|
|
}
|