DOMHelpers.onceDOMReady should return a promise

RESOLVED WONTFIX

Status

()

Firefox
Developer Tools: Framework
RESOLVED WONTFIX
4 years ago
3 years ago

People

(Reporter: jwalker, Assigned: jwalker)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Created attachment 8370383 [details] [diff] [review]
domhelper.patch

Die, callbacks. Die.
Maybe we don't care about DOMHelpers much, but this could result in quite a bit of code simplification.
It's a bit of a drive-by patch and uses the wrong promise lib right now.
Attachment #8370383 - Flags: feedback?(bbenvie)
Component: Developer Tools → Developer Tools: Framework
Comment on attachment 8370383 [details] [diff] [review]
domhelper.patch

Review of attachment 8370383 [details] [diff] [review]:
-----------------------------------------------------------------

This looks like a welcome cleanup; promises compose much more cleanly with other promises. I think you *may* have to keep using the addon-sdk's promise implementation with where this is currently being used, until bug 943510 lands. You should definitely try using Promise.jsm first and see if it works. If not then feel free to fall back to using addon-sdk's promise.

::: browser/devtools/shared/DOMHelpers.jsm
@@ +157,2 @@
>          // We want to avoid that so we execute the callback in the next queue.
>          Services.tm.mainThread.dispatch(callback, 0);

This should be conditional since callback will be optional now.

@@ +157,4 @@
>          // We want to avoid that so we execute the callback in the next queue.
>          Services.tm.mainThread.dispatch(callback, 0);
> +
> +        promise.resolve(undefined);

deferred.resolve
Attachment #8370383 - Flags: feedback?(bbenvie) → feedback+
Assignee: nobody → jwalker
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.