Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1503)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp

Issue 1914923002: Rename all existing custom element classes as V0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CustomElementV0 -> V0CustomElement Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "bindings/core/v8/CustomElementConstructorBuilder.h" 31 #include "bindings/core/v8/V0CustomElementConstructorBuilder.h"
32 32
33 #include "bindings/core/v8/CustomElementBinding.h"
34 #include "bindings/core/v8/DOMWrapperWorld.h" 33 #include "bindings/core/v8/DOMWrapperWorld.h"
35 #include "bindings/core/v8/ExceptionState.h" 34 #include "bindings/core/v8/ExceptionState.h"
35 #include "bindings/core/v8/V0CustomElementBinding.h"
36 #include "bindings/core/v8/V8Binding.h" 36 #include "bindings/core/v8/V8Binding.h"
37 #include "bindings/core/v8/V8Document.h" 37 #include "bindings/core/v8/V8Document.h"
38 #include "bindings/core/v8/V8HTMLElement.h" 38 #include "bindings/core/v8/V8HTMLElement.h"
39 #include "bindings/core/v8/V8HiddenValue.h" 39 #include "bindings/core/v8/V8HiddenValue.h"
40 #include "bindings/core/v8/V8PerContextData.h" 40 #include "bindings/core/v8/V8PerContextData.h"
41 #include "bindings/core/v8/V8SVGElement.h" 41 #include "bindings/core/v8/V8SVGElement.h"
42 #include "core/HTMLNames.h" 42 #include "core/HTMLNames.h"
43 #include "core/SVGNames.h" 43 #include "core/SVGNames.h"
44 #include "core/dom/Document.h" 44 #include "core/dom/Document.h"
45 #include "core/dom/ElementRegistrationOptions.h" 45 #include "core/dom/ElementRegistrationOptions.h"
46 #include "core/dom/custom/CustomElementDefinition.h" 46 #include "core/dom/custom/V0CustomElementDefinition.h"
47 #include "core/dom/custom/CustomElementDescriptor.h" 47 #include "core/dom/custom/V0CustomElementDescriptor.h"
48 #include "core/dom/custom/CustomElementException.h" 48 #include "core/dom/custom/V0CustomElementException.h"
49 #include "core/dom/custom/CustomElementProcessingStack.h" 49 #include "core/dom/custom/V0CustomElementProcessingStack.h"
50 #include "wtf/Assertions.h" 50 #include "wtf/Assertions.h"
51 51
52 namespace blink { 52 namespace blink {
53 53
54 static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>&); 54 static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>&);
55 55
56 CustomElementConstructorBuilder::CustomElementConstructorBuilder(ScriptState* sc riptState, const ElementRegistrationOptions& options) 56 V0CustomElementConstructorBuilder::V0CustomElementConstructorBuilder(ScriptState * scriptState, const ElementRegistrationOptions& options)
57 : m_scriptState(scriptState) 57 : m_scriptState(scriptState)
58 , m_options(options) 58 , m_options(options)
59 { 59 {
60 ASSERT(m_scriptState->context() == m_scriptState->isolate()->GetCurrentConte xt()); 60 ASSERT(m_scriptState->context() == m_scriptState->isolate()->GetCurrentConte xt());
61 } 61 }
62 62
63 bool CustomElementConstructorBuilder::isFeatureAllowed() const 63 bool V0CustomElementConstructorBuilder::isFeatureAllowed() const
64 { 64 {
65 return m_scriptState->world().isMainWorld(); 65 return m_scriptState->world().isMainWorld();
66 } 66 }
67 67
68 bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, QualifiedName& tagName, ExceptionState& exceptionState) 68 bool V0CustomElementConstructorBuilder::validateOptions(const AtomicString& type , QualifiedName& tagName, ExceptionState& exceptionState)
69 { 69 {
70 ASSERT(m_prototype.IsEmpty()); 70 ASSERT(m_prototype.IsEmpty());
71 71
72 v8::TryCatch tryCatch(m_scriptState->isolate()); 72 v8::TryCatch tryCatch(m_scriptState->isolate());
73 73
74 if (!m_scriptState->perContextData()) { 74 if (!m_scriptState->perContextData()) {
75 // FIXME: This should generate an InvalidContext exception at a later po int. 75 // FIXME: This should generate an InvalidContext exception at a later po int.
76 CustomElementException::throwException(CustomElementException::ContextDe stroyedCheckingPrototype, type, exceptionState); 76 V0CustomElementException::throwException(V0CustomElementException::Conte xtDestroyedCheckingPrototype, type, exceptionState);
77 tryCatch.ReThrow(); 77 tryCatch.ReThrow();
78 return false; 78 return false;
79 } 79 }
80 80
81 if (m_options.hasPrototype()) { 81 if (m_options.hasPrototype()) {
82 ASSERT(m_options.prototype().isObject()); 82 ASSERT(m_options.prototype().isObject());
83 m_prototype = m_options.prototype().v8Value().As<v8::Object>(); 83 m_prototype = m_options.prototype().v8Value().As<v8::Object>();
84 } else { 84 } else {
85 m_prototype = v8::Object::New(m_scriptState->isolate()); 85 m_prototype = v8::Object::New(m_scriptState->isolate());
86 v8::Local<v8::Object> basePrototype = m_scriptState->perContextData()->p rototypeForType(&V8HTMLElement::wrapperTypeInfo); 86 v8::Local<v8::Object> basePrototype = m_scriptState->perContextData()->p rototypeForType(&V8HTMLElement::wrapperTypeInfo);
87 if (!basePrototype.IsEmpty()) { 87 if (!basePrototype.IsEmpty()) {
88 if (!v8CallBoolean(m_prototype->SetPrototype(m_scriptState->context( ), basePrototype))) 88 if (!v8CallBoolean(m_prototype->SetPrototype(m_scriptState->context( ), basePrototype)))
89 return false; 89 return false;
90 } 90 }
91 } 91 }
92 92
93 AtomicString namespaceURI = HTMLNames::xhtmlNamespaceURI; 93 AtomicString namespaceURI = HTMLNames::xhtmlNamespaceURI;
94 if (hasValidPrototypeChainFor(&V8SVGElement::wrapperTypeInfo)) 94 if (hasValidPrototypeChainFor(&V8SVGElement::wrapperTypeInfo))
95 namespaceURI = SVGNames::svgNamespaceURI; 95 namespaceURI = SVGNames::svgNamespaceURI;
96 96
97 ASSERT(!tryCatch.HasCaught()); 97 ASSERT(!tryCatch.HasCaught());
98 98
99 AtomicString localName; 99 AtomicString localName;
100 100
101 if (m_options.hasExtends()) { 101 if (m_options.hasExtends()) {
102 localName = AtomicString(m_options.extends().lower()); 102 localName = AtomicString(m_options.extends().lower());
103 103
104 if (!Document::isValidName(localName)) { 104 if (!Document::isValidName(localName)) {
105 CustomElementException::throwException(CustomElementException::Exten dsIsInvalidName, type, exceptionState); 105 V0CustomElementException::throwException(V0CustomElementException::E xtendsIsInvalidName, type, exceptionState);
106 tryCatch.ReThrow(); 106 tryCatch.ReThrow();
107 return false; 107 return false;
108 } 108 }
109 if (CustomElement::isValidName(localName)) { 109 if (V0CustomElement::isValidName(localName)) {
110 CustomElementException::throwException(CustomElementException::Exten dsIsCustomElementName, type, exceptionState); 110 V0CustomElementException::throwException(V0CustomElementException::E xtendsIsCustomElementName, type, exceptionState);
111 tryCatch.ReThrow(); 111 tryCatch.ReThrow();
112 return false; 112 return false;
113 } 113 }
114 } else { 114 } else {
115 if (namespaceURI == SVGNames::svgNamespaceURI) { 115 if (namespaceURI == SVGNames::svgNamespaceURI) {
116 CustomElementException::throwException(CustomElementException::Exten dsIsInvalidName, type, exceptionState); 116 V0CustomElementException::throwException(V0CustomElementException::E xtendsIsInvalidName, type, exceptionState);
117 tryCatch.ReThrow(); 117 tryCatch.ReThrow();
118 return false; 118 return false;
119 } 119 }
120 localName = type; 120 localName = type;
121 } 121 }
122 122
123 ASSERT(!tryCatch.HasCaught()); 123 ASSERT(!tryCatch.HasCaught());
124 tagName = QualifiedName(nullAtom, localName, namespaceURI); 124 tagName = QualifiedName(nullAtom, localName, namespaceURI);
125 return true; 125 return true;
126 } 126 }
127 127
128 CustomElementLifecycleCallbacks* CustomElementConstructorBuilder::createCallback s() 128 V0CustomElementLifecycleCallbacks* V0CustomElementConstructorBuilder::createCall backs()
129 { 129 {
130 ASSERT(!m_prototype.IsEmpty()); 130 ASSERT(!m_prototype.IsEmpty());
131 131
132 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); 132 v8::TryCatch exceptionCatcher(m_scriptState->isolate());
133 exceptionCatcher.SetVerbose(true); 133 exceptionCatcher.SetVerbose(true);
134 134
135 v8::MaybeLocal<v8::Function> created = retrieveCallback("createdCallback"); 135 v8::MaybeLocal<v8::Function> created = retrieveCallback("createdCallback");
136 v8::MaybeLocal<v8::Function> attached = retrieveCallback("attachedCallback") ; 136 v8::MaybeLocal<v8::Function> attached = retrieveCallback("attachedCallback") ;
137 v8::MaybeLocal<v8::Function> detached = retrieveCallback("detachedCallback") ; 137 v8::MaybeLocal<v8::Function> detached = retrieveCallback("detachedCallback") ;
138 v8::MaybeLocal<v8::Function> attributeChanged = retrieveCallback("attributeC hangedCallback"); 138 v8::MaybeLocal<v8::Function> attributeChanged = retrieveCallback("attributeC hangedCallback");
139 139
140 m_callbacks = V8CustomElementLifecycleCallbacks::create(m_scriptState.get(), m_prototype, created, attached, detached, attributeChanged); 140 m_callbacks = V8V0CustomElementLifecycleCallbacks::create(m_scriptState.get( ), m_prototype, created, attached, detached, attributeChanged);
141 return m_callbacks.get(); 141 return m_callbacks.get();
142 } 142 }
143 143
144 v8::MaybeLocal<v8::Function> CustomElementConstructorBuilder::retrieveCallback(c onst char* name) 144 v8::MaybeLocal<v8::Function> V0CustomElementConstructorBuilder::retrieveCallback (const char* name)
145 { 145 {
146 v8::Local<v8::Value> value; 146 v8::Local<v8::Value> value;
147 if (!m_prototype->Get(m_scriptState->context(), v8String(m_scriptState->isol ate(), name)).ToLocal(&value) || !value->IsFunction()) 147 if (!m_prototype->Get(m_scriptState->context(), v8String(m_scriptState->isol ate(), name)).ToLocal(&value) || !value->IsFunction())
148 return v8::MaybeLocal<v8::Function>(); 148 return v8::MaybeLocal<v8::Function>();
149 return v8::MaybeLocal<v8::Function>(value.As<v8::Function>()); 149 return v8::MaybeLocal<v8::Function>(value.As<v8::Function>());
150 } 150 }
151 151
152 bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust omElementDefinition* definition, ExceptionState& exceptionState) 152 bool V0CustomElementConstructorBuilder::createConstructor(Document* document, V0 CustomElementDefinition* definition, ExceptionState& exceptionState)
153 { 153 {
154 ASSERT(!m_prototype.IsEmpty()); 154 ASSERT(!m_prototype.IsEmpty());
155 ASSERT(m_constructor.IsEmpty()); 155 ASSERT(m_constructor.IsEmpty());
156 ASSERT(document); 156 ASSERT(document);
157 157
158 v8::Isolate* isolate = m_scriptState->isolate(); 158 v8::Isolate* isolate = m_scriptState->isolate();
159 v8::Local<v8::Context> context = m_scriptState->context(); 159 v8::Local<v8::Context> context = m_scriptState->context();
160 160
161 if (!prototypeIsValid(definition->descriptor().type(), exceptionState)) 161 if (!prototypeIsValid(definition->descriptor().type(), exceptionState))
162 return false; 162 return false;
163 163
164 const CustomElementDescriptor& descriptor = definition->descriptor(); 164 const V0CustomElementDescriptor& descriptor = definition->descriptor();
165 165
166 v8::Local<v8::String> v8TagName = v8String(isolate, descriptor.localName()); 166 v8::Local<v8::String> v8TagName = v8String(isolate, descriptor.localName());
167 v8::Local<v8::Value> v8Type; 167 v8::Local<v8::Value> v8Type;
168 if (descriptor.isTypeExtension()) 168 if (descriptor.isTypeExtension())
169 v8Type = v8String(isolate, descriptor.type()); 169 v8Type = v8String(isolate, descriptor.type());
170 else 170 else
171 v8Type = v8::Null(isolate); 171 v8Type = v8::Null(isolate);
172 172
173 v8::Local<v8::Object> data = v8::Object::New(isolate); 173 v8::Local<v8::Object> data = v8::Object::New(isolate);
174 V8HiddenValue::setHiddenValue(m_scriptState.get(), data, V8HiddenValue::cust omElementDocument(isolate), toV8(document, context->Global(), isolate)); 174 V8HiddenValue::setHiddenValue(m_scriptState.get(), data, V8HiddenValue::cust omElementDocument(isolate), toV8(document, context->Global(), isolate));
175 V8HiddenValue::setHiddenValue(m_scriptState.get(), data, V8HiddenValue::cust omElementNamespaceURI(isolate), v8String(isolate, descriptor.namespaceURI())); 175 V8HiddenValue::setHiddenValue(m_scriptState.get(), data, V8HiddenValue::cust omElementNamespaceURI(isolate), v8String(isolate, descriptor.namespaceURI()));
176 V8HiddenValue::setHiddenValue(m_scriptState.get(), data, V8HiddenValue::cust omElementTagName(isolate), v8TagName); 176 V8HiddenValue::setHiddenValue(m_scriptState.get(), data, V8HiddenValue::cust omElementTagName(isolate), v8TagName);
177 V8HiddenValue::setHiddenValue(m_scriptState.get(), data, V8HiddenValue::cust omElementType(isolate), v8Type); 177 V8HiddenValue::setHiddenValue(m_scriptState.get(), data, V8HiddenValue::cust omElementType(isolate), v8Type);
178 178
179 v8::Local<v8::FunctionTemplate> constructorTemplate = v8::FunctionTemplate:: New(isolate); 179 v8::Local<v8::FunctionTemplate> constructorTemplate = v8::FunctionTemplate:: New(isolate);
180 constructorTemplate->SetCallHandler(constructCustomElement, data); 180 constructorTemplate->SetCallHandler(constructCustomElement, data);
181 if (!constructorTemplate->GetFunction(context).ToLocal(&m_constructor)) { 181 if (!constructorTemplate->GetFunction(context).ToLocal(&m_constructor)) {
182 CustomElementException::throwException(CustomElementException::ContextDe stroyedRegisteringDefinition, definition->descriptor().type(), exceptionState); 182 V0CustomElementException::throwException(V0CustomElementException::Conte xtDestroyedRegisteringDefinition, definition->descriptor().type(), exceptionStat e);
183 return false; 183 return false;
184 } 184 }
185 185
186 m_constructor->SetName(v8Type->IsNull() ? v8TagName : v8Type.As<v8::String>( )); 186 m_constructor->SetName(v8Type->IsNull() ? v8TagName : v8Type.As<v8::String>( ));
187 187
188 v8::Local<v8::String> prototypeKey = v8String(isolate, "prototype"); 188 v8::Local<v8::String> prototypeKey = v8String(isolate, "prototype");
189 if (!v8CallBoolean(m_constructor->HasOwnProperty(context, prototypeKey))) 189 if (!v8CallBoolean(m_constructor->HasOwnProperty(context, prototypeKey)))
190 return false; 190 return false;
191 // This sets the property *value*; calling Set is safe because 191 // This sets the property *value*; calling Set is safe because
192 // "prototype" is a non-configurable data property so there can be 192 // "prototype" is a non-configurable data property so there can be
(...skipping 14 matching lines...) Expand all
207 if (!v8CallBoolean(m_constructor->SetPrototype(context, constructorPrototype ))) 207 if (!v8CallBoolean(m_constructor->SetPrototype(context, constructorPrototype )))
208 return false; 208 return false;
209 209
210 V8HiddenValue::setHiddenValue(m_scriptState.get(), m_prototype, V8HiddenValu e::customElementIsInterfacePrototypeObject(isolate), v8::True(isolate)); 210 V8HiddenValue::setHiddenValue(m_scriptState.get(), m_prototype, V8HiddenValu e::customElementIsInterfacePrototypeObject(isolate), v8::True(isolate));
211 if (!v8CallBoolean(m_prototype->DefineOwnProperty(context, v8String(isolate, "constructor"), m_constructor, v8::DontEnum))) 211 if (!v8CallBoolean(m_prototype->DefineOwnProperty(context, v8String(isolate, "constructor"), m_constructor, v8::DontEnum)))
212 return false; 212 return false;
213 213
214 return true; 214 return true;
215 } 215 }
216 216
217 bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type, ExceptionState& exceptionState) const 217 bool V0CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& typ e, ExceptionState& exceptionState) const
218 { 218 {
219 if (m_prototype->InternalFieldCount() || !V8HiddenValue::getHiddenValue(m_sc riptState.get(), m_prototype, V8HiddenValue::customElementIsInterfacePrototypeOb ject(m_scriptState->isolate())).IsEmpty()) { 219 if (m_prototype->InternalFieldCount() || !V8HiddenValue::getHiddenValue(m_sc riptState.get(), m_prototype, V8HiddenValue::customElementIsInterfacePrototypeOb ject(m_scriptState->isolate())).IsEmpty()) {
220 CustomElementException::throwException(CustomElementException::Prototype InUse, type, exceptionState); 220 V0CustomElementException::throwException(V0CustomElementException::Proto typeInUse, type, exceptionState);
221 return false; 221 return false;
222 } 222 }
223 223
224 v8::PropertyAttribute propertyAttribute; 224 v8::PropertyAttribute propertyAttribute;
225 if (!v8Call(m_prototype->GetPropertyAttributes(m_scriptState->context(), v8S tring(m_scriptState->isolate(), "constructor")), propertyAttribute) || (property Attribute & v8::DontDelete)) { 225 if (!v8Call(m_prototype->GetPropertyAttributes(m_scriptState->context(), v8S tring(m_scriptState->isolate(), "constructor")), propertyAttribute) || (property Attribute & v8::DontDelete)) {
226 CustomElementException::throwException(CustomElementException::Construct orPropertyNotConfigurable, type, exceptionState); 226 V0CustomElementException::throwException(V0CustomElementException::Const ructorPropertyNotConfigurable, type, exceptionState);
227 return false; 227 return false;
228 } 228 }
229 229
230 return true; 230 return true;
231 } 231 }
232 232
233 bool CustomElementConstructorBuilder::didRegisterDefinition() const 233 bool V0CustomElementConstructorBuilder::didRegisterDefinition() const
234 { 234 {
235 ASSERT(!m_constructor.IsEmpty()); 235 ASSERT(!m_constructor.IsEmpty());
236 236
237 return m_callbacks->setBinding(CustomElementBinding::create(m_scriptState->i solate(), m_prototype)); 237 return m_callbacks->setBinding(V0CustomElementBinding::create(m_scriptState- >isolate(), m_prototype));
238 } 238 }
239 239
240 ScriptValue CustomElementConstructorBuilder::bindingsReturnValue() const 240 ScriptValue V0CustomElementConstructorBuilder::bindingsReturnValue() const
241 { 241 {
242 return ScriptValue(m_scriptState.get(), m_constructor); 242 return ScriptValue(m_scriptState.get(), m_constructor);
243 } 243 }
244 244
245 bool CustomElementConstructorBuilder::hasValidPrototypeChainFor(const WrapperTyp eInfo* type) const 245 bool V0CustomElementConstructorBuilder::hasValidPrototypeChainFor(const WrapperT ypeInfo* type) const
246 { 246 {
247 v8::Local<v8::Object> elementPrototype = m_scriptState->perContextData()->pr ototypeForType(type); 247 v8::Local<v8::Object> elementPrototype = m_scriptState->perContextData()->pr ototypeForType(type);
248 if (elementPrototype.IsEmpty()) 248 if (elementPrototype.IsEmpty())
249 return false; 249 return false;
250 250
251 v8::Local<v8::Value> chain = m_prototype; 251 v8::Local<v8::Value> chain = m_prototype;
252 while (!chain.IsEmpty() && chain->IsObject()) { 252 while (!chain.IsEmpty() && chain->IsObject()) {
253 if (chain == elementPrototype) 253 if (chain == elementPrototype)
254 return true; 254 return true;
255 chain = chain.As<v8::Object>()->GetPrototype(); 255 chain = chain.As<v8::Object>()->GetPrototype();
(...skipping 18 matching lines...) Expand all
274 274
275 ScriptState* scriptState = ScriptState::current(isolate); 275 ScriptState* scriptState = ScriptState::current(isolate);
276 v8::Local<v8::Object> data = v8::Local<v8::Object>::Cast(info.Data()); 276 v8::Local<v8::Object> data = v8::Local<v8::Object>::Cast(info.Data());
277 Document* document = V8Document::toImpl(V8HiddenValue::getHiddenValue(script State, data, V8HiddenValue::customElementDocument(isolate)).As<v8::Object>()); 277 Document* document = V8Document::toImpl(V8HiddenValue::getHiddenValue(script State, data, V8HiddenValue::customElementDocument(isolate)).As<v8::Object>());
278 TOSTRING_VOID(V8StringResource<>, namespaceURI, V8HiddenValue::getHiddenValu e(scriptState, data, V8HiddenValue::customElementNamespaceURI(isolate))); 278 TOSTRING_VOID(V8StringResource<>, namespaceURI, V8HiddenValue::getHiddenValu e(scriptState, data, V8HiddenValue::customElementNamespaceURI(isolate)));
279 TOSTRING_VOID(V8StringResource<>, tagName, V8HiddenValue::getHiddenValue(scr iptState, data, V8HiddenValue::customElementTagName(isolate))); 279 TOSTRING_VOID(V8StringResource<>, tagName, V8HiddenValue::getHiddenValue(scr iptState, data, V8HiddenValue::customElementTagName(isolate)));
280 v8::Local<v8::Value> maybeType = V8HiddenValue::getHiddenValue(scriptState, data, V8HiddenValue::customElementType(isolate)); 280 v8::Local<v8::Value> maybeType = V8HiddenValue::getHiddenValue(scriptState, data, V8HiddenValue::customElementType(isolate));
281 TOSTRING_VOID(V8StringResource<>, type, maybeType); 281 TOSTRING_VOID(V8StringResource<>, type, maybeType);
282 282
283 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl ement", info.Holder(), info.GetIsolate()); 283 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl ement", info.Holder(), info.GetIsolate());
284 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; 284 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
285 Element* element = document->createElementNS(namespaceURI, tagName, maybeTyp e->IsNull() ? nullAtom : type, exceptionState); 285 Element* element = document->createElementNS(namespaceURI, tagName, maybeTyp e->IsNull() ? nullAtom : type, exceptionState);
286 if (exceptionState.throwIfNeeded()) 286 if (exceptionState.throwIfNeeded())
287 return; 287 return;
288 v8SetReturnValueFast(info, element, document); 288 v8SetReturnValueFast(info, element, document);
289 } 289 }
290 290
291 } // namespace blink 291 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698