| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 { | 202 { |
| 203 let store = getObjectStore(dbInstance, storeName); | 203 let store = getObjectStore(dbInstance, storeName); |
| 204 let req = store.get(fileName); | 204 let req = store.get(fileName); |
| 205 | 205 |
| 206 req.onsuccess = event => resolve(event.currentTarget.result); | 206 req.onsuccess = event => resolve(event.currentTarget.result); |
| 207 req.onerror = event => reject(event.target.error); | 207 req.onerror = event => reject(event.target.error); |
| 208 }) | 208 }) |
| 209 .catch(error => | 209 .catch(error => |
| 210 { | 210 { |
| 211 if (error.name == "UnknownError") | 211 if (error.name == "UnknownError") |
| 212 return reestablishConnection(dbInstance) | 212 return reestablishConnection(dbInstance).then(() => undefined); |
| 213 .then(() => undefined); | |
|
Sebastian Noack
2018/09/04 21:00:01
Nit: Wrapping here seems unnecessary. It appears t
geo
2018/09/05 14:04:34
Done.
| |
| 214 }); | 213 }); |
| 215 } | 214 } |
| 216 | 215 |
| 217 function saveFile(data, dbInstance, storeName) | 216 function saveFile(data, dbInstance, storeName) |
| 218 { | 217 { |
| 219 return new Promise((resolve, reject) => | 218 return new Promise((resolve, reject) => |
| 220 { | 219 { |
| 221 let store = getObjectStore(dbInstance, storeName); | 220 let store = getObjectStore(dbInstance, storeName); |
| 222 let req = store.put(data); | 221 let req = store.put(data); |
| 223 | 222 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 fileName: fileToKey(newName), | 344 fileName: fileToKey(newName), |
| 346 content: fileData.content, | 345 content: fileData.content, |
| 347 lastModified: fileData.lastModified | 346 lastModified: fileData.lastModified |
| 348 }, | 347 }, |
| 349 dbInstance, | 348 dbInstance, |
| 350 dbConfig.storeName)) | 349 dbConfig.storeName)) |
| 351 .then(() => deleteFile(fromFile, dbInstance, dbConfig.storeName)))); | 350 .then(() => deleteFile(fromFile, dbInstance, dbConfig.storeName)))); |
| 352 } | 351 } |
| 353 }; | 352 }; |
| 354 | 353 |
| LEFT | RIGHT |