firefox-patches/disable-sponsored-tiles.patch

109 lines
3.3 KiB
Diff

--- a/browser/modules/DirectoryLinksProvider.jsm
+++ b/browser/modules/DirectoryLinksProvider.jsm
@@ -189,30 +189,6 @@ var DirectoryLinksProvider = {
* @return the selected locale or "en-US" if none is selected
*/
get locale() {
- let matchOS;
- try {
- matchOS = Services.prefs.getBoolPref(PREF_MATCH_OS_LOCALE);
- }
- catch (e) {}
-
- if (matchOS) {
- return Services.locale.getLocaleComponentForUserAgent();
- }
-
- try {
- let locale = Services.prefs.getComplexValue(PREF_SELECTED_LOCALE,
- Ci.nsIPrefLocalizedString);
- if (locale) {
- return locale.data;
- }
- }
- catch (e) {}
-
- try {
- return Services.prefs.getCharPref(PREF_SELECTED_LOCALE);
- }
- catch (e) {}
-
return "en-US";
},
@@ -288,7 +264,6 @@ var DirectoryLinksProvider = {
uri = uri.replace("%CHANNEL%", UpdateUtils.UpdateChannel);
return this._downloadJsonData(uri).then(json => {
- return OS.File.writeAtomic(this._directoryFilePath, json, {tmpPath: this._directoryFilePath + ".tmp"});
});
},
@@ -299,31 +274,6 @@ var DirectoryLinksProvider = {
*/
_downloadJsonData: function DirectoryLinksProvider__downloadJsonData(uri) {
let deferred = Promise.defer();
- let xmlHttp = this._newXHR();
-
- xmlHttp.onload = function(aResponse) {
- let json = this.responseText;
- if (this.status && this.status != 200) {
- json = "{}";
- }
- deferred.resolve(json);
- };
-
- xmlHttp.onerror = function(e) {
- deferred.reject("Fetching " + uri + " results in error code: " + e.target.status);
- };
-
- try {
- xmlHttp.open("GET", uri);
- // Override the type so XHR doesn't complain about not well-formed XML
- xmlHttp.overrideMimeType(DIRECTORY_LINKS_TYPE);
- // Set the appropriate request type for servers that require correct types
- xmlHttp.setRequestHeader("Content-Type", DIRECTORY_LINKS_TYPE);
- xmlHttp.send();
- } catch (e) {
- deferred.reject("Error fetching " + uri);
- Cu.reportError(e);
- }
return deferred.promise;
},
@@ -337,23 +287,6 @@ var DirectoryLinksProvider = {
return this._downloadDeferred.promise;
}
- if (forceDownload || this._needsDownload) {
- this._downloadDeferred = Promise.defer();
- this._fetchAndCacheLinks(this._linksURL).then(() => {
- // the new file was successfully downloaded and cached, so update a timestamp
- this._lastDownloadMS = Date.now();
- this._downloadDeferred.resolve();
- this._downloadDeferred = null;
- this._callObservers("onManyLinksChanged")
- },
- error => {
- this._downloadDeferred.resolve();
- this._downloadDeferred = null;
- this._callObservers("onDownloadFail");
- });
- return this._downloadDeferred.promise;
- }
-
// download is not needed
return Promise.resolve();
},
@@ -362,10 +295,6 @@ var DirectoryLinksProvider = {
* @return true if download is needed, false otherwise
*/
get _needsDownload () {
- // fail if last download occured less then 24 hours ago
- if ((Date.now() - this._lastDownloadMS) > this._downloadIntervalMS) {
- return true;
- }
return false;
},