| Index: lib/filterStorage.js |
| =================================================================== |
| --- a/lib/filterStorage.js |
| +++ b/lib/filterStorage.js |
| @@ -70,18 +70,19 @@ |
| * Will be set to true if no patterns.ini file exists. |
| * @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. |
| + * @type {Map.<string,string>} |
| */ |
| - fileProperties: Object.create(null), |
| + fileProperties: new Map(), |
| /** |
| * List of filter subscriptions containing all filters |
| * @type {Subscription[]} |
| */ |
| subscriptions: [], |
| /** |
| @@ -684,17 +685,17 @@ |
| } |
| /** |
| * Listener returned by FilterStorage.importData(), parses filter data. |
| * @constructor |
| */ |
| function INIParser() |
| { |
| - this.fileProperties = this.curObj = {}; |
| + this.fileProperties = this.curObj = new Map(); |
| this.subscriptions = []; |
| this.knownFilters = new Map(); |
| this.knownSubscriptions = new Map(); |
| } |
| INIParser.prototype = |
| { |
| linesProcessed: 0, |
| subscriptions: null, |
| @@ -710,30 +711,30 @@ |
| let origKnownFilters = Filter.knownFilters; |
| Filter.knownFilters = this.knownFilters; |
| let origKnownSubscriptions = Subscription.knownSubscriptions; |
| Subscription.knownSubscriptions = this.knownSubscriptions; |
| let match; |
| try |
| { |
| if (this.wantObj === true && (match = /^(\w+)=(.*)$/.exec(val))) |
| - this.curObj[match[1]] = match[2]; |
| + this.curObj.set(match[1], match[2]); |
| else if (val === null || (match = /^\s*\[(.+)\]\s*$/.exec(val))) |
| { |
| if (this.curObj) |
| { |
| // Process current object before going to next section |
| switch (this.curSection) |
| { |
| case "filter": |
| - if ("text" in this.curObj) |
| - Filter.fromObject(this.curObj); |
| + if (this.curObj.has("text")) |
| + Filter.fromMap(this.curObj); |
| break; |
| case "subscription": { |
| - let subscription = Subscription.fromObject(this.curObj); |
| + let subscription = Subscription.fromMap(this.curObj); |
| if (subscription) |
| this.subscriptions.push(subscription); |
| break; |
| } |
| case "subscription filters": |
| if (this.subscriptions.length) |
| { |
| let subscription = this.subscriptions[ |
| @@ -754,17 +755,17 @@ |
| return; |
| this.curSection = match[1].toLowerCase(); |
| switch (this.curSection) |
| { |
| case "filter": |
| case "subscription": |
| this.wantObj = true; |
| - this.curObj = {}; |
| + this.curObj = new Map(); |
| break; |
| case "subscription filters": |
| this.wantObj = false; |
| this.curObj = []; |
| break; |
| default: |
| this.wantObj = undefined; |
| this.curObj = null; |