Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e589b1e7773335a680e6b700a94e7341fd8c13c4
      
https://github.com/WebKit/WebKit/commit/e589b1e7773335a680e6b700a94e7341fd8c13c4
  Author: Timothy Hatcher <[email protected]>
  Date:   2026-05-08 (Fri, 08 May 2026)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionActionCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIAction.mm

  Log Message:
  -----------
  Web Extensions popup WKWebView and NSPopover are not released when the popup 
is dismissed on macOS.
https://webkit.org/b/314323
rdar://174673022

Reviewed by Kiara Rose.

`_WKWebExtensionActionPopover` had `popoverWillClose:` and `popoverDidClose:` 
methods implemented
but never registered as `NSNotificationCenter` observers, so when AppKit 
dismissed the popup via
semitransient behavior `closePopup()` was never called, leaving 
`m_popupWebView` and `m_popupPopover`
set indefinitely. Registering both notifications with `object:self` ensures 
`closePopup()` is called
on dismissal, and removing all observers in `popoverDidClose:` prevents any 
double-close.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIAction.mm

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionActionCocoa.mm:
(-[_WKWebExtensionActionPopover initWithWebExtensionAction:]): Added observer 
registrations for
`NSPopoverWillCloseNotification` and `NSPopoverDidCloseNotification` with 
`object:self`.
(-[_WKWebExtensionActionPopover popoverDidClose:]): Added `removeObserver:self` 
before calling
`closePopup()` to clean up all notification observers.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIAction.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIAction, 
PopoverCloseNotificationCallsClosePopup)): Added
test that posts `NSPopoverDidCloseNotification` and verifies `closePopup()` was 
called by
confirming the popup can be re-presented with a fresh web view.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to