Closed Bug 1566879 Opened 5 years ago Closed 5 years ago

Simplify WebConsoleConnectionProxy connect/disconnect function

Categories

(DevTools :: Console, task, P1)

task

Tracking

(firefox70 fixed)

RESOLVED FIXED
Firefox 70
Tracking Status
firefox70 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

Details

Attachments

(2 files)

The connect function is quite hard to follow, with other methods responsible to resolve or reject the connection Promise created in connect.

Furthermore, both function use defer, which we could probably get rid of

cc Alex as he's doing work around destroy in the console, which might be related to this (or maybe not)

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #1)

cc Alex as he's doing work around destroy in the console, which might be related to this (or maybe not)

Yes, nothing bad, but I'm conflicting on the change made to disconnect, I'm removing the _disconnected defer object, as well as the await on isAttached:
https://phabricator.services.mozilla.com/D38310#change-OBZPMd324VF1

It doesn't look like you are actually modifying anything in term of what we are waiting for in disconnect, but if you do, you may hit the same test failure I'm currently investigating. So be aware that I already fixed a bunch.

let's make this bug depend on Bug 1566421 so we don't conflict each other

Depends on: 1566421

Both function were using defer. We replace it with plain
Promises.
The connect function was very hard to follow, with other methods
responsible to resolve the connection Promise.
We modify this to only deal with the connection Promise inside
the connect function so it's easier to follow.
The connection timeout was handled in a similar fashion, with
the callback to a setTimeout responsible to reject the connection
promise.
We modify this behavior in favor of a Promise.race which brings
us the same benefit while being easier to understand.

Depends on D39470

Attachment #9080838 - Attachment description: Bug 1566879 - Simplify WebConsoleConnection connect and disconnect functions. r=ochameau. → Bug 1566879 - Simplify WebConsoleConnection connect function. r=ochameau.
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1a8f06f91829
Switch WebConsoleConnectionProxy to a class. r=ochameau.
https://hg.mozilla.org/integration/autoland/rev/4fb51afb9b47
Simplify WebConsoleConnection connect function. r=ochameau.
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: