Chromium Code Reviews| 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; |