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
|
// This test checks that browsers are removed from the SessionStore's
// crashed browser set at a correct time, so that it can stop ignoring update
// events coming from those browsers.
/**
* Open a tab, crash it, navigate it to a remote uri, and check that it
* is removed from a crashed set.
*/
add_task(async function test_update_crashed_tab_after_navigate_to_remote() {
let tab = BrowserTestUtils.addTab(gBrowser, "https://example.com/");
let browser = tab.linkedBrowser;
gBrowser.selectedTab = tab;
await promiseBrowserLoaded(browser);
ok(
!SessionStore.isBrowserInCrashedSet(browser),
"browser is not in the crashed set"
);
await BrowserTestUtils.crashFrame(browser);
ok(
SessionStore.isBrowserInCrashedSet(browser),
"browser is in the crashed set"
);
BrowserTestUtils.startLoadingURIString(browser, "https://example.org/");
await BrowserTestUtils.browserLoaded(browser, false, "https://example.org/");
ok(
!SessionStore.isBrowserInCrashedSet(browser),
"browser is not in the crashed set"
);
ok(
!tab.hasAttribute("crashed"),
"Tab shouldn't be marked as crashed anymore."
);
gBrowser.removeTab(tab);
});
/**
* Open a tab, crash it, navigate it to a non-remote uri, and check that it
* is removed from a crashed set.
*/
add_task(async function test_update_crashed_tab_after_navigate_to_non_remote() {
let tab = BrowserTestUtils.addTab(gBrowser, "https://example.com/");
let browser = tab.linkedBrowser;
gBrowser.selectedTab = tab;
await promiseBrowserLoaded(browser);
ok(
!SessionStore.isBrowserInCrashedSet(browser),
"browser is not in the crashed set"
);
await BrowserTestUtils.crashFrame(browser);
ok(
SessionStore.isBrowserInCrashedSet(browser),
"browser is in the crashed set"
);
BrowserTestUtils.startLoadingURIString(browser, "about:mozilla");
await BrowserTestUtils.browserLoaded(browser, false, "about:mozilla");
ok(
!SessionStore.isBrowserInCrashedSet(browser),
"browser is not in the crashed set"
);
ok(
!gBrowser.selectedTab.hasAttribute("crashed"),
"Tab shouldn't be marked as crashed anymore."
);
gBrowser.removeTab(tab);
});
/**
* Open a tab, crash it, restore it from history, and check that it
* is removed from a crashed set.
*/
add_task(async function test_update_crashed_tab_after_session_restore() {
let tab = BrowserTestUtils.addTab(gBrowser, "https://example.com/");
let browser = tab.linkedBrowser;
gBrowser.selectedTab = tab;
await promiseBrowserLoaded(browser);
ok(
!SessionStore.isBrowserInCrashedSet(browser),
"browser is not in the crashed set"
);
await BrowserTestUtils.crashFrame(browser);
ok(
SessionStore.isBrowserInCrashedSet(browser),
"browser is in the crashed set"
);
let tabRestoredPromise = promiseTabRestored(tab);
// Click restoreTab button
await SpecialPowers.spawn(browser, [], () => {
let button = content.document.getElementById("restoreTab");
button.click();
});
await tabRestoredPromise;
ok(
!tab.hasAttribute("crashed"),
"Tab shouldn't be marked as crashed anymore."
);
ok(
!SessionStore.isBrowserInCrashedSet(browser),
"browser is not in the crashed set"
);
gBrowser.removeTab(tab);
});
|