Bug 1483786 - Add aOptions object param to 'replaceTabsWithWindow' function in browser/base/content/tabbrowser.js file. r=jaws
authorAbdoulaye O. Ly <ablayelyfondou@gmail.com>
Fri, 31 Aug 2018 05:11:34 +0000
changeset 434194 06af1619a7998038ce334196cf6e8790d26007c2
parent 434193 a37beca7fec4076855f181b0a1d1acf849176e70
child 434195 b073a55c2be73fc6e5ba1a0f2bcef7c61d4d68ef
push id68584
push userjwein@mozilla.com
push dateFri, 31 Aug 2018 05:12:15 +0000
treeherderautoland@06af1619a799 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1483786
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1483786 - Add aOptions object param to 'replaceTabsWithWindow' function in browser/base/content/tabbrowser.js file. r=jaws replaceTabsWithWindow calls replaceTabWithWindow to create a new window window with a first tab. But unlike the later function, the former cited function don't take an object param (aOptions) containing informations such as the mouse position (which helps set the new window position). To adress the issue, we added support for passing an option param to replaceTabsWithWindow which just transferts the param to replaceTabWithWindow. Differential Revision: https://phabricator.services.mozilla.com/D4735
browser/base/content/tabbrowser.js
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -3497,30 +3497,30 @@ window._gBrowser = {
     return window.openDialog(AppConstants.BROWSER_CHROME_URL, "_blank", options, aTab);
   },
 
   /**
    * Move contextTab (or selected tabs in a mutli-select context)
    * to a new browser window, unless it is (they are) already the only tab(s)
    * in the current window, in which case this will do nothing.
    */
-  replaceTabsWithWindow(contextTab) {
+  replaceTabsWithWindow(contextTab, aOptions) {
     let tabs;
     if (contextTab.multiselected) {
       tabs = this.selectedTabs;
     } else {
       tabs = [contextTab];
     }
 
     if (this.tabs.length == tabs.length) {
       return null;
     }
 
     if (tabs.length == 1) {
-      return this.replaceTabWithWindow(tabs[0]);
+      return this.replaceTabWithWindow(tabs[0], aOptions);
     }
 
     // The order of the tabs is reserved.
     // To avoid mutliple tab-switch, the active tab is "moved" lastly, if applicable.
     // If applicable, the active tab remains active in the new window.
     let activeTab = gBrowser.selectedTab;
     let inactiveTabs = tabs.filter(t => t != activeTab);
     let activeTabNewIndex = tabs.indexOf(activeTab);
@@ -3548,17 +3548,17 @@ window._gBrowser = {
 
       // Restore tab selection
       let winVisibleTabs = win.gBrowser.visibleTabs;
       let winTabLength = winVisibleTabs.length;
       win.gBrowser.addRangeToMultiSelectedTabs(winVisibleTabs[0],
                                                winVisibleTabs[winTabLength - 1]);
     }, { once: true });
 
-    win = this.replaceTabWithWindow(firstInactiveTab);
+    win = this.replaceTabWithWindow(firstInactiveTab, aOptions);
     return win;
   },
 
   _updateTabsAfterInsert() {
     for (let i = 0; i < this.tabs.length; i++) {
       this.tabs[i]._tPos = i;
       this.tabs[i]._selected = false;
     }