Bug 1347459 - make the link and URL protocol setters adhere to the URL spec text validating changes of protocol between file and/or special schemes; r=kershaw,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D182850
This commit is contained in:
Thomas Wisniewski 2023-07-06 15:40:31 +00:00
Родитель 185848e40b
Коммит aa8ab4ddf6
9 изменённых файлов: 120 добавлений и 813 удалений

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

@ -152,19 +152,10 @@ void Link::SetProtocol(const nsAString& aProtocol) {
// Ignore failures to be compatible with NS4.
return;
}
nsAString::const_iterator start, end;
aProtocol.BeginReading(start);
aProtocol.EndReading(end);
nsAString::const_iterator iter(start);
(void)FindCharInReadable(':', iter, end);
nsresult rv = NS_MutateURI(uri)
.SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)))
.Finalize(uri);
if (NS_FAILED(rv)) {
uri = net::TryChangeProtocol(uri, aProtocol);
if (!uri) {
return;
}
SetHrefAttribute(uri);
}

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

@ -232,38 +232,14 @@ void URL::GetProtocol(nsAString& aProtocol) const {
}
void URL::SetProtocol(const nsAString& aProtocol) {
nsAString::const_iterator start;
aProtocol.BeginReading(start);
nsAString::const_iterator end;
aProtocol.EndReading(end);
nsAString::const_iterator iter(start);
FindCharInReadable(':', iter, end);
// Changing the protocol of a URL, changes the "nature" of the URI
// implementation. In order to do this properly, we have to serialize the
// existing URL and reparse it in a new object.
nsCOMPtr<nsIURI> clone;
nsresult rv = NS_MutateURI(URI())
.SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)))
.Finalize(clone);
if (NS_WARN_IF(NS_FAILED(rv))) {
nsCOMPtr<nsIURI> uri(URI());
if (!uri) {
return;
}
nsAutoCString href;
rv = clone->GetSpec(href);
if (NS_WARN_IF(NS_FAILED(rv))) {
uri = net::TryChangeProtocol(uri, aProtocol);
if (!uri) {
return;
}
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), href);
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
mURI = std::move(uri);
}

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

