gecko-dev/xpinstall/tests/browser_enabled.js

26 lines
1013 B
JavaScript

// 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();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() {
// Allow the in-page load handler to run first
executeSoon(page_loaded);
}, true);
gBrowser.loadURI(TESTROOT + "enabled.html");
}
function page_loaded() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, false);
var doc = gBrowser.contentDocument;
is(doc.getElementById("enabled").textContent, "true", "installTrigger should have been enabled");
gBrowser.removeCurrentTab();
finish();
}