Index: sdk/lib/js/dartium/js_dartium.dart |
diff --git a/sdk/lib/js/dartium/js_dartium.dart b/sdk/lib/js/dartium/js_dartium.dart |
index e7f3004c686d8efbc0b5bdc038bbb28178f2f5d2..69f272d20c93b2ea0d0cdbc0ac6d8c383f5b48e0 100644 |
--- a/sdk/lib/js/dartium/js_dartium.dart |
+++ b/sdk/lib/js/dartium/js_dartium.dart |
@@ -87,6 +87,7 @@ |
*/ |
library dart.js; |
+import 'dart:async' show Zone; |
import 'dart:collection' show ListMixin; |
import 'dart:nativewrappers'; |
@@ -360,6 +361,18 @@ class JsArray<E> extends JsObject with ListMixin<E> { |
} |
/** |
+ * This function performs any wrapping of a Dart value before Dartium proxies |
+ * it to JS. |
+ */ |
+_wrapToJs(value) => value is Function ? _applyZoned(value) : value; |
+ |
+_applyZoned(f) { |
+ var call = (List arguments) => Function.apply(f, arguments); |
+ if (Zone.current == Zone.ROOT) return call; |
+ return Zone.current.bindUnaryCallback(call); |
+} |
+ |
+/** |
* Placeholder object for cases where we need to determine exactly how many |
* args were passed to a function. |
*/ |