blob: fae1130685b906b4a279c56e30b149a4a00db68c (
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
48
|
"use strict";
/**
* Verify that loading an invalid URI does not clobber a previously-loaded page's history
* entry, but that the invalid URI gets its own history entry instead. We're checking this
* using nsIWebNavigation's canGoBack, as well as actually going back and then checking
* canGoForward.
*/
add_task(async function checkBackFromInvalidURI() {
await pushPrefs(["keyword.enabled", false]);
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:robots",
true
);
info("Loaded about:robots");
gURLBar.value = "::2600";
let promiseErrorPageLoaded = BrowserTestUtils.waitForErrorPage(
tab.linkedBrowser
);
gURLBar.handleCommand();
await promiseErrorPageLoaded;
ok(gBrowser.webNavigation.canGoBack, "Should be able to go back");
if (gBrowser.webNavigation.canGoBack) {
// Can't use DOMContentLoaded here because the page is bfcached. Can't use pageshow for
// the error page because it doesn't seem to fire for those.
let promiseOtherPageLoaded = BrowserTestUtils.waitForEvent(
tab.linkedBrowser,
"pageshow",
false,
// Be paranoid we *are* actually seeing this other page load, not some kind of race
// for if/when we do start firing pageshow for the error page...
function () {
return gBrowser.currentURI.spec == "about:robots";
}
);
gBrowser.goBack();
await promiseOtherPageLoaded;
ok(
gBrowser.webNavigation.canGoForward,
"Should be able to go forward from previous page."
);
}
BrowserTestUtils.removeTab(tab);
});
|