diff --git a/src/js/pagestore.js b/src/js/pagestore.js index a8cb32dbd..d01b54a8d 100644 --- a/src/js/pagestore.js +++ b/src/js/pagestore.js @@ -713,9 +713,10 @@ PageStore.prototype.logRequest = function(context, result) { if ( requestHostname === '' ) { requestHostname = context.pageHostname; } + var now = Date.now(); if ( this.hostnameToCountMap.hasOwnProperty(requestHostname) === false ) { this.hostnameToCountMap[requestHostname] = 0; - this.contentLastModified = Date.now(); + this.contentLastModified = now; } var c = result.charAt(1); if ( c === '' || c === 'a' ) { @@ -727,6 +728,7 @@ PageStore.prototype.logRequest = function(context, result) { this.perLoadBlockedRequestCount++; µb.localSettings.blockedRequestCount++; } + this.localSettingsModifyTime = now; this.logBuffer.writeOne(context, result); }; diff --git a/src/js/storage.js b/src/js/storage.js index beb3edeed..32142efad 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -38,6 +38,11 @@ if ( typeof callback !== 'function' ) { callback = this.noopFunc; } + if ( this.localSettingsModifyTime <= this.localSettingsSaveTime ) { + callback(); + return; + } + this.localSettingsSaveTime = Date.now(); vAPI.storage.set(this.localSettings, callback); };