Bug 1433133 - remove unused prefs and exported bits from NewTabUtils.jsm, r?dao draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 06 Mar 2018 22:56:07 +0000
changeset 764189 8a5a2398c13e9ee6ec87643a5faac3cbbe9d353c
parent 763961 7d28e5630dc4e136de2adba4b1101466ab61bf76
push id101693
push userbmo:gijskruitbosch+bugs@gmail.com
push dateWed, 07 Mar 2018 11:28:25 +0000
reviewersdao
bugs1433133
milestone60.0a1
Bug 1433133 - remove unused prefs and exported bits from NewTabUtils.jsm, r?dao MozReview-Commit-ID: 75xPd5hKexV
browser/app/profile/firefox.js
testing/geckodriver/src/prefs.rs
testing/marionette/client/marionette_driver/geckoinstance.py
testing/marionette/components/marionette.js
testing/profiles/prefs_general.js
testing/talos/talos/config.py
toolkit/components/telemetry/TelemetryEnvironment.jsm
toolkit/modules/NewTabUtils.jsm
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1162,17 +1162,16 @@ pref("services.sync.prefs.sync.addons.ig
 // could weaken the pref locally, install an add-on from an untrusted
 // source, and this would propagate automatically to other,
 // uncompromised Sync-connected devices.
 pref("services.sync.prefs.sync.browser.ctrlTab.previews", true);
 pref("services.sync.prefs.sync.browser.download.useDownloadDir", true);
 pref("services.sync.prefs.sync.browser.formfill.enable", true);
 pref("services.sync.prefs.sync.browser.link.open_newwindow", true);
 pref("services.sync.prefs.sync.browser.newtabpage.enabled", true);
-pref("services.sync.prefs.sync.browser.newtabpage.enhanced", true);
 pref("services.sync.prefs.sync.browser.newtabpage.pinned", true);
 pref("services.sync.prefs.sync.browser.offline-apps.notify", true);
 pref("services.sync.prefs.sync.browser.safebrowsing.phishing.enabled", true);
 pref("services.sync.prefs.sync.browser.safebrowsing.malware.enabled", true);
 pref("services.sync.prefs.sync.browser.safebrowsing.downloads.enabled", true);
 pref("services.sync.prefs.sync.browser.safebrowsing.passwords.enabled", true);
 pref("services.sync.prefs.sync.browser.search.update", true);
 pref("services.sync.prefs.sync.browser.sessionstore.restore_on_demand", true);
@@ -1252,39 +1251,20 @@ sticky_pref("lightweightThemes.selectedT
 pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties");
 
 // Allow using tab-modal prompts when possible.
 pref("prompts.tab_modal.enabled", true);
 
 // Activates preloading of the new tab url.
 pref("browser.newtab.preload", true);
 
-// Remembers if the about:newtab intro has been shown
-// NOTE: This preference is unused but was not removed in case
-//       this information will be valuable in the future.
-pref("browser.newtabpage.introShown", false);
-
-// Toggles the content of 'about:newtab'. Shows the grid when enabled.
+// Is supposed to toggle something to do with about:newtab . Doesn't seem to do
+// anything in activity stream. bug 1443646 covers dealing with this.
 pref("browser.newtabpage.enabled", true);
 
-// Toggles the directory tiles content of 'about:newtab'.
-sticky_pref("browser.newtabpage.enhanced", true);
-
-// enables Activity Stream inspired layout
-pref("browser.newtabpage.compact", false);
-
-// enables showing basic placeholders for missing thumbnails
-pref("browser.newtabpage.thumbnailPlaceholder", false);
-
-// number of rows of newtab grid
-pref("browser.newtabpage.rows", 3);
-
-// number of columns of newtab grid
-pref("browser.newtabpage.columns", 5);
-
 // Activity Stream prefs that control to which page to redirect
 pref("browser.newtabpage.activity-stream.prerender", true);
 #ifndef RELEASE_OR_BETA
 #ifdef MOZILLA_OFFICIAL
 pref("browser.newtabpage.activity-stream.debug", false);
 #else
 pref("browser.newtabpage.activity-stream.debug", true);
 #endif
--- a/testing/geckodriver/src/prefs.rs
+++ b/testing/geckodriver/src/prefs.rs
@@ -1,12 +1,12 @@
 use mozprofile::preferences::Pref;
 
 lazy_static! {
-    pub static ref DEFAULT: [(&'static str, Pref); 80] = [
+    pub static ref DEFAULT: [(&'static str, Pref); 79] = [
         // Disable automatic downloading of new releases
         ("app.update.auto", Pref::new(false)),
 
         // Disable automatically upgrading Firefox
         ("app.update.enabled", Pref::new(false)),
 
         // Increase the APZ content response timeout in tests to 1
         // minute.  This is to accommodate the fact that test environments
@@ -28,21 +28,16 @@ lazy_static! {
         ("browser.download.panel.shown", Pref::new(true)),
 
         // Implicitly accept license
         ("browser.EULA.override", Pref::new(true)),
 
         // use about:blank as new tab page
         ("browser.newtabpage.enabled", Pref::new(false)),
 
-        // Assume the about:newtab pages intro panels have been shown
-        // to not depend on which test runs first and happens to open
-        // about:newtab
-        ("browser.newtabpage.introShown", Pref::new(true)),
-
         // Never start the browser in offline mode
         ("browser.offline", Pref::new(false)),
 
         // Background thumbnails in particular cause grief, and disabling
         // thumbnails in general cannot hurt
         ("browser.pagethumbnails.capturing_disabled", Pref::new(true)),
 
         // Avoid performing Reader Mode intros during tests
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -494,19 +494,16 @@ class DesktopInstance(GeckoInstance):
         # download test runs first doesn"t show the popup inconsistently
         "browser.download.panel.shown": True,
 
         # Do not show the EULA notification which can interfer with tests
         "browser.EULA.override": True,
 
         # Turn off about:newtab and make use of about:blank instead for new opened tabs
         "browser.newtabpage.enabled": False,
-        # Assume the about:newtab page"s intro panels have been shown to not depend on
-        # which test runs first and happens to open about:newtab
-        "browser.newtabpage.introShown": True,
 
         # Background thumbnails in particular cause grief, and disabling thumbnails
         # in general can"t hurt - we re-enable them when tests need them
         "browser.pagethumbnails.capturing_disabled": True,
 
         # Disable safebrowsing components
         "browser.safebrowsing.blockedURIs.enabled": False,
         "browser.safebrowsing.downloads.enabled": False,
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -88,20 +88,16 @@ const RECOMMENDED_PREFS = new Map([
 
   // Turn off about:newtab and make use of about:blank instead for new
   // opened tabs.
   //
   // This should also be set in the profile prior to starting Firefox,
   // as it is picked up at runtime.
   ["browser.newtabpage.enabled", false],
 
-  // Assume the about:newtab page's intro panels have been shown to not
-  // depend on which test runs first and happens to open about:newtab
-  ["browser.newtabpage.introShown", true],
-
   // Never start the browser in offline mode
   //
   // This should also be set in the profile prior to starting Firefox,
   // as it is picked up at runtime.
   ["browser.offline", false],
 
   // Background thumbnails in particular cause grief, and disabling
   // thumbnails in general cannot hurt
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -293,19 +293,16 @@ user_pref("browser.aboutHomeSnippets.upd
 
 // Use an empty list of sites to avoid fetching
 user_pref("browser.newtabpage.activity-stream.default.sites", "");
 user_pref("browser.newtabpage.activity-stream.telemetry", false);
 user_pref("browser.newtabpage.activity-stream.tippyTop.service.endpoint", "");
 user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
 user_pref("browser.newtabpage.activity-stream.feeds.snippets", false);
 
-// Don't fetch directory tiles data from real servers
-user_pref("browser.newtabpage.directory.source", 'data:application/json,{"testing":1}');
-
 // Ensure UITour won't hit the network
 user_pref("browser.uitour.pinnedTabUrl", "http://%(server)s/uitour-dummy/pinnedTab");
 user_pref("browser.uitour.url", "http://%(server)s/uitour-dummy/tour");
 
 // Tell the search service we are running in the US.  This also has the desired
 // side-effect of preventing our geoip lookup.
 user_pref("browser.search.isUS", true);
 user_pref("browser.search.countryCode", "US");
--- a/testing/talos/talos/config.py
+++ b/testing/talos/talos/config.py
@@ -107,17 +107,16 @@ DEFAULTS = dict(
         'dom.send_after_paint_to_content': True,
         'security.turn_off_all_security_so_that_viruses_can_'
         'take_over_this_computer': True,
         'browser.newtabpage.activity-stream.default.sites': '',
         'browser.newtabpage.activity-stream.telemetry': False,
         'browser.newtabpage.activity-stream.tippyTop.service.endpoint': '',
         'browser.newtabpage.activity-stream.feeds.section.topstories': False,
         'browser.newtabpage.activity-stream.feeds.snippets': False,
-        'browser.newtabpage.introShown': True,
         'browser.safebrowsing.downloads.remote.url':
             'http://127.0.0.1/safebrowsing-dummy/downloads',
         'browser.safebrowsing.provider.google.gethashURL':
             'http://127.0.0.1/safebrowsing-dummy/gethash',
         'browser.safebrowsing.provider.google.updateURL':
             'http://127.0.0.1/safebrowsing-dummy/update',
         'browser.safebrowsing.provider.google4.gethashURL':
             'http://127.0.0.1/safebrowsing4-dummy/gethash',
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -195,17 +195,16 @@ const DEFAULT_ENVIRONMENT_PREFS = new Ma
   ["app.update.silent", {what: RECORD_PREF_VALUE}],
   ["app.update.url", {what: RECORD_PREF_VALUE}],
   ["browser.cache.disk.enable", {what: RECORD_PREF_VALUE}],
   ["browser.cache.disk.capacity", {what: RECORD_PREF_VALUE}],
   ["browser.cache.memory.enable", {what: RECORD_PREF_VALUE}],
   ["browser.cache.offline.enable", {what: RECORD_PREF_VALUE}],
   ["browser.formfill.enable", {what: RECORD_PREF_VALUE}],
   ["browser.newtabpage.enabled", {what: RECORD_PREF_VALUE}],
-  ["browser.newtabpage.enhanced", {what: RECORD_PREF_VALUE}],
   ["browser.shell.checkDefaultBrowser", {what: RECORD_PREF_VALUE}],
   ["browser.search.ignoredJAREngines", {what: RECORD_DEFAULTPREF_VALUE}],
   ["browser.search.region", {what: RECORD_PREF_VALUE}],
   ["browser.search.suggest.enabled", {what: RECORD_PREF_VALUE}],
   ["browser.search.widget.inNavBar", {what: RECORD_DEFAULTPREF_VALUE}],
   ["browser.startup.homepage", {what: RECORD_PREF_STATE}],
   ["browser.startup.page", {what: RECORD_PREF_VALUE}],
   ["toolkit.cosmeticAnimations.enabled", {what: RECORD_PREF_VALUE}],
--- a/toolkit/modules/NewTabUtils.jsm
+++ b/toolkit/modules/NewTabUtils.jsm
@@ -33,23 +33,16 @@ XPCOMUtils.defineLazyGetter(this, "gUnic
   let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
                     .createInstance(Ci.nsIScriptableUnicodeConverter);
   converter.charset = "utf8";
   return converter;
 });
 
 // Boolean preferences that control newtab content
 const PREF_NEWTAB_ENABLED = "browser.newtabpage.enabled";
-const PREF_NEWTAB_ENHANCED = "browser.newtabpage.enhanced";
-
-// The preference that tells the number of rows of the newtab grid.
-const PREF_NEWTAB_ROWS = "browser.newtabpage.rows";
-
-// The preference that tells the number of columns of the newtab grid.
-const PREF_NEWTAB_COLUMNS = "browser.newtabpage.columns";
 
 // The maximum number of results PlacesProvider retrieves from history.
 const HISTORY_RESULTS_LIMIT = 100;
 
 // The maximum number of links Links.getLinks will return.
 const LINKS_GET_LINKS_LIMIT = 100;
 
 // The gather telemetry topic.
@@ -204,21 +197,16 @@ var AllPages = {
   _pages: [],
 
   /**
    * Cached value that tells whether the New Tab Page feature is enabled.
    */
   _enabled: null,
 
   /**
-   * Cached value that tells whether the New Tab Page feature is enhanced.
-   */
-  _enhanced: null,
-
-  /**
    * Adds a page to the internal list of pages.
    * @param aPage The page to register.
    */
   register: function AllPages_register(aPage) {
     this._pages.push(aPage);
     this._addObserver();
   },
 
@@ -246,34 +234,16 @@ var AllPages = {
    * Enables or disables the 'New Tab Page' feature.
    */
   set enabled(aEnabled) {
     if (this.enabled != aEnabled)
       Services.prefs.setBoolPref(PREF_NEWTAB_ENABLED, !!aEnabled);
   },
 
   /**
-   * Returns whether the history tiles are enhanced.
-   */
-  get enhanced() {
-    if (this._enhanced === null)
-      this._enhanced = Services.prefs.getBoolPref(PREF_NEWTAB_ENHANCED);
-
-    return this._enhanced;
-  },
-
-  /**
-   * Enables or disables the enhancement of history tiles feature.
-   */
-  set enhanced(aEnhanced) {
-    if (this.enhanced != aEnhanced)
-      Services.prefs.setBoolPref(PREF_NEWTAB_ENHANCED, !!aEnhanced);
-  },
-
-  /**
    * Returns the number of registered New Tab Pages (i.e. the number of open
    * about:newtab instances).
    */
   get length() {
     return this._pages.length;
   },
 
   /**
@@ -295,105 +265,39 @@ var AllPages = {
    */
   observe: function AllPages_observe(aSubject, aTopic, aData) {
     if (aTopic == "nsPref:changed") {
       // Clear the cached value.
       switch (aData) {
         case PREF_NEWTAB_ENABLED:
           this._enabled = null;
           break;
-        case PREF_NEWTAB_ENHANCED:
-          this._enhanced = null;
-          break;
       }
     }
     // and all notifications get forwarded to each page.
     this._pages.forEach(function(aPage) {
       aPage.observe(aSubject, aTopic, aData);
     }, this);
   },
 
   /**
    * Adds a preference and new thumbnail observer and turns itself into a
    * no-op after the first invokation.
    */
   _addObserver: function AllPages_addObserver() {
     Services.prefs.addObserver(PREF_NEWTAB_ENABLED, this, true);
-    Services.prefs.addObserver(PREF_NEWTAB_ENHANCED, this, true);
     Services.obs.addObserver(this, "page-thumbnail:create", true);
     this._addObserver = function() {};
   },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
                                          Ci.nsISupportsWeakReference])
 };
 
 /**
- * Singleton that keeps Grid preferences
- */
-var GridPrefs = {
-  /**
-   * Cached value that tells the number of rows of newtab grid.
-   */
-  _gridRows: null,
-  get gridRows() {
-    if (!this._gridRows) {
-      this._gridRows = Math.max(1, Services.prefs.getIntPref(PREF_NEWTAB_ROWS));
-    }
-
-    return this._gridRows;
-  },
-
-  /**
-   * Cached value that tells the number of columns of newtab grid.
-   */
-  _gridColumns: null,
-  get gridColumns() {
-    if (!this._gridColumns) {
-      this._gridColumns = Math.max(1, Services.prefs.getIntPref(PREF_NEWTAB_COLUMNS));
-    }
-
-    return this._gridColumns;
-  },
-
-
-  /**
-   * Initializes object. Adds a preference observer
-   */
-  init: function GridPrefs_init() {
-    Services.prefs.addObserver(PREF_NEWTAB_ROWS, this);
-    Services.prefs.addObserver(PREF_NEWTAB_COLUMNS, this);
-  },
-
- /**
-  * Uninitializes object. Removes the preference observers
-  */
-  uninit: function GridPrefs_uninit() {
-    Services.prefs.removeObserver(PREF_NEWTAB_ROWS, this);
-    Services.prefs.removeObserver(PREF_NEWTAB_COLUMNS, this);
-  },
-
-  /**
-   * Implements the nsIObserver interface to get notified when the preference
-   * value changes.
-   */
-  observe: function GridPrefs_observe(aSubject, aTopic, aData) {
-    if (aData == PREF_NEWTAB_ROWS) {
-      this._gridRows = null;
-    } else {
-      this._gridColumns = null;
-    }
-
-    AllPages.update();
-  }
-};
-
-GridPrefs.init();
-
-/**
  * Singleton that keeps track of all pinned links and their positions in the
  * grid.
  */
 var PinnedLinks = {
   /**
    * The cached list of pinned links.
    */
   _links: null,
@@ -1833,20 +1737,16 @@ var Links = {
   /**
    * Merges the cached lists of links from all providers whose lists are cached.
    * @return The merged list.
    */
   _getMergedProviderLinks: function Links__getMergedProviderLinks() {
     // Build a list containing a copy of each provider's sortedLinks list.
     let linkLists = [];
     for (let provider of this._providers.keys()) {
-      if (!AllPages.enhanced && provider != PlacesProvider) {
-        // Only show history tiles if we're not in 'enhanced' mode.
-        continue;
-      }
       let links = this._providers.get(provider);
       if (links && links.sortedLinks) {
         linkLists.push(links.sortedLinks.slice());
       }
     }
 
     return this.mergeLinkLists(linkLists);
   },
@@ -2049,18 +1949,16 @@ var Telemetry = {
 
   /**
    * Collects data.
    */
   _collect: function Telemetry_collect() {
     let probes = [
       { histogram: "NEWTAB_PAGE_ENABLED",
         value: AllPages.enabled },
-      { histogram: "NEWTAB_PAGE_ENHANCED",
-        value: AllPages.enhanced },
       { histogram: "NEWTAB_PAGE_PINNED_SITES_COUNT",
         value: PinnedLinks.links.length },
       { histogram: "NEWTAB_PAGE_BLOCKED_SITES_COUNT",
         value: Object.keys(BlockedLinks.links).length }
     ];
 
     probes.forEach(function Telemetry_collect_forEach(aProbe) {
       Services.telemetry.getHistogramById(aProbe.histogram)
@@ -2181,17 +2079,16 @@ var NewTabUtils = {
       return true;
     }
     return false;
   },
 
   uninit: function NewTabUtils_uninit() {
     if (this.initialized) {
       Telemetry.uninit();
-      GridPrefs.uninit();
       BlockedLinks.removeObservers();
     }
   },
 
   getProviderLinks(aProvider) {
     let cache = Links._providers.get(aProvider);
     if (cache && cache.sortedLinks) {
       return cache.sortedLinks;
@@ -2234,16 +2131,13 @@ var NewTabUtils = {
     Storage.remove("blockedLinks");
     Links.resetCache();
     BlockedLinks.resetCache();
     Links.populateCache(aCallback, true);
   },
 
   links: Links,
   allPages: AllPages,
-  linkChecker: LinkChecker,
   pinnedLinks: PinnedLinks,
   blockedLinks: BlockedLinks,
-  gridPrefs: GridPrefs,
-  placesProvider: PlacesProvider,
   activityStreamLinks: ActivityStreamLinks,
   activityStreamProvider: ActivityStreamProvider
 };