Closed
Bug 1318727
Opened 8 years ago
Closed 8 years ago
BroadcastChannel doesn't work with null principal
Categories
(Core :: DOM: Core & HTML, defect, P5)
Tracking
()
RESOLVED
FIXED
mozilla53
Tracking | Status | |
---|---|---|
firefox53 | --- | fixed |
People
(Reporter: smaug, Assigned: baku)
Details
Attachments
(1 file)
8.06 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
data:text/html,<script>var b = new BroadcastChannel("foo") </script> throws a Gecko internal exception. As far as I see, it should work and one should be able to communicate with other channels from the same null-principal.
Reporter | ||
Comment 1•8 years ago
|
||
Looks like bent's review comments in bug 966439 were just wrong.
Reporter | ||
Comment 2•8 years ago
|
||
hmm, Chrome throws "Can't create BroadcastChannel in an opaque origin"
Reporter | ||
Comment 3•8 years ago
|
||
But I don't see spec saying anything like that. BroadcastChannel should just work.
Comment 4•8 years ago
|
||
I didn't think null principal subsumed any other principal; event other null principals. I thought it was supposed to represent unique opaque origins.
Reporter | ||
Comment 5•8 years ago
|
||
So? You can still create a window which has such null principal and use BroadcastChannel inside it.
Comment 6•8 years ago
|
||
(In reply to Olli Pettay [:smaug] (vacation Nov 19-26) from comment #5) > So? You can still create a window which has such null principal and use > BroadcastChannel inside it. And listen to itself? I guess I'm trying to understand the use case. It seems no remote environment could ever be considered same-origin here.
Reporter | ||
Comment 7•8 years ago
|
||
you can create multiple BroadcastChannels inside a window context and make them communicate. Or you can add about:blank iframes which inherit the origin from data: page etc.
Reporter | ||
Comment 8•8 years ago
|
||
This is an edge sure, but this also hints that we are doing something wrong with principals.
Comment 9•8 years ago
|
||
Per comment 8, it's a really edge case and there's no real-world use case for now, so put it in P5 (really low priority).
Priority: -- → P5
Assignee | ||
Comment 10•8 years ago
|
||
Smaug, do you mind to review this patch?
Assignee: nobody → amarchesini
Flags: needinfo?(bugs)
Reporter | ||
Comment 11•8 years ago
|
||
Put it to my review queue, thanks.
Flags: needinfo?(bugs) → needinfo?(amarchesini)
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(amarchesini)
Attachment #8814869 -
Flags: review?(bugs)
Reporter | ||
Comment 12•8 years ago
|
||
Comment on attachment 8814869 [details] [diff] [review] bc.patch > if (aPrincipal->GetIsNullPrincipal()) { >- *aPrincipalInfo = NullPrincipalInfo(BasePrincipal::Cast(aPrincipal)->OriginAttributesRef()); >+ nsCOMPtr<nsIURI> uri; >+ nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri)); >+ if (NS_WARN_IF(NS_FAILED(rv))) { >+ return rv; >+ } >+ >+ if (NS_WARN_IF(!uri)) { >+ return NS_ERROR_FAILURE; >+ } >+ >+ nsCString spec; nsAutoCString Some test is needed here. Perhaps easiest is to use sandboxed (allow-scripts) data: -url iframe which then tests broadcastchannel and sends messages to its parent window. That could be a wpt test. Please don't land this without a test.
Attachment #8814869 -
Flags: review?(bugs) → review+
Comment 13•8 years ago
|
||
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/124b6d766926 BroadcastChannel should support data URL, r=smaug
Comment 14•8 years ago
|
||
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/0bdc2dfc9dcc BroadcastChannel should support data URL - part 2, r=me
Comment 15•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/124b6d766926 https://hg.mozilla.org/mozilla-central/rev/0bdc2dfc9dcc
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox53:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Reporter | ||
Comment 16•8 years ago
|
||
FWIW, Google landed some invalid BroadcastChannel tests to w3c wpt recently. But the spec isn't going to change https://github.com/whatwg/html/issues/1319
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•