Version 1.13.2
Cherry-pick commit '5363e5c9453b096900d3a9bbc37012a4ea65f754' to stable
diff --git a/sdk/lib/_internal/js_runtime/lib/async_patch.dart b/sdk/lib/_internal/js_runtime/lib/async_patch.dart
index 1155e79..450e30b 100644
--- a/sdk/lib/_internal/js_runtime/lib/async_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/async_patch.dart
@@ -11,6 +11,7 @@
convertDartClosureToJS,
getTraceFromException,
requiresPreamble,
+ wrapException,
unwrapException;
import 'dart:_isolate_helper' show
IsolateNatives,
@@ -509,5 +510,7 @@
@patch
void _rethrow(Object error, StackTrace stackTrace) {
- throw new AsyncError(error, stackTrace);
+ error = wrapException(error);
+ JS("void", "#.stack = #", error, stackTrace.toString());
+ JS("void", "throw #", error);
}
diff --git a/tests/lib/async/dart2js_uncaught_error_test.dart b/tests/lib/async/dart2js_uncaught_error_test.dart
new file mode 100644
index 0000000..6c7f12d
--- /dev/null
+++ b/tests/lib/async/dart2js_uncaught_error_test.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:async";
+import "dart:js";
+import "dart:collection" show Queue;
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+var errors = new Queue();
+int ctr = 0;
+
+main() {
+ print("STARTED");
+ asyncStart();
+
+ void errorHandler(self, message, url, line, [column, error]) {
+ print(">> $message / $ctr");
+ var expect = errors.removeFirst();
+ if (ctr == 2) {
+ asyncEnd();
+ print("DONE");
+ }
+ Expect.equals(expect[0].toString(), message);
+ Expect.equals(expect[1].toString(), error["stack"].toString());
+ }
+ context["onerror"] = new JsFunction.withThis(errorHandler);
+
+ void throwit() {
+ var err = ++ctr;
+ try {
+ throw err;
+ } catch (e, s) {
+ errors.add([e, s]);
+ rethrow;
+ }
+ }
+
+ () async {
+ () async {
+ throwit();
+ }();
+ throwit();
+ }();
+}
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 00412af..886da8b 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -356,3 +356,6 @@
mirrors/mirrors_used_typedef_declaration_test/01: Crash # Assertion failure: typedef(Foo) has not been checked for cycles.
mirrors/mirrors_used_typedef_declaration_test/none: Crash # Assertion failure: typedef(Foo) has not been checked for cycles.
mirrors/typedef_library_test: Crash # Assertion failure: typedef(G) has not been checked for cycles.
+
+[ $compiler != dart2js ]
+async/dart2js_uncaught_error_test: Skip # JS-integration only test
diff --git a/tools/VERSION b/tools/VERSION
index 73cc853..6cc2096 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -26,6 +26,6 @@
CHANNEL stable
MAJOR 1
MINOR 13
-PATCH 1
+PATCH 2
PRERELEASE 0
PRERELEASE_PATCH 0