Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5c8c4c249eb9c78b93201eeeae068a057069ad2c
      
https://github.com/WebKit/WebKit/commit/5c8c4c249eb9c78b93201eeeae068a057069ad2c
  Author: Elijah Sawyers <[email protected]>
  Date:   2026-09-30 (Wed, 30 Sep 2026)

  Changed paths:
    M 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPINotificationsCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in
    M 
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINotificationsCocoa.mm
    M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINotifications.h
    M 
Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPINotifications.idl
    M Tools/TestWebKitAPI/Helpers/cocoa/TestWebExtensionsDelegate.h
    M Tools/TestWebKitAPI/Helpers/cocoa/TestWebExtensionsDelegate.mm
    M 
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPINotifications.mm

  Log Message:
  -----------
  Implement browser.notifications.clear(), getAll(), and getPermissionLevel() 
for the web extension API
https://bugs.webkit.org/show_bug.cgi?id=325533
rdar://187616262

Reviewed by Timothy Hatcher.

This patch implements browser.notifications.clear(), getAll(), and
getPermissionLevel().

clear() looks up the notification in the context and hands it to the browser
through the delegate method to dismiss it. The promise resolves with a boolean
whether a matching notification existed and was cleared, and rejects when the
browser reports an internal error.

getAll() resolves with an object whose keys are the identifiers of the
notifications WebKit is tracking for the extension, each mapped to true.
Firefox resolves an object where the properties are the notification IDs, and
the values are NotificationOptions objects. However, Chrome resolves an object
where the properies are the notification IDs, but the values are just true, a
boolean.

getPermissionLevel() asks the browser through the delegate method whether the
extension may present notifications, and resolves with "granted" or "denied". It
rejects when the browser reports an internal error.

Tests are included.

* 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPINotificationsCocoa.mm:
(WebKit::WebExtensionContext::notificationsClear):
(WebKit::WebExtensionContext::notificationsGetAll):
(WebKit::WebExtensionContext::notificationsGetPermissionLevel):
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in:
* 
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPINotificationsCocoa.mm:
(WebKit::WebExtensionAPINotifications::clear):
(WebKit::WebExtensionAPINotifications::getAll):
(WebKit::WebExtensionAPINotifications::getPermissionLevel):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPINotifications.h:
* 
Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPINotifications.idl:
* Tools/TestWebKitAPI/Helpers/cocoa/TestWebExtensionsDelegate.h:
* Tools/TestWebKitAPI/Helpers/cocoa/TestWebExtensionsDelegate.mm:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPINotifications.mm:

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



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

Reply via email to