[Pkg-mozext-commits] [requestpolicy] 162/257: [ref] RulesetStorage: switch to Module Pattern
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:20:08 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 9b7969899419eef956b20eaf02d04921f06ca821
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Dec 1 13:20:00 2015 +0100
[ref] RulesetStorage: switch to Module Pattern
---
src/content/lib/ruleset-storage.jsm | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/content/lib/ruleset-storage.jsm b/src/content/lib/ruleset-storage.jsm
index f85b61c..eec6a94 100644
--- a/src/content/lib/ruleset-storage.jsm
+++ b/src/content/lib/ruleset-storage.jsm
@@ -36,13 +36,15 @@ let {FileUtil} = importModule("lib/utils/files");
// RulesetStorage
//==============================================================================
-var RulesetStorage = {
+var RulesetStorage = (function() {
+ let self = {};
/**
+ * @param {String} filename
+ * @param {String} subscriptionListName
* @return {RawRuleset}
*/
- loadRawRulesetFromFile : function(/**string*/ filename,
- /**string*/ subscriptionListName) {
+ self.loadRawRulesetFromFile = function (filename, subscriptionListName) {
// TODO: change filename argument to policyname and we'll append the '.json'
// TODO: get a stream and use the mozilla json interface to decode from stream.
var policyFile = FileUtil.getRPUserDir("policies");
@@ -64,10 +66,15 @@ var RulesetStorage = {
// str = FileUtil.fileToString(policyFile);
//}
return new RawRuleset(str);
- },
+ };
- saveRawRulesetToFile : function(/**RawRuleset*/ policy, /**string*/ filename,
- /**string*/ subscriptionListName) {
+ /**
+ * @param {RawRuleset} policy
+ * @param {String} filename
+ * @param {String} subscriptionListName
+ */
+ self.saveRawRulesetToFile = function (policy, filename,
+ subscriptionListName) {
// TODO: change filename argument to policyname and we'll append the '.json'
// TODO: get a stream and use the mozilla json interface to encode to stream.
if (subscriptionListName) {
@@ -78,6 +85,7 @@ var RulesetStorage = {
}
policyFile.appendRelativePath(filename);
FileUtil.stringToFile(JSON.stringify(policy), policyFile);
- }
+ };
-};
+ return self;
+}());
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list