summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/DeferredSave.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/extensions/DeferredSave.jsm')
-rw-r--r--toolkit/mozapps/extensions/DeferredSave.jsm43
1 files changed, 21 insertions, 22 deletions
diff --git a/toolkit/mozapps/extensions/DeferredSave.jsm b/toolkit/mozapps/extensions/DeferredSave.jsm
index 89f82b265..d7f5b8864 100644
--- a/toolkit/mozapps/extensions/DeferredSave.jsm
+++ b/toolkit/mozapps/extensions/DeferredSave.jsm
@@ -9,11 +9,10 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/osfile.jsm");
-/* globals OS*/
Cu.import("resource://gre/modules/Promise.jsm");
// Make it possible to mock out timers for testing
-var MakeTimer = () => Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+let MakeTimer = () => Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this.EXPORTED_SYMBOLS = ["DeferredSave"];
@@ -21,26 +20,26 @@ this.EXPORTED_SYMBOLS = ["DeferredSave"];
const DEFAULT_SAVE_DELAY_MS = 50;
Cu.import("resource://gre/modules/Log.jsm");
-// Configure a logger at the parent 'DeferredSave' level to format
-// messages for all the modules under DeferredSave.*
+//Configure a logger at the parent 'DeferredSave' level to format
+//messages for all the modules under DeferredSave.*
const DEFERREDSAVE_PARENT_LOGGER_ID = "DeferredSave";
-var parentLogger = Log.repository.getLogger(DEFERREDSAVE_PARENT_LOGGER_ID);
+let parentLogger = Log.repository.getLogger(DEFERREDSAVE_PARENT_LOGGER_ID);
parentLogger.level = Log.Level.Warn;
-var formatter = new Log.BasicFormatter();
-// Set parent logger (and its children) to append to
-// the Javascript section of the Browser Console
+let formatter = new Log.BasicFormatter();
+//Set parent logger (and its children) to append to
+//the Javascript section of the Browser Console
parentLogger.addAppender(new Log.ConsoleAppender(formatter));
-// Set parent logger (and its children) to
-// also append to standard out
+//Set parent logger (and its children) to
+//also append to standard out
parentLogger.addAppender(new Log.DumpAppender(formatter));
-// Provide the ability to enable/disable logging
-// messages at runtime.
-// If the "extensions.logging.enabled" preference is
-// missing or 'false', messages at the WARNING and higher
-// severity should be logged to the JS console and standard error.
-// If "extensions.logging.enabled" is set to 'true', messages
-// at DEBUG and higher should go to JS console and standard error.
+//Provide the ability to enable/disable logging
+//messages at runtime.
+//If the "extensions.logging.enabled" preference is
+//missing or 'false', messages at the WARNING and higher
+//severity should be logged to the JS console and standard error.
+//If "extensions.logging.enabled" is set to 'true', messages
+//at DEBUG and higher should go to JS console and standard error.
Cu.import("resource://gre/modules/Services.jsm");
const PREF_LOGGING_ENABLED = "extensions.logging.enabled";
@@ -52,13 +51,13 @@ const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
* parent 'addons' level logger accordingly.
*/
var PrefObserver = {
- init: function() {
+ init: function PrefObserver_init() {
Services.prefs.addObserver(PREF_LOGGING_ENABLED, this, false);
Services.obs.addObserver(this, "xpcom-shutdown", false);
this.observe(null, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, PREF_LOGGING_ENABLED);
},
- observe: function(aSubject, aTopic, aData) {
+ observe: function PrefObserver_observe(aSubject, aTopic, aData) {
if (aTopic == "xpcom-shutdown") {
Services.prefs.removeObserver(PREF_LOGGING_ENABLED, this);
Services.obs.removeObserver(this, "xpcom-shutdown");
@@ -104,7 +103,7 @@ PrefObserver.init();
* that marks the data as needing to be saved, and when the DeferredSave
* begins writing the data to disk. Default 50 milliseconds.
*/
-this.DeferredSave = function(aPath, aDataProvider, aDelay) {
+this.DeferredSave = function (aPath, aDataProvider, aDelay) {
// Create a new logger (child of 'DeferredSave' logger)
// for use by this particular instance of DeferredSave object
let leafName = OS.Path.basename(aPath);
@@ -208,7 +207,7 @@ this.DeferredSave.prototype = {
try {
toSave = this._dataProvider();
}
- catch (e) {
+ catch(e) {
this.logger.error("Deferred save dataProvider failed", e);
writing.then(null, error => {})
.then(count => {
@@ -217,7 +216,7 @@ this.DeferredSave.prototype = {
return;
}
- writing.then(null, error => { return 0; })
+ writing.then(null, error => {return 0;})
.then(count => {
this.logger.debug("Starting write");
this.totalSaves++;