Closed Bug 1252604 Opened 4 years ago Closed 4 years ago

Change logic in alarms observer to return immediately if the alarm has been cancelled

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set

Tracking

(firefox48 fixed)

RESOLVED FIXED
mozilla48
Iteration:
48.1 - Mar 21
Tracking Status
firefox48 --- fixed

People

(Reporter: bsilverberg, Assigned: bsilverberg)

Details

Attachments

(1 file)

The code currently fires the callbacks and then returns if the alarm has been cancelled. This should be changed so that if the alarm has been cancelled it just returns immediately.

The code in question can be found at https://dxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/ext-alarms.js#51.

We should also attempt to write a test for this, but it may be difficult to test. The case is described as:

"It essentially requires setting an alarm that should fire almost immediately, spending enough time in the main thread without returning to the event loop that it fires, and then canceling it before returning to the event loop, and then making sure it doesn't fire."
Assignee: nobody → bob.silverberg
Status: NEW → ASSIGNED
Iteration: --- → 47.3 - Mar 7
Iteration: 47.3 - Mar 7 → 48.1 - Mar 21
Attachment #8731263 - Flags: review?(kmaglione+bmo) → review+
Comment on attachment 8731263 [details]
MozReview Request: Bug 1252604 - Change logic in alarms observer to return immediately if the alarm has been cancelled, r?kmag

https://reviewboard.mozilla.org/r/40469/#review36975
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/77258bd00fa3
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.