| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 } | 88 } |
| 89 | 89 |
| 90 loadFile(file).then(onLoaded, callback); | 90 loadFile(file).then(onLoaded, callback); |
| 91 }, | 91 }, |
| 92 | 92 |
| 93 writeToFile: function(file, data, callback) | 93 writeToFile: function(file, data, callback) |
| 94 { | 94 { |
| 95 let items = {}; | 95 let items = {}; |
| 96 let entry = items[fileToKey(file)] = {lastModified: Date.now()}; | 96 let entry = items[fileToKey(file)] = {lastModified: Date.now()}; |
| 97 | 97 |
| 98 if (typeof browser == "object") | 98 if (typeof browser == "object") |
|
Oleksandr
2016/04/01 12:45:10
I was using this to test in Chrome. Just noticed t
| |
| 99 { | 99 { |
| 100 loadFile(file).catch(() => null) | 100 loadFile(file).catch(() => null) |
| 101 .then(oldEntry => | 101 .then(oldEntry => |
| 102 { | 102 { |
| 103 let quota = 1024 * 1024 / 2 - 1000; | 103 let quota = 1024 * 1024 / 2 - 1000; |
| 104 let chunks = []; | 104 let chunks = []; |
| 105 let chunk = []; | 105 let chunk = []; |
| 106 let chunkSize = 0; | 106 let chunkSize = 0; |
| 107 | 107 |
| 108 for (let line of data) | 108 for (let line of data) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 { | 140 { |
| 141 function onLoaded(entry) | 141 function onLoaded(entry) |
| 142 { | 142 { |
| 143 callback(null, { | 143 callback(null, { |
| 144 exists: true, | 144 exists: true, |
| 145 lastModified: entry.lastModified | 145 lastModified: entry.lastModified |
| 146 }); | 146 }); |
| 147 } | 147 } |
| 148 | 148 |
| 149 loadFile(file).then(onLoaded, callback); | 149 loadFile(file).then(onLoaded, callback); |
| 150 }, | 150 } |
|
Sebastian Noack
2016/04/01 13:01:05
Nit: You added a redundant comma here. There shoul
| |
| 151 }; | 151 }; |
| LEFT | RIGHT |