| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bindings/core/v8/V8HTMLElement.h" | 5 #include "bindings/core/v8/V8HTMLElement.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/DOMWrapperWorld.h" | 7 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptCustomElementDefinition.h" | 9 #include "bindings/core/v8/ScriptCustomElementDefinition.h" |
| 10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (element) { | 70 if (element) { |
| 71 // This is an element being upgraded that has called super | 71 // This is an element being upgraded that has called super |
| 72 definition->constructionStack().last().clear(); | 72 definition->constructionStack().last().clear(); |
| 73 } else { | 73 } else { |
| 74 // During upgrade an element has invoked the same constructor | 74 // During upgrade an element has invoked the same constructor |
| 75 // before calling 'super' and that invocation has poached the | 75 // before calling 'super' and that invocation has poached the |
| 76 // element. | 76 // element. |
| 77 exceptionState.throwDOMException( | 77 exceptionState.throwDOMException( |
| 78 InvalidStateError, | 78 InvalidStateError, |
| 79 "this instance is already constructed"); | 79 "this instance is already constructed"); |
| 80 exceptionState.throwIfNeeded(); | |
| 81 return; | 80 return; |
| 82 } | 81 } |
| 83 } | 82 } |
| 84 const WrapperTypeInfo* wrapperType = element->wrapperTypeInfo(); | 83 const WrapperTypeInfo* wrapperType = element->wrapperTypeInfo(); |
| 85 v8::Local<v8::Object> wrapper = V8DOMWrapper::associateObjectWithWrapper( | 84 v8::Local<v8::Object> wrapper = V8DOMWrapper::associateObjectWithWrapper( |
| 86 isolate, | 85 isolate, |
| 87 element, | 86 element, |
| 88 wrapperType, | 87 wrapperType, |
| 89 info.Holder()); | 88 info.Holder()); |
| 90 // If the element had a wrapper, we now update and return that | 89 // If the element had a wrapper, we now update and return that |
| 91 // instead. | 90 // instead. |
| 92 v8SetReturnValue(info, wrapper); | 91 v8SetReturnValue(info, wrapper); |
| 93 | 92 |
| 94 wrapper->SetPrototype(scriptState->context(), definition->prototype()).ToChe
cked(); | 93 wrapper->SetPrototype(scriptState->context(), definition->prototype()).ToChe
cked(); |
| 95 } | 94 } |
| 96 | 95 |
| 97 } // namespace blink | 96 } // namespace blink |
| OLD | NEW |