blob: 171197a7438f965b3eb0a890d2e8308d4a7ea922 (
plain)
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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(async function testDiscardWithNotLoadedUserTypedValue() {
let tab1 = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"https://example.com"
);
// Make sure we flushed the state at least once (otherwise the fix
// for Bug 1422588 would make SessionStore.resetBrowserToLazyState
// to still store the user typed value into the tab state cache
// even when the user typed value was not yet being loading when
// the tab got discarded).
await TabStateFlusher.flush(tab1.linkedBrowser);
tab1.linkedBrowser.userTypedValue = "mockUserTypedValue";
let tab2 = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:robots"
);
let waitForTabDiscarded = BrowserTestUtils.waitForEvent(
tab1,
"TabBrowserDiscarded"
);
gBrowser.discardBrowser(tab1);
await waitForTabDiscarded;
const promiseTabLoaded = BrowserTestUtils.browserLoaded(
tab1.linkedBrowser,
false,
"https://example.com/"
);
await BrowserTestUtils.switchTab(gBrowser, tab1);
info("Wait for the restored tab to load https://example.com");
await promiseTabLoaded;
is(
tab1.linkedBrowser.currentURI.spec,
"https://example.com/",
"Restored discarded tab has loaded the expected url"
);
BrowserTestUtils.removeTab(tab2);
BrowserTestUtils.removeTab(tab1);
});
|