Bug 1073823 - Turn off enhanced tiles for all Firefox 33 users [r=ttaubert a=sylvestre]
authorEd Lee <edilee@mozilla.com>
Tue, 30 Sep 2014 11:07:05 -0700
changeset 216891 8dfb2430db1c
parent 216890 041c9b3d66b1
child 216892 583cc1307044
push id3957
push useredilee@gmail.com
push date2014-10-01 15:55 +0000
treeherdermozilla-beta@8dfb2430db1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert, sylvestre
bugs1073823
milestone33.0
Bug 1073823 - Turn off enhanced tiles for all Firefox 33 users [r=ttaubert a=sylvestre] Check for a _testing value that only gets set for the xpcshell test. Override enabled for mochitest.
browser/base/content/test/newtab/head.js
toolkit/modules/DirectoryLinksProvider.jsm
toolkit/modules/tests/xpcshell/test_DirectoryLinksProvider.js
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -19,16 +19,19 @@ let {Promise, NewTabUtils, Sanitizer, cl
 let uri = Services.io.newURI("about:newtab", null, null);
 let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
 
 let isMac = ("nsILocalFileMac" in Ci);
 let isLinux = ("@mozilla.org/gnome-gconf-service;1" in Cc);
 let isWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
 let gWindow = window;
 
+// Override with enabled for testing (except for individual tests that turn off)
+DirectoryLinksProvider.enabled = true;
+
 // Default to dummy/empty directory links
 let gDirectorySource = 'data:application/json,{"test":1}';
 let gOrigDirectorySource;
 
 // The tests assume all 3 rows and all 3 columns of sites are shown, but the
 // window may be too small to actually show everything.  Resize it if necessary.
 let requiredSize = {};
 requiredSize.innerHeight =
--- a/toolkit/modules/DirectoryLinksProvider.jsm
+++ b/toolkit/modules/DirectoryLinksProvider.jsm
@@ -393,17 +393,18 @@ let DirectoryLinksProvider = {
       });
     }).catch(ex => {
       Cu.reportError(ex);
       return [];
     }).then(aCallback);
   },
 
   init: function DirectoryLinksProvider_init() {
-    this.enabled = this.locale.search(/^(en|de|es|fr|ja|pl|pt|ru)/) == 0;
+    // Allow for overriding enabled to true for testing
+    this.enabled = this._testing && this.locale.search(/^(en|de|es|fr|ja|pl|pt|ru)/) == 0;
 
     this._setDefaultEnhanced();
     this._addPrefsObserver();
     // setup directory file path and last download timestamp
     this._directoryFilePath = OS.Path.join(OS.Constants.Path.localProfileDir, DIRECTORY_LINKS_FILE);
     this._lastDownloadMS = 0;
     return Task.spawn(function() {
       // get the last modified time of the links file if it exists
--- a/toolkit/modules/tests/xpcshell/test_DirectoryLinksProvider.js
+++ b/toolkit/modules/tests/xpcshell/test_DirectoryLinksProvider.js
@@ -17,16 +17,19 @@ Cu.import("resource://gre/modules/osfile
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
   "resource://gre/modules/NetUtil.jsm");
 
 do_get_profile();
 
+// Make sure enabled gets set for xpcshell tests that initialize multiple times
+DirectoryLinksProvider._testing = true;
+
 const DIRECTORY_LINKS_FILE = "directoryLinks.json";
 const DIRECTORY_FRECENCY = 1000;
 const kURLData = {"en-US": [{"url":"http://example.com","title":"LocalSource"}]};
 const kTestURL = 'data:application/json,' + JSON.stringify(kURLData);
 
 // DirectoryLinksProvider preferences
 const kLocalePref = DirectoryLinksProvider._observedPrefs.prefSelectedLocale;
 const kSourceUrlPref = DirectoryLinksProvider._observedPrefs.linksURL;