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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 1380963003: Preserve identity of Dart wrappers on DOM objects (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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:
Download patch
« no previous file with comments | « no previous file | sdk/lib/js/dartium/js_dartium.dart » ('j') | sdk/lib/js/dartium/js_dartium.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 95c43f64b33d9239ec51225fad5095bae41037c2..a3885eeec5d4a4e09e1631e69b17e27724cf4f17 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -1145,10 +1145,19 @@ unwrap_jso(dartClass_instance) {
*/
wrap_jso(jsObject) {
try {
- if (jsObject is! js.JsObject) {
+ if (jsObject is! js.JsObject || jsObject == null) {
// JS Interop converted the object to a Dart class e.g., Uint8ClampedList.
+ // or it's a simple type.
return jsObject;
}
+
+ // TODO(alanknight): With upgraded custom elements this causes a failure because
+ // we need a new wrapper after the type changes. We could possibly invalidate this
+ // if the constructor name didn't match?
+ if (jsObject.dartWrapper != null) {
+ return jsObject.dartWrapper;
Jacob 2015/10/01 21:07:47 change this to _dartWrapper and add a helper metho
+ }
+
// Try the most general type conversions on it.
// TODO(alanknight): We may be able to do better. This maintains identity,
// which is useful, but expensive. And if we nest something that only
@@ -1175,6 +1184,7 @@ wrap_jso(jsObject) {
if (func != null) {
dartClass_instance = func();
dartClass_instance.blink_jsObject = jsObject;
+ jsObject.dartWrapper = dartClass_instance;
}
}
return dartClass_instance;
@@ -37168,10 +37178,10 @@ class Url extends NativeFieldWrapperClass2 implements UrlUtils {
if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(unwrap_jso(blob_OR_source_OR_stream));
}
- if ((blob_OR_source_OR_stream is MediaStream)) {
+ if ((blob_OR_source_OR_stream is MediaSource)) {
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(unwrap_jso(blob_OR_source_OR_stream));
}
- if ((blob_OR_source_OR_stream is MediaSource)) {
+ if ((blob_OR_source_OR_stream is MediaStream)) {
return _blink.BlinkURL.instance.createObjectURL_Callback_1_(unwrap_jso(blob_OR_source_OR_stream));
}
throw new ArgumentError("Incorrect number or type of arguments");
« no previous file with comments | « no previous file | sdk/lib/js/dartium/js_dartium.dart » ('j') | sdk/lib/js/dartium/js_dartium.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698