Skip to content

Commit c822b85

Browse files
committed
fixup
1 parent d3237c0 commit c822b85

File tree

12 files changed

+580
-30
lines changed

12 files changed

+580
-30
lines changed

lib/internal/per_context/domexception.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,25 @@ const {
77
SafeWeakMap,
88
SafeMap,
99
SymbolToStringTag,
10+
TypeError,
1011
} = primordials;
1112

12-
class ERR_INVALID_THIS extends TypeError {
13-
constructor(type) {
14-
super('Value of "this" must be of ' + type);
15-
}
16-
17-
get code() { return 'ERR_INVALID_THIS'; }
13+
function ERR_INVALID_THIS(type) {
14+
// eslint-disable-next-line no-restricted-syntax
15+
const error = new TypeError(`Value of "this" must be of type ${type}`);
16+
ObjectDefineProperty(error, 'toString', {
17+
value() {
18+
return `${this.name} [ERR_INVALID_THIS]: ${this.message}`;
19+
},
20+
enumerable: false,
21+
writable: true,
22+
configurable: true,
23+
});
24+
error.name = 'TypeError [ERR_INVALID_THIS]';
25+
error.stack;
26+
delete error.name;
27+
error.code = 'ERR_INVALID_THIS';
28+
return error;
1829
}
1930

2031
let internalsMap;

test/common/wpt.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,10 @@ class WPTRunner {
442442
GLOBAL: {
443443
isWindow() { return false; }
444444
},
445-
Object
445+
Object,
446+
Error,
447+
RangeError,
448+
TypeError,
446449
};
447450

448451
return result;

test/fixtures/wpt/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Last update:
1212

1313
- console: https://github.com/web-platform-tests/wpt/tree/b0daaa6b86/console
1414
- encoding: https://github.com/web-platform-tests/wpt/tree/ab733fd9f5/encoding
15-
- url: https://github.com/web-platform-tests/wpt/tree/3696f2233a/url
15+
- url: https://github.com/web-platform-tests/wpt/tree/c8cd629083/url
1616
- resources: https://github.com/web-platform-tests/wpt/tree/abfd8c9729/resources
1717
- interfaces: https://github.com/web-platform-tests/wpt/tree/3cbf8e150b/interfaces
1818
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing

test/fixtures/wpt/url/resources/setters_tests.json

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,12 +1848,30 @@
18481848
}
18491849
},
18501850
{
1851-
"comment": "Simple percent-encoding; nuls, tabs, and newlines are removed",
1851+
"comment": "Simple percent-encoding; tabs and newlines are removed",
18521852
"href": "a:/",
18531853
"new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
18541854
"expected": {
1855-
"href": "a:/#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
1856-
"hash": "#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
1855+
"href": "a:/#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
1856+
"hash": "#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
1857+
}
1858+
},
1859+
{
1860+
"comment": "Percent-encode NULLs in fragment",
1861+
"href": "http://example.net",
1862+
"new_value": "a\u0000b",
1863+
"expected": {
1864+
"href": "http://example.net/#a%00b",
1865+
"hash": "#a%00b"
1866+
}
1867+
},
1868+
{
1869+
"comment": "Percent-encode NULLs in fragment",
1870+
"href": "non-spec:/",
1871+
"new_value": "a\u0000b",
1872+
"expected": {
1873+
"href": "non-spec:/#a%00b",
1874+
"hash": "#a%00b"
18571875
}
18581876
},
18591877
{

test/fixtures/wpt/url/resources/toascii.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,27 @@
145145
{
146146
"input": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.β",
147147
"output": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa"
148+
},
149+
{
150+
"comment": "IDNA ignored code points",
151+
"input": "a\u00ADb",
152+
"output": "ab"
153+
},
154+
{
155+
"input": "a%C2%ADb",
156+
"output": "ab"
157+
},
158+
{
159+
"comment": "Empty host after domain to ASCII",
160+
"input": "\u00AD",
161+
"output": null
162+
},
163+
{
164+
"input": "%C2%AD",
165+
"output": null
166+
},
167+
{
168+
"input": "xn--",
169+
"output": null
148170
}
149171
]

0 commit comments

Comments
 (0)