Closed Bug 1869171 Opened 2 years ago Closed 3 months ago

alarms.create is not declared as an async function

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(firefox138 fixed)

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: robwu, Assigned: erosman, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, good-first-bug)

Attachments

(1 file, 1 obsolete file)

The alarms.create method is not declared as an async function. Consequently, it is not possible for extension callers to await the registration of an alarm.

Moreover, it is not possible to raise async errors. The current implementation doesn't raise such errors, but there is precedent in other browsers to do so, e.g. in Chrome creating 500+ timers results in an error (e.g. seen at https://github.com/w3c/webextensions/issues/422 and tracked at bug 1844605).

This mistake was likely inherit from when the alarms API definition was imported from Chromium. This issue (lack of async callback) was fixed in Chrome 111 by https://chromium.googlesource.com/chromium/src/+/cf0de9610438fb89556cc6a4f9405bfb20cc42ee

The fix would be simple: add "async": "callback" + append an optional function parameter, to https://searchfox.org/mozilla-central/rev/cb8fc16f6b1455d1237853dbad21c62870eaaba9/toolkit/components/extensions/schemas/alarms.json#32-35,64

Mentor: rob
Severity: -- → S4
Keywords: good-first-bug
Priority: -- → P3

Hey, I would lke to work on this issue and solve it. Kindly can i be assigned for this work as this will be my first PR

Flags: needinfo?(rob)

(In reply to arunavdutta27 from comment #2)

Hey, I would lke to work on this issue and solve it. Kindly can i be assigned for this work as this will be my first PR

The bug will automatically assigned when a patch is submitted to Phabricator. Since this is your first contribution, check out the tutorial at https://wiki.mozilla.org/WebExtensions/Contribution_Onramp

Flags: needinfo?(rob)
Assignee: nobody → eros_uk
Status: NEW → ASSIGNED
Attachment #9471772 - Attachment is obsolete: true
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/cff7f1d25b36 Declare alarms.create as an async function r=robwu,webidl,emilio
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch

Documentation updates in Bug-1869171 alarms.create now async function #38834

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: