dart-sdk/runtime
Siva Annamalai 98b9b6c07c Revert "[vm] Treat Future.then(..., onError:...) as catch all handler"
This reverts commit 38e0046cad.

Reason for revert: https://github.com/flutter/flutter/issues/133677

Original change's description:
> [vm] Treat Future.then(..., onError:...) as catch all handler
>
> Commit a52f2b9 which reworked awaiter stack unwinding and its
> integration with debugger introduced the following regression:
> it stopped treating `Future` listeners which had both `onValue`
> and `onError` callbacks as catch all exception handlers. Only
> listners with `onError` callback (those created with
> `Future.onError`) were treated as a catch all handler.
>
> This meant that debugger started to treat exceptions in the
> code below as uncaught:
>
> ```
> Future<void> foo() {
>   await 0;
>   throw '';
> }
>
> await foo().then(..., onError: (e, st) {
>
> });
> ```
>
> This change fixes this regression by checking if
> `FutureListener.state & stateCatchError != 0` instead of
> more narrow `FutureListener.state == stateCatchError` which
> only detects listeners which only catch errors but do not
> handle values. The new predicate matches
> `FutureListener.handlesError`.
>
> Fixes https://github.com/dart-lang/sdk/issues/53334
>
> TEST=service/pause_on_unhandled_async_exceptions_test
>
> Fixed: 53334
> Change-Id: I374114b7a7b2ef86b7ed6bf7d5e7cf71ba6054dc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323280
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>

Change-Id: Id20a6929aac93511173c7467caee91e2488696ed
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323429
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-08-30 18:24:46 +00:00
..
bin [vm/ffi] Closure callbacks for sync callbacks 2023-08-25 03:35:44 +00:00
docs Revert "Reland "[vm, gc] Mark through new-space."" 2023-08-28 14:34:21 +00:00
include [vm] Separate for-snapshot vs embed-sources bools when compiling to kernel 2023-07-28 10:01:53 +00:00
lib [vm] Cleanup lookups in the library import 2023-08-30 17:18:53 +00:00
observatory Revert "[vm] Treat Future.then(..., onError:...) as catch all handler" 2023-08-30 18:24:46 +00:00
observatory_2 [infra] Use actual package names in the generated package config. 2023-08-28 10:29:48 +00:00
platform Revert "Reland "[vm, gc] Mark through new-space."" 2023-08-28 14:34:21 +00:00
tests [vm, compiler] Add option to suppress obfuscation of type names for some hierarchy. 2023-08-25 18:55:32 +00:00
third_party Spelling pkg analyzer lib 2023-01-25 14:08:27 +00:00
tools Remove duplicate keys in dartfuzz_api_table 2023-08-21 17:43:28 +00:00
vm Revert "[vm] Treat Future.then(..., onError:...) as catch all handler" 2023-08-30 18:24:46 +00:00
.clang-tidy
.gitignore
BUILD.gn Add a GN flag for the non-debug optimization level 2023-07-15 14:14:59 +00:00
codereview.settings
configs.gni [Runtime] Add extra_product_deps and extra_nonproduct_deps params to "library_for_all_configs_with_compiler" template 2023-04-14 19:51:40 +00:00
CPPLINT.cfg [cpplint] Disable runtime/references lint 2023-01-23 18:21:48 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
PRESUBMIT.py Reland "Reland "[VM] Begin supporting Perfetto file recorder"" 2023-04-18 19:39:05 +00:00
runtime_args.gni Add a GN flag for the non-debug optimization level 2023-07-15 14:14:59 +00:00