1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function setup() {
registerCleanupFunction(async () => {
Services.prefs.clearUserPref("browser.urlbar.suggest.searches");
});
Services.prefs.setBoolPref("browser.urlbar.suggest.searches", false);
});
add_task(async function test_untrimmed_secure_www() {
info("Searching for untrimmed https://www entry");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("https://www.mozilla.org/test/"),
});
let context = createContext("mo", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/",
completed: "https://www.mozilla.org/",
matches: [
makeVisitResult(context, {
uri: "https://www.mozilla.org/",
title: "https://www.mozilla.org",
heuristic: true,
}),
makeVisitResult(context, {
uri: "https://www.mozilla.org/test/",
title: "test visit for https://www.mozilla.org/test/",
}),
],
});
await cleanupPlaces();
});
add_task(async function test_untrimmed_secure_www_path() {
info("Searching for untrimmed https://www entry with path");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("https://www.mozilla.org/test/"),
});
let context = createContext("mozilla.org/t", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/test/",
completed: "https://www.mozilla.org/test/",
matches: [
makeVisitResult(context, {
uri: "https://www.mozilla.org/test/",
title: "https://www.mozilla.org/test/",
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_untrimmed_secure() {
info("Searching for untrimmed https:// entry");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("https://mozilla.org/test/"),
});
let context = createContext("mo", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/",
completed: "https://mozilla.org/",
matches: [
makeVisitResult(context, {
uri: "https://mozilla.org/",
title: "https://mozilla.org",
heuristic: true,
}),
makeVisitResult(context, {
uri: "https://mozilla.org/test/",
title: "test visit for https://mozilla.org/test/",
}),
],
});
await cleanupPlaces();
});
add_task(async function test_untrimmed_secure_path() {
info("Searching for untrimmed https:// entry with path");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("https://mozilla.org/test/"),
});
let context = createContext("mozilla.org/t", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/test/",
completed: "https://mozilla.org/test/",
matches: [
makeVisitResult(context, {
uri: "https://mozilla.org/test/",
title: "https://mozilla.org/test/",
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_untrimmed_www() {
info("Searching for untrimmed http://www entry");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("http://www.mozilla.org/test/"),
});
let context = createContext("mo", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/",
completed: "http://www.mozilla.org/",
matches: [
makeVisitResult(context, {
uri: "http://www.mozilla.org/",
title: "www.mozilla.org",
heuristic: true,
}),
makeVisitResult(context, {
uri: "http://www.mozilla.org/test/",
title: "test visit for http://www.mozilla.org/test/",
}),
],
});
await cleanupPlaces();
});
add_task(async function test_untrimmed_www_path() {
info("Searching for untrimmed http://www entry with path");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("http://www.mozilla.org/test/"),
});
let context = createContext("mozilla.org/t", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/test/",
completed: "http://www.mozilla.org/test/",
matches: [
makeVisitResult(context, {
uri: "http://www.mozilla.org/test/",
title: "www.mozilla.org/test/",
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_untrimmed_ftp() {
info("Searching for untrimmed ftp:// entry");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("ftp://mozilla.org/test/"),
});
let context = createContext("mo", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/",
completed: "ftp://mozilla.org/",
matches: [
makeVisitResult(context, {
uri: "ftp://mozilla.org/",
title: "ftp://mozilla.org",
heuristic: true,
}),
makeVisitResult(context, {
uri: "ftp://mozilla.org/test/",
title: "test visit for ftp://mozilla.org/test/",
}),
],
});
await cleanupPlaces();
});
add_task(async function test_untrimmed_ftp_path() {
info("Searching for untrimmed ftp:// entry with path");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("ftp://mozilla.org/test/"),
});
let context = createContext("mozilla.org/t", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/test/",
completed: "ftp://mozilla.org/test/",
matches: [
makeVisitResult(context, {
uri: "ftp://mozilla.org/test/",
title: "ftp://mozilla.org/test/",
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_escaped_chars() {
info("Searching for URL with characters that are normally escaped");
await PlacesTestUtils.addVisits({
uri: Services.io.newURI("https://www.mozilla.org/啊-test"),
});
let context = createContext("https://www.mozilla.org/啊-test", {
isPrivate: false,
});
await check_results({
context,
matches: [
makeVisitResult(context, {
source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL,
uri: "https://www.mozilla.org/%E5%95%8A-test",
title: "https://www.mozilla.org/啊-test",
iconUri: "page-icon:https://www.mozilla.org/",
heuristic: true,
}),
// UnifiedComplete escapes this character.
makeVisitResult(context, {
uri: "https://www.mozilla.org/%E5%95%8A-test",
title: "test visit for https://www.mozilla.org/%E5%95%8A-test",
}),
],
});
await cleanupPlaces();
});
|