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
fetch, Web IDL: Test that Headers iteration happens on live value pairs. #36455
fetch, Web IDL: Test that Headers iteration happens on live value pairs. #36455
Conversation
Add some tests to verify the pair iterator behavior specified in Web IDL, namely that the value pairs to be iterated over are retrieved on every invocation of the iterator prototype object's `next()` function. In practice, this means that every iteration step needs to be performed on a Headers' sorted-and-combined headers list that should not be cached. Gecko seems to be the only engine doing this right, as both WebKit and Blink appear to carry out the entire iteration on a cached copy of the header list. The tests were based on the ones in webidl/ecmascript-binding/iterator-invalidation-foreach.html.
@annevk I'm tentatively assigning to you because you're involved with both Fetch and Web IDL. I wasn't sure if it made sense to add these new tests to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have sworn there was test coverage for this, but perhaps it was an equivalent data structure...
This seems reasonable.
Final optional nit: maybe use short function syntax, i.e., () => { ... }
.
* Use `() => {}` form for inner test functions. * Stop breaking declaration of `headers` into multiple lines. * Use `const` in the for..of loop. * Improve description of the last test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is similar to web-platform-tests#36455 and web-platform-tests#20445: we want to make sure that adding and deleting elements during iteration is reflected in FormData's value pairs to iterate over (i.e. iteration does not happen on a cached version).
Add some tests to verify the pair iterator behavior specified in Web IDL, namely that the value pairs to be iterated over are retrieved on every invocation of the iterator prototype object's
next()
function.In practice, this means that every iteration step needs to be performed on a Headers' sorted-and-combined headers list that should not be cached. Gecko seems to be the only engine doing this right, as both WebKit and Blink appear to carry out the entire iteration on a cached copy of the header list.
The tests were based on the ones in
webidl/ecmascript-binding/iterator-invalidation-foreach.html.