Open Bug 1550706 Opened 5 years ago Updated 2 years ago

Add a helper for an interval timer that uses TYPE_REPEATING_SLACK

Categories

(Chat Core :: General, task)

Tracking

(Not tracked)

People

(Reporter: KaiE, Assigned: khushil324)

References

Details

Follow-up from bug 1518172.

The comm/ codebase contains many places that construct a timer instance and init it with type TYPE_REPEATING_SLACK.

It has been suggested to add a new helper in XPCOMUtils, and use it to simplify the other places.

An example use are the setInterval and clearInterval functions in OTR.jsm. Function clearInterval can probably be dropped in favor of clearTimeout.

Who could help with this code simplification task?
I think this would be only for comm-central, not for uplift to 68.

Type: defect → enhancement

From https://phabricator.services.mozilla.com/D17691

clokep

This (and clearInterval) look almost identical to the setTimeout and clearTimeout in imXPCOMUtils. It might make sense to add another thing there instead of copying that code.

kaie

This is very little code, and I find 12 other places in comm/ that use exactly the same short code with parameter TYPE_REPEATING_SLACK. If you want a new shared helper in imXPCOMUtils, it should be a project that handles all of those. I've filed a follow-up bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1550706

The landed code is here: https://searchfox.org/comm-central/rev/3a823d0c0fca436b989c1bef70563741bcbb7228/chat/modules/OTR.jsm#30

Assignee: nobody → khushil324
Type: enhancement → task
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.