michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: var w; michael@0: const secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager); michael@0: var iteration = 1; michael@0: const uris = ["", "about:blank"]; michael@0: var uri; michael@0: var origDoc; michael@0: michael@0: function testLoad() { michael@0: if (w.document == origDoc) { michael@0: // Go back to polling michael@0: setTimeout(testLoad, 10); michael@0: return; michael@0: } michael@0: var prin = w.document.nodePrincipal; michael@0: isnot(prin, null, "Loaded principal must not be null when adding " + uri); michael@0: isnot(prin, undefined, "Loaded principal must not be undefined when loading " + uri); michael@0: is(secMan.isSystemPrincipal(prin), false, michael@0: "Loaded principal must not be system when loading " + uri); michael@0: w.close(); michael@0: michael@0: if (iteration == uris.length) { michael@0: finish(); michael@0: } else { michael@0: ++iteration; michael@0: doTest(); michael@0: } michael@0: } michael@0: michael@0: function doTest() { michael@0: uri = uris[iteration - 1]; michael@0: w = window.open(uri, "_blank", "width=10,height=10"); michael@0: var prin = w.document.nodePrincipal; michael@0: if (!uri) { michael@0: uri = undefined; michael@0: } michael@0: isnot(prin, null, "Forced principal must not be null when loading " + uri); michael@0: isnot(prin, undefined, michael@0: "Forced principal must not be undefined when loading " + uri); michael@0: is(secMan.isSystemPrincipal(prin), false, michael@0: "Forced principal must not be system when loading " + uri); michael@0: if (uri == undefined) { michael@0: // No actual load here, so just move along. michael@0: w.close(); michael@0: ++iteration; michael@0: doTest(); michael@0: } else { michael@0: origDoc = w.document; michael@0: // Need to poll, because load listeners on the content window won't michael@0: // survive the load. michael@0: setTimeout(testLoad, 10); michael@0: } michael@0: } michael@0: michael@0: doTest(); michael@0: }