[webkit-changes] [WebKit/WebKit] bd7fed: postMessage to site-isolated iframe should have co...

Alex Christensen noreply at github.com
Wed Nov 29 09:19:41 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bd7fed371ce8437e0b70db6b5fb306a590c014dc
      https://github.com/WebKit/WebKit/commit/bd7fed371ce8437e0b70db6b5fb306a590c014dc
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    M LayoutTests/http/tests/site-isolation/post-message-expected.txt
    M LayoutTests/http/tests/site-isolation/post-message.html
    M Source/WebCore/page/LocalDOMWindow.cpp
    M Source/WebCore/page/LocalDOMWindow.h
    M Source/WebCore/page/RemoteDOMWindow.cpp
    M Source/WebCore/page/RemoteFrameClient.h
    M Source/WebKit/UIProcess/WebProcessProxy.cpp
    M Source/WebKit/UIProcess/WebProcessProxy.h
    M Source/WebKit/UIProcess/WebProcessProxy.messages.in
    M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h
    M Source/WebKit/WebProcess/WebProcess.cpp
    M Source/WebKit/WebProcess/WebProcess.h
    M Source/WebKit/WebProcess/WebProcess.messages.in

  Log Message:
  -----------
  postMessage to site-isolated iframe should have correct event.origin
https://bugs.webkit.org/show_bug.cgi?id=265494
rdar://118907443

Reviewed by Pascoe.

In LocalDOMWindow::postMessageFromRemoteFrame we were passing the destination document
as the source document, and we were using that document to get the source origin,
which made event.origin the origin of the receiver instead of sender.  To fix it, pass
the sourceOrigin along from the sending process to the receiving process.

The source document was also used in a call to InspectorInstrumentation::consoleAgentEnabled,
and instead of the source document we'll use the receiving LocalDOMWindow's document,
which is probably more correct but either way it is just a perf optimization to not get
the stack trace if the web inspector is not open.

* LayoutTests/http/tests/site-isolation/post-message-expected.txt:
* LayoutTests/http/tests/site-isolation/post-message.html:
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::processPostMessage):
(WebCore::LocalDOMWindow::postMessage):
(WebCore::LocalDOMWindow::postMessageFromRemoteFrame):
* Source/WebCore/page/LocalDOMWindow.h:
* Source/WebCore/page/RemoteDOMWindow.cpp:
(WebCore::RemoteDOMWindow::postMessage):
* Source/WebCore/page/RemoteFrameClient.h:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::postMessageToRemote):
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Source/WebKit/UIProcess/WebProcessProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp:
(WebKit::WebRemoteFrameClient::postMessageToRemote):
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h:
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::remotePostMessage):
* Source/WebKit/WebProcess/WebProcess.h:
* Source/WebKit/WebProcess/WebProcess.messages.in:

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




More information about the webkit-changes mailing list