Mozilla/mozilla/docshell/test/browser/browser_bug388121-1.js
bzbarsky%mit.edu 52d93b63e1 Adding tests.
git-svn-id: svn://10.0.0.236/trunk@233780 18797224-902f-48f8-a5cc-f745e15eee43
2007-09-03 04:58:05 +00:00

28 lines
924 B
JavaScript

function test() {
waitForExplicitFinish();
var newTab;
var newBrowser;
const secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"].
getService(Components.interfaces.nsIScriptSecurityManager);
function testLoad(event) {
newBrowser.removeEventListener("load", testLoad, true);
is (event.target, newBrowser.contentDocument, "Unexpected target");
var prin = newBrowser.contentDocument.nodePrincipal;
isnot(prin, null, "Loaded principal must not be null");
isnot(prin, undefined, "Loaded principal must not be undefined");
is(secMan.isSystemPrincipal(prin), false,
"Loaded principal must not be system");
gBrowser.removeTab(newTab);
finish();
}
newTab = gBrowser.addTab();
newBrowser = gBrowser.getBrowserForTab(newTab);
newBrowser.contentWindow.location.href = "about:blank"
newBrowser.addEventListener("load", testLoad, true);
}