Bug 1873973 - Fix nsStandardURL incorrectly escaped "^" in the path r=necko-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D211898
This commit is contained in:
Sean 2024-05-29 17:00:47 +00:00
Родитель 97a961c8b2
Коммит 968eadeb66
6 изменённых файлов: 23 добавлений и 31 удалений

Просмотреть файл

@ -23,6 +23,6 @@ function run_test() {
Assert.equal(
createPrincipal("http://test/foo^bar").exposableSpec,
"http://test/foo%5Ebar"
"http://test/foo^bar"
);
}

Просмотреть файл

@ -499,6 +499,25 @@ add_test(function test_hugeStringThrows() {
run_next_test();
});
add_test(function test_caretNotEscaped() {
var url = stringToURL("wss://host/ !\"$%&'()*+,-./:;<=>@[\\]^_{|}~");
Assert.equal(
url.spec,
"wss://host/%20!%22$%&'()*+,-./:;%3C=%3E@[/]^_%7B|%7D~"
);
url = stringToURL("wss://host/abc^.bar");
Assert.equal(url.spec, "wss://host/abc^.bar");
url = stringToURL("wss://host/path/to/something?q=foo^bar");
Assert.equal(url.spec, "wss://host/path/to/something?q=foo^bar");
url = stringToURL("wss://host/#^");
Assert.equal(url.spec, "wss://host/#^");
run_next_test();
});
add_test(function test_filterWhitespace() {
let url = stringToURL(
" \r\n\th\nt\rt\tp://ex\r\n\tample.com/path\r\n\t/\r\n\tto the/fil\r\n\te.e\r\n\txt?que\r\n\try#ha\r\n\tsh \r\n\t "

Просмотреть файл

@ -596,9 +596,6 @@
[Parsing: <foo://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[Parsing: <wss://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[Parsing: <foo://host/dir/? !"$%&'()*+,-./:;<=>?@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
@ -977,8 +974,4 @@
[Parsing: <wss://!"$&'()*+,-.;=_`{}~/> against <about:blank>]
expected: FAIL
[Parsing: <wss://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[a-element-xhtml.xhtml?include=mailto]

Просмотреть файл

@ -625,9 +625,6 @@
[Parsing: <foo://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[Parsing: <wss://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[Parsing: <foo://host/dir/? !"$%&'()*+,-./:;<=>?@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
@ -1006,8 +1003,4 @@
[Parsing: <wss://!"$&'()*+,-.;=_`{}~/> against <about:blank>]
expected: FAIL
[Parsing: <wss://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[a-element.html?include=mailto]

Просмотреть файл

@ -403,9 +403,6 @@
[Parsing: <foo://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[Parsing: <wss://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[Parsing: <foo://host/dir/? !"$%&'()*+,-./:;<=>?@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
@ -995,9 +992,6 @@
[Parsing: <foo://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[Parsing: <wss://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
[Parsing: <foo://host/dir/? !"$%&'()*+,-./:;<=>?@[\\\]^_`{|}~> against <about:blank>]
expected: FAIL
@ -1206,9 +1200,6 @@
[Parsing: <wss://!"$&'()*+,-.;=_`{}~/> without base]
expected: FAIL
[Parsing: <wss://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> without base]
expected: FAIL
[url-constructor.any.html?include=file]
[Parsing: <file:c:\\foo\\bar.html> against <file:///tmp/mock/path>]
@ -1536,10 +1527,6 @@
[Parsing: <wss://!"$&'()*+,-.;=_`{}~/> without base]
expected: FAIL
[Parsing: <wss://host/ !"$%&'()*+,-./:;<=>@[\\\]^_`{|}~> without base]
expected: FAIL
[url-constructor.any.html?include=javascript]
[Parsing: <javascript:/../> without base]
expected: FAIL

Просмотреть файл

@ -278,9 +278,9 @@ static constexpr std::array<uint32_t, 256> BuildEscapeChars() {
AddUnescapedChars("'.", esc_Username, table);
AddUnescapedChars("'.", esc_Password, table);
AddUnescapedChars(".", esc_Host, table); // Same as esc_Scheme
AddUnescapedChars("'./:;=@[]|", esc_Directory, table);
AddUnescapedChars("'.:;=@[]|", esc_FileBaseName, table);
AddUnescapedChars("':;=@[]|", esc_FileExtension, table);
AddUnescapedChars("'./:;=@[]^|", esc_Directory, table);
AddUnescapedChars("'.:;=@[]^|", esc_FileBaseName, table);
AddUnescapedChars("':;=@[]^|", esc_FileExtension, table);
AddUnescapedChars(".:;=@[\\]^`{|}", esc_Param, table);
AddUnescapedChars("./:;=?@[\\]^`{|}", esc_Query, table);
AddUnescapedChars("#'./:;=?@[\\]^{|}", esc_Ref, table);