Bug 948983: Make about:newtab the start page with about:home and about:start as aliases and save all as about:newtab in sessionstore. r=mbrubeck a=lsblakk
authorMarina Samuel <msamuel@mozilla.com>
Thu, 12 Dec 2013 15:55:31 -0500
changeset 175387 3efbdbcaaaceff55b9a6078aee315ae3a13cd36e
parent 175386 29ce4b1f69d478c3f8ac5c22e2ca7f5482be6b93
child 175388 5be7ada24379ba522255aa242fc32fce472b20ab
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck, lsblakk
bugs948983
milestone28.0a2
Bug 948983: Make about:newtab the start page with about:home and about:start as aliases and save all as about:newtab in sessionstore. r=mbrubeck a=lsblakk
browser/metro/base/content/Util.js
browser/metro/base/content/bindings/browser.js
browser/metro/base/content/browser-ui.js
browser/metro/base/content/browser.js
browser/metro/components/AboutRedirector.js
browser/metro/components/BrowserCLH.js
browser/metro/components/components.manifest
--- a/browser/metro/base/content/Util.js
+++ b/browser/metro/base/content/Util.js
@@ -204,16 +204,17 @@ let Util = {
   },
 
   // Don't display anything in the urlbar for these special URIs.
   isURLEmpty: function isURLEmpty(aURL) {
     return (!aURL ||
             aURL == "about:blank" ||
             aURL == "about:empty" ||
             aURL == "about:home" ||
+            aURL == "about:newtab" ||
             aURL == "about:start");
   },
 
   // Title to use for emptyURL tabs.
   getEmptyURLTabTitle: function getEmptyURLTabTitle() {
     let browserStrings = Services.strings.createBundle("chrome://browser/locale/browser.properties");
 
     return browserStrings.GetStringFromName("tabs.emptyTabTitle");
--- a/browser/metro/base/content/bindings/browser.js
+++ b/browser/metro/base/content/bindings/browser.js
@@ -342,16 +342,22 @@ let WebNavigation =  {
   },
 
   sendHistory: function sendHistory() {
     // We need to package up the session history and send it to the sessionstore
     let entries = [];
     let history = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
     for (let i = 0; i < history.count; i++) {
       let entry = this._serializeHistoryEntry(history.getEntryAtIndex(i, false));
+
+      // If someone directly navigates to one of these URLs and they switch to Desktop,
+      // we need to make the page load-able.
+      if (entry.url == "about:home" || entry.url == "about:start") {
+        entry.url = "about:newtab";
+      }
       entries.push(entry);
     }
     let index = history.index + 1;
     sendAsyncMessage("Content:SessionHistory", { entries: entries, index: index });
   },
 
   _serializeHistoryEntry: function _serializeHistoryEntry(aEntry) {
     let entry = { url: aEntry.URI.spec };
--- a/browser/metro/base/content/browser-ui.js
+++ b/browser/metro/base/content/browser-ui.js
@@ -303,17 +303,17 @@ var BrowserUI = {
   },
 
   get isStartTabVisible() {
     return this.isStartURI();
   },
 
   isStartURI: function isStartURI(aURI) {
     aURI = aURI || Browser.selectedBrowser.currentURI.spec;
-    return aURI == kStartURI || aURI == "about:home";
+    return aURI == kStartURI || aURI == "about:start" || aURI == "about:home";
   },
 
   updateStartURIAttributes: function (aURI) {
     let wasStart = Elements.windowState.hasAttribute("startpage");
     aURI = aURI || Browser.selectedBrowser.currentURI.spec;
     if (this.isStartURI(aURI)) {
       ContextUI.displayNavbar();
       Elements.windowState.setAttribute("startpage", "true");
--- a/browser/metro/base/content/browser.js
+++ b/browser/metro/base/content/browser.js
@@ -6,17 +6,17 @@
 let Cc = Components.classes;
 let Ci = Components.interfaces;
 let Cu = Components.utils;
 let Cr = Components.results;
 
 Cu.import("resource://gre/modules/PageThumbs.jsm");
 
 // Page for which the start UI is shown
-const kStartURI = "about:start";
+const kStartURI = "about:newtab";
 
 // allow panning after this timeout on pages with registered touch listeners
 const kTouchTimeout = 300;
 const kSetInactiveStateTimeout = 100;
 
 const kTabThumbnailDelayCapture = 500;
 
 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
--- a/browser/metro/components/AboutRedirector.js
+++ b/browser/metro/components/AboutRedirector.js
@@ -3,17 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 let modules = {
-  start: {
+  newtab: {
     uri: "chrome://browser/content/Start.xul",
     privileged: true
   },
   // about:blank has some bad loading behavior we can avoid, if we use an alias
   empty: {
     uri: "about:blank",
     privileged: false
   },
@@ -32,18 +32,22 @@ let modules = {
   blocked: {
     uri: "chrome://browser/content/blockedSite.xhtml",
     privileged: true
   },
   certerror: {
     uri: "chrome://browser/content/aboutCertError.xhtml",
     privileged: true
   },
+  start: {
+    uri: "about:newtab",
+    privileged: true
+  },
   home: {
-    uri: "about:start",
+    uri: "about:newtab",
     privileged: true
   },
 #ifdef MOZ_CRASHREPORTER
   crashprompt: {
     uri: "chrome://browser/content/crashprompt.xhtml",
     privileged: true
   },
 #endif
--- a/browser/metro/components/BrowserCLH.js
+++ b/browser/metro/components/BrowserCLH.js
@@ -68,17 +68,17 @@ function needHomepageOverride() {
 
     return (savedmstone ? "new version" : "new profile");
   }
 
   return "none";
 }
 
 function getHomePage() {
-  let url = "about:start";
+  let url = "about:newtab";
   try {
     url = Services.prefs.getComplexValue("browser.startup.homepage", Ci.nsIPrefLocalizedString).data;
   } catch (e) { }
 
   return url;
 }
 
 function showPanelWhenReady(aWindow, aPage) {
--- a/browser/metro/components/components.manifest
+++ b/browser/metro/components/components.manifest
@@ -1,15 +1,16 @@
 # AboutRedirector.js
 component {433d2d75-5923-49b0-854d-f37267b03dc7} AboutRedirector.js
 contract @mozilla.org/network/protocol/about;1?what=start {433d2d75-5923-49b0-854d-f37267b03dc7}
 contract @mozilla.org/network/protocol/about;1?what=empty {433d2d75-5923-49b0-854d-f37267b03dc7}
 contract @mozilla.org/network/protocol/about;1?what=firefox {433d2d75-5923-49b0-854d-f37267b03dc7}
 contract @mozilla.org/network/protocol/about;1?what=rights {433d2d75-5923-49b0-854d-f37267b03dc7}
 contract @mozilla.org/network/protocol/about;1?what=certerror {433d2d75-5923-49b0-854d-f37267b03dc7}
+contract @mozilla.org/network/protocol/about;1?what=newtab {433d2d75-5923-49b0-854d-f37267b03dc7}
 contract @mozilla.org/network/protocol/about;1?what=home {433d2d75-5923-49b0-854d-f37267b03dc7}
 #ifdef MOZ_CRASHREPORTER
 contract @mozilla.org/network/protocol/about;1?what=crashprompt {433d2d75-5923-49b0-854d-f37267b03dc7}
 #endif
 #ifdef MOZ_SAFE_BROWSING
 contract @mozilla.org/network/protocol/about;1?what=blocked {433d2d75-5923-49b0-854d-f37267b03dc7}
 #endif