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
|
var original = Services.prefs.getBoolPref("browser.search.suggest.enabled");
registerCleanupFunction(() => {
Services.prefs.setBoolPref("browser.search.suggest.enabled", original);
});
// Open with suggestions enabled
add_task(function*() {
Services.prefs.setBoolPref("browser.search.suggest.enabled", true);
yield openPreferencesViaOpenPreferencesAPI("search", undefined, { leaveOpen: true });
let doc = gBrowser.selectedBrowser.contentDocument;
let urlbarBox = doc.getElementById("urlBarSuggestion");
ok(!urlbarBox.disabled, "Checkbox should be enabled");
Services.prefs.setBoolPref("browser.search.suggest.enabled", false);
ok(urlbarBox.disabled, "Checkbox should be disabled");
gBrowser.removeCurrentTab();
});
// Open with suggestions disabled
add_task(function*() {
Services.prefs.setBoolPref("browser.search.suggest.enabled", false);
yield openPreferencesViaOpenPreferencesAPI("search", undefined, { leaveOpen: true });
let doc = gBrowser.selectedBrowser.contentDocument;
let urlbarBox = doc.getElementById("urlBarSuggestion");
ok(urlbarBox.disabled, "Checkbox should be disabled");
Services.prefs.setBoolPref("browser.search.suggest.enabled", true);
ok(!urlbarBox.disabled, "Checkbox should be enabled");
gBrowser.removeCurrentTab();
});
add_task(function*() {
Services.prefs.setBoolPref("browser.search.suggest.enabled", original);
});
|