Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 180a5367d48b98a3217ad772b702cc652e9c178d https://github.com/WebKit/WebKit/commit/180a5367d48b98a3217ad772b702cc652e9c178d Author: Timothy Hatcher <timo...@apple.com> Date: 2024-06-10 (Mon, 10 Jun 2024)
Changed paths: M Source/WebKit/Shared/Extensions/WebExtensionUtilities.h M Source/WebKit/Shared/Extensions/WebExtensionUtilities.mm M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIExtensionCocoa.mm M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINamespaceCocoa.mm M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageCocoa.mm M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebPageNamespaceCocoa.mm M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWindowsCocoa.mm M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIExtension.h M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINamespace.h M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIRuntime.h M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIStorage.h M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIStorageArea.h M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITabs.h M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebPageNamespace.h M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindows.h M Source/WebKit/WebProcess/Extensions/Bindings/Cocoa/JSWebExtensionWrapperCocoa.mm M Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.h M Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm Log Message: ----------- BitWarden hangs when login fails or logging out of the extension. https://webkit.org/b/275274 rdar://129016688 Reviewed by Brian Weinstein. BitWarden is reloading the background page when a logout occurs. This causes the loop they have to send a 'sleep' message every 10 seconds to the native app to instantly throw an exception inside a generator function. Since the native message is no longer yielding a promise, the loop never exits to the runloop. WebKit is waiting for the runloop to exit to teardown the document, but it is stuck in the infinite loop. To fix this, we need to partially revert 91a979b and stop bailing early in the bindings code when the page can't be found. Only a couple properties need the page to answer the `isPropertyAllowed()` call, so those properties can just do a separate null check. We also need to return a promise instead of `undefined` when the page isn't found and it is needed for a function call, like `runtime.sendNativeMessage()`. This required moving the generated code down closer to the call site, and returning a pre-rejected promise with an unknown error message instead of `undefined`. * Source/WebKit/Shared/Extensions/WebExtensionUtilities.h: * Source/WebKit/Shared/Extensions/WebExtensionUtilities.mm: (WebKit::toJSRejectedPromise): Added. Helper to make a rejected promise. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIExtensionCocoa.mm: (WebKit::WebExtensionAPIExtension::isPropertyAllowed): Changed WebPage to a pointer. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINamespaceCocoa.mm: (WebKit::WebExtensionAPINamespace::isPropertyAllowed): Changed WebPage to a pointer. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm: (WebKit::WebExtensionAPIRuntime::isPropertyAllowed): Changed WebPage to a pointer. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageAreaCocoa.mm: (WebKit::WebExtensionAPIStorageArea::isPropertyAllowed): Changed WebPage to a pointer. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIStorageCocoa.mm: (WebKit::WebExtensionAPIStorage::isPropertyAllowed): Changed WebPage to a pointer. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm: (WebKit::WebExtensionAPITabs::isPropertyAllowed): Changed WebPage to a pointer. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWebPageNamespaceCocoa.mm: (WebKit::WebExtensionAPIWebPageNamespace::isPropertyAllowed): Changed WebPage to a pointer. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIWindowsCocoa.mm: (WebKit::WebExtensionAPIWindows::isPropertyAllowed): Changed WebPage to a pointer. * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIExtension.h: * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINamespace.h: * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIRuntime.h: * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIStorage.h: * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIStorageArea.h: * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITabs.h: * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWebPageNamespace.h: * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIWindows.h: * Source/WebKit/WebProcess/Extensions/Bindings/Cocoa/JSWebExtensionWrapperCocoa.mm: * Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.h: (WebKit::toJSContext): Added. Helper to do a common thing that is repeated in many places. (WebKit::toJSValue): Use toJSContext(). (WebKit::toJSValueRef): Use toJSContext. * Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm: (_generateImplementationFile): Moved toFrame and toPage calls down and return a rejected promise instead, so code exception a promise will not throw. (_scriptClassName): Added so it can be used for other logging reasons. (_callString): Use _scriptClassName. (_dynamicAttributesImplementation): Removed null page errors and early returns. The isPropertyAllowed() calls that care now check it directly. This avoids throwing premature unknown property exceptions when the page can't be found. Canonical link: https://commits.webkit.org/279882@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes