Closed Bug 929013 Opened 7 years ago Closed 3 years ago

Clean up non-async or sometimes-async callbacks in XPI provider

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED INACTIVE

People

(Reporter: Irving, Unassigned)

References

Details

(Whiteboard: [lang=js])

The work in bug 853388 affected the async behaviour of some of the callbacks. To avoid releasing Zalgo (see http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony and the posts it links to), we should ensure that all methods in XPI Provider are either obviously synchronous (returning a value rather than taking a callback) or are guaranteed async (always performing the callback later)

Based on a quick read through,

XPIProvider.jsm:

XPI_getInstallsByTypes is always synchronous but takes a callback

AI_initLocalInstall is mixed sync / async

AI_initAvailableDownload is always sync

AI_loadMultipackageManifests is mixed

AI_loadManifest calls the callback 0 times if it throws, possibly multiple times if the file being loaded is a "multipackage"

AI_createInstall is mixed
(In reply to :Irving Reid from comment #0)
> The work in bug 853388 affected the async behaviour of some of the
> callbacks. To avoid releasing Zalgo (see
> http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony and the
> posts it links to), we should ensure that all methods in XPI Provider are
> either obviously synchronous (returning a value rather than taking a
> callback) or are guaranteed async (always performing the callback later)
> 
> Based on a quick read through,
> 
> XPIProvider.jsm:
> 
> XPI_getInstallsByTypes is always synchronous but takes a callback

This was done this way on the assumption that it might become async later. If it is a problem we could just force it async now.

> AI_initLocalInstall is mixed sync / async
> 
> AI_initAvailableDownload is always sync
> 
> AI_loadMultipackageManifests is mixed
> 
> AI_loadManifest calls the callback 0 times if it throws, possibly multiple
> times if the file being loaded is a "multipackage"
> 
> AI_createInstall is mixed

These are all internal methods, I'm not sure how much it is worth changing them.
Mentor: irving
Whiteboard: [mentor=irving][lang=js] → [lang=js]
Mentor: irving
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.