Bug 1303196 - Part 6: Correctly set the opener when creating new tabs on android, r=smaug
authorMichael Layzell <michael@thelayzells.com>
Wed, 19 Oct 2016 14:17:39 -0400
changeset 319864 fc29cabb300b077d2d83f138c2790366a2473650
parent 319863 11f778f3ea300696e3c900c9583f726809cd8359
child 319865 74ef5b08ae25f39a81503cdcb86b12ea3d6312d2
push id20749
push userryanvm@gmail.com
push dateSat, 29 Oct 2016 13:21:21 +0000
treeherderfx-team@1b170b39ed6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1303196
milestone52.0a1
Bug 1303196 - Part 6: Correctly set the opener when creating new tabs on android, r=smaug MozReview-Commit-ID: CLT9G1o6lXv
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3292,16 +3292,17 @@ nsBrowserAccess.prototype = {
         }
       }
 
       // BrowserApp.addTab calls loadURIWithFlags with the appropriate params
       let tab = BrowserApp.addTab(aURI ? aURI.spec : "about:blank", { flags: loadflags,
                                                                       referrerURI: referrer,
                                                                       external: isExternal,
                                                                       parentId: parentId,
+                                                                      opener: aOpener,
                                                                       selected: true,
                                                                       isPrivate: isPrivate,
                                                                       pinned: pinned });
 
       return tab.browser;
     }
 
     // OPEN_CURRENTWINDOW and illegal values
@@ -3399,16 +3400,21 @@ Tab.prototype = {
     this.browser.setAttribute("messagemanagergroup", "browsers");
 
     if (Preferences.get("browser.tabs.remote.force-enable", false)) {
       this.browser.setAttribute("remote", "true");
     }
 
     this.browser.permanentKey = {};
 
+    // Check if we have a "parent" window which we need to set as our opener
+    if ("opener" in aParams) {
+      this.browser.presetOpenerWindow(aParams.opener);
+    }
+
     // Make sure the previously selected panel remains selected. The selected panel of a deck is
     // not stable when panels are added.
     let selectedPanel = BrowserApp.deck.selectedPanel;
     BrowserApp.deck.insertBefore(this.browser, aParams.sibling || null);
     BrowserApp.deck.selectedPanel = selectedPanel;
 
     let attrs = {};
     if (BrowserApp.manifestUrl) {