[webkit-changes] [WebKit/WebKit] b5f2a6: BroadcastChannel is not always computing correctly...

youennf noreply at github.com
Thu Dec 8 01:34:35 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b5f2a68531f7fe3718d62f999d770dc9594e82fc
      https://github.com/WebKit/WebKit/commit/b5f2a68531f7fe3718d62f999d770dc9594e82fc
  Author: Youenn Fablet <youennf at gmail.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    A LayoutTests/http/wpt/shared-workers/resources/third-party-shared-worker-broadcast-channel-iframe.html
    A LayoutTests/http/wpt/shared-workers/resources/third-party-shared-worker-broadcast-channel-sharedworker.js
    A LayoutTests/http/wpt/shared-workers/third-party-shared-worker-broadcast-channel-expected.txt
    A LayoutTests/http/wpt/shared-workers/third-party-shared-worker-broadcast-channel.html
    M Source/WebCore/dom/BroadcastChannel.cpp
    M Source/WebCore/dom/BroadcastChannel.h
    M Source/WebCore/page/PartitionedSecurityOrigin.h

  Log Message:
  -----------
  BroadcastChannel is not always computing correctly its origin
https://bugs.webkit.org/show_bug.cgi?id=248869
rdar://102519898

Reviewed by Chris Dumez.

Shared Workers document is also its own top document.
This makes Document::topOrigin() computation wrong in case of third-party Shared Workers.
Update BroadcastChannel to directly use ScriptExecutionContext::topOrigin instead.
As a follow-up, we should probably update third-party SharedWorker/ServiceWorker document creation to ensure this mistake does not pop up again.

* LayoutTests/http/wpt/shared-workers/resources/third-party-shared-worker-broadcast-channel-iframe.html: Added.
* LayoutTests/http/wpt/shared-workers/resources/third-party-shared-worker-broadcast-channel-sharedworker.js: Added.
* LayoutTests/http/wpt/shared-workers/third-party-shared-worker-broadcast-channel-expected.txt: Added.
* LayoutTests/http/wpt/shared-workers/third-party-shared-worker-broadcast-channel.html: Added.
* Source/WebCore/dom/BroadcastChannel.cpp:
(WebCore::shouldPartitionOrigin):
(WebCore::BroadcastChannel::MainThreadBridge::ensureOnMainThread):
(WebCore::BroadcastChannel::MainThreadBridge::registerChannel):
(WebCore::BroadcastChannel::MainThreadBridge::unregisterChannel):
(WebCore::BroadcastChannel::MainThreadBridge::postMessage):
* Source/WebCore/dom/BroadcastChannel.h:
* Source/WebCore/page/PartitionedSecurityOrigin.h:
(WebCore::PartitionedSecurityOrigin::isolatedCopy const):
* Source/WebKit/NetworkProcess/NetworkBroadcastChannelRegistry.cpp:
(WebKit::NetworkBroadcastChannelRegistry::registerChannel):
(WebKit::NetworkBroadcastChannelRegistry::unregisterChannel):
(WebKit::NetworkBroadcastChannelRegistry::postMessage):
* Source/WebKit/WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.cpp:
(WebKit::WebBroadcastChannelRegistry::registerChannel):
(WebKit::WebBroadcastChannelRegistry::unregisterChannel):
(WebKit::WebBroadcastChannelRegistry::postMessage):
(WebKit::WebBroadcastChannelRegistry::postMessageLocally):
(WebKit::WebBroadcastChannelRegistry::postMessageToRemote):

Canonical link: https://commits.webkit.org/257551@main




More information about the webkit-changes mailing list