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
Make the higher-order comparisons in the structured clone tests async
#31232
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the structured clone battery of tests, the `callback` parameter to `check` can be an `async` function, and its return value is awaited. However, comparison functions which might be `async` can be passed to the higher-order comparison function `enumerate_props`, whose return value is in turn passed to the higher-order functions `compare_Array` or `compare_Object`. Currently, the returned function from these higher-order comparison functions is sync and simply calls the HOF's callback. This means that, if the callback is `async` (like `compare_Blob` is), its comparison might not be done by the time the test finishes, and any errors and assertion failures in the comparison will count as errors of the test file, rather than of the specific subtest. This change makes the function returned from `enumerate_props`, `compare_Array` and `compare_Object` `async` and changes them to `await` the return value of their callback. It also makes `compare_File` await for the return value of `compare_Blob`.
wpt-pr-bot
requested review from
annevk,
domenic,
foolip,
jdm,
jgraham and
zqzhang
October 14, 2021 09:57
andreubotella
pushed a commit
that referenced
this pull request
Oct 14, 2021
The `test_obj` parameter in the comparison functions of the structured clone battery of tests doesn't seem to be used at all, considering that the those functions only use it to call `test_obj.done()`, which is a no-op. This seems to have once been used to indicate asynchronous test completion, but that hasn't worked for a long time, and #31232 has now made that obsolete. Aside from removing the `test_obj` arguments to the comparison functions and the calls to `test_obj.done()`, as well as the creation of the `testObjMock` object in the `check` function, this change also removes the `callback_is_async` boolean argument to `compare_Array` and `compare_Object`.
I wonder if @surma is willing to review this. It looks reasonable to me, but I'm not as familiar with the complete setup. |
Can we/should we also remove |
I did that and other follow-up clean-ups in #31233. |
domenic
approved these changes
Oct 25, 2021
andreubotella
pushed a commit
that referenced
this pull request
Oct 25, 2021
The `test_obj` parameter in the comparison functions of the structured clone battery of tests doesn't seem to be used at all, considering that the those functions only use it to call `test_obj.done()`, which is a no-op. This seems to have once been used to indicate asynchronous test completion, but that hasn't worked for a long time, and #31232 has now made that obsolete. Aside from removing the `test_obj` arguments to the comparison functions and the calls to `test_obj.done()`, as well as the creation of the `testObjMock` object in the `check` function, this change also removes the `callback_is_async` boolean argument to `compare_Array` and `compare_Object`.
domenic
pushed a commit
that referenced
this pull request
Oct 25, 2021
The `test_obj` parameter in the comparison functions of the structured clone battery of tests doesn't seem to be used at all, considering that the those functions only use it to call `test_obj.done()`, which is a no-op. This seems to have once been used to indicate asynchronous test completion, but that hasn't worked for a long time, and #31232 has now made that obsolete. Aside from removing the `test_obj` arguments to the comparison functions and the calls to `test_obj.done()`, as well as the creation of the `testObjMock` object in the `check` function, this change also removes the `callback_is_async` boolean argument to `compare_Array` and `compare_Object`.
Gabisampaio
pushed a commit
to Gabisampaio/wpt
that referenced
this pull request
Nov 18, 2021
The `test_obj` parameter in the comparison functions of the structured clone battery of tests doesn't seem to be used at all, considering that the those functions only use it to call `test_obj.done()`, which is a no-op. This seems to have once been used to indicate asynchronous test completion, but that hasn't worked for a long time, and web-platform-tests#31232 has now made that obsolete. Aside from removing the `test_obj` arguments to the comparison functions and the calls to `test_obj.done()`, as well as the creation of the `testObjMock` object in the `check` function, this change also removes the `callback_is_async` boolean argument to `compare_Array` and `compare_Object`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the structured clone battery of tests, the
callback
parameter tocheck
can be anasync
function, and its return value is awaited. However, comparison functions which might beasync
can be passed to the higher-order comparison functionenumerate_props
, whose return value is in turn passed to the higher-order functionscompare_Array
orcompare_Object
.Currently, the returned function from these higher-order comparison functions is sync and simply calls the HOF's callback. This means that, if the callback is
async
(likecompare_Blob
is), its comparison might not be done by the time the test finishes, and any errors and assertion failures in the comparison will count as errors of the test file, rather than of the specific subtest.This change makes the function returned from
enumerate_props
,compare_Array
andcompare_Object
async
and changes them toawait
the return value of their callback. It also makescompare_File
await for the return value ofcompare_Blob
.