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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library dart.dom.indexed_db; 1 library dart.dom.indexed_db;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:html'; 4 import 'dart:html';
5 import 'dart:html_common'; 5 import 'dart:html_common';
6 import 'dart:nativewrappers'; 6 import 'dart:nativewrappers';
7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
8 // for details. All rights reserved. Use of this source code is governed by a 8 // for details. All rights reserved. Use of this source code is governed by a
9 // BSD-style license that can be found in the LICENSE file. 9 // BSD-style license that can be found in the LICENSE file.
10 10
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 /** 933 /**
934 * Provides a Future which will be completed once the transaction has 934 * Provides a Future which will be completed once the transaction has
935 * completed. 935 * completed.
936 * 936 *
937 * The future will error if an error occurrs on the transaction or if the 937 * The future will error if an error occurrs on the transaction or if the
938 * transaction is aborted. 938 * transaction is aborted.
939 */ 939 */
940 Future<Database> get completed { 940 Future<Database> get completed {
941 var completer = new Completer<Database>(); 941 var completer = new Completer<Database>();
942 942
943 var errored = false;
944
943 this.onComplete.first.then((_) { 945 this.onComplete.first.then((_) {
944 completer.complete(db); 946 completer.complete(db);
945 }); 947 });
946 948
947 this.onError.first.then((e) { 949 this.onError.first.then((e) {
950 errored = true;
948 completer.completeError(e); 951 completer.completeError(e);
949 }); 952 });
950 953
951 this.onAbort.first.then((e) { 954 this.onAbort.first.then((e) {
952 completer.completeError(e); 955 // Avoid completing twice if an error occurs.
956 if (!errored) {
957 completer.completeError(e);
958 }
953 }); 959 });
954 960
955 return completer.future; 961 return completer.future;
956 } 962 }
957 963
958 // To suppress missing implicit constructor warnings. 964 // To suppress missing implicit constructor warnings.
959 factory Transaction._() { throw new UnsupportedError("Not supported"); } 965 factory Transaction._() { throw new UnsupportedError("Not supported"); }
960 966
961 @DomName('IDBTransaction.abortEvent') 967 @DomName('IDBTransaction.abortEvent')
962 @DocsEditable() 968 @DocsEditable()
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 1057
1052 1058
1053 @DocsEditable() 1059 @DocsEditable()
1054 @DomName('IDBAny') 1060 @DomName('IDBAny')
1055 @deprecated // nonstandard 1061 @deprecated // nonstandard
1056 abstract class _IDBAny extends NativeFieldWrapperClass1 { 1062 abstract class _IDBAny extends NativeFieldWrapperClass1 {
1057 // To suppress missing implicit constructor warnings. 1063 // To suppress missing implicit constructor warnings.
1058 factory _IDBAny._() { throw new UnsupportedError("Not supported"); } 1064 factory _IDBAny._() { throw new UnsupportedError("Not supported"); }
1059 1065
1060 } 1066 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698