Closed Bug 1420310 Opened 6 years ago Closed 6 years ago

Wait for the next event tick in ContentTaskUtils.waitForEvent

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 59
Tracking Status
firefox59 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(2 files)

https://treeherder.mozilla.org/#/jobs?repo=try&revision=dc35b181a4a55c0bd3cca8a19346ff224545a649&selectedJob=143221687
>  FAIL | toolkit/components/passwordmgr/test/browser/browser_context_menu.js |
> Password filled and correct. - "password1" == ""
> Stack trace: resource://testing-common/content-task.js line 52 > eval:null:22

it looks like similar case as bug 1416446, that ContentTaskUtils.waitForEvent should also wait for the next event tick before resolving the promise.
ContentTaskUtils.waitForEvent needs to wait for the next event tick before resolving the promise inside event handler, to avoid the resolution handler running in unexpected state (like, when not all event handlers are executed).

before fixing it, tests/browser_subdialogs.js needs to be fixed to add dialogopen event handler directly inside DOMFrameContentLoaded event handler,
to avoid missing the event.
Attachment #8932821 - Flags: review?(felipc)
Changed ContentTaskUtils.waitForEvent to wait for the next event tick.
Attachment #8932823 - Flags: review?(felipc)
Attachment #8932821 - Flags: review?(felipc) → review+
Attachment #8932823 - Flags: review?(felipc) → review+
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7387473088a9
Part 0: Fix browser_subdialogs.js to wait for events in correct order and timing. r=felipe
https://hg.mozilla.org/integration/mozilla-inbound/rev/cc1225a95cc6
Part 1: Wait for the next event tick in ContentTaskUtils.waitForEvent r=felipe
https://hg.mozilla.org/integration/mozilla-inbound/rev/7387473088a9d83396d18c6b3c89a33fee02433b
Bug 1420310 - Part 0: Fix browser_subdialogs.js to wait for events in correct order and timing. r=felipe

https://hg.mozilla.org/integration/mozilla-inbound/rev/cc1225a95cc667b54806398a22eff54519024236
Bug 1420310 - Part 1: Wait for the next event tick in ContentTaskUtils.waitForEvent r=felipe
https://hg.mozilla.org/mozilla-central/rev/7387473088a9
https://hg.mozilla.org/mozilla-central/rev/cc1225a95cc6
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: