Repository navigation
url: run setter steps after converting the value - #67382
Open
thekivashyn wants to merge 1 commit into
Open
thekivashyn wants to merge 1 commit into
thekivashyn wants to merge 1 commit into
Conversation
Web IDL converts the assigned value to a string before the setter steps run. The component setters read the URL's href first and only then converted the value, so a URL that the conversion itself changed, through a `toString()` that assigns to `href`, was overwritten with the state from before the conversion. Keep a reference to the context, which leaves the receiver check ahead of the conversion, convert the value, and read the href last. Fixes: nodejs#67345 Assisted-by: a coding agent Signed-off-by: thekivashyn <dev.tringuyen@gmail.com>
Collaborator
|
Review requested:
|
Contributor
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
This file contains hidden or 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
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.
Web IDL converts the assigned value to a string before the setter steps run. The component setters read the URL's href first and only then converted the value, so a URL that the conversion itself changed, through a
toString()that assigns tohref, was overwritten with the state from before the conversion.Keep a reference to the context, which leaves the receiver check ahead of the conversion, convert the value, and read the href last.
Tested on macOS arm64 with a build of
mainat b1cd451:test/parallel/test-whatwg-url-custom-setters-conversion.jsfails without thelib/internal/url.jschange and passes with it.tools/test.py "parallel/test-whatwg-url-*" "parallel/test-url-*" parallel/test-fs-whatwg-url wpt/test-url: 113 passed.make lint-js: passed.make -j10 test-only: 7621 passed, 3 failed. The three (test-cli-node-options,test-openssl-ca-options,test-tls-off-thread-cert-loading-disabled) fail becauseNODE_USE_SYSTEM_CAis set in my shell, and pass with it unset.The patch and this description were written with the help of a coding agent. I ran the new test on my own build.
#66188 rewrites the same setters. I can rebase onto it if it lands first.
Fixes: #67345
Refs: #66188
Assisted-by: a coding agent