third_party/js/mozmill/shared-modules/tabs.js
function getTabsWithURL(aUrl) {
  var tabs = [ ];

  var uri = utils.createURI(aUrl, null, null);

  var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
           getService(Ci.nsIWindowMediator);
  var winEnum = wm.getEnumerator("navigator:browser");

  // Iterate through all windows
  while (winEnum.hasMoreElements()) {
    var window = winEnum.getNext();
 
    // Don't check windows which are about to close or don't have gBrowser set
    if (window.closed || !("gBrowser" in window))
      continue;

    // Iterate through all tabs in the current window
    var browsers = window.gBrowser.browsers;
    for (var i = 0; i < browsers.length; i++) {
      var browser = browsers[i];
      if (browser.currentURI.equals(uri)) {
        tabs.push({
          controller : new mozmill.controller.MozMillController(window),
          index : i
        });
      }
    }
  }

  return tabs;
}
function getTabsWithURL(aUrl) {
  var tabs = [ ];

  var uri = utils.createURI(aUrl, null, null);

  var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
           getService(Ci.nsIWindowMediator);
  var winEnum = wm.getEnumerator("navigator:browser");

  // Iterate through all windows
  while (winEnum.hasMoreElements()) {
    var window = winEnum.getNext();
 
    // Don't check windows which are about to close or don't have gBrowser set
    if (window.closed || !("gBrowser" in window))
      continue;

    // Iterate through all tabs in the current window
    var browsers = window.gBrowser.browsers;
    for (var i = 0; i < browsers.length; i++) {
      var browser = browsers[i];
      if (browser.currentURI.equals(uri)) {
        tabs.push({
          controller : new mozmill.controller.MozMillController(window),
          index : i
        });
      }
    }
  }

  return tabs;
}
function getTabsWithURL ( aUrl ) { var tabs = [ ] ; var uri = utils . createURI ( aUrl , null , null ) ; var wm = Cc [ "@mozilla.org/appshell/window-mediator;1" ] . getService ( Ci . nsIWindowMediator ) ; var winEnum = wm . getEnumerator ( "navigator:browser" ) ; // Iterate through all windows while ( winEnum . hasMoreElements ( ) ) { var window = winEnum . getNext ( ) ; // Don't check windows which are about to close or don't have gBrowser set if ( window . closed || ! ( "gBrowser" in window ) ) continue ; // Iterate through all tabs in the current window var browsers = window . gBrowser . browsers ; for ( var i = 0 ; i < browsers . length ; i ++ ) { var browser = browsers [ i ] ; if ( browser . currentURI . equals ( uri ) ) { tabs . push ( { controller : new mozmill . controller . MozMillController ( window ) , index : i } ) ; } } } return tabs ; }
Check and return all open tabs with the specified URL

@param {string} aUrl
URL to check for

@returns Array of tabs
Check and return all open tabs with the specified URL