Index: lib/adblockplus.js |
=================================================================== |
--- a/lib/adblockplus.js |
+++ b/lib/adblockplus.js |
@@ -360,27 +360,30 @@ |
function loadFile(file, successCallback, errorCallback) |
{ |
var key = fileToKey(file); |
- ext.storage.get([key], function(items) |
- { |
- var entry = items[key]; |
- if (entry) |
- { |
- successCallback(entry); |
- } |
- else |
- { |
- errorCallback(new Error("File doesn't exist")); |
- } |
- }); |
+ entry = localStorage.getItem(key); |
kzar
2016/07/27 10:08:14
You missed the `var`.
|
+ if (entry) |
+ successCallback(JSON.parse(entry)); |
+ else |
+ errorCallback(new Error("File doesn't exist")); |
} |
function saveFile(file, data, callback) |
{ |
- ext.storage.set(fileToKey(file), |
- { |
- content: data, |
- lastModified: Date.now() |
- }, callback); |
+ try |
+ { |
+ localStorage.setItem(fileToKey(file), JSON.stringify({ |
+ content: data, |
+ lastModified: Date.now() |
+ })); |
+ } |
+ catch(error) |
+ { |
+ // QuotaExceededError can happen. Notify the user and ignore |
+ alert("Subscription storage is full. Please remove some subscriptions and try again."); |
kzar
2016/07/27 10:08:15
Nit: These lines are too long.
|
+ callback(new Error("Subscription storage is full. Please remove some subscriptions and try again.")); |
kzar
2016/07/27 10:08:14
Mind putting the message in a variable instead of
shoniko
2016/07/27 10:46:51
If we are going to push this we should do it ASAP.
|
+ return; |
+ } |
+ callback(); |
} |
exports.IO = { |
resolveFilePath: function(path) |