[Pkg-mozext-commits] [adblock-plus] 441/464: Issue 656 - Replace some __proto__ with Object.create

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 624a15cb45b878461bc5fad166cf0e411e350285
Author: Tom Schuster <tschuster at adblockplus.org>
Date:   Fri Jun 27 19:05:04 2014 +0200

    Issue 656 - Replace some __proto__ with Object.create
---
 chrome/content/ui/filters-subscriptionview.js |  4 ++--
 chrome/content/ui/sendReport.js               |  8 ++++----
 chrome/content/ui/sidebar.js                  |  4 ++--
 lib/elemHide.js                               | 20 ++++++++++----------
 lib/filterClasses.js                          |  4 ++--
 lib/filterStorage.js                          | 12 ++++++------
 lib/matcher.js                                | 18 +++++++++---------
 lib/subscriptionClasses.js                    |  2 +-
 lib/sync.js                                   |  4 ++--
 lib/timeline.js                               |  2 +-
 lib/utils.js                                  |  4 ++--
 11 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/chrome/content/ui/filters-subscriptionview.js b/chrome/content/ui/filters-subscriptionview.js
index a1673e4..2406320 100644
--- a/chrome/content/ui/filters-subscriptionview.js
+++ b/chrome/content/ui/filters-subscriptionview.js
@@ -176,7 +176,7 @@ ListManager.prototype =
     {
       if (this._scheduledUpdateDisabled == null)
       {
-        this._scheduledUpdateDisabled = {__proto__: null};
+        this._scheduledUpdateDisabled = Object.create(null);
         Utils.runAsync(this.updateDisabled, this);
       }
       for (let i = 0; i < item.subscriptions.length; i++)
@@ -273,7 +273,7 @@ ListManager.prototype =
       {
         if (this._scheduledUpdateDisabled == null)
         {
-          this._scheduledUpdateDisabled = {__proto__: null};
+          this._scheduledUpdateDisabled = Object.create(null);
           Utils.runAsync(this.updateDisabled, this);
         }
         this._scheduledUpdateDisabled[item.url] = true;
diff --git a/chrome/content/ui/sendReport.js b/chrome/content/ui/sendReport.js
index 3ccc0e6..a79c59c 100644
--- a/chrome/content/ui/sendReport.js
+++ b/chrome/content/ui/sendReport.js
@@ -189,7 +189,7 @@ let requestsDataSource =
   origRequests: [],
   requestNotifier: null,
   callback: null,
-  nodeByKey: {__proto__: null},
+  nodeByKey: Object.create(null),
 
   collectData: function(wnd, windowURI, callback)
   {
@@ -636,7 +636,7 @@ let errorsDataSource =
       messages = messages.slice(messages.length - 10, messages.length);
 
     // Censor app and profile paths in error messages
-    let censored = {__proto__: null};
+    let censored = Object.create(null);
     let pathList = [["ProfD", "%PROFILE%"], ["GreD", "%GRE%"], ["CurProcD", "%APP%"]];
     for (let i = 0; i < pathList.length; i++)
     {
@@ -909,7 +909,7 @@ let issuesDataSource =
             disabledMatcher.add(filter);
       }
 
-      let seenFilters = {__proto__: null};
+      let seenFilters = Object.create(null);
       for each (let request in requestsDataSource.origRequests)
       {
         if (request.filter)
@@ -924,7 +924,7 @@ let issuesDataSource =
       }
 
       // Find disabled subscriptions with filters matching any of the requests
-      let seenSubscriptions = {__proto__: null};
+      let seenSubscriptions = Object.create(null);
       for each (let subscription in FilterStorage.subscriptions)
       {
         if (!subscription.disabled)
diff --git a/chrome/content/ui/sidebar.js b/chrome/content/ui/sidebar.js
index 358aebe..6197b9d 100644
--- a/chrome/content/ui/sidebar.js
+++ b/chrome/content/ui/sidebar.js
@@ -1009,7 +1009,7 @@ var treeView = {
   filter: "",
   data: null,
   allData: [],
-  dataMap: {__proto__: null},
+  dataMap: Object.create(null),
   sortColumn: null,
   sortProc: null,
   resortTimeout: null,
@@ -1038,7 +1038,7 @@ var treeView = {
   clearData: function(data) {
     var oldRows = this.rowCount;
     this.allData = [];
-    this.dataMap = {__proto__: null};
+    this.dataMap = Object.create(null);
     this.refilter();
 
     this.boxObject.rowCountChanged(0, -oldRows);
diff --git a/lib/elemHide.js b/lib/elemHide.js
index df17a0f..dddb58a 100644
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -33,25 +33,25 @@ let {TimeLine} = require("timeline");
  * Lookup table, filters by their associated key
  * @type Object
  */
-let filterByKey = {__proto__: null};
+let filterByKey = Object.create(null);
 
 /**
  * Lookup table, keys of the filters by filter text
  * @type Object
  */
-let keyByFilter = {__proto__: null};
+let keyByFilter = Object.create(null);
 
 /**
  * Lookup table, keys are known element hiding exceptions
  * @type Object
  */
-let knownExceptions = {__proto__: null};
+let knownExceptions = Object.create(null);
 
 /**
  * Lookup table, lists of element hiding exceptions by selector
  * @type Object
  */
-let exceptions = {__proto__: null};
+let exceptions = Object.create(null);
 
 /**
  * Currently applied stylesheet URL
@@ -108,10 +108,10 @@ let ElemHide = exports.ElemHide =
    */
   clear: function()
   {
-    filterByKey = {__proto__: null};
-    keyByFilter = {__proto__: null};
-    knownExceptions = {__proto__: null};
-    exceptions = {__proto__: null};
+    filterByKey = Object.create(null);
+    keyByFilter = Object.create(null);
+    knownExceptions = Object.create(null);
+    exceptions = Object.create(null);
     ElemHide.isDirty = false;
     ElemHide.unapply();
   },
@@ -305,7 +305,7 @@ let ElemHide = exports.ElemHide =
   {
     // Grouping selectors by domains
     TimeLine.log("start grouping selectors");
-    let domains = {__proto__: null};
+    let domains = Object.create(null);
     let hasFilters = false;
     for (let key in filterByKey)
     {
@@ -317,7 +317,7 @@ let ElemHide = exports.ElemHide =
         list = domains[domain];
       else
       {
-        list = {__proto__: null};
+        list = Object.create(null);
         domains[domain] = list;
       }
       list[filter.selector] = key;
diff --git a/lib/filterClasses.js b/lib/filterClasses.js
index e3c2d2f..4572946 100644
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -68,7 +68,7 @@ Filter.prototype =
  * Cache for known filters, maps string representation to filter objects.
  * @type Object
  */
-Filter.knownFilters = {__proto__: null};
+Filter.knownFilters = Object.create(null);
 
 /**
  * Regular expression that element hiding filters should match
@@ -366,7 +366,7 @@ ActiveFilter.prototype =
           }
 
           if (!domains)
-            domains = {__proto__: null};
+            domains = Object.create(null);
 
           domains[domain] = include;
         }
diff --git a/lib/filterStorage.js b/lib/filterStorage.js
index 546f788..f263a68 100644
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -99,7 +99,7 @@ let FilterStorage = exports.FilterStorage =
    * Map of properties listed in the filter storage file before the sections
    * start. Right now this should be only the format version.
    */
-  fileProperties: {__proto__: null},
+  fileProperties: Object.create(null),
 
   /**
    * List of filter subscriptions containing all filters
@@ -111,7 +111,7 @@ let FilterStorage = exports.FilterStorage =
    * Map of subscriptions already on the list, by their URL/identifier
    * @type Object
    */
-  knownSubscriptions: {__proto__: null},
+  knownSubscriptions: Object.create(null),
 
   /**
    * Finds the filter group that a filter should be added to by default. Will
@@ -420,7 +420,7 @@ let FilterStorage = exports.FilterStorage =
     {
       // Old special groups might have been converted, remove them if they are empty
       let specialMap = {"~il~": true, "~wl~": true, "~fl~": true, "~eh~": true};
-      let knownSubscriptions = {__proto__: null};
+      let knownSubscriptions = Object.create(null);
       for (let i = 0; i < parser.subscriptions.length; i++)
       {
         let subscription = parser.subscriptions[i];
@@ -494,7 +494,7 @@ let FilterStorage = exports.FilterStorage =
     yield "# Adblock Plus preferences";
     yield "version=" + formatVersion;
 
-    let saved = {__proto__: null};
+    let saved = Object.create(null);
     let buf = [];
 
     // Save filter data
@@ -794,8 +794,8 @@ function INIParser()
 {
   this.fileProperties = this.curObj = {};
   this.subscriptions = [];
-  this.knownFilters = {__proto__: null};
-  this.knownSubscriptions = {__proto__: null};
+  this.knownFilters = Object.create(null);
+  this.knownSubscriptions = Object.create(null);
 }
 INIParser.prototype =
 {
diff --git a/lib/matcher.js b/lib/matcher.js
index 80b2380..40289d0 100644
--- a/lib/matcher.js
+++ b/lib/matcher.js
@@ -49,8 +49,8 @@ Matcher.prototype = {
    */
   clear: function()
   {
-    this.filterByKeyword = {__proto__: null};
-    this.keywordByFilter = {__proto__: null};
+    this.filterByKeyword = Object.create(null);
+    this.keywordByFilter = Object.create(null);
   },
 
   /**
@@ -215,8 +215,8 @@ function CombinedMatcher()
 {
   this.blacklist = new Matcher();
   this.whitelist = new Matcher();
-  this.keys = {__proto__: null};
-  this.resultCache = {__proto__: null};
+  this.keys = Object.create(null);
+  this.resultCache = Object.create(null);
 }
 exports.CombinedMatcher = CombinedMatcher;
 
@@ -265,8 +265,8 @@ CombinedMatcher.prototype =
   {
     this.blacklist.clear();
     this.whitelist.clear();
-    this.keys = {__proto__: null};
-    this.resultCache = {__proto__: null};
+    this.keys = Object.create(null);
+    this.resultCache = Object.create(null);
     this.cacheEntries = 0;
   },
 
@@ -290,7 +290,7 @@ CombinedMatcher.prototype =
 
     if (this.cacheEntries > 0)
     {
-      this.resultCache = {__proto__: null};
+      this.resultCache = Object.create(null);
       this.cacheEntries = 0;
     }
   },
@@ -315,7 +315,7 @@ CombinedMatcher.prototype =
 
     if (this.cacheEntries > 0)
     {
-      this.resultCache = {__proto__: null};
+      this.resultCache = Object.create(null);
       this.cacheEntries = 0;
     }
   },
@@ -406,7 +406,7 @@ CombinedMatcher.prototype =
 
     if (this.cacheEntries >= CombinedMatcher.maxCacheEntries)
     {
-      this.resultCache = {__proto__: null};
+      this.resultCache = Object.create(null);
       this.cacheEntries = 0;
     }
 
diff --git a/lib/subscriptionClasses.js b/lib/subscriptionClasses.js
index 1d777bc..c62f87a 100644
--- a/lib/subscriptionClasses.js
+++ b/lib/subscriptionClasses.js
@@ -154,7 +154,7 @@ Subscription.prototype =
  * Cache for known filter subscriptions, maps URL to subscription objects.
  * @type Object
  */
-Subscription.knownSubscriptions = {__proto__: null};
+Subscription.knownSubscriptions = Object.create(null);
 
 /**
  * Returns a subscription from its URL, creates a new one if necessary.
diff --git a/lib/sync.js b/lib/sync.js
index 05eeced..573ae5c 100644
--- a/lib/sync.js
+++ b/lib/sync.js
@@ -250,7 +250,7 @@ ABPStore.prototype =
     let data = record.cleartext.subscriptions;
 
     // First make sure we have the same subscriptions on both sides
-    let seenSubscription = {__proto__: null};
+    let seenSubscription = Object.create(null);
     for (let remoteSubscription of data)
     {
       seenSubscription[remoteSubscription.url] = true;
@@ -292,7 +292,7 @@ ABPStore.prototype =
     }
 
     // Now sync the custom filters
-    let seenFilter = {__proto__: null};
+    let seenFilter = Object.create(null);
     for (let remoteSubscription of data)
     {
       if (!("filters" in remoteSubscription))
diff --git a/lib/timeline.js b/lib/timeline.js
index 18c10fb..fba2098 100644
--- a/lib/timeline.js
+++ b/lib/timeline.js
@@ -23,7 +23,7 @@ let nestingCounter = 0;
 let firstTimeStamp = null;
 let lastTimeStamp = null;
 
-let asyncActions = {__proto__: null};
+let asyncActions = Object.create(null);
 
 /**
  * Time logging module, used to measure startup time of Adblock Plus (development builds only).
diff --git a/lib/utils.js b/lib/utils.js
index 8fbdf3e..b827f90 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -539,7 +539,7 @@ let Utils = exports.Utils =
 function Cache(/**Integer*/ size)
 {
   this._ringBuffer = new Array(size);
-  this.data = {__proto__: null};
+  this.data = Object.create(null);
 }
 exports.Cache = Cache;
 
@@ -593,7 +593,7 @@ Cache.prototype =
   clear: function()
   {
     this._ringBuffer = new Array(this._ringBuffer.length);
-    this.data = {__proto__: null};
+    this.data = Object.create(null);
   }
 }
 

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