Skip to content

Commit c2b4cda

Browse files
authored
Update for Unicode 16 / TR46 rev 33
In addition to the dependency update on tr46, this includes a series of recent URL Standard changes: * whatwg/url@cd8f1d6 * whatwg/url@a6e4492 * whatwg/url@c3d173f * whatwg/url@7f3e3b6 Closes #291.
1 parent 0caed47 commit c2b4cda

File tree

6 files changed

+30
-15
lines changed

6 files changed

+30
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ whatwg-url is a full implementation of the WHATWG [URL Standard](https://url.spe
44

55
## Specification conformance
66

7-
whatwg-url is currently up to date with the URL spec up to commit [da212c9](https://github.com/whatwg/url/commit/da212c98f0bba9c35aec3728bbcc13f8f3a7eb52).
7+
whatwg-url is currently up to date with the URL spec up to commit [cfae7c4](https://github.com/whatwg/url/commit/cfae7c4ed1851886390e132fc336b653fada9123).
88

99
For `file:` URLs, whose [origin is left unspecified](https://url.spec.whatwg.org/#concept-url-origin), whatwg-url chooses to use a new opaque origin (which serializes to `"null"`).
1010

lib/url-state-machine.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,6 @@ function parseHost(input, isOpaque = false) {
344344
return failure;
345345
}
346346

347-
if (containsForbiddenDomainCodePoint(asciiDomain)) {
348-
return failure;
349-
}
350-
351347
if (endsInANumber(asciiDomain)) {
352348
return parseIPv4(asciiDomain);
353349
}
@@ -429,15 +425,26 @@ function serializeHost(host) {
429425

430426
function domainToASCII(domain, beStrict = false) {
431427
const result = tr46.toASCII(domain, {
428+
checkHyphens: beStrict,
432429
checkBidi: true,
433-
checkHyphens: false,
434430
checkJoiners: true,
435431
useSTD3ASCIIRules: beStrict,
436-
verifyDNSLength: beStrict
432+
transitionalProcessing: false,
433+
verifyDNSLength: beStrict,
434+
ignoreInvalidPunycode: false
437435
});
438-
if (result === null || result === "") {
436+
if (result === null) {
439437
return failure;
440438
}
439+
440+
if (!beStrict) {
441+
if (result === "") {
442+
return failure;
443+
}
444+
if (containsForbiddenDomainCodePoint(result)) {
445+
return failure;
446+
}
447+
}
441448
return result;
442449
}
443450

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"license": "MIT",
1313
"repository": "jsdom/whatwg-url",
1414
"dependencies": {
15-
"tr46": "^5.0.0",
15+
"tr46": "^5.1.0",
1616
"webidl-conversions": "^7.0.0"
1717
},
1818
"devDependencies": {

scripts/get-latest-platform-tests.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const path = require("path");
1313
// 1. Go to https://github.com/web-platform-tests/wpt/tree/master/url
1414
// 2. Press "y" on your keyboard to get a permalink
1515
// 3. Copy the commit hash
16-
const commitHash = "a9fe2e77b64b0ce9aefb2ed4331c52bfa44fced4";
16+
const commitHash = "7c9c41aedbcd49bf96fb9e35a133293b3977b83d";
1717

1818
const urlPrefix = `https://raw.githubusercontent.com/web-platform-tests/wpt/${commitHash}/url/`;
1919
const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests");
@@ -25,7 +25,8 @@ const resources = [
2525
"resources/toascii.json",
2626
"resources/urltestdata.json",
2727
"resources/urltestdata-javascript-only.json",
28-
"resources/IdnaTestV2.json"
28+
"resources/IdnaTestV2.json",
29+
"resources/IdnaTestV2-removed.json"
2930
];
3031

3132
// These tests we can download and run directly in /test/web-platform.js.
@@ -54,6 +55,7 @@ exports.directlyRunnableTests = [
5455
// can distinguish.
5556
exports.resourceDependentTests = [
5657
"IdnaTestV2.window.js",
58+
"IdnaTestV2-removed.window.js",
5759
"url-constructor.any.js",
5860
"url-origin.any.js",
5961
"url-setters.any.js"

test/web-platform.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const { utf8PercentEncodeString, isSpecialQueryPercentEncode } = require("../lib
1111
const { URL, URLSearchParams } = require("..");
1212

1313
const idnaTestV2Data = require("./web-platform-tests/resources/IdnaTestV2.json");
14+
const idnaTestV2RemovedData = require("./web-platform-tests/resources/IdnaTestV2-removed.json");
1415
const urlTestData = require("./web-platform-tests/resources/urltestdata.json");
1516
const urlTestDataJavaScriptOnly = require("./web-platform-tests/resources/urltestdata-javascript-only.json");
1617
const settersData = require("./web-platform-tests/resources/setters_tests.json");
@@ -29,6 +30,7 @@ describe("Data file-based web platform tests", () => {
2930
resourceDependentTests,
3031
[
3132
"IdnaTestV2.window.js",
33+
"IdnaTestV2-removed.window.js",
3234
"url-constructor.any.js",
3335
"url-origin.any.js",
3436
"url-setters.any.js"
@@ -41,6 +43,10 @@ describe("Data file-based web platform tests", () => {
4143
sandbox.runTests(idnaTestV2Data);
4244
});
4345

46+
runWPT("IdnaTestV2-removed.window.js", sandbox => {
47+
sandbox.runTests(idnaTestV2RemovedData);
48+
});
49+
4450
runWPT("url-constructor.any.js", sandbox => {
4551
sandbox.runURLTests(urlTestData);
4652
sandbox.runURLTests(urlTestDataJavaScriptOnly);

0 commit comments

Comments
 (0)