Index: safari/ext/background.js |
=================================================================== |
--- a/safari/ext/background.js |
+++ b/safari/ext/background.js |
@@ -716,6 +716,37 @@ |
settings[item.key] = item.value; |
} |
} |
+ }, |
+ |
+ // 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(); |
} |
}; |