B2G/gecko/browser/components/tabview/test/browser_tabview_bug623768.js
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */
Any copyright is dedicated to the Public Domain.
Any copyright is dedicated to the Public Domain .
function test() {
  waitForExplicitFinish();
  let newTab = gBrowser.loadOneTab("http://www.example.com/#1",
                                   { inBackground: false });
  afterAllTabsLoaded(function() {
    executeSoon(function() {
      ok(!newTab.linkedBrowser.canGoBack, 
         "Browser should not be able to go back in history");
      newTab.linkedBrowser.loadURI("http://www.example.com/#2");
      afterAllTabsLoaded(function() {
        ok(newTab.linkedBrowser.canGoBack, 
           "Browser can go back in history after loading another URL");
        showTabView(function() {
          let contentWindow = document.getElementById("tab-view").contentWindow;
          EventUtils.synthesizeKey("VK_BACK_SPACE", { type: "keyup" }, contentWindow);
          executeSoon(function() {
            ok(newTab.linkedBrowser.canGoBack, 
               "Browser can still go back in history");
            hideTabView(function() {
              gBrowser.removeTab(newTab);
              finish();
            });
          });
        });
      });
    });
  });
}
function test ( ) { waitForExplicitFinish ( ) ; let newTab = gBrowser . loadOneTab ( "http://www.example.com/#1" , { inBackground : false } ) ; afterAllTabsLoaded ( function ( ) { executeSoon ( function ( ) { ok ( ! newTab . linkedBrowser . canGoBack , "Browser should not be able to go back in history" ) ; newTab . linkedBrowser . loadURI ( "http://www.example.com/#2" ) ; afterAllTabsLoaded ( function ( ) { ok ( newTab . linkedBrowser . canGoBack , "Browser can go back in history after loading another URL" ) ; showTabView ( function ( ) { let contentWindow = document . getElementById ( "tab-view" ) . contentWindow ; EventUtils . synthesizeKey ( "VK_BACK_SPACE" , { type : "keyup" } , contentWindow ) ; executeSoon ( function ( ) { ok ( newTab . linkedBrowser . canGoBack , "Browser can still go back in history" ) ; hideTabView ( function ( ) { gBrowser . removeTab ( newTab ) ; finish ( ) ; } ) ; } ) ; } ) ; } ) ; } ) ; } ) ; }
Any copyright is dedicated to the Public Domain.
Any copyright is dedicated to the Public Domain .
// The executeSoon() call is really needed here because there's callback // waiting to be fired after gBrowser.loadOneTab(). After that the browser is // in a state where loadURI() will create a new entry in the session history // (that is vital for back/forward functionality). // check after a delay