Bug 1122697 - [Linux Only] When opening a bookmark folder, no tabs are opened when the opening multiple tabs dialog warning is dismissed r=Neil
authorPhilip Chee <philip.chee@gmail.com>
Sun, 01 Feb 2015 01:12:41 +0800
changeset 25611 3c4eaadf0fddbb64103b93e0d38f481864bfe212
parent 25610 67390c3956d7c7fbb26cc7d36d3b1d02e5464b61
child 25612 26dc15bce34bfa6e78691c5baf7843eae1401a21
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs1122697
Bug 1122697 - [Linux Only] When opening a bookmark folder, no tabs are opened when the opening multiple tabs dialog warning is dismissed r=Neil a=IanN comm-aurora comm-beta comm-release CLOSED TREE
suite/common/src/PlacesUIUtils.jsm
--- a/suite/common/src/PlacesUIUtils.jsm
+++ b/suite/common/src/PlacesUIUtils.jsm
@@ -602,22 +602,22 @@ var PlacesUIUtils = {
   _showBookmarkDialog: function PUIU__showBookmarkDialog(aInfo) {
     var dialogURL = "chrome://communicator/content/bookmarks/bm-props.xul";
     var features = "centerscreen,chrome,modal,resizable=yes";
     this._getCurrentActiveWin().openDialog(dialogURL, "", features, aInfo);
     return ("performed" in aInfo && aInfo.performed);
   },
 
   _getTopBrowserWin: function PUIU__getTopBrowserWin() {
-    return focusManager.activeWindow.gPrivate ||
+    return this._getCurrentActiveWin().gPrivate ||
            Services.wm.getMostRecentWindow("navigator:browser");
   },
 
   _getCurrentActiveWin: function PUIU__getCurrentActiveWin() {
-    return focusManager.activeWindow;
+    return focusManager.activeWindow || Services.wm.getMostRecentWindow(null);
   },
 
   /**
    * Returns the closet ancestor places view for the given DOM node
    * @param aNode
    *        a DOM node
    * @return the closet ancestor places view if exists, null otherwsie.
    */
@@ -776,48 +776,48 @@ var PlacesUIUtils = {
     }
 
     return reallyOpen;
   },
 
   /** aItemsToOpen needs to be an array of objects of the form:
     * {uri: string, isBookmark: boolean}
     */
-  _openTabset: function PUIU__openTabset(aItemsToOpen, aEvent) {
+  _openTabset: function (aItemsToOpen, aEvent, aWhere) {
     if (!aItemsToOpen.length)
       return;
 
     var urls = [];
-    for (var i = 0; i < aItemsToOpen.length; i++) {
-      var item = aItemsToOpen[i];
+    for (let item of aItemsToOpen) {
       if (item.isBookmark)
         this.markPageAsFollowedBookmark(item.uri);
       else
         this.markPageAsTyped(item.uri);
 
       urls.push(item.uri);
     }
 
     var browserWindow = this._getTopBrowserWin();
     if (browserWindow) {
-      browserWindow.openUILinkArrayIn(urls, browserWindow.whereToOpenLink(aEvent, false, true));
+      let where = aWhere || browserWindow.whereToOpenLink(aEvent, false, true);
+      browserWindow.openUILinkArrayIn(urls, where);
     }
     else {
       let win = this._getCurrentActiveWin();
       win.openDialog(win.getBrowserURL(), "_blank",
                      "chrome,all,dialog=no", urls.join("\n"));
     }
   },
 
-  openContainerNodeInTabs: function PUIU_openContainerInTabs(aNode, aEvent) {
+  openContainerNodeInTabs: function PUIU_openContainerInTabs(aNode, aEvent, aWhere) {
     var urlsToOpen = PlacesUtils.getURLsForContainerNode(aNode);
     if (!this._confirmOpenInTabs(urlsToOpen.length))
       return;
 
-    this._openTabset(urlsToOpen, aEvent);
+    this._openTabset(urlsToOpen, aEvent, aWhere);
   },
 
   openURINodesInTabs: function PUIU_openURINodesInTabs(aNodes, aEvent) {
     var urlsToOpen = [];
     for (var i=0; i < aNodes.length; i++) {
       // skip over separators and folders
       if (PlacesUtils.nodeIsURI(aNodes[i]))
         urlsToOpen.push({uri: aNodes[i].uri, isBookmark: PlacesUtils.nodeIsBookmark(aNodes[i])});