michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for untrimmed https://www entry", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "https://www.mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for untrimmed https://www entry with path", michael@0: "mozilla.org/t", michael@0: { autoFilled: "mozilla.org/test/", completed: "https://www.mozilla.org/test/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for untrimmed https:// entry", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "https://mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for untrimmed https:// entry with path", michael@0: "mozilla.org/t", michael@0: { autoFilled: "mozilla.org/test/", completed: "https://mozilla.org/test/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for untrimmed http://www entry", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "www.mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for untrimmed http://www entry with path", michael@0: "mozilla.org/t", michael@0: { autoFilled: "mozilla.org/test/", completed: "http://www.mozilla.org/test/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for untrimmed ftp:// entry", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for untrimmed ftp:// entry with path", michael@0: "mozilla.org/t", michael@0: { autoFilled: "mozilla.org/test/", completed: "ftp://mozilla.org/test/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Ensuring correct priority 1", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Ensuring correct priority 2", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Ensuring correct priority 3", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Ensuring correct priority 4", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Ensuring correct priority 5", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("ftp://www.mozilla.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Ensuring correct priority 6", michael@0: "mo", michael@0: { autoFilled: "mozilla.org/", completed: "www.mozilla.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test1/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test2/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Ensuring longer domain can't match", michael@0: "mo", michael@0: { autoFilled: "mozilla.co/", completed: "mozilla.co/" }, michael@0: function () { michael@0: // The .co should be preferred, but should not get the https from the .com. michael@0: // The .co domain must be added later to activate the trigger bug. michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.com/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.co/"), michael@0: transition: TRANSITION_TYPED }); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.co/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for URL with characters that are normally escaped", michael@0: "https://www.mozilla.org/啊-test", michael@0: { autoFilled: "https://www.mozilla.org/啊-test", completed: "https://www.mozilla.org/啊-test" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/啊-test"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Don't return unsecure URL when searching for secure ones", michael@0: "https://test.moz.org/t", michael@0: { autoFilled: "https://test.moz.org/test/", completed: "https://test.moz.org/test/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Don't return unsecure domain when searching for secure ones", michael@0: "https://test.moz", michael@0: { autoFilled: "https://test.moz.org/", completed: "https://test.moz.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"), michael@0: transition: TRANSITION_TYPED }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Untyped is not accounted for www", michael@0: "mo", michael@0: { autoFilled: "moz.org/", completed: "moz.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://www.moz.org/test/") }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Untyped is not accounted for ftp", michael@0: "mo", michael@0: { autoFilled: "moz.org/", completed: "moz.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("ftp://moz.org/test/") }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Untyped is not accounted for https", michael@0: "mo", michael@0: { autoFilled: "moz.org/", completed: "moz.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://moz.org/test/") }); michael@0: }, michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Untyped is not accounted for https://www", michael@0: "mo", michael@0: { autoFilled: "moz.org/", completed: "moz.org/" }, michael@0: function () { michael@0: promiseAddVisits({ uri: NetUtil.newURI("https://www.moz.org/test/") }); michael@0: }, michael@0: ]);