Closed Bug 1937257 Opened 2 months ago Closed 2 months ago

[wpt-sync] Sync PR 49691 - Fix a bug in test_driver.bless()

Categories

(Testing :: web-platform-tests, task, P4)

task

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 49691 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/49691
Details from upstream follow.

Mason Freed <masonf@chromium.org> wrote:

Fix a bug in test_driver.bless()

The code was previously doing this:

  let wait_click = new Promise(resolve => {
    button.addEventListener("click", resolve));
  };
  return test_driver.click(button)
    .then(wait_click)
    .then(...

but the argument to .then(wait_click) isn't a function, it's the promise to return. Therefore .then() ignores its argument (see step #3 at https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-performpromisethen) and proceeds immediately to the next .then() block.

Since the code wasn't actually waiting for the click event to finish getting fired, subsequent steps could happen out of order.

Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.