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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 if (element) { | 62 if (element) { |
63 // This is an element being upgraded that has called super | 63 // This is an element being upgraded that has called super |
64 definition->constructionStack().last().clear(); | 64 definition->constructionStack().last().clear(); |
65 } else { | 65 } else { |
66 // During upgrade an element has invoked the same constructor | 66 // During upgrade an element has invoked the same constructor |
67 // before calling 'super' and that invocation has poached the | 67 // before calling 'super' and that invocation has poached the |
68 // element. | 68 // element. |
69 exceptionState.throwDOMException( | 69 exceptionState.throwDOMException( |
70 InvalidStateError, | 70 InvalidStateError, |
71 "this instance is already constructed"); | 71 "this instance is already constructed"); |
72 exceptionState.throwIfNeeded(); | |
73 return; | 72 return; |
74 } | 73 } |
75 } | 74 } |
76 const WrapperTypeInfo* wrapperType = element->wrapperTypeInfo(); | 75 const WrapperTypeInfo* wrapperType = element->wrapperTypeInfo(); |
77 v8::Local<v8::Object> wrapper = V8DOMWrapper::associateObjectWithWrapper( | 76 v8::Local<v8::Object> wrapper = V8DOMWrapper::associateObjectWithWrapper( |
78 isolate, | 77 isolate, |
79 element, | 78 element, |
80 wrapperType, | 79 wrapperType, |
81 info.Holder()); | 80 info.Holder()); |
82 // If the element had a wrapper, we now update and return that | 81 // If the element had a wrapper, we now update and return that |
83 // instead. | 82 // instead. |
84 v8SetReturnValue(info, wrapper); | 83 v8SetReturnValue(info, wrapper); |
85 | 84 |
86 wrapper->SetPrototype(scriptState->context(), definition->prototype()).ToChe
cked(); | 85 wrapper->SetPrototype(scriptState->context(), definition->prototype()).ToChe
cked(); |
87 } | 86 } |
88 | 87 |
89 } // namespace blink | 88 } // namespace blink |
OLD | NEW |