Closed Bug 967879 Opened 10 years ago Closed 9 years ago

DOMHelpers.onceDOMReady should return a promise

Categories

(DevTools :: Framework, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jwalker, Assigned: jwalker)

Details

Attachments

(1 file)

Attached patch domhelper.patchSplinter Review
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
Closed: 9 years ago
Resolution: --- → WONTFIX
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: