| Index: Source/bindings/dart/DartCustomElementWrapper.cpp
|
| diff --git a/Source/bindings/dart/DartCustomElementWrapper.cpp b/Source/bindings/dart/DartCustomElementWrapper.cpp
|
| index 28da221dbc7f52d01a85639e59651d52715fde25..8217d88111844c21cf733fc6552cba41b3e9db4a 100644
|
| --- a/Source/bindings/dart/DartCustomElementWrapper.cpp
|
| +++ b/Source/bindings/dart/DartCustomElementWrapper.cpp
|
| @@ -112,13 +112,17 @@ Dart_Handle DartCustomElementWrapper<HTMLElement>::upgradeDartWrapper(HTMLElemen
|
| Dart_HandleFromWeakPersistent(oldInstance));
|
| }
|
|
|
| - domData->pushUpgradingCustomElement(element);
|
| + Dart_Handle newInstance = Dart_Allocate(customType);
|
| + ASSERT(!Dart_IsError(newInstance));
|
|
|
| - Dart_Handle newInstance = Dart_New(customType, Dart_NewStringFromCString("created"), 0, 0);
|
| - if (Dart_IsError(newInstance)) {
|
| - domData->popUpgradingCustomElement();
|
| + Dart_Handle result = Dart_SetNativeInstanceField(newInstance, 0, reinterpret_cast<intptr_t>(element));
|
| + UNUSED_PARAM(result);
|
| + ASSERT(!Dart_IsError(result));
|
|
|
| - DartUtilities::reportProblem(DartDOMData::current()->scriptExecutionContext(), newInstance);
|
| + result = Dart_InvokeConstructor(newInstance, Dart_NewStringFromCString("created"), 0, 0);
|
| +
|
| + if (Dart_IsError(result)) {
|
| + DartUtilities::reportProblem(domData->scriptExecutionContext(), newInstance);
|
|
|
| // Fall back to the old wrapper if possible.
|
| if (oldInstance) {
|
| @@ -138,8 +142,6 @@ Dart_Handle DartCustomElementWrapper<HTMLElement>::upgradeDartWrapper(HTMLElemen
|
|
|
| return fallbackWrapper;
|
| }
|
| - // Should have come through initializeCustomElement.
|
| - ASSERT(!domData->isUpgradingCustomElement(element));
|
| return newInstance;
|
| }
|
|
|
| @@ -155,17 +157,16 @@ template<>
|
| void DartCustomElementWrapper<HTMLElement>::initializeCustomElement(Dart_Handle wrapper, Dart_Handle& exception)
|
| {
|
| DartDOMData* domData = DartDOMData::current();
|
| - HTMLElement* element = reinterpret_cast<HTMLElement*>(domData->popUpgradingCustomElement());
|
| + HTMLElement* element = DartDOMWrapper::unwrapDartWrapper<DartHTMLElement>(domData, wrapper, exception);
|
| + if (exception) {
|
| + return;
|
| + }
|
| if (!element) {
|
| exception = Dart_NewStringFromCString("created called outside of custom element creation.");
|
| return;
|
| }
|
|
|
| DartDOMWrapper::associateWrapper<DartHTMLElement>(domData, element, wrapper);
|
| -
|
| - Dart_Handle result = Dart_SetNativeInstanceField(wrapper, 0, reinterpret_cast<intptr_t>(element));
|
| - UNUSED_PARAM(result);
|
| - ASSERT(!Dart_IsError(result));
|
| }
|
|
|
| template
|
|
|