Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterStorage.js

Issue 5636077285015552: Issue 656 - Replace some __proto__ with Object.create (Closed)
Patch Set: Created June 23, 2014, 8:46 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/filterClasses.js ('k') | lib/matcher.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterStorage.js
===================================================================
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -94,29 +94,29 @@ let FilterStorage = exports.FilterStorag
* @type Boolean
*/
firstRun: false,
/**
* 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
* @type Array of Subscription
*/
subscriptions: [],
/**
* 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
* return null if this group doesn't exist yet.
*/
getGroupForFilter: function(/**Filter*/ filter) /**SpecialSubscription*/
{
let generalSubscription = null;
@@ -415,17 +415,17 @@ let FilterStorage = exports.FilterStorag
TimeLine.leave("FilterStorage.loadFromDisk() <- readFile()", "FilterStorageRead");
}.bind(this);
var doneReading = function(parser)
{
// 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];
if (subscription instanceof SpecialSubscription && subscription.filters.length == 0 && subscription.url in specialMap)
parser.subscriptions.splice(i--, 1);
else
knownSubscriptions[subscription.url] = subscription;
}
@@ -489,17 +489,17 @@ let FilterStorage = exports.FilterStorag
TimeLine.leave("FilterStorage.loadFromDisk() done");
},
_generateFilterData: function(subscriptions)
{
yield "# Adblock Plus preferences";
yield "version=" + formatVersion;
- let saved = {__proto__: null};
+ let saved = Object.create(null);
let buf = [];
// Save filter data
for (let i = 0; i < subscriptions.length; i++)
{
let subscription = subscriptions[i];
for (let j = 0; j < subscription.filters.length; j++)
{
@@ -789,18 +789,18 @@ PrivateBrowsing.init();
/**
* IO.readFromFile() listener to parse filter data.
* @constructor
*/
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 =
{
linesProcessed: 0,
subscriptions: null,
knownFilters: null,
knownSubscriptions : null,
wantObj: true,
« no previous file with comments | « lib/filterClasses.js ('k') | lib/matcher.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld