[Pkg-mozext-commits] [adblock-plus] 15/22: Backed out changeset 2d52467436ed (Issue 427 - Remove non-standard function and getter syntax) - dropping compatibility with Firefox 21 and below wasn't intentional

David Prévot taffit at moszumanska.debian.org
Thu Jun 5 14:01:09 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 51f71afe5e48be4d163ba1b01edd9c584f5fc778
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Tue Jun 3 16:48:46 2014 +0200

    Backed out changeset 2d52467436ed (Issue 427 - Remove non-standard function and getter syntax) - dropping compatibility with Firefox 21 and below wasn't intentional
---
 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 +++---
 12 files changed, 55 insertions(+), 100 deletions(-)

diff --git a/lib/appSupport.js b/lib/appSupport.js
index 67c6248..664da1a 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 = (/**Window*/ window) => false;
+exports.isKnownWindow = function 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 = (window) => window.gBrowser;
+    exports.getBrowser = function ff_getBrowser(window) window.gBrowser;
 
     exports.addTab = function ff_addTab(window, url, event)
     {
@@ -396,7 +396,7 @@ switch (application)
 
     exports.delayInitialization = true;
 
-    exports.getBrowser = (window) => window.getBrowser();
+    exports.getBrowser = function tb_getBrowser(window) window.getBrowser();
 
     exports.addTab = function tb_addTab(window, url, event)
     {
@@ -683,11 +683,11 @@ switch (application)
 
   case "fennec2":
   {
-    exports.isKnownWindow = (window) => window.document.documentElement.id == "main-window";
+    exports.isKnownWindow = function fmn_isKnownWindow(/**Window*/ window) window.document.documentElement.id == "main-window";
 
-    exports.getBrowser = (window) => window.BrowserApp.selectedBrowser;
+    exports.getBrowser = function fmn_getBrowser(window) window.BrowserApp.selectedBrowser;
 
-    exports.addTab = (window, url, event) => window.BrowserApp.addTab(url, {selected: true});
+    exports.addTab = function fmn_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 7db7425..e7e69e3 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", () => require("ui").UI);
+XPCOMUtils.defineLazyGetter(this, "UI", function() require("ui").UI);
 
 let widgets = Map();
 
diff --git a/lib/elemHide.js b/lib/elemHide.js
index df17a0f..b5a1473 100644
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -379,10 +379,7 @@ let ElemHide = exports.ElemHide =
    * Retrieves the currently applied stylesheet URL
    * @type String
    */
-  get styleURL()
-  {
-    return ElemHide.applied ? styleURL.spec : null;
-  },
+  get styleURL() 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 e3c2d2f..044022d 100644
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -239,10 +239,7 @@ ActiveFilter.prototype =
    * Defines whether the filter is disabled
    * @type Boolean
    */
-  get disabled()
-  {
-    return this._disabled;
-  },
+  get disabled() this._disabled,
   set disabled(value)
   {
     if (value != this._disabled)
@@ -258,10 +255,7 @@ ActiveFilter.prototype =
    * Number of hits on the filter since the last reset
    * @type Number
    */
-  get hitCount()
-  {
-    return this._hitCount;
-  },
+  get hitCount() this._hitCount,
   set hitCount(value)
   {
     if (value != this._hitCount)
@@ -277,10 +271,7 @@ ActiveFilter.prototype =
    * Last time the filter had a hit (in milliseconds since the beginning of the epoch)
    * @type Number
    */
-  get lastHit()
-  {
-    return this._lastHit;
-  },
+  get lastHit() this._lastHit,
   set lastHit(value)
   {
     if (value != this._lastHit)
@@ -473,7 +464,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", () => regexp);
+    this.__defineGetter__("regexp", function() regexp);
   }
   else
   {
@@ -531,7 +522,7 @@ RegExpFilter.prototype =
     let regexp = new RegExp(source, this.matchCase ? "" : "i");
 
     delete this.regexpSource;
-    this.__defineGetter__("regexp", () => regexp);
+    this.__defineGetter__("regexp", function() regexp);
     return this.regexp;
   },
   /**
diff --git a/lib/filterStorage.js b/lib/filterStorage.js
index 546f788..01b7328 100644
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -47,10 +47,7 @@ let FilterStorage = exports.FilterStorage =
    * Version number of the patterns.ini format used.
    * @type Integer
    */
-  get formatVersion()
-  {
-    return formatVersion;
-  },
+  get formatVersion() formatVersion,
 
   /**
    * File that the filter list has been loaded from and should be saved to
@@ -85,7 +82,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", () => file);
+    this.__defineGetter__("sourceFile", function() file);
     return this.sourceFile;
   },
 
@@ -228,7 +225,7 @@ let FilterStorage = exports.FilterStorage =
   {
     if (!subscription)
     {
-      if (filter.subscriptions.some(s => s instanceof SpecialSubscription && !s.disabled))
+      if (filter.subscriptions.some(function(s) s instanceof SpecialSubscription && !s.disabled))
         return;   // No need to add
       subscription = FilterStorage.getGroupForFilter(filter);
     }
@@ -631,7 +628,7 @@ let FilterStorage = exports.FilterStorage =
       TimeLine.enter("FilterStorage.saveToDisk() -> removeLastBackup()");
       let file = targetFile.clone();
       file.leafName = part1 + "-backup" + Prefs.patternsbackups + part2;
-      IO.removeFile(file, (e) => renameBackup(part1, part2, Prefs.patternsbackups - 1));
+      IO.removeFile(file, function(e) renameBackup(part1, part2, Prefs.patternsbackups - 1));
       TimeLine.leave("FilterStorage.saveToDisk() <- removeLastBackup()");
     }.bind(this);
 
@@ -645,7 +642,7 @@ let FilterStorage = exports.FilterStorage =
 
         let toName = part1 + "-backup" + (index + 1) + part2;
 
-        IO.renameFile(fromFile, toName, (e) => renameBackup(part1, part2, index - 1));
+        IO.renameFile(fromFile, toName, function(e) renameBackup(part1, part2, index - 1));
       }
       else
       {
@@ -658,7 +655,7 @@ let FilterStorage = exports.FilterStorage =
     }.bind(this);
 
     // Do not persist external subscriptions
-    let subscriptions = this.subscriptions.filter((s) => !(s instanceof ExternalSubscription));
+    let subscriptions = this.subscriptions.filter(function(s) !(s instanceof ExternalSubscription));
     if (!explicitFile)
       this._saving = true;
 
diff --git a/lib/io.js b/lib/io.js
index ea362b7..dfe8b8f 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", () => lineBreak);
+    IO.__defineGetter__("lineBreak", function() lineBreak);
     return IO.lineBreak;
   },
 
diff --git a/lib/requestNotifier.js b/lib/requestNotifier.js
index 2ee9ec3..63edc5f 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 = (map, key, value) => map.set(key, value);
-  hasEntry = (map, key) => map.has(key);
-  getEntry = (map, key) => map.get(key);
+  setEntry = function(map, key, value) map.set(key, value);
+  hasEntry = function(map, key) map.has(key);
+  getEntry = function(map, key) map.get(key);
 }
 else
 {
@@ -58,9 +58,9 @@ else
     }
   };
 
-  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;
+  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;
 }
 
 /**
@@ -347,18 +347,12 @@ RequestEntry.prototype =
    * String representation of the content type, e.g. "subdocument"
    * @type String
    */
-  get typeDescr()
-  {
-    return require("contentPolicy").Policy.typeDescr[this.type];
-  },
+  get typeDescr() require("contentPolicy").Policy.typeDescr[this.type],
   /**
    * User-visible localized representation of the content type, e.g. "frame"
    * @type String
    */
-  get localizedDescr()
-  {
-    return require("contentPolicy").Policy.localizedDescr[this.type];
-  },
+  get localizedDescr() 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 1d777bc..58b028b 100644
--- a/lib/subscriptionClasses.js
+++ b/lib/subscriptionClasses.js
@@ -68,10 +68,7 @@ Subscription.prototype =
    * Title of the filter subscription
    * @type String
    */
-  get title()
-  {
-    return this._title;
-  },
+  get title() this._title,
   set title(value)
   {
     if (value != this._title)
@@ -87,10 +84,7 @@ Subscription.prototype =
    * Determines whether the title should be editable
    * @type Boolean
    */
-  get fixedTitle()
-  {
-    return this._fixedTitle;
-  },
+  get fixedTitle() this._fixedTitle,
   set fixedTitle(value)
   {
     if (value != this._fixedTitle)
@@ -106,10 +100,7 @@ Subscription.prototype =
    * Defines whether the filters in the subscription should be disabled
    * @type Boolean
    */
-  get disabled()
-  {
-    return this._disabled;
-  },
+  get disabled() this._disabled,
   set disabled(value)
   {
     if (value != this._disabled)
@@ -302,7 +293,7 @@ SpecialSubscription.prototype =
   {
     Subscription.prototype.serialize.call(this, buffer);
     if (this.defaults && this.defaults.length)
-      buffer.push("defaults=" + this.defaults.filter((type) => type in SpecialSubscription.defaultsMap).join(" "));
+      buffer.push("defaults=" + this.defaults.filter(function(type) type in SpecialSubscription.defaultsMap).join(" "));
     if (this._lastDownload)
       buffer.push("lastDownload=" + this._lastDownload);
   }
@@ -375,10 +366,7 @@ RegularSubscription.prototype =
    * Filter subscription homepage if known
    * @type String
    */
-  get homepage()
-  {
-    return this._homepage;
-  },
+  get homepage() this._homepage,
   set homepage(value)
   {
     if (value != this._homepage)
@@ -394,10 +382,7 @@ RegularSubscription.prototype =
    * Time of the last subscription download (in seconds since the beginning of the epoch)
    * @type Number
    */
-  get lastDownload()
-  {
-    return this._lastDownload;
-  },
+  get lastDownload() this._lastDownload,
   set lastDownload(value)
   {
     if (value != this._lastDownload)
@@ -473,10 +458,7 @@ DownloadableSubscription.prototype =
    * Status of the last download (ID of a string)
    * @type String
    */
-  get downloadStatus()
-  {
-    return this._downloadStatus;
-  },
+  get downloadStatus() this._downloadStatus,
   set downloadStatus(value)
   {
     let oldValue = this._downloadStatus;
@@ -497,10 +479,7 @@ DownloadableSubscription.prototype =
    * if the user doesn't use Adblock Plus for some time.
    * @type Number
    */
-  get lastCheck()
-  {
-    return this._lastCheck;
-  },
+  get lastCheck() this._lastCheck,
   set lastCheck(value)
   {
     if (value != this._lastCheck)
@@ -528,10 +507,7 @@ DownloadableSubscription.prototype =
    * Number of download failures since last success
    * @type Number
    */
-  get errors()
-  {
-    return this._errors;
-  },
+  get errors() this._errors,
   set errors(value)
   {
     if (value != this._errors)
diff --git a/lib/sync.js b/lib/sync.js
index 05eeced..fe0a4ab 100644
--- a/lib/sync.js
+++ b/lib/sync.js
@@ -306,7 +306,7 @@ ABPStore.prototype =
         if (trackerInstance.didFilterChange(filter))
           continue;
 
-        if (filter.subscriptions.some((subscription) => subscription instanceof SpecialSubscription))
+        if (filter.subscriptions.some(function(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 619270c..590ad73 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((f) => f.text).join("\n");
+            let data = "[Adblock]\n" + subscription.filters.map(function(f) f.text).join("\n");
             redirectCallback("data:text/plain," + encodeURIComponent(data));
           }
         }, false);
diff --git a/lib/ui.js b/lib/ui.js
index ab5b089..e61200a 100644
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -126,8 +126,7 @@ let optionsObserver =
         this.value = Prefs.savestats;
       });
 
-      let hasAcceptableAds = FilterStorage.subscriptions.some((subscription) => subscription instanceof DownloadableSubscription &&
-        subscription.url == Prefs.subscriptions_exceptionsurl);
+      let hasAcceptableAds = FilterStorage.subscriptions.some(function(subscription) subscription instanceof DownloadableSubscription && subscription.url == Prefs.subscriptions_exceptionsurl);
       setChecked("adblockplus-acceptableAds", hasAcceptableAds);
       addCommandHandler("adblockplus-acceptableAds", function()
       {
@@ -159,8 +158,9 @@ let optionsObserver =
           if (onShutdown.done)
             return;
 
-          let currentSubscription = FilterStorage.subscriptions.filter((subscription) => subscription instanceof DownloadableSubscription &&
-            subscription.url != Prefs.subscriptions_exceptionsurl);
+          let currentSubscription = FilterStorage.subscriptions.filter(
+            function(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,
-      (node) => !/\S/.test(node.nodeValue), false
+      function(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(() => notificationTimer.cancel());
+    onShutdown.add(function() 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((subscription) => subscription.url == Prefs.subscriptions_exceptionsurl || subscription.url in privacySubscriptions))
+    if (FilterStorage.subscriptions.some(function(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((subscription) => subscription instanceof DownloadableSubscription && subscription.url != Prefs.subscriptions_exceptionsurl))
+    if (FilterStorage.subscriptions.some(function(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((subscription) => subscription.url != Prefs.subscriptions_exceptionsurl && subscription.filters.length))
+      if (FilterStorage.subscriptions.some(function(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((subscription) => !(subscription instanceof SpecialSubscription)))
+      if (filter.disabled || filter.subscriptions.some(function(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(
-      ((subscription) => subscription instanceof DownloadableSubscription && subscription.url != Prefs.subscriptions_exceptionsurl)
+      function(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)
   {
-    let E = (id) => window.document.getElementById(id);
+    function 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((filter) => !filter.disabled).length];
+          return [subscriptions, filters + current.filters.filter(function(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 8fbdf3e..27dad78 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", () => result);
+    Utils.__defineGetter__("isFennec", function() result);
     return result;
   },
 
@@ -73,7 +73,7 @@ let Utils = exports.Utils =
     {
       Cu.reportError(e);
     }
-    Utils.__defineGetter__("appLocale", () => locale);
+    Utils.__defineGetter__("appLocale", function() locale);
     return Utils.appLocale;
   },
 
@@ -83,7 +83,7 @@ let Utils = exports.Utils =
   get platformVersion()
   {
     let platformVersion = Services.appinfo.platformVersion;
-    Utils.__defineGetter__("platformVersion", () => platformVersion);
+    Utils.__defineGetter__("platformVersion", function() platformVersion);
     return Utils.platformVersion;
   },
 

-- 
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