@ -193,6 +193,7 @@
base: undefined,
error: false,
protocol: "gopher:",
expectedChangedProtocol: "https:",
},
{ url: "ws://ws.something.net",
base: undefined,
@ -208,6 +209,7 @@
base: undefined,
error: false,
protocol: "foo:",
expectedChangedProtocol: "https:",
},
{ url: "about:blank",
@ -319,7 +321,8 @@
if ("href" in test) is(url.href, test.href, "href");
if ("origin" in test) is(url.origin, test.origin, "origin");
if ("protocol" in test) is(url.protocol, test.protocol, "protocol");
if ("expectedChangedProtocol" in test) is(url.protocol, test.expectedChangedProtocol, "protocol");
else if ("protocol" in test) is(url.protocol, test.protocol, "protocol");
if ("username" in test) is(url.username, test.username, "username");
if ("password" in test) is(url.password, test.password, "password");
if ("host" in test) is(url.host, test.host, "host");

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

@ -32,12 +32,12 @@ try {
}
base.protocol = "http:";
ok(true, "Protocol: http changed");
is(base.href, "http://text/plain,", "Base URL is correct");
ok(true, "Protocol: http not changed (special scheme)");
is(base.href, "chrome://text/plain,", "Base URL is correct");
relative = new URL("a", base);
ok(relative, "This works.");
is(relative.href, "http://text/a", "Relative URL is correct");
is(relative.href, "chrome://text/a", "Relative URL is correct");
</script>

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

@ -202,6 +202,7 @@ onmessage = function () {
base: undefined,
error: false,
protocol: "gopher:",
expectedChangedProtocol: "https:",
},
{
url: "ws://ws.something.net",
@ -220,6 +221,7 @@ onmessage = function () {
base: undefined,
error: false,
protocol: "foo:",
expectedChangedProtocol: "https:",
},
];
@ -317,7 +319,9 @@ onmessage = function () {
if ("origin" in test) {
is(url.origin, test.origin, "origin");
}
if ("protocol" in test) {
if ("expectedChangedProtocol" in test) {
is(url.protocol, test.expectedChangedProtocol, "protocol");
} else if ("protocol" in test) {
is(url.protocol, test.protocol, "protocol");
}
if ("username" in test) {

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

@ -3363,6 +3363,102 @@ bool SchemeIsFTP(nsIURI* aURI) {
return aURI->SchemeIs("ftp");
}
bool SchemeIsSpecial(const nsACString& aScheme) {
// See https://url.spec.whatwg.org/#special-scheme
return aScheme.EqualsIgnoreCase("ftp") || aScheme.EqualsIgnoreCase("file") ||
aScheme.EqualsIgnoreCase("http") ||
aScheme.EqualsIgnoreCase("https") || aScheme.EqualsIgnoreCase("ws") ||
aScheme.EqualsIgnoreCase("wss");
}
bool IsSchemeChangePermitted(nsIURI* aOldURI, const nsACString& newScheme) {
// See step 2.1 in https://url.spec.whatwg.org/#special-scheme
// Note: The spec text uses "buffer" instead of newScheme, and "url"
MOZ_ASSERT(aOldURI);
nsAutoCString tmp;
nsresult rv = aOldURI->GetScheme(tmp);
// If url's scheme is a special scheme and buffer is not a
// special scheme, then return.
// If url's scheme is not a special scheme and buffer is a
// special scheme, then return.
if (NS_FAILED(rv) || SchemeIsSpecial(tmp) != SchemeIsSpecial(newScheme)) {
return false;
}
// If url's scheme is "file" and its host is an empty host, then return.
if (aOldURI->SchemeIs("file")) {
rv = aOldURI->GetHost(tmp);
if (NS_FAILED(rv) || tmp.IsEmpty()) {
return false;
}
}
// URL Spec: If url includes credentials or has a non-null port, and
// buffer is "file", then return.
if (newScheme.EqualsIgnoreCase("file")) {
rv = aOldURI->GetUsername(tmp);
if (NS_FAILED(rv) || !tmp.IsEmpty()) {
return false;
}
rv = aOldURI->GetPassword(tmp);
if (NS_FAILED(rv) || !tmp.IsEmpty()) {
return false;
}
int32_t port;
rv = aOldURI->GetPort(&port);
if (NS_FAILED(rv) || port != -1) {
return false;
}
}
return true;
}
already_AddRefed<nsIURI> TryChangeProtocol(nsIURI* aURI,
const nsAString& aProtocol) {
MOZ_ASSERT(aURI);
nsAString::const_iterator start;
aProtocol.BeginReading(start);
nsAString::const_iterator end;
aProtocol.EndReading(end);
nsAString::const_iterator iter(start);
FindCharInReadable(':', iter, end);
// Changing the protocol of a URL, changes the "nature" of the URI
// implementation. In order to do this properly, we have to serialize the
// existing URL and reparse it in a new object.
nsCOMPtr<nsIURI> clone;
nsresult rv = NS_MutateURI(aURI)
.SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter)))
.Finalize(clone);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
nsAutoCString newScheme;
rv = clone->GetScheme(newScheme);
if (NS_FAILED(rv) || !net::IsSchemeChangePermitted(aURI, newScheme)) {
return nullptr;
}
nsAutoCString href;
rv = clone->GetSpec(href);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
RefPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), href);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
return uri.forget();
}
// Decode a parameter value using the encoding defined in RFC 5987 (in place)
//
// charset "'" [ language ] "'" value-chars

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

