Replace `defer` usage with `async/await` in devtools/client/shared/widgets/tooltip/SwatchCubicBezierTooltip.js
Categories
(DevTools :: Shared Components, enhancement, P3)
Tracking
(firefox67 fixed)
| Tracking | Status | |
|---|---|---|
| firefox67 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: paarmita1998, Mentored)
References
Details
(Keywords: good-first-bug)
Attachments
(2 files, 2 obsolete files)
defer is used in devtools/client/shared/widgets/tooltip/SwatchCubicBezierTooltip.js#52-61, but we should use new Promise instead.
Here's the current code:
const def = defer();
// Wait for the tooltip to be shown before calling instanciating the widget
// as it expect its DOM elements to be visible.
this.tooltip.once("shown", () => {
const widget = new CubicBezierWidget(container, bezier);
def.resolve(widget);
});
return def.promise;
What we want to have instead is transform the function to an async one, and in the code await on the tooltip:
// Wait for the tooltip to be shown before calling instanciating the widget
// as it expect its DOM elements to be visible.
await this.tooltip.once("shown");
return new CubicBezierWidget(container, bezier);
| Reporter | ||
Updated•7 years ago
|
Hi,i am an outreachy applicant and am looking to make my contribution.could you assign it to me so that i can start working on it. Thanks
| Reporter | ||
Comment 2•7 years ago
|
||
Hello again asish.
I just assigned you another bug, so maybe we should wait until you are done with it? (also we may want to keep this one for the first bug of another person maybe)
| Assignee | ||
Comment 3•7 years ago
|
||
Hey,
I am also an outreachy applicant and would like to take this up as my first contribution?
Can you please assign it to me?
| Reporter | ||
Comment 4•7 years ago
|
||
Hello paarmita1998, thanks for wanting to help us!
I assigned the bug to you, so you can start working on it 🙂
You can read http://docs.firefox-dev.tools/getting-started/ to setup the work environment. Make sure to use Artifact Builds when asked to as it's much faster.
Feel free to ask any question, either here or on our Slack.
| Reporter | ||
Updated•7 years ago
|
Comment 5•7 years ago
|
||
(In reply to Nicolas Chevobbe from comment #0)
deferis used in devtools/client/shared/widgets/tooltip/SwatchCubicBezierTooltip.js#52-61, but we should usenew Promiseinstead.Here's the current code:
const def = defer(); // Wait for the tooltip to be shown before calling instanciating the widget // as it expect its DOM elements to be visible. this.tooltip.once("shown", () => { const widget = new CubicBezierWidget(container, bezier); def.resolve(widget); }); return def.promise;What we want to have instead is transform the function to an
asyncone, and in the codeawaiton the tooltip:// Wait for the tooltip to be shown before calling instanciating the widget // as it expect its DOM elements to be visible. await this.tooltip.once("shown"); return new CubicBezierWidget(container, bezier);
Hello, I would like to ask if I can be assigned to this bug if no one is currently working on it. Thanks.
| Assignee | ||
Comment 6•7 years ago
|
||
Hey Erik, I am working on it.
| Reporter | ||
Comment 7•7 years ago
|
||
Erik, make sure to check the bug status when commenting :)
| Assignee | ||
Comment 8•7 years ago
|
||
Hey Nicolas, Can you please review the patch- https://phabricator.services.mozilla.com/D21406
| Assignee | ||
Comment 9•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
| Reporter | ||
Comment 10•7 years ago
|
||
I realize I didn't wrote a proper explanation on how to show the widget, to ensure the changes don't break anything.
So, to show the widget, you should:
- In the URL bar, paste
data:text/html,<meta charset=utf8><style>h1 { color: red; transition: color 0.3s ease-in; } h1:hover {color: yellow;}</style><h1>Hello</h1>. That will open a simple page with an animation on hover. - Right click on "Hello", and select "Inspect the element" to open the inspector.
- In the Inspector rule view, in the
transitionline, you should see an icon before "ease-in", click on it - This should open the widget, and it should look like what's in the attachment.
Make sure you can reproduce all these steps before submitting a new patch :)
| Assignee | ||
Comment 11•7 years ago
|
||
Okay, will do it! Thanks.
| Assignee | ||
Comment 12•7 years ago
|
||
Hey I followed the above steps and made the new patch
Can you please review- https://phabricator.services.mozilla.com/D21591
| Assignee | ||
Comment 13•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
| Assignee | ||
Comment 14•7 years ago
|
||
Updated•7 years ago
|
Comment 15•7 years ago
|
||
Comment 16•7 years ago
|
||
| bugherder | ||
Description
•