-
Notifications
You must be signed in to change notification settings - Fork 54
/
test_encoded_urls.js
75 lines (72 loc) · 3 KB
/
test_encoded_urls.js
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
add_task(async function test_encoded() {
info("Searching for over encoded url should not break it");
await PlacesTestUtils.addVisits({
uri: NetUtil.newURI("https://www.mozilla.com/search/top/?q=%25%32%35"),
title: "https://www.mozilla.com/search/top/?q=%25%32%35",
transition: TRANSITION_TYPED,
});
await check_autocomplete({
search: "https://www.mozilla.com/search/top/?q=%25%32%35",
matches: [ { uri: NetUtil.newURI("https://www.mozilla.com/search/top/?q=%25%32%35"),
title: "https://www.mozilla.com/search/top/?q=%25%32%35",
style: [ "autofill", "heuristic" ] }],
autofilled: "https://www.mozilla.com/search/top/?q=%25%32%35",
completed: "https://www.mozilla.com/search/top/?q=%25%32%35",
});
await cleanup();
});
add_task(async function test_encoded_trimmed() {
info("Searching for over encoded url should not break it");
await PlacesTestUtils.addVisits({
uri: NetUtil.newURI("https://www.mozilla.com/search/top/?q=%25%32%35"),
title: "https://www.mozilla.com/search/top/?q=%25%32%35",
transition: TRANSITION_TYPED,
});
await check_autocomplete({
search: "mozilla.com/search/top/?q=%25%32%35",
matches: [
{
value: "mozilla.com/search/top/?q=%25%32%35",
comment: "https://www.mozilla.com/search/top/?q=%25%32%35",
style: ["autofill", "heuristic"],
},
],
autofilled: "mozilla.com/search/top/?q=%25%32%35",
completed: "https://www.mozilla.com/search/top/?q=%25%32%35",
});
await cleanup();
});
add_task(async function test_encoded_partial() {
info("Searching for over encoded url should not break it");
await PlacesTestUtils.addVisits({
uri: NetUtil.newURI("https://www.mozilla.com/search/top/?q=%25%32%35"),
title: "https://www.mozilla.com/search/top/?q=%25%32%35",
transition: TRANSITION_TYPED,
});
await check_autocomplete({
search: "https://www.mozilla.com/search/top/?q=%25",
matches: [ { uri: NetUtil.newURI("https://www.mozilla.com/search/top/?q=%25%32%35"),
title: "https://www.mozilla.com/search/top/?q=%25%32%35",
style: [ "autofill", "heuristic" ] }],
autofilled: "https://www.mozilla.com/search/top/?q=%25%32%35",
completed: "https://www.mozilla.com/search/top/?q=%25%32%35",
});
await cleanup();
});
add_task(async function test_encoded_path() {
info("Searching for over encoded url should not break it");
await PlacesTestUtils.addVisits({
uri: NetUtil.newURI("https://www.mozilla.com/%25%32%35/top/"),
title: "https://www.mozilla.com/%25%32%35/top/",
transition: TRANSITION_TYPED,
});
await check_autocomplete({
search: "https://www.mozilla.com/%25%32%35/t",
matches: [ { uri: NetUtil.newURI("https://www.mozilla.com/%25%32%35/top/"),
title: "https://www.mozilla.com/%25%32%35/top/",
style: [ "autofill", "heuristic" ] }],
autofilled: "https://www.mozilla.com/%25%32%35/top/",
completed: "https://www.mozilla.com/%25%32%35/top/",
});
await cleanup();
});