| Index: tools/dom/templates/html/dartium/html_dartium.darttemplate
|
| diff --git a/tools/dom/templates/html/dartium/html_dartium.darttemplate b/tools/dom/templates/html/dartium/html_dartium.darttemplate
|
| index b15dab237afe597501927d563a74b151841e4748..7cd522c372404a6faee30022be59761176f70e86 100644
|
| --- a/tools/dom/templates/html/dartium/html_dartium.darttemplate
|
| +++ b/tools/dom/templates/html/dartium/html_dartium.darttemplate
|
| @@ -390,10 +390,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;
|
| + }
|
| +
|
| // 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
|
| @@ -420,6 +429,7 @@ wrap_jso(jsObject) {
|
| if (func != null) {
|
| dartClass_instance = func();
|
| dartClass_instance.blink_jsObject = jsObject;
|
| + jsObject.dartWrapper = dartClass_instance;
|
| }
|
| }
|
| return dartClass_instance;
|
|
|