B2G/gecko/browser/components/places/src/PlacesUIUtils.jsm
/** aItemsToOpen needs to be an array of objects of the form:
    * {uri: string, isBookmark: boolean}
    */
aItemsToOpen needs to be an array of objects of the form:
{uri: string, isBookmark: boolean}
aItemsToOpen needs to be an array of objects of the form : { uri : string isBookmark : boolean }
function PUIU__openTabset(aItemsToOpen, aEvent, aWindow) {
    if (!aItemsToOpen.length)
      return;
    var urls = [];
    for (var i = 0; i < aItemsToOpen.length; i++) {
      var item = aItemsToOpen[i];
      if (item.isBookmark)
        this.markPageAsFollowedBookmark(item.uri);
      else
        this.markPageAsTyped(item.uri);
      urls.push(item.uri);
    }
    var browserWindow = null;
    browserWindow =
      aWindow && aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser" ?
      aWindow : this._getTopBrowserWin();
    var where = browserWindow ?
                browserWindow.whereToOpenLink(aEvent, false, true) : "window";
    if (where == "window") {
      var uriList = PlacesUtils.toISupportsString(urls.join("|"));
      var args = Cc["@mozilla.org/supports-array;1"].
                  createInstance(Ci.nsISupportsArray);
      args.AppendElement(uriList);      
      browserWindow = Services.ww.openWindow(aWindow,
                                             "chrome://browser/content/browser.xul",
                                             null, "chrome,dialog=no,all", args);
      return;
    }
    var loadInBackground = where == "tabshifted" ? true : false;
    browserWindow.gBrowser.loadTabs(urls, loadInBackground, false);
  }
function PUIU__openTabset ( aItemsToOpen , aEvent , aWindow ) { if ( ! aItemsToOpen . length ) return ; var urls = [ ] ; for ( var i = 0 ; i < aItemsToOpen . length ; i ++ ) { var item = aItemsToOpen [ i ] ; if ( item . isBookmark ) this . markPageAsFollowedBookmark ( item . uri ) ; else this . markPageAsTyped ( item . uri ) ; urls . push ( item . uri ) ; } var browserWindow = null ; browserWindow = aWindow && aWindow . document . documentElement . getAttribute ( "windowtype" ) == "navigator:browser" ? aWindow : this . _getTopBrowserWin ( ) ; var where = browserWindow ? browserWindow . whereToOpenLink ( aEvent , false , true ) : "window" ; if ( where == "window" ) { var uriList = PlacesUtils . toISupportsString ( urls . join ( "|" ) ) ; var args = Cc [ "@mozilla.org/supports-array;1" ] . createInstance ( Ci . nsISupportsArray ) ; args . AppendElement ( uriList ) ; browserWindow = Services . ww . openWindow ( aWindow , "chrome://browser/content/browser.xul" , null , "chrome,dialog=no,all" , args ) ; return ; } var loadInBackground = where == "tabshifted" ? true : false ; browserWindow . gBrowser . loadTabs ( urls , loadInBackground , false ) ; }
aItemsToOpen needs to be an array of objects of the form:
 {uri: string, isBookmark: boolean}
aItemsToOpen needs to be an array of objects of the form : { uri : string isBookmark : boolean }
// Prefer the caller window if it's a browser window, otherwise use // the top browser window. // whereToOpenLink doesn't return "window" when there's no browser window // open (Bug 630255). // There is no browser window open, thus open a new one. // For consistency, we want all the bookmarks to open in new tabs, instead // of having one of them replace the currently focused tab.  Hence we call // loadTabs with aReplace set to false.