| Summary: | Ignore BroadcastChannel::postMessage from detached iframe / closing worker contexts | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Andrew Williams <awillia> | ||||||||
| Component: | New Bugs | Assignee: | Chris Dumez <cdumez> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | achristensen, cdumez, clopez, darin, esprehn+autocc, ews-watchlist, ggaren, kangil.han, sam, webkit-bug-importer, youennf | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | Safari Technology Preview | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=232946 | ||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 232855 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Andrew Williams
2021-11-03 20:37:59 PDT
Created attachment 443618 [details]
Patch
Created attachment 443623 [details]
Patch
Comment on attachment 443623 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=443623&action=review > LayoutTests/imported/w3c/web-platform-tests/webmessaging/broadcastchannel/service-worker.https-expected.txt:2 > +FAIL BroadcastChannel works in service workers promise_test: Unhandled rejection with value: object "TypeError: ReferenceError: Can't find variable: BroadcastChannel" Will address this failure via https://bugs.webkit.org/show_bug.cgi?id=232855. Created attachment 443635 [details]
Patch
Comment on attachment 443635 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=443635&action=review > Source/WebCore/dom/BroadcastChannel.cpp:187 > + if (!isEligibleForMessaging()) > + return { }; > + > if (m_isClosed) > return Exception { InvalidStateError, "This BroadcastChannel is closed" }; So while closing we silently do nothing, and once closed we throw an exception. To me this seems like a peculiar design. > Source/WebCore/dom/BroadcastChannel.cpp:235 > + if (!isEligibleForMessaging()) > + return; > + > if (m_isClosed) > return; If it wasn’t for the unusual case above, I would suggest we merge the m_closed check into isEligibleForMessaging. Comment on attachment 443635 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=443635&action=review >> Source/WebCore/dom/BroadcastChannel.cpp:187 >> return Exception { InvalidStateError, "This BroadcastChannel is closed" }; > > So while closing we silently do nothing, and once closed we throw an exception. To me this seems like a peculiar design. A little peculiar but definitely what was just added to the spec: - https://html.spec.whatwg.org/#dom-broadcastchannel-postmessage Maybe they were worried about breakage when throwing since this check is new? Committed r285503 (244027@main): <https://commits.webkit.org/244027@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 443635 [details]. |