forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1297687 - Use the OriginAttributes associated with a window princ…
…ipal when creating a Sandbox with an expanded principal; r=baku
- Loading branch information
Showing
8 changed files
with
108 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
js/xpconnect/tests/browser/browser_expandedPrincipal_originAttributes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
add_task(function* test() { | ||
let privateWin = yield BrowserTestUtils.openNewBrowserWindow({private: true}); | ||
|
||
yield ContentTask.spawn(privateWin.gBrowser.selectedBrowser, {}, function*() { | ||
let tests = [ | ||
[["https://mozilla.org", content], 1], | ||
[["https://mozilla.org", "https://example.com"], 0], | ||
]; | ||
tests.forEach(item => { | ||
let sandbox = Components.utils.Sandbox(item[0]); | ||
let principal = Services.scriptSecurityManager | ||
.getSandboxPrincipal(sandbox); | ||
is(principal.privateBrowsingId, item[1], | ||
"Sandbox principal should have the correct OriginAttributes"); | ||
}); | ||
}); | ||
|
||
privateWin.close(); | ||
|
||
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function*() { | ||
let tests = [ | ||
[["https://mozilla.org", content], 0], | ||
[["https://mozilla.org", "https://example.com"], 0], | ||
]; | ||
tests.forEach(item => { | ||
let sandbox = Components.utils.Sandbox(item[0]); | ||
let principal = Services.scriptSecurityManager | ||
.getSandboxPrincipal(sandbox); | ||
is(principal.privateBrowsingId, item[1], | ||
"Sandbox principal should have the correct OriginAttributes"); | ||
}); | ||
}); | ||
}); |