Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 07565287df4a952e02a052d06125123d24ffcebd
      
https://github.com/WebKit/WebKit/commit/07565287df4a952e02a052d06125123d24ffcebd
  Author: Kiara Rose <[email protected]>
  Date:   2026-08-03 (Mon, 03 Aug 2026)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/API/WebExtensionContextAPIAlarms.cpp
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in
    M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIAlarms.cpp
    M Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIAlarms.h
    M Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIAlarms.idl
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIAlarms.mm

  Log Message:
  -----------
  Address inconsistencies with the browser.alarms API
https://bugs.webkit.org/show_bug.cgi?id=320767
rdar://183770530

Reviewed
by Timothy Hatcher.

This patch addresses a few of inconsistencies with the browser.alarms API:
- alarms.create() should return a promise as specified in the MDN documentation.
- alarms.create() should allow for a "name" key to be specified in the info 
options. https://github.com/w3c/webextensions/issues/999
- alarms.get() for an unknown alarm should return undefined, not nil.
- alarms.clear() and alarms.clearAll() should return a promise that resolves 
with a boolean.

Note: Chrome returns true always for clearAll() whereas Firefox only returns 
true if an alarm was
actually cleared. This patch matches Firefox's behavior since this 
implementation follows the MDN
documentation. I filed https://github.com/w3c/webextensions/issues/1055 to 
address this in the WECG.

With these changes, all of the currently running WPT tests for browser.alarms 
pass.

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

*
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIAlarmsCocoa.mm:
(WebKit::WebExtensionContext::alarmsCreate):
(WebKit::WebExtensionContext::alarmsClear):
(WebKit::WebExtensionContext::alarmsClearAll):
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in:
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIAlarmsCocoa.mm:
(WebKit::WebExtensionAPIAlarms::createAlarm):
(WebKit::WebExtensionAPIAlarms::get):
(WebKit::WebExtensionAPIAlarms::clear):
(WebKit::WebExtensionAPIAlarms::clearAll):
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIAlarms.h:
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIAlarms.idl:
* 
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/xcshareddata/xcschemes/TestWebKitAPI.xcscheme:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIAlarms.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPIAlarms,
Errors)):
(TestWebKitAPI::TEST(WKWebExtensionAPIAlarms, ClearSingleAlarm)):
(TestWebKitAPI::TEST(WKWebExtensionAPIAlarms, GetSingleAlarm)):
(TestWebKitAPI::TEST(WKWebExtensionAPIAlarms, ClearAllAlarms)):
(TestWebKitAPI::TEST(WKWebExtensionAPIAlarms, CreateAlarms)):

Canonical link: 
https://flagged.apple.com:443/proxy?t2=dd0h0F7xY2&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE4NDkzQG1haW4=&emid=e1a27f09-3ab0-4740-a88d-6bee091f5580&c=11



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

Reply via email to