From 35078555cdc4e02880bdd7ffc76e01ab12db7c86 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Thu, 1 Feb 2018 19:32:00 +0100 Subject: [PATCH] fix _downloadJsonData undefined error --- disable-sponsored-tiles.patch | 50 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/disable-sponsored-tiles.patch b/disable-sponsored-tiles.patch index 1e51d2e..ffc1d85 100644 --- a/disable-sponsored-tiles.patch +++ b/disable-sponsored-tiles.patch @@ -31,25 +31,18 @@ return "en-US"; }, -@@ -283,13 +259,6 @@ var DirectoryLinksProvider = { - }, +@@ -288,7 +264,6 @@ var DirectoryLinksProvider = { + uri = uri.replace("%CHANNEL%", UpdateUtils.UpdateChannel); - _fetchAndCacheLinks: function DirectoryLinksProvider_fetchAndCacheLinks(uri) { -- // Replace with the same display locale used for selecting links data -- uri = uri.replace("%LOCALE%", this.locale); -- uri = uri.replace("%CHANNEL%", UpdateUtils.UpdateChannel); -- -- return this._downloadJsonData(uri).then(json => { + return this._downloadJsonData(uri).then(json => { - return OS.File.writeAtomic(this._directoryFilePath, json, {tmpPath: this._directoryFilePath + ".tmp"}); -- }); + }); }, - /** -@@ -298,33 +267,6 @@ var DirectoryLinksProvider = { - * @return promise resolved to json string, "{}" returned if status != 200 +@@ -299,31 +274,6 @@ var DirectoryLinksProvider = { */ _downloadJsonData: function DirectoryLinksProvider__downloadJsonData(uri) { -- let deferred = Promise.defer(); + let deferred = Promise.defer(); - let xmlHttp = this._newXHR(); - - xmlHttp.onload = function(aResponse) { @@ -75,19 +68,13 @@ - deferred.reject("Error fetching " + uri); - Cu.reportError(e); - } -- return deferred.promise; + return deferred.promise; }, - /** -@@ -332,30 +274,6 @@ var DirectoryLinksProvider = { - * @return promise resolved immediately if no download needed, or upon completion - */ - _fetchAndCacheLinksIfNecessary: function DirectoryLinksProvider_fetchAndCacheLinksIfNecessary(forceDownload=false) { -- if (this._downloadDeferred) { -- // fetching links already - just return the promise -- return this._downloadDeferred.promise; -- } -- +@@ -337,23 +287,6 @@ var DirectoryLinksProvider = { + return this._downloadDeferred.promise; + } + - if (forceDownload || this._needsDownload) { - this._downloadDeferred = Promise.defer(); - this._fetchAndCacheLinks(this._linksURL).then(() => { @@ -105,8 +92,17 @@ - return this._downloadDeferred.promise; - } - -- // download is not needed -- return Promise.resolve(); + // 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; }, - /**