Closed Bug 1227474 Opened 9 years ago Closed 9 years ago

Promisify all client methods

Categories

(DevTools :: Framework, defect)

defect
Not set
normal

Tracking

(firefox45 fixed)

RESOLVED FIXED
Firefox 45
Tracking Status
firefox45 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(1 file)

This is very frustrating when using Client APIs today as some returns promises and some others don't.
The very manual `DebuggerClient.request()` is going to return a promise,
whereas all the Client objects defined in devtools/shared/client/main.js that uses `requester` won't!
And all other client using protocol.js fronts are also returning promises.

Because of this, we end up creating inline promises everywhere we have to call a requester method while using Task.jsm.
Like:
  http://mxr.mozilla.org/mozilla-central/source/devtools/client/framework/connect/connect.js#93

And it is all related to requester not returning the call the DebuggerClient.request.
At first, I thought changing this to return the promise would break many tests, but it looks like, it doesn't:
  https://treeherder.mozilla.org/#/jobs?repo=try&revision=d5c6dbf9aa1d

I would like to land this, spread the word about this and may be try to remove a bunch of these inlined promises that kill the readability of our codebase in various places.
Blocks: 1225473
Attached patch patch v1Splinter Review
Attachment #8691333 - Flags: review?(jryans)
Comment on attachment 8691333 [details] [diff] [review]
patch v1

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

Hmm, seems too simple. :P

Please at least file a bug to clean up the inline usages.

What about the top-level methods in `DebuggerClient.prototype`?  Many of those don't use `requester`, but would still benefit from promises.
Attachment #8691333 - Flags: review?(jryans) → review+
Yes, I started cleanup up the codebase to benefit from new requester behavior
and hit DebuggerClient.connect/close not being promise ready.
Blocks: 1227978
https://hg.mozilla.org/mozilla-central/rev/1f527cd0e45a
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45
Depends on: 1239276
Depends on: 1239287
Depends on: 1243452
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: