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

testharness.js throws in some cases #46940

Open
asamuzaK opened this issue Jun 29, 2024 · 0 comments · May be fixed by #46945
Open

testharness.js throws in some cases #46940

asamuzaK opened this issue Jun 29, 2024 · 0 comments · May be fixed by #46945

Comments

@asamuzaK
Copy link

asamuzaK commented Jun 29, 2024

When I tried to update wpt for jsdom, I noticed that testharness.js throws an exception in some tests.

TypeError: Cannot read properties of undefined (reading 'arguments.length')
    at do_substitution (http://web-platform.test:10000/resources/testharness.js:4417:49)
    at substitute_children (http://web-platform.test:10000/resources/testharness.js:4448:32)
    at substitute_single (http://web-platform.test:10000/resources/testharness.js:4461:13)
    at substitute (http://web-platform.test:10000/resources/testharness.js:4399:20)
    at substitute_children (http://web-platform.test:10000/resources/testharness.js:4439:39)
    at substitute_single (http://web-platform.test:10000/resources/testharness.js:4461:13)
    at substitute (http://web-platform.test:10000/resources/testharness.js:4399:20)
    at substitute_children (http://web-platform.test:10000/resources/testharness.js:4439:39)
    at substitute_single (http://web-platform.test:10000/resources/testharness.js:4461:13)
    at substitute (http://web-platform.test:10000/resources/testharness.js:4399:20)

On line 4417, it tries to extract an element from the substitutions[] array, but there are cases where substitutions is not an array but undefined, so the error occurred there.

This can be fixed by changing line 4407 to set a default value.

function substitute_single(template, substitutions = [])
{
  // snip
}
asamuzaK added a commit to asamuzaK/wpt that referenced this issue Jun 30, 2024
@asamuzaK asamuzaK linked a pull request Jun 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant