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

Unified Diff: sdk/lib/indexed_db/dart2js/indexed_db_dart2js.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
« no previous file with comments | « no previous file | sdk/lib/indexed_db/dartium/indexed_db_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
diff --git a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
index 5b2948dfec31367eac7ea807fb43b75fa684ea90..d0b2919771fa1d7af3324d4cd5366f0d961480af 100644
--- a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
+++ b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
@@ -1252,16 +1252,22 @@ class Transaction extends EventTarget native "IDBTransaction" {
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) {
Emily Fortuna 2013/10/16 00:20:59 would completer.isCompleted work instead?
blois 2013/10/17 01:05:07 Ah, much nicer!
+ completer.completeError(e);
+ }
});
return completer.future;
« no previous file with comments | « no previous file | sdk/lib/indexed_db/dartium/indexed_db_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698