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"); |