Closed Bug 1268803 Opened 8 years ago Closed 8 years ago

Make sure BroadcastChannel are separated by userContextId

Categories

(Core :: DOM: Security, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jhao, Assigned: jhao)

References

(Blocks 1 open bug)

Details

(Whiteboard: [userContextId][OA][domsecurity-active])

Attachments

(1 file, 2 obsolete files)

I tried to write a test for bug 1260907, but later I realized my test actually tests BroadcastChannel's postMessage, instead of window-to-window postMessage. Therefore, I open this bug for that.
Whiteboard: [userContextId][OA]
Hi baku, may I ask you to review this patch? Thanks.
Attachment #8746991 - Flags: review?(amarchesini)
Removed trailing spaces.
Attachment #8746992 - Flags: review?(amarchesini)
Attachment #8746991 - Attachment is obsolete: true
Attachment #8746991 - Flags: review?(amarchesini)
Whiteboard: [userContextId][OA] → [userContextId][OA][domsecurity-active]
Comment on attachment 8746992 [details] [diff] [review]
Make sure BroadcastChannels are separated by userContextId

Review of attachment 8746992 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/contextualidentity/test/browser/browser_postMessage.js
@@ +21,5 @@
> +
> +add_task(function* setup() {
> +  // make sure userContext is enabled.
> +  SpecialPowers.pushPrefEnv({"set": [
> +    ["privacy.userContext.enabled", true]

There is a better way to do it. What about this:

add_task(function* setup() {
  yield new Promise((resolve) => {
    SpecialPowers.pushPrefEnv({"set": [
      ["privacy.userContext.enabled", true],
    ]}, resolve);
  });
});

Maybe file a bug to fix all the existing contextual identity browser tests.
If we do that, we can remove cleanup().

@@ +28,5 @@
> +
> +add_task(function* cleanup() {
> +  // make sure we don't leave any prefs set for the next tests
> +  registerCleanupFunction(function() {
> +    SpecialPowers.popPrefEnv();

remove this one. We don't need it if we use pushPrefEnv.
Attachment #8746992 - Flags: review?(amarchesini) → review+
Thanks, baku.
I addressed your comments. I also added some comments in the test, and change the filename from browser_postMessage.js to browser_broadcastchannel.js to avoid confusion.
Attachment #8746992 - Attachment is obsolete: true
Attachment #8748040 - Flags: review+
See Also: → 1269660
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/afc86294a605
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: