Bug 1039904 - Changing the URL in a pinned tab shouldn't open a new tab. r+a=gavin
authorDão Gottwald <dao@mozilla.com>
Fri, 01 Aug 2014 18:20:57 +0200
changeset 217363 11f605516d11b09eb7561dc10509c39a79e26882
parent 217362 1f0ef1b4edd786d206e285c39f7928ccd65da92f
child 217364 0841adfcb0288f12db50bca9e1e8bb1bd8990087
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1039904
milestone33.0a2
Bug 1039904 - Changing the URL in a pinned tab shouldn't open a new tab. r+a=gavin
browser/base/content/urlbarBindings.xml
browser/base/content/utilityOverlay.js
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -312,16 +312,17 @@
               // but don't let that interfere with the loading of the url.
               Cu.reportError(ex);
             }
 
             function loadCurrent() {
               openUILinkIn(url, "current", {
                 allowThirdPartyFixup: true,
                 disallowInheritPrincipal: !mayInheritPrincipal,
+                allowPinnedTabHostChange: true,
                 postData: postData
               });
             }
 
             // Focus the content area before triggering loads, since if the load
             // occurs in a new tab, we want focus to be restored to the content
             // area when the current tab is re-selected.
             gBrowser.selectedBrowser.focus();
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -180,16 +180,17 @@ function whereToOpenLink( e, ignoreButto
  *
  * Instead of aAllowThirdPartyFixup, you may also pass an object with any of
  * these properties:
  *   allowThirdPartyFixup (boolean)
  *   postData             (nsIInputStream)
  *   referrerURI          (nsIURI)
  *   relatedToCurrent     (boolean)
  *   skipTabAnimation     (boolean)
+ *   allowPinnedTabHostChange (boolean)
  */
 function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI) {
   var params;
 
   if (arguments.length == 3 && typeof arguments[2] == "object") {
     params = aAllowThirdPartyFixup;
   } else {
     params = {
@@ -215,16 +216,17 @@ function openLinkIn(url, where, params) 
   var aReferrerURI          = params.referrerURI;
   var aRelatedToCurrent     = params.relatedToCurrent;
   var aAllowMixedContent    = params.allowMixedContent;
   var aInBackground         = params.inBackground;
   var aDisallowInheritPrincipal = params.disallowInheritPrincipal;
   var aInitiatingDoc        = params.initiatingDoc;
   var aIsPrivate            = params.private;
   var aSkipTabAnimation     = params.skipTabAnimation;
+  var aAllowPinnedTabHostChange = !!params.allowPinnedTabHostChange;
 
   if (where == "save") {
     if (!aInitiatingDoc) {
       Components.utils.reportError("openUILink/openLinkIn was called with " +
         "where == 'save' but without initiatingDoc.  See bug 814264.");
       return;
     }
     saveURL(url, null, null, true, null, aReferrerURI, aInitiatingDoc);
@@ -283,17 +285,18 @@ function openLinkIn(url, where, params) 
 
   let uriObj;
   if (where == "current") {
     try {
       uriObj = Services.io.newURI(url, null, null);
     } catch (e) {}
   }
 
-  if (where == "current" && w.gBrowser.selectedTab.pinned) {
+  if (where == "current" && w.gBrowser.selectedTab.pinned &&
+      !aAllowPinnedTabHostChange) {
     try {
       // nsIURI.host can throw for non-nsStandardURL nsIURIs.
       if (!uriObj || (!uriObj.schemeIs("javascript") &&
                       w.gBrowser.currentURI.host != uriObj.host)) {
         where = "tab";
         loadInBackground = false;
       }
     } catch (err) {