[webkit-changes] [WebKit/WebKit] 53b1e6: 1Password fails to load popup after focusing a for...
Timothy Hatcher
noreply at github.com
Wed Feb 28 12:44:53 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 53b1e6b7f02bbbc8a252792659963244ee04620f
https://github.com/WebKit/WebKit/commit/53b1e6b7f02bbbc8a252792659963244ee04620f
Author: Timothy Hatcher <timothy at apple.com>
Date: 2024-02-28 (Wed, 28 Feb 2024)
Changed paths:
M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm
M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIRuntime.mm
Log Message:
-----------
1Password fails to load popup after focusing a form field on a page.
https://webkit.org/b/270233
rdar://123423266
Reviewed by Jeff Miller and Brian Weinstein.
Once the input field is focused, 1Password creates an iframe with an extension document in the
tab. This causes two processes to have listeners for the runtime.onMessage event. That then
causes a race when sending messages, and the tab frame wins since the background replies async
after doing some work.
This was happening because the reply aggregator in the web process was sending a default null
reply, since the completion handler is always called, which was indistinguishable from a real
reply. Now we always send either null for default or at minimum an empty string for the JSON
reply, and the UI process skips the replies that are null strings. The aggregator on the UI
process side will then get the real reply or default to null later once it goes out of scope.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm:
(WebKit::WebExtensionContext::runtimeSendMessage): Don't call callbackAggregator for null string.
(WebKit::WebExtensionContext::runtimeWebPageSendMessage): Ditto.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm:
(WebKit::WebExtensionContextProxy::internalDispatchRuntimeMessageEvent): Ensure a real reply is
never null, so the completionHandler can make the distinction. Send default replies as null.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIRuntime.mm:
(TEST(WKWebExtensionAPIRuntime, SendMessageWithTabFrameAndAsyncReply)): Added.
(TEST(WKWebExtensionAPIRuntime, SendMessageFromWebPageWithTabFrameAndAsyncReply)): Added.
Canonical link: https://commits.webkit.org/275461@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list