B2G/gecko/browser/components/sessionstore/test/browser_739531.js
// don't result in uncaught errors and a broken browser state.
don't result in uncaught errors and a broken browser state.
don ' t result in uncaught errors and a broken browser state .
function test() {
  waitForExplicitFinish();
  let testURL = "http://mochi.test:8888/browser/" +
    "browser/components/sessionstore/test/browser_739531_sample.html";
  let loadCount = 0;
  let tab = gBrowser.addTab(testURL);
  tab.linkedBrowser.addEventListener("load", function onLoad(aEvent) {
    if (++loadCount < 2)
      return;
    tab.linkedBrowser.removeEventListener("load", onLoad, true);
    executeSoon(function() {
      let tab2;
      let caughtError = false;
      try {
        tab2 = ss.duplicateTab(window, tab);
      }
      catch (e) {
        caughtError = true;
        info(e);
      }
      is(gBrowser.tabs.length, 3, "there should be 3 tabs")
      ok(!caughtError, "duplicateTab didn't throw");
      if (tab2)
        gBrowser.removeTab(tab2);
      gBrowser.removeTab(tab);
      finish();
    });
  }, true);
}
function test ( ) { waitForExplicitFinish ( ) ; let testURL = "http://mochi.test:8888/browser/" + "browser/components/sessionstore/test/browser_739531_sample.html" ; let loadCount = 0 ; let tab = gBrowser . addTab ( testURL ) ; tab . linkedBrowser . addEventListener ( "load" , function onLoad ( aEvent ) { if ( ++ loadCount < 2 ) return ; tab . linkedBrowser . removeEventListener ( "load" , onLoad , true ) ; executeSoon ( function ( ) { let tab2 ; let caughtError = false ; try { tab2 = ss . duplicateTab ( window , tab ) ; } catch ( e ) { caughtError = true ; info ( e ) ; } is ( gBrowser . tabs . length , 3 , "there should be 3 tabs" ) ok ( ! caughtError , "duplicateTab didn't throw" ) ; if ( tab2 ) gBrowser . removeTab ( tab2 ) ; gBrowser . removeTab ( tab ) ; finish ( ) ; } ) ; } , true ) ; }
don't result in uncaught errors and a broken browser state.
don ' t result in uncaught errors and a broken browser state .
// make sure both the page and the frame are loaded // executeSoon to allow the JS to execute on the page // if the test fails, we don't want to try to close a tab that doesn't exist