Bug 1530500 - remove obsolete browser swapping flags, r=dao
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 20 Mar 2019 08:49:04 +0000
changeset 465204 1dcd5b03a6876fd6933560f1cd8b5ee8d778c1dc
parent 465203 a8e6586172fdefe46349797d8aef9cc5e7147d3b
child 465205 8918328d3461a3935fa78c381d643906b7256e12
push id112496
push usershindli@mozilla.com
push dateThu, 21 Mar 2019 04:37:39 +0000
treeherdermozilla-inbound@29476d3ca61d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1530500
milestone68.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 1530500 - remove obsolete browser swapping flags, r=dao Differential Revision: https://phabricator.services.mozilla.com/D24114
browser/base/content/tabbrowser.js
dom/interfaces/base/nsIBrowser.idl
toolkit/content/widgets/browser-custom-element.js
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -3313,17 +3313,17 @@ window._gBrowser = {
       var isBusy = aOtherTab.hasAttribute("busy");
       if (isBusy) {
         aOurTab.setAttribute("busy", "true");
         modifiedAttrs.push("busy");
         if (aOurTab.selected)
           this._isBusy = true;
       }
 
-      this._swapBrowserDocShells(aOurTab, otherBrowser, Ci.nsIBrowser.SWAP_DEFAULT, stateFlags);
+      this._swapBrowserDocShells(aOurTab, otherBrowser, stateFlags);
     }
 
     // Unregister the previously opened URI
     if (otherBrowser.registeredOpenURI) {
       let userContextId = otherBrowser.getAttribute("usercontextid") || 0;
       this.UrlbarProviderOpenTabs.unregisterOpenTab(otherBrowser.registeredOpenURI.spec,
                                                     userContextId);
       delete otherBrowser.registeredOpenURI;
@@ -3362,39 +3362,39 @@ window._gBrowser = {
 
     if (modifiedAttrs.length) {
       this._tabAttrModified(aOurTab, modifiedAttrs);
     }
 
     return true;
   },
 
-  swapBrowsers(aOurTab, aOtherTab, aFlags) {
+  swapBrowsers(aOurTab, aOtherTab) {
     let otherBrowser = aOtherTab.linkedBrowser;
     let otherTabBrowser = otherBrowser.getTabBrowser();
 
     // We aren't closing the other tab so, we also need to swap its tablisteners.
     let filter = otherTabBrowser._tabFilters.get(aOtherTab);
     let tabListener = otherTabBrowser._tabListeners.get(aOtherTab);
     otherBrowser.webProgress.removeProgressListener(filter);
     filter.removeProgressListener(tabListener);
 
     // Perform the docshell swap through the common mechanism.
-    this._swapBrowserDocShells(aOurTab, otherBrowser, aFlags);
+    this._swapBrowserDocShells(aOurTab, otherBrowser);
 
     // Restore the listeners for the swapped in tab.
     tabListener = new otherTabBrowser.ownerGlobal.TabProgressListener(aOtherTab, otherBrowser, false, false);
     otherTabBrowser._tabListeners.set(aOtherTab, tabListener);
 
     const notifyAll = Ci.nsIWebProgress.NOTIFY_ALL;
     filter.addProgressListener(tabListener, notifyAll);
     otherBrowser.webProgress.addProgressListener(filter, notifyAll);
   },
 
-  _swapBrowserDocShells(aOurTab, aOtherBrowser, aFlags, aStateFlags) {
+  _swapBrowserDocShells(aOurTab, aOtherBrowser, aStateFlags) {
     // aOurTab's browser needs to be inserted now if it hasn't already.
     this._insertBrowser(aOurTab);
 
     // Unhook our progress listener
     const filter = this._tabFilters.get(aOurTab);
     let tabListener = this._tabListeners.get(aOurTab);
     let ourBrowser = this.getBrowserForTab(aOurTab);
     ourBrowser.webProgress.removeProgressListener(filter);
@@ -3427,27 +3427,25 @@ window._gBrowser = {
     }
 
     // Register new outerWindowIDs.
     this._outerWindowIDBrowserMap.set(ourBrowser.outerWindowID, ourBrowser);
     if (remoteBrowser) {
       remoteBrowser._outerWindowIDBrowserMap.set(aOtherBrowser.outerWindowID, aOtherBrowser);
     }
 
-    if (!(aFlags & Ci.nsIBrowser.SWAP_KEEP_PERMANENT_KEY)) {
-      // Swap permanentKey properties.
-      let ourPermanentKey = ourBrowser.permanentKey;
-      ourBrowser.permanentKey = aOtherBrowser.permanentKey;
-      aOtherBrowser.permanentKey = ourPermanentKey;
-      aOurTab.permanentKey = ourBrowser.permanentKey;
-      if (remoteBrowser) {
-        let otherTab = remoteBrowser.getTabForBrowser(aOtherBrowser);
-        if (otherTab) {
-          otherTab.permanentKey = aOtherBrowser.permanentKey;
-        }
+    // Swap permanentKey properties.
+    let ourPermanentKey = ourBrowser.permanentKey;
+    ourBrowser.permanentKey = aOtherBrowser.permanentKey;
+    aOtherBrowser.permanentKey = ourPermanentKey;
+    aOurTab.permanentKey = ourBrowser.permanentKey;
+    if (remoteBrowser) {
+      let otherTab = remoteBrowser.getTabForBrowser(aOtherBrowser);
+      if (otherTab) {
+        otherTab.permanentKey = aOtherBrowser.permanentKey;
       }
     }
 
     // Restore the progress listener
     tabListener = new TabProgressListener(aOurTab, ourBrowser, false, false, aStateFlags);
     this._tabListeners.set(aOurTab, tabListener);
 
     const notifyAll = Ci.nsIWebProgress.NOTIFY_ALL;
--- a/dom/interfaces/base/nsIBrowser.idl
+++ b/dom/interfaces/base/nsIBrowser.idl
@@ -29,44 +29,28 @@ interface nsIBrowser : nsISupports
    * @param triggeringPrincipal a principal that initiated loading
    *                            of the dropped links
    */
   void dropLinks(in unsigned long linksCount,
                  [array, size_is(linksCount)] in wstring links,
                  in nsIPrincipal aTriggeringPrincipal);
 
   /**
-   * Flags for controlling the behavior of swapBrowsers
-   */
-
-  /**
-   * The default options. This is used for swapping browsers between windows
-   */
-  const unsigned long SWAP_DEFAULT = 0;
-
-  /**
-   * If this bit is set, swapping the browsers will not swap the permanentKey of
-   * the browsers. This is used when performing cross process loads by swapping
-   * browsers.
-   */
-  const unsigned long SWAP_KEEP_PERMANENT_KEY = 0x1;
-
-  /**
    * Swapping of frameloaders are usually initiated from a frameloader owner
    * or other components operating on frameloader owners. This is done by calling
    * swapFrameLoaders at MozFrameLoaderOwner webidl interface.
    *
    * This function aimed to provide the other way around -
    * if the swapping is initiated from frameloader itself or other platform level
    * components, it uses this interface to delegate the swapping request to
    * frameloader owners and ask them to re-initiate frameloader swapping, so that
    * frameloader owners such as <xul:browser> can setup their properties and /
    * or listeners properly on swapping.
    */
-  void swapBrowsers(in nsIBrowser aOtherBrowser, in unsigned long aFlags);
+  void swapBrowsers(in nsIBrowser aOtherBrowser);
 
   /**
    * Close the browser (usually means to remove a tab).
    */
   void closeBrowser();
 
   /**
    * A browser can change from remote to non-remote and vice versa.
--- a/toolkit/content/widgets/browser-custom-element.js
+++ b/toolkit/content/widgets/browser-custom-element.js
@@ -1617,26 +1617,26 @@ class MozBrowser extends MozElementMixin
         tabbrowser.removeTab(tab);
         return;
       }
     }
 
     throw new Error("Closing a browser which was not attached to a tabbrowser is unsupported.");
   }
 
-  swapBrowsers(aOtherBrowser, aFlags) {
+  swapBrowsers(aOtherBrowser) {
     // The request comes from a XPCOM component, we'd want to redirect
     // the request to tabbrowser so tabbrowser will be setup correctly,
     // and it will eventually call swapDocShells.
     let ourTabBrowser = this.getTabBrowser();
     let otherTabBrowser = aOtherBrowser.getTabBrowser();
     if (ourTabBrowser && otherTabBrowser) {
       let ourTab = ourTabBrowser.getTabForBrowser(this);
       let otherTab = otherTabBrowser.getTabForBrowser(aOtherBrowser);
-      ourTabBrowser.swapBrowsers(ourTab, otherTab, aFlags);
+      ourTabBrowser.swapBrowsers(ourTab, otherTab);
       return;
     }
 
     // One of us is not connected to a tabbrowser, so just swap.
     this.swapDocShells(aOtherBrowser);
   }
 
   swapDocShells(aOtherBrowser) {