Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 705d5a3f9744ecfb8d5a0ccba1d525c26aacc5fe
https://github.com/WebKit/WebKit/commit/705d5a3f9744ecfb8d5a0ccba1d525c26aacc5fe
Author: Timothy Hatcher <[email protected]>
Date: 2025-05-01 (Thu, 01 May 2025)
Changed paths:
M
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp
M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm
M Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.mm
Log Message:
-----------
Web Extension content scripts stop receiving messages after back/forward
navigation.
https://webkit.org/b/292378
rdar://149063567
Reviewed by Brian Weinstein.
The logic for fetching web processes for a tab when sending a message was
sometimes returning two processes,
when only one was expected. Since the call site used `takeAny()`, it was random
which process was picked,
and sometimes it was the wrong one.
Fix this by intersecting the set of active processes for the page with the set
of processes we know are
listening for extension messages. This reliably finds the right process and
ensures only one is returned.
Looking ahead to site isolation, we still need to support multiple processes,
since different frames
can be in separate processes. So messaging a tab can legitimately involve
multiple processes in the future,
where we previously assumed just one. This requires more complex IPC handling,
but we already had to
solve this for `runtime.sendMessage`, so adapt that approach for
`tabs.sendMessage` and `tabs.connect`.
*
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm:
(WebKit::WebExtensionContext::tabsSendMessage): Handle multiple processes with
EagerCallbackAggregator.
(WebKit::WebExtensionContext::tabsConnect): Handle multiple processes.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm:
(WebKit::WebExtensionTab::processes const): Return the intersection of
processes.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp:
(WebKit::WebExtensionContext::processes const): Pass the process to the lambda.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPITabs,
SendMessageBackAndForwardNavigation)): Added.
* Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.mm:
(-[WKWebView _test_waitForDidStartProvisionalNavigation]): Restore the previous
delegate.
(-[WKWebView _test_waitForDidFailProvisionalNavigation]): Ditto.
(-[WKWebView _test_waitForDidFinishNavigationWithoutPresentationUpdate]): Ditto.
(-[WKWebView _test_waitForDidFinishNavigationWithPreferences:]): Ditto.
(-[WKWebView _test_waitForDidFinishNavigation]): Ditto.
(-[WKWebView _test_waitForDidSameDocumentNavigation]): Ditto.
(-[WKWebView _test_waitForDidFinishNavigationWhileIgnoringSSLErrors]): Ditto.
(-[WKWebView _test_waitForWebContentProcessDidTerminate]): Ditto.
Canonical link: https://commits.webkit.org/294395@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes