B2G/gecko/browser/devtools/commandline/test/head.js
/**
 * Open a new tab at a URL and call a callback on load
 */
Open a new tab at a URL and call a callback on load
Open a new tab at a URL and call a callback on load
function addTab(aURL, aCallback)
{
  waitForExplicitFinish();
  gBrowser.selectedTab = gBrowser.addTab();
  content.location = aURL;
  let tab = gBrowser.selectedTab;
  let browser = gBrowser.getBrowserForTab(tab);
  function onTabLoad() {
    browser.removeEventListener("load", onTabLoad, true);
    aCallback(browser, tab, browser.contentDocument);
  }
  browser.addEventListener("load", onTabLoad, true);
}
function addTab ( aURL , aCallback ) { waitForExplicitFinish ( ) ; gBrowser . selectedTab = gBrowser . addTab ( ) ; content . location = aURL ; let tab = gBrowser . selectedTab ; let browser = gBrowser . getBrowserForTab ( tab ) ; function onTabLoad ( ) { browser . removeEventListener ( "load" , onTabLoad , true ) ; aCallback ( browser , tab , browser . contentDocument ) ; } browser . addEventListener ( "load" , onTabLoad , true ) ; }
Open a new tab at a URL and call a callback on load
Open a new tab at a URL and call a callback on load