Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 21569: Add first-party domain to Permissions key
- Loading branch information
1 parent
58d186d
commit 7a8a74e
Showing
7 changed files
with
50 additions
and
40 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
46 changes: 46 additions & 0 deletions
46
browser/components/originattributes/test/browser/browser_permissions_isolation.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,46 @@ | ||
/** | ||
* Tor Bug 21569 - A test case for permissions isolation. | ||
*/ | ||
|
||
const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/" + | ||
"originattributes/test/browser/file_firstPartyBasic.html"; | ||
|
||
function* init() { | ||
let permPromise = TestUtils.topicObserved("perm-changed"); | ||
Services.perms.removeAll(); | ||
info("called removeAll"); | ||
yield permPromise; | ||
info("cleared permissions for new test"); | ||
} | ||
|
||
// Define the testing function | ||
function* doTest(aBrowser) { | ||
// Promise will result when permissions popup appears: | ||
let popupShowPromise = BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown"); | ||
let originalStatus = yield ContentTask.spawn(aBrowser, null, function* (key) { | ||
let status = (yield content.navigator.permissions.query({name: "notifications"})).state; | ||
content.Notification.requestPermission(); | ||
return status; | ||
}); | ||
info(`originalStatus: '${originalStatus}'`); | ||
if (originalStatus === "prompt") { | ||
// Wait for the popup requesting permission to show notifications: | ||
yield popupShowPromise; | ||
let popupHidePromise = BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popuphidden"); | ||
let popupNotification = PopupNotifications.panel.childNodes[0]; | ||
// Click to grant permission: | ||
popupNotification.button.click(); | ||
// Wait for popup to hide again. | ||
yield popupHidePromise; | ||
} | ||
return originalStatus; | ||
} | ||
|
||
add_task(function* () { | ||
yield SpecialPowers.pushPrefEnv({ | ||
set: [["dom.webnotifications.enabled", true]] | ||
}); | ||
IsolationTestTools.runTests(TEST_PAGE, doTest, | ||
(isolated, val1, val2) => (isolated === ( val2 === "prompt")), | ||
init, true); | ||
}); |
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