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

Issue 1025133004: Make Completer.complete handle a Future with a misbehaving "then" call. (Closed)

Created:
5 years, 9 months ago by Lasse Reichstein Nielsen
Modified:
5 years, 9 months ago
Reviewers:
Søren Gjesse, sigurdm
CC:
reviews_dartlang.org, floitsch
Target Ref:
refs/remotes/git-svn
Visibility:
Public.

Description

Make Completer.complete handle a Future with a misbehaving "then" call. Instead of throwing and getting into an invalid state (isChained but won't ever complete), the synchronous error from trying to call "then" is used to complete the future. This should never happen in practice - it requires a "then" implementation that is missing or throwing even when given valid arguments. R=sgjesse@google.com Committed: https://code.google.com/p/dart/source/detail?r=44629

Patch Set 1 #

Total comments: 2

Patch Set 2 : Expand explanation #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -12 lines) Patch
M sdk/lib/async/future_impl.dart View 1 2 chunks +22 lines, -12 lines 0 comments Download
M tests/lib/async/future_test.dart View 3 chunks +34 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
Lasse Reichstein Nielsen
5 years, 9 months ago (2015-03-23 09:02:34 UTC) #2
Søren Gjesse
lgtm https://codereview.chromium.org/1025133004/diff/1/sdk/lib/async/future_impl.dart File sdk/lib/async/future_impl.dart (right): https://codereview.chromium.org/1025133004/diff/1/sdk/lib/async/future_impl.dart#newcode321 sdk/lib/async/future_impl.dart:321: // The `then` call threw synchronously. This should ...
5 years, 9 months ago (2015-03-23 09:07:36 UTC) #3
Lasse Reichstein Nielsen
Committed patchset #2 (id:20001) manually as 44629 (presubmit successful).
5 years, 9 months ago (2015-03-23 09:09:39 UTC) #4
Lasse Reichstein Nielsen
5 years, 9 months ago (2015-03-23 09:43:54 UTC) #5
Message was sent while issue was closed.
https://codereview.chromium.org/1025133004/diff/1/sdk/lib/async/future_impl.dart
File sdk/lib/async/future_impl.dart (right):

https://codereview.chromium.org/1025133004/diff/1/sdk/lib/async/future_impl.d...
sdk/lib/async/future_impl.dart:321: // The `then` call threw synchronously. This
should never happen!
The _Future implementation never reaches here. To even reach this function, a
different implementation of Future is required, and to get to the catch, it must
throw when calling "then" with perfectly good arguments - so it's a really bad
implementation - which obviously *shouldn't* happen.

Powered by Google App Engine
This is Rietveld 408576698