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