* clearBackup * Remove any backup stored in localStorage. * This happens when: * - The user chooses to "Discard my changes" from the restore screen * - The user switches sources with the source switcher * - A changeset is inflight, we remove it to prevent the user from restoring dupli
()
| 1233 | * - A changeset is inflight, we remove it to prevent the user from restoring duplicate edits |
| 1234 | */ |
| 1235 | clearBackup() { |
| 1236 | this._canRestoreBackup = false; |
| 1237 | this.deferredBackup.cancel(); |
| 1238 | |
| 1239 | if (!this._mutex.locked()) return; // another browser tab owns the history |
| 1240 | |
| 1241 | const storage = this.context.systems.storage; |
| 1242 | storage.removeItem(this._backupKey()); |
| 1243 | |
| 1244 | // clear the changeset metadata associated with the saved history |
| 1245 | storage.removeItem('comment'); |
| 1246 | storage.removeItem('hashtags'); |
| 1247 | storage.removeItem('source'); |
| 1248 | } |
| 1249 | |
| 1250 | |
| 1251 | /** |
no test coverage detected