Index: chrome/ext/background.js |
=================================================================== |
--- a/chrome/ext/background.js |
+++ b/chrome/ext/background.js |
@@ -531,89 +531,7 @@ |
{ |
chrome.storage.local.remove(key, callback); |
}, |
- onChanged: chrome.storage.onChanged, |
- |
- // Migrate localStorage to chrome.storage.local, |
- // ignoring unkown and invalid preferences. |
- migratePrefs: function(hooks) |
- { |
- var items = {}; |
- |
- for (let key in localStorage) |
- { |
- var item = hooks.map(key, localStorage[key]); |
- if (item) |
- items[item.key] = item.value; |
- } |
- |
- chrome.storage.local.set(items, function() { |
- localStorage.clear(); |
- hooks.done(); |
- }); |
- }, |
- |
- // Migrate FileSystem API to chrome.storage.local. For simplicity |
- // only patterns.ini is considered. Backups are left behind. |
- migrateFiles: function(callback) |
- { |
- if ("webkitRequestFileSystem" in window) |
- { |
- webkitRequestFileSystem(PERSISTENT, 0, function(fs) |
- { |
- fs.root.getFile("patterns.ini", {}, function(entry) |
- { |
- entry.getMetadata(function(metadata) |
- { |
- entry.file(function(file) |
- { |
- var reader = new FileReader(); |
- reader.onloadend = function() |
- { |
- if (!reader.error) |
- { |
- chrome.storage.local.set( |
- { |
- "file:patterns.ini": { |
- content: reader.result.split(/[\r\n]+/), |
- lastModified: metadata.modificationTime.getTime() |
- } |
- }, |
- function() |
- { |
- fs.root.createReader().readEntries(function(entries) |
- { |
- var emptyFunc = function() {}; |
- |
- for (var i = 0; i < entries.length; i++) |
- { |
- var entry = entries[i]; |
- if (entry.isDirectory) |
- entry.removeRecursively(emptyFunc, emptyFunc); |
- else |
- entry.remove(emptyFunc, emptyFunc); |
- } |
- }); |
- |
- callback(); |
- } |
- ); |
- } |
- else |
- { |
- callback(); |
- } |
- }; |
- reader.readAsText(file); |
- }, callback); |
- }, callback); |
- }, callback); |
- }, callback); |
- } |
- else |
- { |
- callback(); |
- } |
- } |
+ onChanged: chrome.storage.onChanged |
}; |
/* Options */ |