CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / docshell / test / browser / browser_bug349769.js
blob35eef985df5c0811857acbee95d6c8fb50e97682
1 function test() {
2 waitForExplicitFinish();
4 var newTab;
5 var newBrowser;
6 const secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
7 var iteration = 1;
8 const uris = [undefined, "about:blank"];
9 var uri;
11 function testLoad(event) {
12 newBrowser.removeEventListener("load", testLoad, true);
13 is (event.target, newBrowser.contentDocument, "Unexpected target");
14 var prin = newBrowser.contentDocument.nodePrincipal;
15 isnot(prin, null, "Loaded principal must not be null when adding " + uri);
16 isnot(prin, undefined, "Loaded principal must not be undefined when loading " + uri);
17 is(secMan.isSystemPrincipal(prin), false,
18 "Loaded principal must not be system when loading " + uri);
19 gBrowser.removeTab(newTab);
21 if (iteration == uris.length) {
22 finish();
23 } else {
24 ++iteration;
25 doTest();
29 function doTest() {
30 uri = uris[iteration - 1];
31 newTab = gBrowser.addTab(uri);
32 newBrowser = gBrowser.getBrowserForTab(newTab);
33 newBrowser.addEventListener("load", testLoad, true);
34 var prin = newBrowser.contentDocument.nodePrincipal;
35 isnot(prin, null, "Forced principal must not be null when loading " + uri);
36 isnot(prin, undefined,
37 "Forced principal must not be undefined when loading " + uri);
38 is(secMan.isSystemPrincipal(prin), false,
39 "Forced principal must not be system when loading " + uri);
42 doTest();