Skip to content

Commit

Permalink
lib,url: correct URL's argument to pass idlharness
Browse files Browse the repository at this point in the history
`url.idl` defines URL's constructor as:

```
constructor(USVString url, optional USVString base);
```

`idlharness.any.js` checks its length as `1`. So we should remove
constructor's second argument and use `arguments[1]` in constructor's
logic.

Refs: https://url.spec.whatwg.org/#idl-index
  • Loading branch information
XadillaX committed Aug 23, 2021
1 parent 28113ed commit b0bf274
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ function isURLThis(self) {
}

class URL {
constructor(input, base) {
constructor(input, base = undefined) {
// toUSVString is not needed.
input = `${input}`;
let base_context;
Expand Down
3 changes: 0 additions & 3 deletions test/wpt/status/url.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
"urlencoded-parser.any.js": {
"fail": "missing Request and Response"
},
"idlharness.any.js": {
"fail": "getter/setter names are wrong, etc."
},
"urlsearchparams-constructor.any.js": {
"fail": "FormData is not defined"
},
Expand Down
1 change: 1 addition & 0 deletions test/wpt/test-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ const { WPTRunner } = require('../common/wpt');

const runner = new WPTRunner('url');

runner.setInitScript('global.Window = global.__proto__.constructor;');
runner.runJsTests();

0 comments on commit b0bf274

Please sign in to comment.