@ -992,6 +992,12 @@ bool SchemeIsViewSource(nsIURI* aURI);
bool SchemeIsResource(nsIURI* aURI);
bool SchemeIsFTP(nsIURI* aURI);
// Helper functions for SetProtocol methods to follow
// step 2.1 in https://url.spec.whatwg.org/#scheme-state
bool SchemeIsSpecial(const nsACString&);
bool IsSchemeChangePermitted(nsIURI*, const nsACString&);
already_AddRefed<nsIURI> TryChangeProtocol(nsIURI*, const nsAString&);
struct LinkHeader {
nsString mHref;
nsString mRel;

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

@ -1,592 +1,4 @@
[url-setters-a-area.window.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[<a>: Setting <http://test@example.net>.protocol = 'file' Cant switch from URL containing username/password/port to file]
expected: FAIL
[<area>: Setting <http://test@example.net>.protocol = 'file' Cant switch from URL containing username/password/port to file]
expected: FAIL
[<a>: Setting <https://example.net:1234>.protocol = 'file']
expected: FAIL
[<area>: Setting <https://example.net:1234>.protocol = 'file']
expected: FAIL
[<a>: Setting <wss://x:x@example.net:1234>.protocol = 'file']
expected: FAIL
[<area>: Setting <wss://x:x@example.net:1234>.protocol = 'file']
expected: FAIL
[<a>: Setting <file://localhost/>.protocol = 'http' Cant switch from file URL with no host]
expected: FAIL
[<area>: Setting <file://localhost/>.protocol = 'http' Cant switch from file URL with no host]
expected: FAIL
[<a>: Setting <file:///test>.protocol = 'https']
expected: FAIL
[<area>: Setting <file:///test>.protocol = 'https']
expected: FAIL
[<a>: Setting <file:>.protocol = 'wss']
expected: FAIL
[<area>: Setting <file:>.protocol = 'wss']
expected: FAIL
[<a>: Setting <http://example.net>.protocol = 'b' Cant switch from special scheme to non-special]
expected: FAIL
[<area>: Setting <http://example.net>.protocol = 'b' Cant switch from special scheme to non-special]
expected: FAIL
[<a>: Setting <file://hi/path>.protocol = 's']
expected: FAIL
[<area>: Setting <file://hi/path>.protocol = 's']
expected: FAIL
[<a>: Setting <https://example.net>.protocol = 's']
expected: FAIL
[<area>: Setting <https://example.net>.protocol = 's']
expected: FAIL
[<a>: Setting <ftp://example.net>.protocol = 'test']
expected: FAIL
[<area>: Setting <ftp://example.net>.protocol = 'test']
expected: FAIL
[<a>: Setting <mailto:me@example.net>.protocol = 'http' Cannot-be-a-base URL doesnt have a host, but URL in a special scheme must.]
expected: FAIL
[<area>: Setting <mailto:me@example.net>.protocol = 'http' Cannot-be-a-base URL doesnt have a host, but URL in a special scheme must.]
expected: FAIL
[<a>: Setting <ssh://me@example.net>.protocol = 'http' Cant switch from non-special scheme to special]
expected: FAIL
[<area>: Setting <ssh://me@example.net>.protocol = 'http' Cant switch from non-special scheme to special]
expected: FAIL
[<a>: Setting <ssh://me@example.net>.protocol = 'https']
expected: FAIL
[<area>: Setting <ssh://me@example.net>.protocol = 'https']
expected: FAIL
[<a>: Setting <ssh://me@example.net>.protocol = 'file']
expected: FAIL
[<area>: Setting <ssh://me@example.net>.protocol = 'file']
expected: FAIL
[<a>: Setting <ssh://example.net>.protocol = 'file']
expected: FAIL
[<area>: Setting <ssh://example.net>.protocol = 'file']
expected: FAIL
[<a>: Setting <nonsense:///test>.protocol = 'https']
expected: FAIL
[<area>: Setting <nonsense:///test>.protocol = 'https']
expected: FAIL
[<a>: Setting <http://example.net>.username = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the userinfo encode set.]
expected: FAIL
[<area>: Setting <http://example.net>.username = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the userinfo encode set.]
expected: FAIL
[<a>: Setting <javascript://x/>.username = 'wario']
expected: FAIL
[<area>: Setting <javascript://x/>.username = 'wario']
expected: FAIL
[<a>: Setting <file://test/>.username = 'test']
expected: FAIL
[<area>: Setting <file://test/>.username = 'test']
expected: FAIL
[<a>: Setting <http://example.net>.password = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the userinfo encode set.]
expected: FAIL
[<area>: Setting <http://example.net>.password = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the userinfo encode set.]
expected: FAIL
[<a>: Setting <javascript://x/>.password = 'bowser']
expected: FAIL
[<area>: Setting <javascript://x/>.password = 'bowser']
expected: FAIL
[<a>: Setting <file://test/>.password = 'test']
expected: FAIL
[<area>: Setting <file://test/>.password = 'test']
expected: FAIL
[<a>: Setting <sc://x/>.host = '\x00' Non-special scheme]
expected: FAIL
[<area>: Setting <sc://x/>.host = '\x00' Non-special scheme]
expected: FAIL
[<a>: Setting <sc://x/>.host = '\t']
expected: FAIL
[<area>: Setting <sc://x/>.host = '\t']
expected: FAIL
[<a>: Setting <sc://x/>.host = '\n']
expected: FAIL
[<area>: Setting <sc://x/>.host = '\n']
expected: FAIL
[<a>: Setting <sc://x/>.host = '\r']
expected: FAIL
[<area>: Setting <sc://x/>.host = '\r']
expected: FAIL
[<a>: Setting <sc://x/>.host = ' ']
expected: FAIL
[<area>: Setting <sc://x/>.host = ' ']
expected: FAIL
[<a>: Setting <sc://x/>.host = '#']
expected: FAIL
[<area>: Setting <sc://x/>.host = '#']
expected: FAIL
[<a>: Setting <sc://x/>.host = '/']
expected: FAIL
[<area>: Setting <sc://x/>.host = '/']
expected: FAIL
[<a>: Setting <sc://x/>.host = '?']
expected: FAIL
[<area>: Setting <sc://x/>.host = '?']
expected: FAIL
[<a>: Setting <sc://x/>.host = '@']
expected: FAIL
[<area>: Setting <sc://x/>.host = '@']
expected: FAIL
[<a>: Setting <sc://x/>.host = 'ß']
expected: FAIL
[<area>: Setting <sc://x/>.host = 'ß']
expected: FAIL
[<a>: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes]
expected: FAIL
[<area>: Setting <view-source+http://example.net/foo>.host = '' The empty host is OK for non-special schemes]
expected: FAIL
[<a>: Setting <a:/foo>.host = 'example.net' Path-only URLs can gain a host]
expected: FAIL
[<area>: Setting <a:/foo>.host = 'example.net' Path-only URLs can gain a host]
expected: FAIL
[<a>: Setting <view-source+http://example.net/path>.host = 'example.com\\stuff' \\ is not a delimiter for non-special schemes, but still forbidden in hosts]
expected: FAIL
[<area>: Setting <view-source+http://example.net/path>.host = 'example.com\\stuff' \\ is not a delimiter for non-special schemes, but still forbidden in hosts]
expected: FAIL
[<a>: Setting <view-source+http://example.net/path>.host = 'example.com:8080stuff2' Anything other than ASCII digit stops the port parser in a setter but is not an error]
expected: FAIL
[<area>: Setting <view-source+http://example.net/path>.host = 'example.com:8080stuff2' Anything other than ASCII digit stops the port parser in a setter but is not an error]
expected: FAIL
[<a>: Setting <file://y/>.host = 'x:123']
expected: FAIL
[<area>: Setting <file://y/>.host = 'x:123']
expected: FAIL
[<a>: Setting <sc://test@test/>.host = '']
expected: FAIL
[<area>: Setting <sc://test@test/>.host = '']
expected: FAIL
[<a>: Setting <sc://test:12/>.host = '']
expected: FAIL
[<area>: Setting <sc://test:12/>.host = '']
expected: FAIL
[<a>: Setting <sc://x/>.hostname = '\x00' Non-special scheme]
expected: FAIL
[<area>: Setting <sc://x/>.hostname = '\x00' Non-special scheme]
expected: FAIL
[<a>: Setting <sc://x/>.hostname = '\t']
expected: FAIL
[<area>: Setting <sc://x/>.hostname = '\t']
expected: FAIL
[<a>: Setting <sc://x/>.hostname = '\n']
expected: FAIL
[<area>: Setting <sc://x/>.hostname = '\n']
expected: FAIL
[<a>: Setting <sc://x/>.hostname = '\r']
expected: FAIL
[<area>: Setting <sc://x/>.hostname = '\r']
expected: FAIL
[<a>: Setting <sc://x/>.hostname = ' ']
expected: FAIL
[<area>: Setting <sc://x/>.hostname = ' ']
expected: FAIL
[<a>: Setting <sc://x/>.hostname = '#']
expected: FAIL
[<area>: Setting <sc://x/>.hostname = '#']
expected: FAIL
[<a>: Setting <sc://x/>.hostname = '/']
expected: FAIL
[<area>: Setting <sc://x/>.hostname = '/']
expected: FAIL
[<a>: Setting <sc://x/>.hostname = '?']
expected: FAIL
[<area>: Setting <sc://x/>.hostname = '?']
expected: FAIL
[<a>: Setting <sc://x/>.hostname = '@']
expected: FAIL
[<area>: Setting <sc://x/>.hostname = '@']
expected: FAIL
[<a>: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes]
expected: FAIL
[<area>: Setting <view-source+http://example.net/foo>.hostname = '' The empty host is OK for non-special schemes]
expected: FAIL
[<a>: Setting <a:/foo>.hostname = 'example.net' Path-only URLs can gain a host]
expected: FAIL
[<area>: Setting <a:/foo>.hostname = 'example.net' Path-only URLs can gain a host]
expected: FAIL
[<a>: Setting <view-source+http://example.net/path>.hostname = 'example.com\\stuff' \\ is not a delimiter for non-special schemes, but still forbidden in hosts]
expected: FAIL
[<area>: Setting <view-source+http://example.net/path>.hostname = 'example.com\\stuff' \\ is not a delimiter for non-special schemes, but still forbidden in hosts]
expected: FAIL
[<a>: Setting <file://y/>.hostname = 'x:123']
expected: FAIL
[<area>: Setting <file://y/>.hostname = 'x:123']
expected: FAIL
[<a>: Setting <sc://test@test/>.hostname = '']
expected: FAIL
[<area>: Setting <sc://test@test/>.hostname = '']
expected: FAIL
[<a>: Setting <sc://test:12/>.hostname = '']
expected: FAIL
[<area>: Setting <sc://test:12/>.hostname = '']
expected: FAIL
[<a>: Setting <non-spec:/.//p>.hostname = 'h' Drop /. from path]
expected: FAIL
[<area>: Setting <non-spec:/.//p>.hostname = 'h' Drop /. from path]
expected: FAIL
[<a>: Setting <non-spec:/.//p>.hostname = '']
expected: FAIL
[<area>: Setting <non-spec:/.//p>.hostname = '']
expected: FAIL
[<a>: Setting <view-source+http://example.net/path>.port = '8080stuff2' Anything other than ASCII digit stops the port parser in a setter but is not an error]
expected: FAIL
[<area>: Setting <view-source+http://example.net/path>.port = '8080stuff2' Anything other than ASCII digit stops the port parser in a setter but is not an error]
expected: FAIL
[<a>: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error]
expected: FAIL
[<area>: Setting <non-special://example.net:8080/path>.port = '65536' Port numbers are 16 bit integers, overflowing is an error]
expected: FAIL
[<a>: Setting <file://test/>.port = '12']
expected: FAIL
[<area>: Setting <file://test/>.port = '12']
expected: FAIL
[<a>: Setting <sc://x/>.port = '12']
expected: FAIL
[<area>: Setting <sc://x/>.port = '12']
expected: FAIL
[<a>: Setting <javascript://x/>.port = '12']
expected: FAIL
[<area>: Setting <javascript://x/>.port = '12']
expected: FAIL
[<a>: Setting <mailto:me@example.net>.pathname = '/foo' Cannot-be-a-base dont have a path]
expected: FAIL
[<area>: Setting <mailto:me@example.net>.pathname = '/foo' Cannot-be-a-base dont have a path]
expected: FAIL
[<a>: Setting <unix:/run/foo.socket?timeout=10>.pathname = '/var/log/../run/bar.socket']
expected: FAIL
[<area>: Setting <unix:/run/foo.socket?timeout=10>.pathname = '/var/log/../run/bar.socket']
expected: FAIL
[<a>: Setting <http://example.net/home?lang=fr#nav>.pathname = '\\a\\%2E\\b\\%2e.\\c' \\ is a segment delimiter for 'special' URLs]
expected: FAIL
[<area>: Setting <http://example.net/home?lang=fr#nav>.pathname = '\\a\\%2E\\b\\%2e.\\c' \\ is a segment delimiter for 'special' URLs]
expected: FAIL
[<a>: Setting <view-source+http://example.net/home?lang=fr#nav>.pathname = '\\a\\%2E\\b\\%2e.\\c' \\ is *not* a segment delimiter for non-'special' URLs]
expected: FAIL
[<area>: Setting <view-source+http://example.net/home?lang=fr#nav>.pathname = '\\a\\%2E\\b\\%2e.\\c' \\ is *not* a segment delimiter for non-'special' URLs]
expected: FAIL
[<a>: Setting <a:/>.pathname = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the default encode set. Tabs and newlines are removed.]
expected: FAIL
[<area>: Setting <a:/>.pathname = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the default encode set. Tabs and newlines are removed.]
expected: FAIL
[<a>: Setting <sc://example.net>.pathname = '?' ? needs to be encoded, non-special scheme]
expected: FAIL
[<area>: Setting <sc://example.net>.pathname = '?' ? needs to be encoded, non-special scheme]
expected: FAIL
[<a>: Setting <sc://example.net>.pathname = '#' # needs to be encoded, non-special scheme]
expected: FAIL
[<area>: Setting <sc://example.net>.pathname = '#' # needs to be encoded, non-special scheme]
expected: FAIL
[<a>: Setting <file://monkey/>.pathname = '\\\\' File URLs and (back)slashes]
expected: FAIL
[<area>: Setting <file://monkey/>.pathname = '\\\\' File URLs and (back)slashes]
expected: FAIL
[<a>: Setting <file:///unicorn>.pathname = '//\\/' File URLs and (back)slashes]
expected: FAIL
[<area>: Setting <file:///unicorn>.pathname = '//\\/' File URLs and (back)slashes]
expected: FAIL
[<a>: Setting <non-spec:/>.pathname = '/.//p' Serialize /. in path]
expected: FAIL
[<area>: Setting <non-spec:/>.pathname = '/.//p' Serialize /. in path]
expected: FAIL
[<a>: Setting <non-spec:/>.pathname = '/..//p']
expected: FAIL
[<area>: Setting <non-spec:/>.pathname = '/..//p']
expected: FAIL
[<a>: Setting <non-spec:/>.pathname = '//p']
expected: FAIL
[<area>: Setting <non-spec:/>.pathname = '//p']
expected: FAIL
[<a>: Setting <non-spec:/.//>.pathname = 'p' Drop /. from path]
expected: FAIL
[<area>: Setting <non-spec:/.//>.pathname = 'p' Drop /. from path]
expected: FAIL
[<a>: Setting <a:/>.search = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the query encode set. Tabs and newlines are removed.]
expected: FAIL
[<area>: Setting <a:/>.search = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the query encode set. Tabs and newlines are removed.]
expected: FAIL
[<a>: Setting <a:/>.hash = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' Simple percent-encoding; tabs and newlines are removed]
expected: FAIL
[<area>: Setting <a:/>.hash = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' Simple percent-encoding; tabs and newlines are removed]
expected: FAIL
[<a>: Setting <sc://example.com/>.host = '///bad.com' Leading / is not stripped]
expected: FAIL
[<area>: Setting <sc://example.com/>.host = '///bad.com' Leading / is not stripped]
expected: FAIL
[<a>: Setting <sc://example.com/>.hostname = '///bad.com' Leading / is not stripped]
expected: FAIL
[<area>: Setting <sc://example.com/>.hostname = '///bad.com' Leading / is not stripped]
expected: FAIL
[<a>: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased]
expected: FAIL
[<area>: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased]
expected: FAIL
[<a>: Setting <foo:///some/path>.pathname = '' Non-special URLs with an empty host can have their paths erased]
expected: FAIL
[<area>: Setting <foo:///some/path>.pathname = '' Non-special URLs with an empty host can have their paths erased]
expected: FAIL
[<a>: Setting <foo:/some/path>.pathname = '' Path-only URLs cannot have their paths erased]
expected: FAIL
[<area>: Setting <foo:/some/path>.pathname = '' Path-only URLs cannot have their paths erased]
expected: FAIL
[<a>: Setting <foo:/some/path>.pathname = 'test' Path-only URLs always have an initial slash]
expected: FAIL
[<area>: Setting <foo:/some/path>.pathname = 'test' Path-only URLs always have an initial slash]
expected: FAIL
[<a>: Setting <mailto:me@example.net>.pathname = '/foo' Opaque paths cannot be set]
expected: FAIL
[<area>: Setting <mailto:me@example.net>.pathname = '/foo' Opaque paths cannot be set]
expected: FAIL
[<a>: Setting <data:original>.pathname = 'new value']
expected: FAIL
[<area>: Setting <data:original>.pathname = 'new value']
expected: FAIL
[<a>: Setting <sc:original>.pathname = 'new value']
expected: FAIL
[<area>: Setting <sc:original>.pathname = 'new value']
expected: FAIL
[<a>: Setting <data:/nospace>.pathname = 'space ' Non-special URLs with non-opaque paths percent-encode U+0020]
expected: FAIL
[<area>: Setting <data:/nospace>.pathname = 'space ' Non-special URLs with non-opaque paths percent-encode U+0020]
expected: FAIL
[<a>: Setting <sc:/nospace>.pathname = 'space ']
expected: FAIL
[<area>: Setting <sc:/nospace>.pathname = 'space ']
expected: FAIL
[<a>: Setting <data:space ?query>.search = '' Drop trailing spaces from trailing opaque paths]
expected: FAIL
[<area>: Setting <data:space ?query>.search = '' Drop trailing spaces from trailing opaque paths]
expected: FAIL
[<a>: Setting <sc:space ?query>.search = '']
expected: FAIL
[<area>: Setting <sc:space ?query>.search = '']
expected: FAIL
[<a>: Setting <data:space ?query#fragment>.search = '' Do not drop trailing spaces from non-trailing opaque paths]
expected: FAIL
[<area>: Setting <data:space ?query#fragment>.search = '' Do not drop trailing spaces from non-trailing opaque paths]
expected: FAIL
[<a>: Setting <sc:space ?query#fragment>.search = '']
expected: FAIL
[<area>: Setting <sc:space ?query#fragment>.search = '']
expected: FAIL
[<a>: Setting <data:space #fragment>.hash = '' Drop trailing spaces from trailing opaque paths]
expected: FAIL
[<area>: Setting <data:space #fragment>.hash = '' Drop trailing spaces from trailing opaque paths]
expected: FAIL
[<a>: Setting <sc:space #fragment>.hash = '']
expected: FAIL
[<area>: Setting <sc:space #fragment>.hash = '']
expected: FAIL
[url-setters-a-area.window.html?include=mailto]
[<a>: Setting <mailto:me@example.net>.protocol = 'http' Cannot-be-a-base URL doesnt have a host, but URL in a special scheme must.]
expected: FAIL
[<area>: Setting <mailto:me@example.net>.protocol = 'http' Cannot-be-a-base URL doesnt have a host, but URL in a special scheme must.]
expected: FAIL
[url-setters-a-area.window.html?include=file]
[<a>: Setting <file://localhost/>.protocol = 'http' Cant switch from file URL with no host]
expected: FAIL
[<area>: Setting <file://localhost/>.protocol = 'http' Cant switch from file URL with no host]
expected: FAIL
[<a>: Setting <file:///test>.protocol = 'https']
expected: FAIL
[<area>: Setting <file:///test>.protocol = 'https']
expected: FAIL
[<a>: Setting <file:>.protocol = 'wss']
expected: FAIL
[<area>: Setting <file:>.protocol = 'wss']
expected: FAIL
[<a>: Setting <file://hi/path>.protocol = 's']
expected: FAIL
@ -637,42 +49,6 @@
[url-setters-a-area.window.html?exclude=(file|javascript|mailto)]
[<a>: Setting <http://test@example.net>.protocol = 'file' Cant switch from URL containing username/password/port to file]
expected: FAIL
[<area>: Setting <http://test@example.net>.protocol = 'file' Cant switch from URL containing username/password/port to file]
expected: FAIL
[<a>: Setting <https://example.net:1234>.protocol = 'file']
expected: FAIL
[<area>: Setting <https://example.net:1234>.protocol = 'file']
expected: FAIL
[<a>: Setting <wss://x:x@example.net:1234>.protocol = 'file']
expected: FAIL
[<area>: Setting <wss://x:x@example.net:1234>.protocol = 'file']
expected: FAIL
[<a>: Setting <http://example.net>.protocol = 'b' Cant switch from special scheme to non-special]
expected: FAIL
[<area>: Setting <http://example.net>.protocol = 'b' Cant switch from special scheme to non-special]
expected: FAIL
[<a>: Setting <https://example.net>.protocol = 's']
expected: FAIL
[<area>: Setting <https://example.net>.protocol = 's']
expected: FAIL
[<a>: Setting <ftp://example.net>.protocol = 'test']
expected: FAIL
[<area>: Setting <ftp://example.net>.protocol = 'test']
expected: FAIL
[<a>: Setting <ssh://me@example.net>.protocol = 'http' Cant switch from non-special scheme to special]
expected: FAIL
@ -697,12 +73,6 @@
[<area>: Setting <ssh://example.net>.protocol = 'file']
expected: FAIL
[<a>: Setting <nonsense:///test>.protocol = 'https']
expected: FAIL
[<area>: Setting <nonsense:///test>.protocol = 'https']
expected: FAIL
[<a>: Setting <http://example.net>.username = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the userinfo encode set.]
expected: FAIL

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

@ -4,45 +4,6 @@
[URL: Setting <http://test@example.net>.protocol = 'file' Cant switch from URL containing username/password/port to file]
expected: FAIL
[URL: Setting <https://example.net:1234>.protocol = 'file']
expected: FAIL
[URL: Setting <wss://x:x@example.net:1234>.protocol = 'file']
expected: FAIL
[URL: Setting <file:///test>.protocol = 'https']
expected: FAIL
[URL: Setting <http://example.net>.protocol = 'b' Cant switch from special scheme to non-special]
expected: FAIL
[URL: Setting <file://hi/path>.protocol = 's']
expected: FAIL
[URL: Setting <https://example.net>.protocol = 's']
expected: FAIL
[URL: Setting <ftp://example.net>.protocol = 'test']
expected: FAIL
[URL: Setting <mailto:me@example.net>.protocol = 'http' Cannot-be-a-base URL doesnt have a host, but URL in a special scheme must.]
expected: FAIL
[URL: Setting <ssh://me@example.net>.protocol = 'http' Cant switch from non-special scheme to special]
expected: FAIL
[URL: Setting <ssh://me@example.net>.protocol = 'https']
expected: FAIL
[URL: Setting <ssh://me@example.net>.protocol = 'file']
expected: FAIL
[URL: Setting <ssh://example.net>.protocol = 'file']
expected: FAIL
[URL: Setting <nonsense:///test>.protocol = 'https']
expected: FAIL
[URL: Setting <http://example.net>.username = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the userinfo encode set.]
expected: FAIL
@ -248,48 +209,6 @@
[url-setters.any.worker.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[URL: Setting <http://test@example.net>.protocol = 'file' Cant switch from URL containing username/password/port to file]
expected: FAIL
[URL: Setting <https://example.net:1234>.protocol = 'file']
expected: FAIL
[URL: Setting <wss://x:x@example.net:1234>.protocol = 'file']
expected: FAIL
[URL: Setting <file:///test>.protocol = 'https']
expected: FAIL
[URL: Setting <http://example.net>.protocol = 'b' Cant switch from special scheme to non-special]
expected: FAIL
[URL: Setting <file://hi/path>.protocol = 's']
expected: FAIL
[URL: Setting <https://example.net>.protocol = 's']
expected: FAIL
[URL: Setting <ftp://example.net>.protocol = 'test']
expected: FAIL
[URL: Setting <mailto:me@example.net>.protocol = 'http' Cannot-be-a-base URL doesnt have a host, but URL in a special scheme must.]
expected: FAIL
[URL: Setting <ssh://me@example.net>.protocol = 'http' Cant switch from non-special scheme to special]
expected: FAIL
[URL: Setting <ssh://me@example.net>.protocol = 'https']
expected: FAIL
[URL: Setting <ssh://me@example.net>.protocol = 'file']
expected: FAIL
[URL: Setting <ssh://example.net>.protocol = 'file']
expected: FAIL
[URL: Setting <nonsense:///test>.protocol = 'https']
expected: FAIL
[URL: Setting <http://example.net>.username = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the userinfo encode set.]
expected: FAIL
@ -504,24 +423,6 @@
[url-setters.any.worker.html?exclude=(file|javascript|mailto)]
[URL: Setting <http://test@example.net>.protocol = 'file' Cant switch from URL containing username/password/port to file]
expected: FAIL
[URL: Setting <https://example.net:1234>.protocol = 'file']
expected: FAIL
[URL: Setting <wss://x:x@example.net:1234>.protocol = 'file']
expected: FAIL
[URL: Setting <http://example.net>.protocol = 'b' Cant switch from special scheme to non-special]
expected: FAIL
[URL: Setting <https://example.net>.protocol = 's']
expected: FAIL
[URL: Setting <ftp://example.net>.protocol = 'test']
expected: FAIL
[URL: Setting <ssh://me@example.net>.protocol = 'http' Cant switch from non-special scheme to special]
expected: FAIL
@ -534,9 +435,6 @@
[URL: Setting <ssh://example.net>.protocol = 'file']
expected: FAIL
[URL: Setting <nonsense:///test>.protocol = 'https']
expected: FAIL
[URL: Setting <http://example.net>.username = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the userinfo encode set.]
expected: FAIL
@ -713,9 +611,6 @@
[url-setters.any.html?include=file]
[URL: Setting <file:///test>.protocol = 'https']
expected: FAIL
[URL: Setting <file://hi/path>.protocol = 's']
expected: FAIL
@ -753,24 +648,6 @@
[url-setters.any.html?exclude=(file|javascript|mailto)]
[URL: Setting <http://test@example.net>.protocol = 'file' Cant switch from URL containing username/password/port to file]
expected: FAIL
[URL: Setting <https://example.net:1234>.protocol = 'file']
expected: FAIL
[URL: Setting <wss://x:x@example.net:1234>.protocol = 'file']
expected: FAIL
[URL: Setting <http://example.net>.protocol = 'b' Cant switch from special scheme to non-special]
expected: FAIL
[URL: Setting <https://example.net>.protocol = 's']
expected: FAIL
[URL: Setting <ftp://example.net>.protocol = 'test']
expected: FAIL
[URL: Setting <ssh://me@example.net>.protocol = 'http' Cant switch from non-special scheme to special]
expected: FAIL
@ -783,9 +660,6 @@
[URL: Setting <ssh://example.net>.protocol = 'file']
expected: FAIL
[URL: Setting <nonsense:///test>.protocol = 'https']
expected: FAIL
[URL: Setting <http://example.net>.username = '\x00\x01\t\n\r\x1f !"#$%&'()*+,-./09:;<=>?@AZ[\\\]^_`az{|}~€Éé' UTF-8 percent encoding with the userinfo encode set.]
expected: FAIL
@ -962,9 +836,6 @@
[url-setters.any.worker.html?include=file]
[URL: Setting <file:///test>.protocol = 'https']
expected: FAIL
[URL: Setting <file://hi/path>.protocol = 's']
expected: FAIL
@ -988,13 +859,3 @@
[URL: Setting <file:///unicorn>.pathname = '//\\/' File URLs and (back)slashes]
expected: FAIL
[url-setters.any.html?include=mailto]
[URL: Setting <mailto:me@example.net>.protocol = 'http' Cannot-be-a-base URL doesnt have a host, but URL in a special scheme must.]
expected: FAIL
[url-setters.any.worker.html?include=mailto]
[URL: Setting <mailto:me@example.net>.protocol = 'http' Cannot-be-a-base URL doesnt have a host, but URL in a special scheme must.]
expected: FAIL