-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 53b1e6b. rdar://123423266
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
- Loading branch information
Showing
3 changed files
with
215 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters