Closed
Bug 1674841
Opened 7 months ago
Closed 7 months ago
Clean up devtools/shared/protocol/tests/xpcshell/test_protocol_async.js
Categories
(DevTools :: General, task)
DevTools
General
Tracking
(firefox84 fixed)
RESOLVED
FIXED
84 Branch
| Tracking | Status | |
|---|---|---|
| firefox84 | --- | fixed |
People
(Reporter: hexagonrecursion, Assigned: hexagonrecursion)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
The attached patch fixes the following:
- Replace var with const where appropriate
- Refactor promiseReturn() into an async function (because it makes it cleaner)
- Refactor promiseThrow(). It was using a fixed timeout hoping that the timeout value is large enough to reproduce a race condition. In the initial version of this file both promiseThrow() and promiseReturn() were using timeouts. During code review promiseReturn() was changed to use do_execute_soon(), but promiseThrow() inexplicably was not. The two functions have so much in common that I reimplemented promiseThrow() as a wrapper around promiseReturn().
- Remove usage of
defer(). I believe that in this case there is no need to replace it withnew Promise
Here is why I think it is safe to remove defer() here.
My best-effort summary of the history of the file:
- A test is introduced to make sure responses are delivered in the same order as requests were sent
- A quirk of Promise.jsm partially breaks the behavior the test was designed to test. A workaround is added to the test to silence it.
I am assuming that both the test and the code under test now use a standard compliant implementation of Promise. If my assumption is correct, I think the workaround is no longer necessary.
PS I tried to do my best but I'm only a human. It is quite possible that some of the above is incorrect
| Assignee | ||
Comment 1•7 months ago
|
||
Updated•7 months ago
|
Assignee: nobody → hexagonrecursion
Updated•7 months ago
|
Attachment #9185212 -
Attachment description: Bug 1674841 Clean up devtools/shared/protocol/tests/xpcshell/test_protocol_async.js r=honza! → Bug 1674841 - [devtools] Clean up devtools/shared/protocol/tests/xpcshell/test_protocol_async.js r=honza!
Updated•7 months ago
|
Attachment #9185212 -
Attachment description: Bug 1674841 - [devtools] Clean up devtools/shared/protocol/tests/xpcshell/test_protocol_async.js r=honza! → Bug 1674841 - [devtools] Clean up devtools/shared/protocol/tests/xpcshell/test_protocol_async.js r=nchevobbe
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/341abc5d6ef7 [devtools] Clean up devtools/shared/protocol/tests/xpcshell/test_protocol_async.js r=nchevobbe
Comment 3•7 months ago
|
||
| bugherder | ||
Status: UNCONFIRMED → RESOLVED
Closed: 7 months ago
status-firefox84:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•