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

URL/Encoding: change query state parsing #10915

Merged
merged 1 commit into from
May 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions encoding/big5-encoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@

encode("ab", "ab", "very basic")
// edge cases
encode("\u9EA6", "&%2340614;", "Highest-pointer BMP character excluded from encoder");
encode("\uD858\uDE6B", "&%23156267;", "Highest-pointer character excluded from encoder");
encode("\u9EA6", "%26%2340614%3B", "Highest-pointer BMP character excluded from encoder");
encode("\uD858\uDE6B", "%26%23156267%3B", "Highest-pointer character excluded from encoder");
encode("\u3000", "%A1@", "Lowest-pointer character included in encoder");
encode("\u20AC", "%A3%E1", "Euro; the highest-pointer character before a range of 30 unmapped pointers");
encode("\u4E00", "%A4@", "The lowest-pointer character after the range of 30 unmapped pointers");
encode("\uD85D\uDE07", "%C8%A4", "The highest-pointer character before a range of 41 unmapped pointers");
encode("\uFFE2", "%C8%CD", "The lowest-pointer character after the range of 41 unmapped pointers");
encode("\u79D4", "%FE%FE", "The last character in the index");
// not in index
encode("\u2603", "&%239731;", "The canonical BMP test character that is not in the index");
encode("\uD83D\uDCA9", "&%23128169;", "The canonical astral test character that is not in the index");
encode("\u2603", "%26%239731%3B", "The canonical BMP test character that is not in the index");
encode("\uD83D\uDCA9", "%26%23128169%3B", "The canonical astral test character that is not in the index");
// duplicate low bits
encode("\uD840\uDFB5", "%FDj", "A Plane 2 character whose low 16 bits match a BMP character that has a lower pointer");
// prefer last
Expand Down
2 changes: 1 addition & 1 deletion encoding/gbk-encoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
encode("\u4E02", "%81@", "character")
encode("\uE4C6", "%A1@", "PUA")
encode("\uE4C5", "%FE%FE", "PUA #2")
encode("\ud83d\udca9", "&%23128169;", "poo")
encode("\ud83d\udca9", "%26%23128169%3B", "poo")
</script>
1 change: 1 addition & 0 deletions encoding/iso-2022-jp-encoder.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
encode("s", "s", "very basic")
encode("\u00A5\u203Es\\\uFF90\u4F69", "%1B(J\\~s%1B(B\\%1B$B%_PP%1B(B", "basics")
encode("\x0E\x0F\x1Bx", "%0E%0F%1Bx", "SO/SI ESC")
encode("\uFFFD", "%26%2365533%3B", "U+FFFD");
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@
for (var j = 0; j < cplist[i].length; j++) {
var t = tests[i][j];
t.step(function() {
assert_equals(
normalizeStr(results[j]),
normalizeStr(cplist[i][j].expected)
);
assert_equals(results[j], cplist[i][j].expected);
});
t.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var a = document.createElement("a"); // <a> uses document encoding for URL's query
a.href = "https://example.com/?" + input;
result = a.search.substr(1); // remove leading "?"
assert_equals(normalizeStr(result), normalizeStr(expected));
assert_equals(result, expected);
}, desc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
function expected(encoding) {
return "?" + {
"UTF-8": "%C3%BF",
"windows-1251": "&%23255;",
"windows-1251": "%26%23255%3B",
"windows-1252": "%FF"
}[encoding];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ onload = function() {
'utf-16be':'%C3%A5',
'utf-16le':'%C3%A5',
'windows-1252':'%E5',
'windows-1251':'&%23229;'
'windows-1251':'%26%23229%3B'
};
var expected_current = expected_obj[encoding];
var expected_utf8 = expected_obj['utf-8'];
Expand Down
7 changes: 7 additions & 0 deletions url/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## urltestdata.json

These tests are for browsers, but the data for
`a-element.html`, `url-constructor.html`, `a-element-xhtml.xhtml`, and `failure.html`
is in `urltestdata.json` and can be re-used by non-browser implementations.
Expand Down Expand Up @@ -25,5 +27,10 @@ true, parsing `about:blank` against `base` must give failure. This tests that th
converting base URLs into strings properly fails the whole parsing algorithm if the base URL cannot
be parsed.

## URL parser's encoding argument

Tests in `/encoding` and `/html/infrastructure/urls/resolving-urls/query-encoding/` cover the
encoding argument to the URL parser.

[parsing]: https://url.spec.whatwg.org/#concept-basic-url-parser
[API]: https://url.spec.whatwg.org/#api
Loading