toolkit/components/places/tests/inline/test_trimming.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 add_autocomplete_test([
michael@0 6 "Searching for untrimmed https://www entry",
michael@0 7 "mo",
michael@0 8 { autoFilled: "mozilla.org/", completed: "https://www.mozilla.org/" },
michael@0 9 function () {
michael@0 10 promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
michael@0 11 transition: TRANSITION_TYPED });
michael@0 12 },
michael@0 13 ]);
michael@0 14
michael@0 15 add_autocomplete_test([
michael@0 16 "Searching for untrimmed https://www entry with path",
michael@0 17 "mozilla.org/t",
michael@0 18 { autoFilled: "mozilla.org/test/", completed: "https://www.mozilla.org/test/" },
michael@0 19 function () {
michael@0 20 promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
michael@0 21 transition: TRANSITION_TYPED });
michael@0 22 },
michael@0 23 ]);
michael@0 24
michael@0 25 add_autocomplete_test([
michael@0 26 "Searching for untrimmed https:// entry",
michael@0 27 "mo",
michael@0 28 { autoFilled: "mozilla.org/", completed: "https://mozilla.org/" },
michael@0 29 function () {
michael@0 30 promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
michael@0 31 transition: TRANSITION_TYPED });
michael@0 32 },
michael@0 33 ]);
michael@0 34
michael@0 35 add_autocomplete_test([
michael@0 36 "Searching for untrimmed https:// entry with path",
michael@0 37 "mozilla.org/t",
michael@0 38 { autoFilled: "mozilla.org/test/", completed: "https://mozilla.org/test/" },
michael@0 39 function () {
michael@0 40 promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
michael@0 41 transition: TRANSITION_TYPED });
michael@0 42 },
michael@0 43 ]);
michael@0 44
michael@0 45 add_autocomplete_test([
michael@0 46 "Searching for untrimmed http://www entry",
michael@0 47 "mo",
michael@0 48 { autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
michael@0 49 function () {
michael@0 50 promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
michael@0 51 transition: TRANSITION_TYPED });
michael@0 52 },
michael@0 53 ]);
michael@0 54
michael@0 55 add_autocomplete_test([
michael@0 56 "Searching for untrimmed http://www entry with path",
michael@0 57 "mozilla.org/t",
michael@0 58 { autoFilled: "mozilla.org/test/", completed: "http://www.mozilla.org/test/" },
michael@0 59 function () {
michael@0 60 promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
michael@0 61 transition: TRANSITION_TYPED });
michael@0 62 },
michael@0 63 ]);
michael@0 64
michael@0 65 add_autocomplete_test([
michael@0 66 "Searching for untrimmed ftp:// entry",
michael@0 67 "mo",
michael@0 68 { autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
michael@0 69 function () {
michael@0 70 promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
michael@0 71 transition: TRANSITION_TYPED });
michael@0 72 },
michael@0 73 ]);
michael@0 74
michael@0 75 add_autocomplete_test([
michael@0 76 "Searching for untrimmed ftp:// entry with path",
michael@0 77 "mozilla.org/t",
michael@0 78 { autoFilled: "mozilla.org/test/", completed: "ftp://mozilla.org/test/" },
michael@0 79 function () {
michael@0 80 promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
michael@0 81 transition: TRANSITION_TYPED });
michael@0 82 },
michael@0 83 ]);
michael@0 84
michael@0 85 add_autocomplete_test([
michael@0 86 "Ensuring correct priority 1",
michael@0 87 "mo",
michael@0 88 { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
michael@0 89 function () {
michael@0 90 promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
michael@0 91 transition: TRANSITION_TYPED });
michael@0 92 promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
michael@0 93 transition: TRANSITION_TYPED });
michael@0 94 promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
michael@0 95 transition: TRANSITION_TYPED });
michael@0 96 promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
michael@0 97 transition: TRANSITION_TYPED });
michael@0 98 promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
michael@0 99 transition: TRANSITION_TYPED });
michael@0 100 },
michael@0 101 ]);
michael@0 102
michael@0 103 add_autocomplete_test([
michael@0 104 "Ensuring correct priority 2",
michael@0 105 "mo",
michael@0 106 { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
michael@0 107 function () {
michael@0 108 promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
michael@0 109 transition: TRANSITION_TYPED });
michael@0 110 promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
michael@0 111 transition: TRANSITION_TYPED });
michael@0 112 promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
michael@0 113 transition: TRANSITION_TYPED });
michael@0 114 promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
michael@0 115 transition: TRANSITION_TYPED });
michael@0 116 },
michael@0 117 ]);
michael@0 118
michael@0 119 add_autocomplete_test([
michael@0 120 "Ensuring correct priority 3",
michael@0 121 "mo",
michael@0 122 { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
michael@0 123 function () {
michael@0 124 promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
michael@0 125 transition: TRANSITION_TYPED });
michael@0 126 promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
michael@0 127 transition: TRANSITION_TYPED });
michael@0 128 promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
michael@0 129 transition: TRANSITION_TYPED });
michael@0 130 },
michael@0 131 ]);
michael@0 132
michael@0 133 add_autocomplete_test([
michael@0 134 "Ensuring correct priority 4",
michael@0 135 "mo",
michael@0 136 { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
michael@0 137 function () {
michael@0 138 promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
michael@0 139 transition: TRANSITION_TYPED });
michael@0 140 promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
michael@0 141 transition: TRANSITION_TYPED });
michael@0 142 },
michael@0 143 ]);
michael@0 144
michael@0 145 add_autocomplete_test([
michael@0 146 "Ensuring correct priority 5",
michael@0 147 "mo",
michael@0 148 { autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
michael@0 149 function () {
michael@0 150 promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
michael@0 151 transition: TRANSITION_TYPED });
michael@0 152 promiseAddVisits({ uri: NetUtil.newURI("ftp://www.mozilla.org/test/"),
michael@0 153 transition: TRANSITION_TYPED });
michael@0 154 },
michael@0 155 ]);
michael@0 156
michael@0 157 add_autocomplete_test([
michael@0 158 "Ensuring correct priority 6",
michael@0 159 "mo",
michael@0 160 { autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
michael@0 161 function () {
michael@0 162 promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test1/"),
michael@0 163 transition: TRANSITION_TYPED });
michael@0 164 promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test2/"),
michael@0 165 transition: TRANSITION_TYPED });
michael@0 166 },
michael@0 167 ]);
michael@0 168
michael@0 169 add_autocomplete_test([
michael@0 170 "Ensuring longer domain can't match",
michael@0 171 "mo",
michael@0 172 { autoFilled: "mozilla.co/", completed: "mozilla.co/" },
michael@0 173 function () {
michael@0 174 // The .co should be preferred, but should not get the https from the .com.
michael@0 175 // The .co domain must be added later to activate the trigger bug.
michael@0 176 promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.com/"),
michael@0 177 transition: TRANSITION_TYPED });
michael@0 178 promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.co/"),
michael@0 179 transition: TRANSITION_TYPED });
michael@0 180 promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.co/"),
michael@0 181 transition: TRANSITION_TYPED });
michael@0 182 },
michael@0 183 ]);
michael@0 184
michael@0 185 add_autocomplete_test([
michael@0 186 "Searching for URL with characters that are normally escaped",
michael@0 187 "https://www.mozilla.org/啊-test",
michael@0 188 { autoFilled: "https://www.mozilla.org/啊-test", completed: "https://www.mozilla.org/啊-test" },
michael@0 189 function () {
michael@0 190 promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/啊-test"),
michael@0 191 transition: TRANSITION_TYPED });
michael@0 192 },
michael@0 193 ]);
michael@0 194
michael@0 195 add_autocomplete_test([
michael@0 196 "Don't return unsecure URL when searching for secure ones",
michael@0 197 "https://test.moz.org/t",
michael@0 198 { autoFilled: "https://test.moz.org/test/", completed: "https://test.moz.org/test/" },
michael@0 199 function () {
michael@0 200 promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
michael@0 201 transition: TRANSITION_TYPED });
michael@0 202 },
michael@0 203 ]);
michael@0 204
michael@0 205 add_autocomplete_test([
michael@0 206 "Don't return unsecure domain when searching for secure ones",
michael@0 207 "https://test.moz",
michael@0 208 { autoFilled: "https://test.moz.org/", completed: "https://test.moz.org/" },
michael@0 209 function () {
michael@0 210 promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
michael@0 211 transition: TRANSITION_TYPED });
michael@0 212 },
michael@0 213 ]);
michael@0 214
michael@0 215 add_autocomplete_test([
michael@0 216 "Untyped is not accounted for www",
michael@0 217 "mo",
michael@0 218 { autoFilled: "moz.org/", completed: "moz.org/" },
michael@0 219 function () {
michael@0 220 promiseAddVisits({ uri: NetUtil.newURI("http://www.moz.org/test/") });
michael@0 221 },
michael@0 222 ]);
michael@0 223
michael@0 224 add_autocomplete_test([
michael@0 225 "Untyped is not accounted for ftp",
michael@0 226 "mo",
michael@0 227 { autoFilled: "moz.org/", completed: "moz.org/" },
michael@0 228 function () {
michael@0 229 promiseAddVisits({ uri: NetUtil.newURI("ftp://moz.org/test/") });
michael@0 230 },
michael@0 231 ]);
michael@0 232
michael@0 233 add_autocomplete_test([
michael@0 234 "Untyped is not accounted for https",
michael@0 235 "mo",
michael@0 236 { autoFilled: "moz.org/", completed: "moz.org/" },
michael@0 237 function () {
michael@0 238 promiseAddVisits({ uri: NetUtil.newURI("https://moz.org/test/") });
michael@0 239 },
michael@0 240 ]);
michael@0 241
michael@0 242 add_autocomplete_test([
michael@0 243 "Untyped is not accounted for https://www",
michael@0 244 "mo",
michael@0 245 { autoFilled: "moz.org/", completed: "moz.org/" },
michael@0 246 function () {
michael@0 247 promiseAddVisits({ uri: NetUtil.newURI("https://www.moz.org/test/") });
michael@0 248 },
michael@0 249 ]);

mercurial