2007-07-15 15:33:21 -07:00
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
|
|
|
var newTab;
|
|
|
|
var newBrowser;
|
2010-04-02 00:20:42 -07:00
|
|
|
const secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
|
2007-07-15 15:33:21 -07:00
|
|
|
var iteration = 1;
|
|
|
|
const uris = [undefined, "about:blank"];
|
|
|
|
var uri;
|
|
|
|
|
|
|
|
function testLoad(event) {
|
|
|
|
newBrowser.removeEventListener("load", testLoad, true);
|
2007-09-02 21:58:05 -07:00
|
|
|
is (event.target, newBrowser.contentDocument, "Unexpected target");
|
2007-07-15 15:33:21 -07:00
|
|
|
var prin = newBrowser.contentDocument.nodePrincipal;
|
|
|
|
isnot(prin, null, "Loaded principal must not be null when adding " + uri);
|
|
|
|
isnot(prin, undefined, "Loaded principal must not be undefined when loading " + uri);
|
|
|
|
is(secMan.isSystemPrincipal(prin), false,
|
|
|
|
"Loaded principal must not be system when loading " + uri);
|
|
|
|
gBrowser.removeTab(newTab);
|
|
|
|
|
|
|
|
if (iteration == uris.length) {
|
|
|
|
finish();
|
|
|
|
} else {
|
|
|
|
++iteration;
|
|
|
|
doTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function doTest() {
|
|
|
|
uri = uris[iteration - 1];
|
|
|
|
newTab = gBrowser.addTab(uri);
|
|
|
|
newBrowser = gBrowser.getBrowserForTab(newTab);
|
|
|
|
newBrowser.addEventListener("load", testLoad, true);
|
|
|
|
var prin = newBrowser.contentDocument.nodePrincipal;
|
|
|
|
isnot(prin, null, "Forced principal must not be null when loading " + uri);
|
|
|
|
isnot(prin, undefined,
|
|
|
|
"Forced principal must not be undefined when loading " + uri);
|
|
|
|
is(secMan.isSystemPrincipal(prin), false,
|
|
|
|
"Forced principal must not be system when loading " + uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
doTest();
|
|
|
|
}
|
|
|
|
|