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

Side by Side Diff: lib/filterStorage.js

Issue 5055554716172288: Issue 653 -Object.defineProperty instead of defineGetter / defineSetter (Closed)
Patch Set: Created June 9, 2014, 9:29 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 { 78 {
79 file = IO.resolveFilePath(Services.prefs.getDefaultBranch("extensions.ad blockplus.").getCharPref("data_directory")); 79 file = IO.resolveFilePath(Services.prefs.getDefaultBranch("extensions.ad blockplus.").getCharPref("data_directory"));
80 if (file) 80 if (file)
81 file.append("patterns.ini"); 81 file.append("patterns.ini");
82 } catch(e) {} 82 } catch(e) {}
83 } 83 }
84 84
85 if (!file) 85 if (!file)
86 Cu.reportError("Adblock Plus: Failed to resolve filter file location from extensions.adblockplus.patternsfile preference"); 86 Cu.reportError("Adblock Plus: Failed to resolve filter file location from extensions.adblockplus.patternsfile preference");
87 87
88 this.__defineGetter__("sourceFile", () => file); 88 Object.defineProperty(FilterStorage, "sourceFile", {value: file});
Wladimir Palant 2014/06/23 11:12:41 Keep using this rather than FilterStorage here?
89 return this.sourceFile; 89 return file;
90 }, 90 },
91 91
92 /** 92 /**
93 * Will be set to true if no patterns.ini file exists. 93 * Will be set to true if no patterns.ini file exists.
94 * @type Boolean 94 * @type Boolean
95 */ 95 */
96 firstRun: false, 96 firstRun: false,
97 97
98 /** 98 /**
99 * Map of properties listed in the filter storage file before the sections 99 * Map of properties listed in the filter storage file before the sections
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 Subscription.knownSubscriptions = origKnownSubscriptions; 888 Subscription.knownSubscriptions = origKnownSubscriptions;
889 } 889 }
890 890
891 // Allow events to be processed every now and then. 891 // Allow events to be processed every now and then.
892 // Note: IO.readFromFile() will deal with the potential reentrance here. 892 // Note: IO.readFromFile() will deal with the potential reentrance here.
893 this.linesProcessed++; 893 this.linesProcessed++;
894 if (this.linesProcessed % 1000 == 0) 894 if (this.linesProcessed % 1000 == 0)
895 Utils.yield(); 895 Utils.yield();
896 } 896 }
897 }; 897 };
OLDNEW

Powered by Google App Engine
This is Rietveld