no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / docshell / test / browser / browser_bug349769.js
blob33fca715cf7e02cc8fddda61f41bf28266cf880f
1 add_task(async function test() {
2   const uris = [undefined, "about:blank"];
4   function checkContentProcess(newBrowser, uri) {
5     return ContentTask.spawn(newBrowser, [uri], async function (uri) {
6       var prin = content.document.nodePrincipal;
7       Assert.notEqual(
8         prin,
9         null,
10         "Loaded principal must not be null when adding " + uri
11       );
12       Assert.notEqual(
13         prin,
14         undefined,
15         "Loaded principal must not be undefined when loading " + uri
16       );
18       Assert.equal(
19         prin.isSystemPrincipal,
20         false,
21         "Loaded principal must not be system when loading " + uri
22       );
23     });
24   }
26   for (var uri of uris) {
27     await BrowserTestUtils.withNewTab(
28       { gBrowser },
29       async function (newBrowser) {
30         let loadedPromise = BrowserTestUtils.browserLoaded(newBrowser);
31         BrowserTestUtils.startLoadingURIString(newBrowser, uri);
33         var prin = newBrowser.contentPrincipal;
34         isnot(
35           prin,
36           null,
37           "Forced principal must not be null when loading " + uri
38         );
39         isnot(
40           prin,
41           undefined,
42           "Forced principal must not be undefined when loading " + uri
43         );
44         is(
45           prin.isSystemPrincipal,
46           false,
47           "Forced principal must not be system when loading " + uri
48         );
50         // Belt-and-suspenders e10s check: make sure that the same checks hold
51         // true in the content process.
52         await checkContentProcess(newBrowser, uri);
54         await loadedPromise;
56         prin = newBrowser.contentPrincipal;
57         isnot(
58           prin,
59           null,
60           "Loaded principal must not be null when adding " + uri
61         );
62         isnot(
63           prin,
64           undefined,
65           "Loaded principal must not be undefined when loading " + uri
66         );
67         is(
68           prin.isSystemPrincipal,
69           false,
70           "Loaded principal must not be system when loading " + uri
71         );
73         // Belt-and-suspenders e10s check: make sure that the same checks hold
74         // true in the content process.
75         await checkContentProcess(newBrowser, uri);
76       }
77     );
78   }
79 });