Skip to content

Commit da001de

Browse files
committed
Factorise read()ing
1 parent 4a3d206 commit da001de

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/chrome/content/code/HTTPSRules.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,10 @@ const RuleWriter = {
241241
return rv;
242242
},
243243

244-
read: function(file, rule_store, ruleset_id) {
244+
245+
read: function(file) {
245246
if (!file.exists())
246247
return null;
247-
if ((rule_store.targets == null) && (rule_store.targets != {}))
248-
this.log(WARN, "TARGETS IS NULL");
249248
var data = "";
250249
var fstream = CC["@mozilla.org/network/file-input-stream;1"]
251250
.createInstance(CI.nsIFileInputStream);
@@ -262,6 +261,14 @@ const RuleWriter = {
262261

263262
sstream.close();
264263
fstream.close();
264+
return data;
265+
},
266+
267+
rulesetFromFile: function(file, rule_store, ruleset_id) {
268+
if ((rule_store.targets == null) && (rule_store.targets != {}))
269+
this.log(WARN, "TARGETS IS NULL");
270+
var data = this.read(file);
271+
if (!data) return null;
265272
return this.readFromString(data, rule_store, ruleset_id);
266273
},
267274

0 commit comments

Comments
 (0)