Bug 1275746 - Fix tests that assume a HTTP url without a hostname is valid r=bz,MattN,jdm,markh

MozReview-Commit-ID: DzRenakrcAG
This commit is contained in:
Valentin Gosu 2016-07-07 16:20:47 +03:00
parent ff510f7133
commit fd0c022031
9 changed files with 17 additions and 34 deletions

View File

@ -426,8 +426,6 @@ var testcases = [ {
protocolChange: true,
}, {
input: "?'.com",
fixedURI: "http:///?%27.com",
alternateURI: "http://www..com/?%27.com",
keywordLookup: true,
protocolChange: true,
}, {
@ -436,14 +434,10 @@ var testcases = [ {
protocolChange: true
}, {
input: "?mozilla",
fixedURI: "http:///?mozilla",
alternateURI: "http://www..com/?mozilla",
keywordLookup: true,
protocolChange: true,
}, {
input: "??mozilla",
fixedURI: "http:///??mozilla",
alternateURI: "http://www..com/??mozilla",
keywordLookup: true,
protocolChange: true,
}, {

View File

@ -154,13 +154,14 @@ function checkInputURL()
sendString("ttp://mozilla.org");
checkValidApplies(element);
for (var i=0; i<13; ++i) {
for (var i=0; i<10; ++i) {
synthesizeKey("VK_BACK_SPACE", {});
checkValidApplies(element);
}
synthesizeKey("VK_BACK_SPACE", {});
for (var i=0; i<4; ++i) {
// "http://" is now invalid
for (var i=0; i<7; ++i) {
checkInvalidApplies(element);
synthesizeKey("VK_BACK_SPACE", {});
}

View File

@ -398,6 +398,18 @@
is(url.href, "scheme://tmp\\test");
</script>
<script>
/** Test for Bug 1275746 **/
SimpleTest.doesThrow(() => { var url = new URL("http:"); }, "http: is not a valid URL");
SimpleTest.doesThrow(() => { var url = new URL("http:///"); }, "http: is not a valid URL");
var url = new URL("file:");
is(url.href, "file:///", "Parsing file: should work.");
url = new URL("file:///");
is(url.href, "file:///", "Parsing file:/// should work.");
</script>
<script>
var url = new URL("scheme:path/to/file?query#hash");
is(url.href, "scheme:path/to/file?query#hash");

View File

@ -79,23 +79,10 @@ function run_test() {
cm.removeAll();
// test that setting an empty or '.' http:// host results in a no-op
var uri = NetUtil.newURI("http://baz.com/");
var emptyuri = NetUtil.newURI("http:///");
var doturi = NetUtil.newURI("http://./");
do_check_eq(uri.asciiHost, "baz.com");
do_check_eq(emptyuri.asciiHost, "");
do_check_eq(doturi.asciiHost, ".");
cs.setCookieString(emptyuri, null, "foo2=bar", null);
do_check_eq(getCookieCount(), 0);
cs.setCookieString(doturi, null, "foo3=bar", null);
do_check_eq(getCookieCount(), 0);
cs.setCookieString(uri, null, "foo=bar", null);
do_check_eq(getCookieCount(), 1);
do_check_eq(cs.getCookieString(uri, null), "foo=bar");
do_check_eq(cs.getCookieString(emptyuri, null), null);
do_check_eq(cs.getCookieString(doturi, null), null);
do_check_eq(cm.countCookiesFromHost(""), 0);
do_check_throws(function() {

View File

@ -142,7 +142,7 @@ add_test(function serverErrorResponse() {
add_test(function networkErrorResponse() {
let client = new FxAccountsOAuthGrantClient({
serverURL: "http://",
serverURL: "http://domain.dummy",
client_id: "abc123"
});
Services.prefs.setBoolPref("identity.fxaccounts.skipDeviceRegistration", true);

View File

@ -299,7 +299,7 @@ add_test(function server401ResponsePersists() {
add_test(function networkErrorResponse() {
let client = new FxAccountsProfileClient({
serverURL: "http://",
serverURL: "http://domain.dummy",
fxa: mockFxa,
});
client.fetchProfile()

View File

@ -2,10 +2,3 @@
type: testharness
[XMLHttpRequest: open() - bogus URLs (http:)]
expected: FAIL
[XMLHttpRequest: open() - bogus URLs (ftp:)]
expected: FAIL
[XMLHttpRequest: open() - bogus URLs (http:////////////)]
expected: FAIL

View File

@ -201,9 +201,6 @@
[Parsing: <file:..> against <http://www.example.com/test>]
expected: FAIL
[Parsing: <http:> against <https://example.org/foo/bar>]
expected: FAIL
[Parsing: <http://[::127.0.0.1\]> against <http://example.org/foo/bar>]
expected: FAIL

View File

@ -192,7 +192,6 @@ add_task(function test_search_all_full_case_sensitive()
{
checkAllSearches({ hostname: "http://www.example.com" }, 1);
checkAllSearches({ hostname: "http://www.example.com/" }, 0);
checkAllSearches({ hostname: "http://" }, 0);
checkAllSearches({ hostname: "example.com" }, 0);
checkAllSearches({ formSubmitURL: "http://www.example.com" }, 2);