OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 function onLoaded(entry) | 80 function onLoaded(entry) |
81 { | 81 { |
82 saveFile(toFile, entry.content, callback); | 82 saveFile(toFile, entry.content, callback); |
83 } | 83 } |
84 | 84 |
85 loadFile(fromFile, onLoaded, callback); | 85 loadFile(fromFile, onLoaded, callback); |
86 }, | 86 }, |
87 | 87 |
88 renameFile: function(fromFile, newName, callback) | 88 renameFile: function(fromFile, newName, callback) |
89 { | 89 { |
90 function onLoaded() | 90 function onLoaded(entry) |
91 { | 91 { |
92 ext.storage.remove(fileToKey(fromFile), function() | 92 ext.storage.remove(fileToKey(fromFile), function() |
93 { | 93 { |
94 ext.storage.set(keyPrefix + newName, entry, callback); | 94 ext.storage.set(keyPrefix + newName, entry, callback); |
95 }); | 95 }); |
96 } | 96 } |
97 | 97 |
98 loadFile(fromFile, onLoaded, callback); | 98 loadFile(fromFile, onLoaded, callback); |
99 }, | 99 }, |
100 | 100 |
101 removeFile: function(file, callback) | 101 removeFile: function(file, callback) |
102 { | 102 { |
103 ext.storage.remove(fileToKey(file), callback); | 103 ext.storage.remove(fileToKey(file), callback); |
104 }, | 104 }, |
105 | 105 |
106 statFile: function(file, callback) | 106 statFile: function(file, callback) |
107 { | 107 { |
108 function onLoaded(entry) | 108 function onLoaded(entry) |
109 { | 109 { |
110 callback(null, { | 110 callback(null, { |
111 exists: true, | 111 exists: true, |
112 lastModified: entry.lastModified | 112 lastModified: entry.lastModified |
113 }); | 113 }); |
114 } | 114 } |
115 | 115 |
116 loadFile(file, onLoaded, callback); | 116 loadFile(file, onLoaded, callback); |
117 } | 117 } |
118 }; | 118 }; |
OLD | NEW |