зеркало из https://github.com/mozilla/gecko-dev.git
Bug 429347 - "URL parser gets confused by ref with no path" [r=bzbarsky sr=cbiesinger]
This commit is contained in:
Родитель
294525a204
Коммит
c6c4687357
|
@ -560,6 +560,11 @@ nsStandardURL::BuildNormalizedSpec(const char *spec)
|
||||||
LOG(("adding leading slash to path\n"));
|
LOG(("adding leading slash to path\n"));
|
||||||
leadingSlash = 1;
|
leadingSlash = 1;
|
||||||
buf[i++] = '/';
|
buf[i++] = '/';
|
||||||
|
// basename must exist, even if empty (bugs 113508, 429347)
|
||||||
|
if (mBasename.mLen == -1) {
|
||||||
|
mBasename.mPos = i;
|
||||||
|
mBasename.mLen = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// record corrected (file)path starting position
|
// record corrected (file)path starting position
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
const Cc = Components.classes;
|
||||||
|
const Ci = Components.interfaces;
|
||||||
|
const Cr = Components.results;
|
||||||
|
|
||||||
|
function run_test() {
|
||||||
|
var ios = Cc["@mozilla.org/network/io-service;1"].
|
||||||
|
getService(Ci.nsIIOService);
|
||||||
|
|
||||||
|
var uri1 = ios.newURI("http://example.com#bar", null, null);
|
||||||
|
var uri2 = ios.newURI("http://example.com/#bar", null, null);
|
||||||
|
do_check_true(uri1.equals(uri2));
|
||||||
|
|
||||||
|
uri1.spec = "http://example.com?bar";
|
||||||
|
uri2.spec = "http://example.com/?bar";
|
||||||
|
do_check_true(uri1.equals(uri2));
|
||||||
|
|
||||||
|
uri1.spec = "http://example.com;bar";
|
||||||
|
uri2.spec = "http://example.com/;bar";
|
||||||
|
do_check_true(uri1.equals(uri2));
|
||||||
|
|
||||||
|
uri1.spec = "http://example.com#";
|
||||||
|
uri2.spec = "http://example.com/#";
|
||||||
|
do_check_true(uri1.equals(uri2));
|
||||||
|
|
||||||
|
uri1.spec = "http://example.com?";
|
||||||
|
uri2.spec = "http://example.com/?";
|
||||||
|
do_check_true(uri1.equals(uri2));
|
||||||
|
|
||||||
|
uri1.spec = "http://example.com;";
|
||||||
|
uri2.spec = "http://example.com/;";
|
||||||
|
do_check_true(uri1.equals(uri2));
|
||||||
|
|
||||||
|
uri1.spec = "http://example.com";
|
||||||
|
uri2.spec = "http://example.com/";
|
||||||
|
do_check_true(uri1.equals(uri2));
|
||||||
|
}
|
|
@ -68,8 +68,7 @@ function test_setQuery()
|
||||||
[
|
[
|
||||||
["http://example.com", "http://example.com/?foo"],
|
["http://example.com", "http://example.com/?foo"],
|
||||||
["http://example.com/bar", "http://example.com/bar?foo"],
|
["http://example.com/bar", "http://example.com/bar?foo"],
|
||||||
/* Can't test the path-less thing because of bug 429347 */
|
["http://example.com#bar", "http://example.com/?foo#bar"],
|
||||||
/* ["http://example.com#bar", "http://example.com/?foo#bar"], */
|
|
||||||
["http://example.com/#bar", "http://example.com/?foo#bar"],
|
["http://example.com/#bar", "http://example.com/?foo#bar"],
|
||||||
["http://example.com/?longerthanfoo#bar", "http://example.com/?foo#bar"],
|
["http://example.com/?longerthanfoo#bar", "http://example.com/?foo#bar"],
|
||||||
["http://example.com/?longerthanfoo", "http://example.com/?foo"],
|
["http://example.com/?longerthanfoo", "http://example.com/?foo"],
|
||||||
|
|
Загрузка…
Ссылка в новой задаче