[webkit-changes] [WebKit/WebKit] 2e5a9d: [Site Isolation] If testRunner.notifyDone is calle...

Ryan Reno noreply at github.com
Wed Feb 7 05:53:52 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2e5a9d342dc4a918aa5623d458b3ee7db81437f7
      https://github.com/WebKit/WebKit/commit/2e5a9d342dc4a918aa5623d458b3ee7db81437f7
  Author: Ryan Reno <rreno at apple.com>
  Date:   2024-02-07 (Wed, 07 Feb 2024)

  Changed paths:
    A LayoutTests/http/tests/site-isolation/notify-done-expected.txt
    A LayoutTests/http/tests/site-isolation/notify-done.html
    A LayoutTests/http/tests/site-isolation/resources/frame-notify-done.html
    M LayoutTests/platform/mac-site-isolation/TestExpectations
    M Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
    M Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
    M Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
    M Tools/WebKitTestRunner/TestInvocation.cpp

  Log Message:
  -----------
  [Site Isolation] If testRunner.notifyDone is called from a site isolated process layout test may not complete
https://bugs.webkit.org/show_bug.cgi?id=268471
rdar://121682316

Reviewed by Pascoe.

There's a race condition between the main frame and a remote frame
when the remote frame calls notifyDone. If the main frame's DocumentLoader
happens to finish and makes its callbacks before the remote frame
can call notifyDone and set the UIProcess' m_waitUntilDone variable
in the TestInvocation object the main frame's process will hang
waiting to be told the test is over. However, if the remote frame is able
to set the variable before the main frame process checks that variable
then the test will complete.

This change makes it so when testRunner.notifyDone is called we check
to see if we're running in a remote frame and if so we send the new "NotifyDone"
message to the UIProcess which in turn will echo that message to the
main frame on behalf of the site isolated frame's process.

dumpAsText and especially dumpChildFramesAsText still won't work quite right
but this will cause the test runner to be more robust against flaky
timeouts when running with site isolation enabled.

* LayoutTests/platform/mac-site-isolation/TestExpectations:
* LayoutTests/http/tests/site-isolation/notify-done-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/notify-done.html: Added.
* LayoutTests/http/tests/site-isolation/resources/frame-notify-done.html: Added.
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameIsRemote):
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::notifyDone):
* Tools/WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

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




More information about the webkit-changes mailing list