Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2097)

Unified Diff: sdk/lib/indexed_db/dartium/indexed_db_dartium.dart

Issue 26789008: Fixing double-completing indexed DB transactions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
diff --git a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
index 34dcf6bb979a12ca536deda4020d0bd2c26bc7e1..32ddc6cab49290b6dcefd6187c0943e7b987c8de 100644
--- a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
+++ b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
@@ -940,16 +940,22 @@ class Transaction extends EventTarget {
Future<Database> get completed {
var completer = new Completer<Database>();
+ var errored = false;
+
this.onComplete.first.then((_) {
completer.complete(db);
});
this.onError.first.then((e) {
+ errored = true;
completer.completeError(e);
});
this.onAbort.first.then((e) {
- completer.completeError(e);
+ // Avoid completing twice if an error occurs.
+ if (!errored) {
+ completer.completeError(e);
+ }
});
return completer.future;

Powered by Google App Engine
This is Rietveld 408576698