Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d0b90425cea4b436f14e30a8bf55e4f94240aca5
      
https://github.com/WebKit/WebKit/commit/d0b90425cea4b436f14e30a8bf55e4f94240aca5
  Author: Elijah Sawyers <[email protected]>
  Date:   2026-10-14 (Wed, 14 Oct 2026)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/API/WebExtensionContextAPIAlarms.cpp
    M Source/WebKit/UIProcess/Extensions/WebExtensionAlarm.cpp
    M Tools/Scripts/webkitpy/api_tests/allowlist.txt
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIAlarms.swift

  Log Message:
  -----------
  browser.alarms API: non-repeating alarms are not removed from the alarm map 
after firing
https://bugs.webkit.org/show_bug.cgi?id=310808
rdar://173399426

Reviewed by Brian Weinstein and Timothy Hatcher.

This patch removes a non-repeating alarm from the alarm map once it fires, so 
browser.alarms.get()
and browser.alarms.getAll() no longer return it and browser.alarms.clear() 
returns false for it,
matching Chrome and Firefox. Previously the alarm's timer was stopped but its 
map entry remained
until the extension cleared it, which broke the common pattern of re-creating 
an alarm only when
get() returns nothing.

Removing the alarm from the map inside its fire handler can release the last 
reference to the
WebExtensionAlarm while WebExtensionAlarm::fire() is still running, since the 
onAlarm event is
dispatched synchronously when the background content is loaded. fire() now 
protects itself for
the duration of the call.

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

* Source/WebKit/UIProcess/Extensions/API/WebExtensionContextAPIAlarms.cpp:
(WebKit::WebExtensionContext::alarmsCreate):
* Source/WebKit/UIProcess/Extensions/WebExtensionAlarm.cpp:
(WebKit::WebExtensionAlarm::fire):
* Tools/Scripts/webkitpy/api_tests/allowlist.txt:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIAlarms.swift:
(WKWebExtensionAPIAlarmsTests.singleShotRemovedAfterFiring):

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



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

Reply via email to