Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in test_driver.bless() #49691

Closed
wants to merge 1 commit into from

Conversation

mfreed7
Copy link
Contributor

@mfreed7 mfreed7 commented Dec 14, 2024

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.

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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur, meaning subsequent steps could happen before the click
actually took place.
@mfreed7 mfreed7 marked this pull request as ready for review December 14, 2024 02:04
@mfreed7 mfreed7 requested a review from a team as a code owner December 14, 2024 02:04
@wpt-pr-bot wpt-pr-bot requested a review from jgraham December 14, 2024 02:04
chromium-wpt-export-bot pushed a commit that referenced this pull request Dec 16, 2024
This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  #49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
aarongable pushed a commit to chromium/chromium that referenced this pull request Dec 16, 2024
This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  web-platform-tests/wpt#49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094526
Reviewed-by: Jonathan Lee <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Commit-Queue: Jonathan Lee <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1397010}
chromium-wpt-export-bot pushed a commit that referenced this pull request Dec 16, 2024
This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  #49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094526
Reviewed-by: Jonathan Lee <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Commit-Queue: Jonathan Lee <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1397010}
@mfreed7
Copy link
Contributor Author

mfreed7 commented Dec 16, 2024

Closing this one in favor of #49719

@mfreed7 mfreed7 closed this Dec 16, 2024
past pushed a commit that referenced this pull request Dec 17, 2024
This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  #49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094526
Reviewed-by: Jonathan Lee <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Commit-Queue: Jonathan Lee <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1397010}

Co-authored-by: Mason Freed <[email protected]>
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Dec 21, 2024
…only

Automatic update from web-platform-tests
Fix a bug in test_driver.bless() (#49719)

This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  web-platform-tests/wpt#49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094526
Reviewed-by: Jonathan Lee <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Commit-Queue: Jonathan Lee <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1397010}

Co-authored-by: Mason Freed <[email protected]>
--

wpt-commits: ce746b469d6c2fe11cf9db769eb2b3426bad6466
wpt-pr: 49719
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Dec 28, 2024
…only

Automatic update from web-platform-tests
Fix a bug in test_driver.bless() (#49719)

This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  web-platform-tests/wpt#49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094526
Reviewed-by: Jonathan Lee <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Commit-Queue: Jonathan Lee <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1397010}

Co-authored-by: Mason Freed <[email protected]>
--

wpt-commits: ce746b469d6c2fe11cf9db769eb2b3426bad6466
wpt-pr: 49719
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Jan 1, 2025
…only

Automatic update from web-platform-tests
Fix a bug in test_driver.bless() (#49719)

This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  web-platform-tests/wpt#49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094526
Reviewed-by: Jonathan Lee <jonathanjleegoogle.com>
Auto-Submit: Mason Freed <masonfchromium.org>
Commit-Queue: Mason Freed <masonfchromium.org>
Commit-Queue: Jonathan Lee <jonathanjleegoogle.com>
Cr-Commit-Position: refs/heads/main{#1397010}

Co-authored-by: Mason Freed <masonfchromium.org>
--

wpt-commits: ce746b469d6c2fe11cf9db769eb2b3426bad6466
wpt-pr: 49719

UltraBlame original commit: 337b58e389432dc74cdafad2aeb85b1e0ea5fc3c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Jan 1, 2025
…only

Automatic update from web-platform-tests
Fix a bug in test_driver.bless() (#49719)

This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  web-platform-tests/wpt#49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094526
Reviewed-by: Jonathan Lee <jonathanjleegoogle.com>
Auto-Submit: Mason Freed <masonfchromium.org>
Commit-Queue: Mason Freed <masonfchromium.org>
Commit-Queue: Jonathan Lee <jonathanjleegoogle.com>
Cr-Commit-Position: refs/heads/main{#1397010}

Co-authored-by: Mason Freed <masonfchromium.org>
--

wpt-commits: ce746b469d6c2fe11cf9db769eb2b3426bad6466
wpt-pr: 49719

UltraBlame original commit: 337b58e389432dc74cdafad2aeb85b1e0ea5fc3c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Jan 1, 2025
…only

Automatic update from web-platform-tests
Fix a bug in test_driver.bless() (#49719)

This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  web-platform-tests/wpt#49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094526
Reviewed-by: Jonathan Lee <jonathanjleegoogle.com>
Auto-Submit: Mason Freed <masonfchromium.org>
Commit-Queue: Mason Freed <masonfchromium.org>
Commit-Queue: Jonathan Lee <jonathanjleegoogle.com>
Cr-Commit-Position: refs/heads/main{#1397010}

Co-authored-by: Mason Freed <masonfchromium.org>
--

wpt-commits: ce746b469d6c2fe11cf9db769eb2b3426bad6466
wpt-pr: 49719

UltraBlame original commit: 337b58e389432dc74cdafad2aeb85b1e0ea5fc3c
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Jan 2, 2025
…only

Automatic update from web-platform-tests
Fix a bug in test_driver.bless() (#49719)

This 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() creates an already-resolved
promise containing `wait_click` as its resolved value. Which the next
`.then()` block ignores. So this wasn't actually waiting for the click
to occur.

This triggered a number of test bugs (caused by erroneous assumptions
accidentally baked into the tests. I fixed a few, and filed a few
bugs for the rest (after failing to figure out how to fix them).

Note that the WPT version of testdriver.js is rolled into Chromium,
so that change is being made here:
  web-platform-tests/wpt#49691

Bug: 384009734,384050894
Change-Id: Ibdb8a97d23998ad89c5a48c23a7e780dc605283b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094526
Reviewed-by: Jonathan Lee <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Commit-Queue: Jonathan Lee <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1397010}

Co-authored-by: Mason Freed <[email protected]>
--

wpt-commits: ce746b469d6c2fe11cf9db769eb2b3426bad6466
wpt-pr: 49719
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants