Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Aug 2, 2020
1 parent d3237c0 commit c822b85
Show file tree
Hide file tree
Showing 12 changed files with 580 additions and 30 deletions.
23 changes: 17 additions & 6 deletions lib/internal/per_context/domexception.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,25 @@ const {
SafeWeakMap,
SafeMap,
SymbolToStringTag,
TypeError,
} = primordials;

class ERR_INVALID_THIS extends TypeError {
constructor(type) {
super('Value of "this" must be of ' + type);
}

get code() { return 'ERR_INVALID_THIS'; }
function ERR_INVALID_THIS(type) {
// eslint-disable-next-line no-restricted-syntax
const error = new TypeError(`Value of "this" must be of type ${type}`);
ObjectDefineProperty(error, 'toString', {
value() {
return `${this.name} [ERR_INVALID_THIS]: ${this.message}`;
},
enumerable: false,
writable: true,
configurable: true,
});
error.name = 'TypeError [ERR_INVALID_THIS]';
error.stack;
delete error.name;
error.code = 'ERR_INVALID_THIS';
return error;
}

let internalsMap;
Expand Down
5 changes: 4 additions & 1 deletion test/common/wpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,10 @@ class WPTRunner {
GLOBAL: {
isWindow() { return false; }
},
Object
Object,
Error,
RangeError,
TypeError,
};

return result;
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Last update:

- console: https://github.com/web-platform-tests/wpt/tree/b0daaa6b86/console
- encoding: https://github.com/web-platform-tests/wpt/tree/ab733fd9f5/encoding
- url: https://github.com/web-platform-tests/wpt/tree/3696f2233a/url
- url: https://github.com/web-platform-tests/wpt/tree/c8cd629083/url
- resources: https://github.com/web-platform-tests/wpt/tree/abfd8c9729/resources
- interfaces: https://github.com/web-platform-tests/wpt/tree/3cbf8e150b/interfaces
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
Expand Down
24 changes: 21 additions & 3 deletions test/fixtures/wpt/url/resources/setters_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -1848,12 +1848,30 @@
}
},
{
"comment": "Simple percent-encoding; nuls, tabs, and newlines are removed",
"comment": "Simple percent-encoding; tabs and newlines are removed",
"href": "a:/",
"new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
"expected": {
"href": "a:/#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
"hash": "#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
"href": "a:/#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
"hash": "#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
}
},
{
"comment": "Percent-encode NULLs in fragment",
"href": "http://example.net",
"new_value": "a\u0000b",
"expected": {
"href": "http://example.net/#a%00b",
"hash": "#a%00b"
}
},
{
"comment": "Percent-encode NULLs in fragment",
"href": "non-spec:/",
"new_value": "a\u0000b",
"expected": {
"href": "non-spec:/#a%00b",
"hash": "#a%00b"
}
},
{
Expand Down
22 changes: 22 additions & 0 deletions test/fixtures/wpt/url/resources/toascii.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,27 @@
{
"input": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.β",
"output": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa"
},
{
"comment": "IDNA ignored code points",
"input": "a\u00ADb",
"output": "ab"
},
{
"input": "a%C2%ADb",
"output": "ab"
},
{
"comment": "Empty host after domain to ASCII",
"input": "\u00AD",
"output": null
},
{
"input": "%C2%AD",
"output": null
},
{
"input": "xn--",
"output": null
}
]
Loading

0 comments on commit c822b85

Please sign in to comment.