Alarms persist extension updates

74 views
Skip to first unread message

Yoav Zab

unread,
Feb 25, 2021, 9:12:12 PM2/25/21
to chromi...@chromium.org
Hi,

I found a behavior which I believe is a bug: an extension reload, update or restart will not delete previously registered alarms.

Scenario:
  1. Load an extension that sets an alarm (chrome.alarms.create).
  2. Reload, update or restart the extension. The loaded extension does not create an alarm.
  3. The reloaded extension adds a listener to the onAlarm event.
  4. The callback is called with the alarm that was set on step 1.
Looking at the AlarmManager code (src/extensions/browser/api/alarms/alarm_manager.cc), it seems that alarms are removed only if the extension is being uninstalled, however, it does not observe the OnExtensionUnloaded event.

The vast majority of stateful extension APIs observe and respond to the OnExtensionUnloaded event, so the state of these APIs will not be kept across extension updates.

Before I'm opening a bug, I would like to know if this is an intended feature.

Thanks,
Yoav.
Reply all
Reply to author
Forward
0 new messages