Bug 639334 - Back button doesn't go back from pages opened by Fennec chrome [r=wesj a=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 08 Mar 2011 12:32:42 -0800
changeset 67480 07e12e7675e2f8ea0d04638cc91b3bbd29ca1a73
parent 67479 59797f58a62937ab4a89c1cf5ade866c09e0268c
child 67481 4e328fade26174302dd3ed6a3c434ee0732f990e
push idunknown
push userunknown
push dateunknown
reviewerswesj, mfinkle
bugs639334
Bug 639334 - Back button doesn't go back from pages opened by Fennec chrome [r=wesj a=mfinkle]
mobile/app/profile/extensions/feedback@mobile.mozilla.org/content/overlay.js
mobile/chrome/content/browser.xul
mobile/chrome/content/downloads.js
mobile/chrome/content/extensions.js
mobile/chrome/content/notification.xml
mobile/chrome/content/sync.js
--- a/mobile/app/profile/extensions/feedback@mobile.mozilla.org/content/overlay.js
+++ b/mobile/app/profile/extensions/feedback@mobile.mozilla.org/content/overlay.js
@@ -70,29 +70,29 @@ var Feedback = {
 
   openFeedback: function(aName) {
     let pref = "extensions.feedback.url." + aName;
     let url = Services.prefs.getPrefType(pref) == Ci.nsIPrefBranch.PREF_INVALID ? "" : Services.prefs.getCharPref(pref);
     if (!url)
       return;
 
     let currentURL = Browser.selectedBrowser.currentURI.spec;
-    let newTab = BrowserUI.newTab(url);
+    let newTab = BrowserUI.newTab(url, Browser.selectedTab);
 
     // Tell the feedback page to fill in the referrer URL
     newTab.browser.messageManager.addMessageListener("DOMContentLoaded", function() {
       newTab.browser.messageManager.removeMessageListener("DOMContentLoaded", arguments.callee, true);
       newTab.browser.messageManager.sendAsyncMessage("Feedback:InitPage", { referrer: currentURL, device: Feedback._device, manufacturer: Feedback._manufacturer });
     });
   },
 
   openReadme: function() {
     let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter);
     let url = formatter.formatURLPref("app.releaseNotesURL");
-    BrowserUI.newTab(url);
+    BrowserUI.newTab(url, Browser.selectedTab);
   },
 
   updateRestart: function updateRestart() {
     let msg = document.getElementById("feedback-messages");
     if (msg) {
       let value = "restart-app";
       let notification = msg.getNotificationWithValue(value);
       if (notification) {
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -415,19 +415,19 @@
             <notificationbox id="prefs-messages" flex="1">
               <richlistbox id="prefs-list" seltype="single" flex="1" onselect="this.ensureSelectedElementIsVisible()">
                 <label id="prefs-list-header" class="panel-header" value="&prefsHeader.label;"/>
                 <setting title="&about.title;" type="control">
                   <button id="prefs-about-button" label="&about.button;"
 #ifdef MOZ_OFFICIAL_BRANDING
 # these two point to the same page, this just matters for what shows up in the
 # URL bar
-                          oncommand="BrowserUI.newTab('about:firefox');"/>
+                          oncommand="BrowserUI.newTab('about:firefox', Browser.selectedTab);"/>
 #else
-                          oncommand="BrowserUI.newTab('about:fennec');"/>
+                          oncommand="BrowserUI.newTab('about:fennec', Browser.selectedTab);"/>
 #endif
                 </setting>
                 <setting id="prefs-uilanguage" title="&language.title;" type="control">
                   <menulist id="prefs-languages" oncommand="PreferencesView.updateLocale();">
                     <menupopup>
                       <menuitem id="prefs-languages-auto" label="&language.auto;" value="auto"/>
                     </menupopup>
                   </menulist>
--- a/mobile/chrome/content/downloads.js
+++ b/mobile/chrome/content/downloads.js
@@ -413,17 +413,17 @@ var DownloadsView = {
   retryDownload: function dv_retryDownload(aItem) {
     this._removeItem(aItem);
     this._dlmgr.retryDownload(aItem.getAttribute("downloadID"));
   },
 
   showPage: function dv_showPage(aItem) {
     let uri = this._getReferrerOrSource(aItem);
     if (uri)
-      BrowserUI.newTab(uri);
+      BrowserUI.newTab(uri, Browser.selectedTab);
   },
 
   showAlert: function dv_showAlert(aName, aMessage, aTitle, aIcon) {
     if (this.visible)
       return;
 
     var notifier = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
 
--- a/mobile/chrome/content/extensions.js
+++ b/mobile/chrome/content/extensions.js
@@ -620,17 +620,17 @@ var ExtensionsView = {
     whatare.setAttribute("typeName", "banner");
     whatare.setAttribute("label", strings.GetStringFromName("addonsWhatAre.label"));
 
     let desc = strings.GetStringFromName("addonsWhatAre.description");
     desc = desc.replace(/#1/g, brandShortName);
     whatare.setAttribute("description", desc);
 
     whatare.setAttribute("button", strings.GetStringFromName("addonsWhatAre.button"));
-    whatare.setAttribute("onbuttoncommand", "BrowserUI.newTab('" + browseURL + "');");
+    whatare.setAttribute("onbuttoncommand", "BrowserUI.newTab('" + browseURL + "', Browser.selectedTab);");
     this.addItem(whatare, "repo");
 
     if (aRecommendedAddons.length == 0 && aBrowseAddons.length == 0) {
       let msg = strings.GetStringFromName("addonsSearchNone.recommended");
       let button = strings.GetStringFromName("addonsSearchNone.button");
       let item = this.displaySectionMessage("repo", msg, button, true);
 
       this._list.scrollBoxObject.scrollToElement(item);
@@ -710,17 +710,17 @@ var ExtensionsView = {
     }
 
     this.displaySectionMessage("repo", null, strings.GetStringFromName("addonsSearchSuccess2.button"), true);
   },
 
   showPage: function ev_showPage(aItem) {
     let uri = aItem.getAttribute("homepageURL");
     if (uri)
-      BrowserUI.newTab(uri);
+      BrowserUI.newTab(uri, Browser.selectedTab);
   },
 
   get searchBox() {
     delete this.searchBox;
     return this.searchBox = document.getElementById("addons-search-text");
   },
 
   doSearch: function ev_doSearch(aTerms) {
@@ -730,17 +730,17 @@ var ExtensionsView = {
 
   resetSearch: function ev_resetSearch() {
     this.searchBox.value = "";
     this.getAddonsFromRepo("");
   },
 
   showMoreResults: function ev_showMoreResults(aURL) {
     if (aURL)
-      BrowserUI.newTab(aURL);
+      BrowserUI.newTab(aURL, Browser.selectedTab);
   },
 
   updateAll: function ev_updateAll() {
     let aus = Cc["@mozilla.org/browser/addon-update-service;1"].getService(Ci.nsITimerCallback);
     aus.notify(null);
 
     if (this._list.selectedItem)
       this._list.selectedItem.focus();
--- a/mobile/chrome/content/notification.xml
+++ b/mobile/chrome/content/notification.xml
@@ -64,17 +64,17 @@
       // We need to override the close method here, otherwise the destructor
       // is not called on removeChild (see bug 230086)
       <method name="close">
         <body>
           <![CDATA[
             var control = this.control;
             if (control)
               control.removeNotification(this);
-            
+
             // Fire an event when closing a notification
             let event = document.createEvent("Events");
             event.initEvent("AlertClose", true, true);
             this.dispatchEvent(event);
           ]]>
         </body>
       </method>
     </implementation>
@@ -88,19 +88,19 @@
     <content>
       <xul:vbox class="notification-inner outset" flex="1" xbl:inherits="type">
         <xul:hbox anonid="details">
           <xul:description anonid="messageText" class="messageText" flex="1" xbl:inherits="xbl:text=label"/>
           <xul:spacer flex="1"/>
           <xul:label anonid="learnMore"
                      class="text-link"
                      value="&geolocation.learnMore;"
-                     onclick="BrowserUI.newTab(this.href); return false;"/>
+                     onclick="BrowserUI.newTab(this.href, Browser.selectedTab); return false;"/>
         </xul:hbox>
-        
+
         <xul:hbox pack="center"
                   oncommand="document.getBindingParent(this)._doButtonCommand(event);">
           <children/>
         </xul:hbox>
       </xul:vbox>
     </content>
 
     <implementation>
--- a/mobile/chrome/content/sync.js
+++ b/mobile/chrome/content/sync.js
@@ -531,17 +531,17 @@ let WeaveGlue = {
     return uri.spec;
   },
 
   openTutorial: function _openTutorial() {
     WeaveGlue.close();
 
     let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter);
     let url = formatter.formatURLPref("app.sync.tutorialURL");
-    BrowserUI.newTab(url, null);
+    BrowserUI.newTab(url, Browser.selectedTab);
   },
 
   loadSetupData: function _loadSetupData() {
     this.setupData = {};
     this.setupData.account = Weave.Service.account || "";
     this.setupData.password = Weave.Service.password || "";
     this.setupData.synckey = Weave.Service.passphrase || "";