[Pkg-mozext-commits] [adblock-plus] 437/464: Relanded changeset 2d52467436ed (Issue 427 - Remove non-standard function and getter syntax) with appropriate compat info changes
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 724b240651bc5ac2577ce226a6637ee5192564aa
Author: Wladimir Palant <trev at adblockplus.org>
Date: Tue Jun 3 16:56:25 2014 +0200
Relanded changeset 2d52467436ed (Issue 427 - Remove non-standard function and getter syntax) with appropriate compat info changes
---
lib/appSupport.js | 12 ++++++------
lib/customizableUI.js | 2 +-
lib/elemHide.js | 5 ++++-
lib/filterClasses.js | 19 ++++++++++++++-----
lib/filterStorage.js | 15 +++++++++------
lib/io.js | 2 +-
lib/requestNotifier.js | 22 ++++++++++++++--------
lib/subscriptionClasses.js | 42 +++++++++++++++++++++++++++++++++---------
lib/sync.js | 2 +-
lib/synchronizer.js | 2 +-
lib/ui.js | 26 +++++++++++++-------------
lib/utils.js | 6 +++---
metadata.gecko | 10 +++++-----
13 files changed, 105 insertions(+), 60 deletions(-)
diff --git a/lib/appSupport.js b/lib/appSupport.js
index 664da1a..67c6248 100644
--- a/lib/appSupport.js
+++ b/lib/appSupport.js
@@ -28,7 +28,7 @@ Cu.import("resource://gre/modules/AddonManager.jsm");
* user interface elements.
* @result Boolean
*/
-exports.isKnownWindow = function isKnownWindow(/**Window*/ window) false;
+exports.isKnownWindow = (/**Window*/ window) => false;
/**
* HACK: In some applications the window finishes initialization during load
@@ -264,7 +264,7 @@ switch (application)
return (window.document.documentElement.getAttribute("windowtype") == "navigator:browser");
};
- exports.getBrowser = function ff_getBrowser(window) window.gBrowser;
+ exports.getBrowser = (window) => window.gBrowser;
exports.addTab = function ff_addTab(window, url, event)
{
@@ -396,7 +396,7 @@ switch (application)
exports.delayInitialization = true;
- exports.getBrowser = function tb_getBrowser(window) window.getBrowser();
+ exports.getBrowser = (window) => window.getBrowser();
exports.addTab = function tb_addTab(window, url, event)
{
@@ -683,11 +683,11 @@ switch (application)
case "fennec2":
{
- exports.isKnownWindow = function fmn_isKnownWindow(/**Window*/ window) window.document.documentElement.id == "main-window";
+ exports.isKnownWindow = (window) => window.document.documentElement.id == "main-window";
- exports.getBrowser = function fmn_getBrowser(window) window.BrowserApp.selectedBrowser;
+ exports.getBrowser = (window) => window.BrowserApp.selectedBrowser;
- exports.addTab = function fmn_addTab(window, url, event) window.BrowserApp.addTab(url, {selected: true});
+ exports.addTab = (window, url, event) => window.BrowserApp.addTab(url, {selected: true});
let BrowserChangeListener = function(window, callback)
{
diff --git a/lib/customizableUI.js b/lib/customizableUI.js
index e7e69e3..7db7425 100644
--- a/lib/customizableUI.js
+++ b/lib/customizableUI.js
@@ -24,7 +24,7 @@ let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", null);
let {Utils} = require("utils");
// UI module has to be referenced lazily to avoid circular references
-XPCOMUtils.defineLazyGetter(this, "UI", function() require("ui").UI);
+XPCOMUtils.defineLazyGetter(this, "UI", () => require("ui").UI);
let widgets = Map();
diff --git a/lib/elemHide.js b/lib/elemHide.js
index b5a1473..df17a0f 100644
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -379,7 +379,10 @@ let ElemHide = exports.ElemHide =
* Retrieves the currently applied stylesheet URL
* @type String
*/
- get styleURL() ElemHide.applied ? styleURL.spec : null,
+ get styleURL()
+ {
+ return ElemHide.applied ? styleURL.spec : null;
+ },
/**
* Retrieves an element hiding filter by the corresponding protocol key
diff --git a/lib/filterClasses.js b/lib/filterClasses.js
index 044022d..e3c2d2f 100644
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -239,7 +239,10 @@ ActiveFilter.prototype =
* Defines whether the filter is disabled
* @type Boolean
*/
- get disabled() this._disabled,
+ get disabled()
+ {
+ return this._disabled;
+ },
set disabled(value)
{
if (value != this._disabled)
@@ -255,7 +258,10 @@ ActiveFilter.prototype =
* Number of hits on the filter since the last reset
* @type Number
*/
- get hitCount() this._hitCount,
+ get hitCount()
+ {
+ return this._hitCount;
+ },
set hitCount(value)
{
if (value != this._hitCount)
@@ -271,7 +277,10 @@ ActiveFilter.prototype =
* Last time the filter had a hit (in milliseconds since the beginning of the epoch)
* @type Number
*/
- get lastHit() this._lastHit,
+ get lastHit()
+ {
+ return this._lastHit;
+ },
set lastHit(value)
{
if (value != this._lastHit)
@@ -464,7 +473,7 @@ function RegExpFilter(text, regexpSource, contentType, matchCase, domains, third
{
// The filter is a regular expression - convert it immediately to catch syntax errors
let regexp = new RegExp(regexpSource.substr(1, regexpSource.length - 2), this.matchCase ? "" : "i");
- this.__defineGetter__("regexp", function() regexp);
+ this.__defineGetter__("regexp", () => regexp);
}
else
{
@@ -522,7 +531,7 @@ RegExpFilter.prototype =
let regexp = new RegExp(source, this.matchCase ? "" : "i");
delete this.regexpSource;
- this.__defineGetter__("regexp", function() regexp);
+ this.__defineGetter__("regexp", () => regexp);
return this.regexp;
},
/**
diff --git a/lib/filterStorage.js b/lib/filterStorage.js
index 01b7328..546f788 100644
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -47,7 +47,10 @@ let FilterStorage = exports.FilterStorage =
* Version number of the patterns.ini format used.
* @type Integer
*/
- get formatVersion() formatVersion,
+ get formatVersion()
+ {
+ return formatVersion;
+ },
/**
* File that the filter list has been loaded from and should be saved to
@@ -82,7 +85,7 @@ let FilterStorage = exports.FilterStorage =
if (!file)
Cu.reportError("Adblock Plus: Failed to resolve filter file location from extensions.adblockplus.patternsfile preference");
- this.__defineGetter__("sourceFile", function() file);
+ this.__defineGetter__("sourceFile", () => file);
return this.sourceFile;
},
@@ -225,7 +228,7 @@ let FilterStorage = exports.FilterStorage =
{
if (!subscription)
{
- if (filter.subscriptions.some(function(s) s instanceof SpecialSubscription && !s.disabled))
+ if (filter.subscriptions.some(s => s instanceof SpecialSubscription && !s.disabled))
return; // No need to add
subscription = FilterStorage.getGroupForFilter(filter);
}
@@ -628,7 +631,7 @@ let FilterStorage = exports.FilterStorage =
TimeLine.enter("FilterStorage.saveToDisk() -> removeLastBackup()");
let file = targetFile.clone();
file.leafName = part1 + "-backup" + Prefs.patternsbackups + part2;
- IO.removeFile(file, function(e) renameBackup(part1, part2, Prefs.patternsbackups - 1));
+ IO.removeFile(file, (e) => renameBackup(part1, part2, Prefs.patternsbackups - 1));
TimeLine.leave("FilterStorage.saveToDisk() <- removeLastBackup()");
}.bind(this);
@@ -642,7 +645,7 @@ let FilterStorage = exports.FilterStorage =
let toName = part1 + "-backup" + (index + 1) + part2;
- IO.renameFile(fromFile, toName, function(e) renameBackup(part1, part2, index - 1));
+ IO.renameFile(fromFile, toName, (e) => renameBackup(part1, part2, index - 1));
}
else
{
@@ -655,7 +658,7 @@ let FilterStorage = exports.FilterStorage =
}.bind(this);
// Do not persist external subscriptions
- let subscriptions = this.subscriptions.filter(function(s) !(s instanceof ExternalSubscription));
+ let subscriptions = this.subscriptions.filter((s) => !(s instanceof ExternalSubscription));
if (!explicitFile)
this._saving = true;
diff --git a/lib/io.js b/lib/io.js
index dfe8b8f..ea362b7 100644
--- a/lib/io.js
+++ b/lib/io.js
@@ -40,7 +40,7 @@ let IO = exports.IO =
{
let lineBreak = (Services.appinfo.OS == "WINNT" ? "\r\n" : "\n");
delete IO.lineBreak;
- IO.__defineGetter__("lineBreak", function() lineBreak);
+ IO.__defineGetter__("lineBreak", () => lineBreak);
return IO.lineBreak;
},
diff --git a/lib/requestNotifier.js b/lib/requestNotifier.js
index 63edc5f..2ee9ec3 100644
--- a/lib/requestNotifier.js
+++ b/lib/requestNotifier.js
@@ -32,9 +32,9 @@ let setEntry, hasEntry, getEntry;
// Last issue(Bug 982561) preventing us from using WeakMap fixed for FF version 32
if (Services.vc.compare(Utils.platformVersion, "32.0a1") >= 0)
{
- setEntry = function(map, key, value) map.set(key, value);
- hasEntry = function(map, key) map.has(key);
- getEntry = function(map, key) map.get(key);
+ setEntry = (map, key, value) => map.set(key, value);
+ hasEntry = (map, key) => map.has(key);
+ getEntry = (map, key) => map.get(key);
}
else
{
@@ -58,9 +58,9 @@ else
}
};
- setEntry = function(map, key, value) key.setUserData(getProp(map), value, null);
- hasEntry = function(map, key) key.getUserData(getProp(map));
- getEntry = function(map, key) key.getUserData(getProp(map)) || undefined;
+ setEntry = (map, key, value) => key.setUserData(getProp(map), value, null);
+ hasEntry = (map, key) => key.getUserData(getProp(map));
+ getEntry = (map, key) => key.getUserData(getProp(map)) || undefined;
}
/**
@@ -347,12 +347,18 @@ RequestEntry.prototype =
* String representation of the content type, e.g. "subdocument"
* @type String
*/
- get typeDescr() require("contentPolicy").Policy.typeDescr[this.type],
+ get typeDescr()
+ {
+ return require("contentPolicy").Policy.typeDescr[this.type];
+ },
/**
* User-visible localized representation of the content type, e.g. "frame"
* @type String
*/
- get localizedDescr() require("contentPolicy").Policy.localizedDescr[this.type],
+ get localizedDescr()
+ {
+ return require("contentPolicy").Policy.localizedDescr[this.type];
+ },
/**
* Attaches this request object to a DOM node.
diff --git a/lib/subscriptionClasses.js b/lib/subscriptionClasses.js
index 58b028b..1d777bc 100644
--- a/lib/subscriptionClasses.js
+++ b/lib/subscriptionClasses.js
@@ -68,7 +68,10 @@ Subscription.prototype =
* Title of the filter subscription
* @type String
*/
- get title() this._title,
+ get title()
+ {
+ return this._title;
+ },
set title(value)
{
if (value != this._title)
@@ -84,7 +87,10 @@ Subscription.prototype =
* Determines whether the title should be editable
* @type Boolean
*/
- get fixedTitle() this._fixedTitle,
+ get fixedTitle()
+ {
+ return this._fixedTitle;
+ },
set fixedTitle(value)
{
if (value != this._fixedTitle)
@@ -100,7 +106,10 @@ Subscription.prototype =
* Defines whether the filters in the subscription should be disabled
* @type Boolean
*/
- get disabled() this._disabled,
+ get disabled()
+ {
+ return this._disabled;
+ },
set disabled(value)
{
if (value != this._disabled)
@@ -293,7 +302,7 @@ SpecialSubscription.prototype =
{
Subscription.prototype.serialize.call(this, buffer);
if (this.defaults && this.defaults.length)
- buffer.push("defaults=" + this.defaults.filter(function(type) type in SpecialSubscription.defaultsMap).join(" "));
+ buffer.push("defaults=" + this.defaults.filter((type) => type in SpecialSubscription.defaultsMap).join(" "));
if (this._lastDownload)
buffer.push("lastDownload=" + this._lastDownload);
}
@@ -366,7 +375,10 @@ RegularSubscription.prototype =
* Filter subscription homepage if known
* @type String
*/
- get homepage() this._homepage,
+ get homepage()
+ {
+ return this._homepage;
+ },
set homepage(value)
{
if (value != this._homepage)
@@ -382,7 +394,10 @@ RegularSubscription.prototype =
* Time of the last subscription download (in seconds since the beginning of the epoch)
* @type Number
*/
- get lastDownload() this._lastDownload,
+ get lastDownload()
+ {
+ return this._lastDownload;
+ },
set lastDownload(value)
{
if (value != this._lastDownload)
@@ -458,7 +473,10 @@ DownloadableSubscription.prototype =
* Status of the last download (ID of a string)
* @type String
*/
- get downloadStatus() this._downloadStatus,
+ get downloadStatus()
+ {
+ return this._downloadStatus;
+ },
set downloadStatus(value)
{
let oldValue = this._downloadStatus;
@@ -479,7 +497,10 @@ DownloadableSubscription.prototype =
* if the user doesn't use Adblock Plus for some time.
* @type Number
*/
- get lastCheck() this._lastCheck,
+ get lastCheck()
+ {
+ return this._lastCheck;
+ },
set lastCheck(value)
{
if (value != this._lastCheck)
@@ -507,7 +528,10 @@ DownloadableSubscription.prototype =
* Number of download failures since last success
* @type Number
*/
- get errors() this._errors,
+ get errors()
+ {
+ return this._errors;
+ },
set errors(value)
{
if (value != this._errors)
diff --git a/lib/sync.js b/lib/sync.js
index fe0a4ab..05eeced 100644
--- a/lib/sync.js
+++ b/lib/sync.js
@@ -306,7 +306,7 @@ ABPStore.prototype =
if (trackerInstance.didFilterChange(filter))
continue;
- if (filter.subscriptions.some(function(subscription) subscription instanceof SpecialSubscription))
+ if (filter.subscriptions.some((subscription) => subscription instanceof SpecialSubscription))
{
// Filter might have been changed remotely
if (filter instanceof ActiveFilter)
diff --git a/lib/synchronizer.js b/lib/synchronizer.js
index 590ad73..619270c 100644
--- a/lib/synchronizer.js
+++ b/lib/synchronizer.js
@@ -311,7 +311,7 @@ let Synchronizer = exports.Synchronizer =
redirectCallback(match[2]);
else if (match && match[1] == "410") // Gone
{
- let data = "[Adblock]\n" + subscription.filters.map(function(f) f.text).join("\n");
+ let data = "[Adblock]\n" + subscription.filters.map((f) => f.text).join("\n");
redirectCallback("data:text/plain," + encodeURIComponent(data));
}
}, false);
diff --git a/lib/ui.js b/lib/ui.js
index e61200a..ab5b089 100644
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -126,7 +126,8 @@ let optionsObserver =
this.value = Prefs.savestats;
});
- let hasAcceptableAds = FilterStorage.subscriptions.some(function(subscription) subscription instanceof DownloadableSubscription && subscription.url == Prefs.subscriptions_exceptionsurl);
+ let hasAcceptableAds = FilterStorage.subscriptions.some((subscription) => subscription instanceof DownloadableSubscription &&
+ subscription.url == Prefs.subscriptions_exceptionsurl);
setChecked("adblockplus-acceptableAds", hasAcceptableAds);
addCommandHandler("adblockplus-acceptableAds", function()
{
@@ -158,9 +159,8 @@ let optionsObserver =
if (onShutdown.done)
return;
- let currentSubscription = FilterStorage.subscriptions.filter(
- function(subscription) subscription instanceof DownloadableSubscription && subscription.url != Prefs.subscriptions_exceptionsurl
- );
+ let currentSubscription = FilterStorage.subscriptions.filter((subscription) => subscription instanceof DownloadableSubscription &&
+ subscription.url != Prefs.subscriptions_exceptionsurl);
currentSubscription = (currentSubscription.length ? currentSubscription[0] : null);
let subscriptions =request.responseXML.getElementsByTagName("subscription");
@@ -342,7 +342,7 @@ let UI = exports.UI =
// Remove whitespace text nodes
let walker = root.ownerDocument.createTreeWalker(
root, Ci.nsIDOMNodeFilter.SHOW_TEXT,
- function(node) !/\S/.test(node.nodeValue), false
+ (node) => !/\S/.test(node.nodeValue), false
);
let whitespaceNodes = [];
while (walker.nextNode())
@@ -422,7 +422,7 @@ let UI = exports.UI =
notificationTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
notificationTimer.initWithCallback(this.showNextNotification.bind(this),
3 * 60 * 1000, Ci.nsITimer.TYPE_ONE_SHOT);
- onShutdown.add(function() notificationTimer.cancel());
+ onShutdown.add(() => notificationTimer.cancel());
// Add "anti-adblock messages" notification
initAntiAdblockNotification();
@@ -782,18 +782,18 @@ let UI = exports.UI =
"https://hg01.codeplex.com/fanboyadblock/raw-file/tip/fanboy-adblocklist-stats.txt": true,
"https://adversity.googlecode.com/hg/Adversity-Tracking.txt": true
};
- if (FilterStorage.subscriptions.some(function(subscription) subscription.url == Prefs.subscriptions_exceptionsurl || subscription.url in privacySubscriptions))
+ if (FilterStorage.subscriptions.some((subscription) => subscription.url == Prefs.subscriptions_exceptionsurl || subscription.url in privacySubscriptions))
addAcceptable = false;
// Don't add subscription if the user has a subscription already
let addSubscription = true;
- if (FilterStorage.subscriptions.some(function(subscription) subscription instanceof DownloadableSubscription && subscription.url != Prefs.subscriptions_exceptionsurl))
+ if (FilterStorage.subscriptions.some((subscription) => subscription instanceof DownloadableSubscription && subscription.url != Prefs.subscriptions_exceptionsurl))
addSubscription = false;
// If this isn't the first run, only add subscription if the user has no custom filters
if (addSubscription && Services.vc.compare(prevVersion, "0.0") > 0)
{
- if (FilterStorage.subscriptions.some(function(subscription) subscription.url != Prefs.subscriptions_exceptionsurl && subscription.filters.length))
+ if (FilterStorage.subscriptions.some((subscription) => subscription.url != Prefs.subscriptions_exceptionsurl && subscription.filters.length))
addSubscription = false;
}
@@ -1169,7 +1169,7 @@ let UI = exports.UI =
{
if (filter.subscriptions.length)
{
- if (filter.disabled || filter.subscriptions.some(function(subscription) !(subscription instanceof SpecialSubscription)))
+ if (filter.disabled || filter.subscriptions.some((subscription) => !(subscription instanceof SpecialSubscription)))
filter.disabled = !filter.disabled;
else
FilterStorage.removeFilter(filter);
@@ -1205,7 +1205,7 @@ let UI = exports.UI =
{
let subscription = Subscription.fromURL(url);
let currentSubscriptions = FilterStorage.subscriptions.filter(
- function(subscription) subscription instanceof DownloadableSubscription && subscription.url != Prefs.subscriptions_exceptionsurl
+ ((subscription) => subscription instanceof DownloadableSubscription && subscription.url != Prefs.subscriptions_exceptionsurl)
);
if (!subscription || currentSubscriptions.indexOf(subscription) >= 0)
return;
@@ -1349,7 +1349,7 @@ let UI = exports.UI =
*/
fillIconTooltip: function(/**Event*/ event, /**Window*/ window)
{
- function E(id) window.document.getElementById(id);
+ let E = (id) => window.document.getElementById(id);
let node = window.document.tooltipNode;
if (!node || !node.hasAttribute("tooltip"))
@@ -1387,7 +1387,7 @@ let UI = exports.UI =
let [activeSubscriptions, activeFilters] = FilterStorage.subscriptions.reduce(function([subscriptions, filters], current)
{
if (current instanceof SpecialSubscription)
- return [subscriptions, filters + current.filters.filter(function(filter) !filter.disabled).length];
+ return [subscriptions, filters + current.filters.filter((filter) => !filter.disabled).length];
else if (!current.disabled && !(Prefs.subscriptions_exceptionscheckbox && current.url == Prefs.subscriptions_exceptionsurl))
return [subscriptions + 1, filters];
else
diff --git a/lib/utils.js b/lib/utils.js
index 27dad78..8fbdf3e 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -55,7 +55,7 @@ let Utils = exports.Utils =
{
let {application} = require("info");
let result = (application == "fennec" || application == "fennec2");
- Utils.__defineGetter__("isFennec", function() result);
+ Utils.__defineGetter__("isFennec", () => result);
return result;
},
@@ -73,7 +73,7 @@ let Utils = exports.Utils =
{
Cu.reportError(e);
}
- Utils.__defineGetter__("appLocale", function() locale);
+ Utils.__defineGetter__("appLocale", () => locale);
return Utils.appLocale;
},
@@ -83,7 +83,7 @@ let Utils = exports.Utils =
get platformVersion()
{
let platformVersion = Services.appinfo.platformVersion;
- Utils.__defineGetter__("platformVersion", function() platformVersion);
+ Utils.__defineGetter__("platformVersion", () => platformVersion);
return Utils.platformVersion;
},
diff --git a/metadata.gecko b/metadata.gecko
index 07f4c23..6b06b77 100644
--- a/metadata.gecko
+++ b/metadata.gecko
@@ -29,11 +29,11 @@ zh-CN=https://adblockplus.org/zh_CN/
zh-TW=https://adblockplus.org/zh_TW/
[compat]
-firefox=19.0/33.0
-fennec2=19.0/33.0
-thunderbird=19.0/33.0
-seamonkey=2.16/2.30
-toolkit=19.0/33.0
+firefox=22.0/33.0
+fennec2=22.0/33.0
+thunderbird=22.0/33.0
+seamonkey=2.19/2.30
+toolkit=22.0/33.0
[preprocess]
chrome/content/ui/firstRun.html =
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list