browser/components/tabview/test/browser_tabview_bug623768.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/tabview/test/browser_tabview_bug623768.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test() {
     1.8 +  waitForExplicitFinish();
     1.9 +
    1.10 +  let newTab = gBrowser.loadOneTab("http://www.example.com/#1",
    1.11 +                                   { inBackground: false });
    1.12 +
    1.13 +  // The executeSoon() call is really needed here because there's callback
    1.14 +  // waiting to be fired after gBrowser.loadOneTab(). After that the browser is
    1.15 +  // in a state where loadURI() will create a new entry in the session history
    1.16 +  // (that is vital for back/forward functionality).
    1.17 +  afterAllTabsLoaded(function() {
    1.18 +    executeSoon(function() {
    1.19 +      ok(!newTab.linkedBrowser.canGoBack, 
    1.20 +         "Browser should not be able to go back in history");
    1.21 +
    1.22 +      newTab.linkedBrowser.loadURI("http://www.example.com/#2");
    1.23 +
    1.24 +      afterAllTabsLoaded(function() {
    1.25 +        ok(newTab.linkedBrowser.canGoBack, 
    1.26 +           "Browser can go back in history after loading another URL");
    1.27 +
    1.28 +        showTabView(function() {
    1.29 +          let contentWindow = document.getElementById("tab-view").contentWindow;
    1.30 +
    1.31 +          EventUtils.synthesizeKey("VK_BACK_SPACE", { type: "keyup" }, contentWindow);
    1.32 +
    1.33 +          // check after a delay
    1.34 +          executeSoon(function() {
    1.35 +            ok(newTab.linkedBrowser.canGoBack, 
    1.36 +               "Browser can still go back in history");
    1.37 +
    1.38 +            hideTabView(function() {
    1.39 +              gBrowser.removeTab(newTab);
    1.40 +              finish();
    1.41 +            });
    1.42 +          });
    1.43 +        });
    1.44 +      });
    1.45 +    });
    1.46 +  });
    1.47 +}
    1.48 +

mercurial