browser/components/tabview/test/browser_tabview_bug623768.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:324f9030891f
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 function test() {
5 waitForExplicitFinish();
6
7 let newTab = gBrowser.loadOneTab("http://www.example.com/#1",
8 { inBackground: false });
9
10 // The executeSoon() call is really needed here because there's callback
11 // waiting to be fired after gBrowser.loadOneTab(). After that the browser is
12 // in a state where loadURI() will create a new entry in the session history
13 // (that is vital for back/forward functionality).
14 afterAllTabsLoaded(function() {
15 executeSoon(function() {
16 ok(!newTab.linkedBrowser.canGoBack,
17 "Browser should not be able to go back in history");
18
19 newTab.linkedBrowser.loadURI("http://www.example.com/#2");
20
21 afterAllTabsLoaded(function() {
22 ok(newTab.linkedBrowser.canGoBack,
23 "Browser can go back in history after loading another URL");
24
25 showTabView(function() {
26 let contentWindow = document.getElementById("tab-view").contentWindow;
27
28 EventUtils.synthesizeKey("VK_BACK_SPACE", { type: "keyup" }, contentWindow);
29
30 // check after a delay
31 executeSoon(function() {
32 ok(newTab.linkedBrowser.canGoBack,
33 "Browser can still go back in history");
34
35 hideTabView(function() {
36 gBrowser.removeTab(newTab);
37 finish();
38 });
39 });
40 });
41 });
42 });
43 });
44 }
45

mercurial