Bug 1203463 - URL constructor should support about:blank URI, r=bz

This commit is contained in:
Andrea Marchesini 2015-09-16 00:45:34 +08:00
Родитель 787c99ae00
Коммит 995d2fc2f8
2 изменённых файлов: 22 добавлений и 2 удалений

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

@ -423,8 +423,15 @@ URL::GetPathname(nsAString& aPathname, ErrorResult& aRv) const
nsCOMPtr<nsIURL> url(do_QueryInterface(mURI));
if (!url) {
// Do not throw! Not having a valid URI or URL should result in an empty
// string.
nsAutoCString path;
nsresult rv = mURI->GetPath(path);
if (NS_FAILED(rv)){
// Do not throw! Not having a valid URI or URL should result in an empty
// string.
return;
}
CopyUTF8toUTF16(path, aPathname);
return;
}

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

@ -209,6 +209,14 @@
error: false,
protocol: 'foo:',
},
{ url: 'about:blank',
base: undefined,
error: false,
protocol: 'about:',
pathname: 'blank',
skip_setters: false,
},
];
while(tests.length) {
@ -243,6 +251,11 @@
if ('search' in test) is(url.search, test.search, "search");
if ('hash' in test) is(url.hash, test.hash, "hash");
if ('skip_setters' in test && test.skip_setters == false) {
info("Skip setter methods for URL: " + test);
continue;
}
url = new URL('https://www.example.net/what#foo?bar');
ok(url, "Url exists!");