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

Unified Diff: tools/dom/templates/html/impl/impl_IDBTransaction.darttemplate

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: tools/dom/templates/html/impl/impl_IDBTransaction.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_IDBTransaction.darttemplate b/tools/dom/templates/html/impl/impl_IDBTransaction.darttemplate
index 180b2b0555e9976f73af7fc64411c9bce45e9350..39e9d30cc0eb39b2848f93b7df87e2afa685d493 100644
--- a/tools/dom/templates/html/impl/impl_IDBTransaction.darttemplate
+++ b/tools/dom/templates/html/impl/impl_IDBTransaction.darttemplate
@@ -16,16 +16,22 @@ $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
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