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
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_PATH = getRootDirectory(gTestPath).replace(
"chrome://mochitests/content",
"http://example.com"
);
/**
* Back/fwd buttons should be re-enabled after customizing.
*/
add_task(async function test_back_forward_buttons() {
await SpecialPowers.pushPrefEnv({
set: [["browser.navigation.requireUserInteraction", false]],
});
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PATH);
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
BrowserTestUtils.loadURI(tab.linkedBrowser, "data:text/html,A separate page");
await loaded;
loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
BrowserTestUtils.loadURI(
tab.linkedBrowser,
"data:text/html,Another separate page"
);
await loaded;
gBrowser.goBack();
await BrowserTestUtils.waitForCondition(() => gBrowser.canGoForward);
let backButton = document.getElementById("back-button");
let forwardButton = document.getElementById("forward-button");
await BrowserTestUtils.waitForCondition(
() =>
!backButton.hasAttribute("disabled") &&
!forwardButton.hasAttribute("disabled")
);
ok(!backButton.hasAttribute("disabled"), "Back button shouldn't be disabled");
ok(
!forwardButton.hasAttribute("disabled"),
"Forward button shouldn't be disabled"
);
await startCustomizing();
is(
backButton.getAttribute("disabled"),
"true",
"Back button should be disabled in customize mode"
);
is(
forwardButton.getAttribute("disabled"),
"true",
"Forward button should be disabled in customize mode"
);
await endCustomizing();
await BrowserTestUtils.waitForCondition(
() =>
!backButton.hasAttribute("disabled") &&
!forwardButton.hasAttribute("disabled")
);
ok(
!backButton.hasAttribute("disabled"),
"Back button shouldn't be disabled after customize mode"
);
ok(
!forwardButton.hasAttribute("disabled"),
"Forward button shouldn't be disabled after customize mode"
);
BrowserTestUtils.removeTab(tab);
});
|