Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: safari/ext/background.js

Issue 5768064935133184: Issue 2021 - Replaced FileSystem API with chrome.storage.local (Closed)
Patch Set: Rebased Created April 10, 2015, 6:54 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « metadata.safari ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: safari/ext/background.js
===================================================================
--- a/safari/ext/background.js
+++ b/safari/ext/background.js
@@ -742,6 +742,37 @@
}
hooks.done();
+ },
+
+ // While moving away from the FileSystem API on Chrome the data structure
+ // for files on Safari changed as well, in order to keep thing consistent.
+ migrateFiles: function(callback)
+ {
+ var settings = safari.extension.settings;
+
+ for (var key in settings)
+ {
+ var match = key.match(/^(.*)\/lastModified$/)
+
+ if (match)
+ {
+ var filename = match[1];
+ var content = settings[filename];
+
+ if (typeof content == "string")
+ {
+ settings["file:" + filename] = {
+ content: content.split(/[\r\n]+/),
+ lastModified: settings[key]
+ };
+
+ delete settings[key];
+ delete settings[filename];
+ }
+ }
+ }
+
+ callback();
}
};
« no previous file with comments | « metadata.safari ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld