OLD | NEW |
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 m_constructor->ForceSet(prototypeKey, m_prototype, v8::PropertyAttribute(v8:
:ReadOnly | v8::DontEnum | v8::DontDelete)); | 203 m_constructor->ForceSet(prototypeKey, m_prototype, v8::PropertyAttribute(v8:
:ReadOnly | v8::DontEnum | v8::DontDelete)); |
204 | 204 |
205 V8HiddenPropertyName::setNamedHiddenReference(m_prototype, "customElementIsI
nterfacePrototypeObject", v8::True(isolate)); | 205 V8HiddenPropertyName::setNamedHiddenReference(m_prototype, "customElementIsI
nterfacePrototypeObject", v8::True(isolate)); |
206 m_prototype->ForceSet(v8String("constructor", isolate), m_constructor, v8::D
ontEnum); | 206 m_prototype->ForceSet(v8String("constructor", isolate), m_constructor, v8::D
ontEnum); |
207 | 207 |
208 return true; | 208 return true; |
209 } | 209 } |
210 | 210 |
211 bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type,
ExceptionState& es) const | 211 bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type,
ExceptionState& es) const |
212 { | 212 { |
213 if (m_prototype->InternalFieldCount() || !m_prototype->GetHiddenValue(V8Hidd
enPropertyName::customElementIsInterfacePrototypeObject()).IsEmpty()) { | 213 if (m_prototype->InternalFieldCount() || !m_prototype->GetHiddenValue(V8Hidd
enPropertyName::customElementIsInterfacePrototypeObject(m_context->GetIsolate())
).IsEmpty()) { |
214 CustomElementException::throwException(CustomElementException::Prototype
InUse, type, es); | 214 CustomElementException::throwException(CustomElementException::Prototype
InUse, type, es); |
215 return false; | 215 return false; |
216 } | 216 } |
217 | 217 |
218 if (m_prototype->GetPropertyAttributes(v8String("constructor", m_context->Ge
tIsolate())) & v8::DontDelete) { | 218 if (m_prototype->GetPropertyAttributes(v8String("constructor", m_context->Ge
tIsolate())) & v8::DontDelete) { |
219 CustomElementException::throwException(CustomElementException::Construct
orPropertyNotConfigurable, type, es); | 219 CustomElementException::throwException(CustomElementException::Construct
orPropertyNotConfigurable, type, es); |
220 return false; | 220 return false; |
221 } | 221 } |
222 | 222 |
223 return true; | 223 return true; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 if (!args.IsConstructCall()) { | 258 if (!args.IsConstructCall()) { |
259 throwTypeError("DOM object constructor cannot be called as a function.",
isolate); | 259 throwTypeError("DOM object constructor cannot be called as a function.",
isolate); |
260 return; | 260 return; |
261 } | 261 } |
262 | 262 |
263 if (args.Length() > 0) { | 263 if (args.Length() > 0) { |
264 throwTypeError(isolate); | 264 throwTypeError(isolate); |
265 return; | 265 return; |
266 } | 266 } |
267 | 267 |
268 Document* document = V8Document::toNative(args.Callee()->GetHiddenValue(V8Hi
ddenPropertyName::customElementDocument()).As<v8::Object>()); | 268 Document* document = V8Document::toNative(args.Callee()->GetHiddenValue(V8Hi
ddenPropertyName::customElementDocument(isolate)).As<v8::Object>()); |
269 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, namespaceURI, args.
Callee()->GetHiddenValue(V8HiddenPropertyName::customElementNamespaceURI())); | 269 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, namespaceURI, args.
Callee()->GetHiddenValue(V8HiddenPropertyName::customElementNamespaceURI(isolate
))); |
270 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, tagName, args.Calle
e()->GetHiddenValue(V8HiddenPropertyName::customElementTagName())); | 270 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, tagName, args.Calle
e()->GetHiddenValue(V8HiddenPropertyName::customElementTagName(isolate))); |
271 v8::Handle<v8::Value> maybeType = args.Callee()->GetHiddenValue(V8HiddenProp
ertyName::customElementType()); | 271 v8::Handle<v8::Value> maybeType = args.Callee()->GetHiddenValue(V8HiddenProp
ertyName::customElementType(isolate)); |
272 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, maybeType); | 272 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, maybeType); |
273 | 273 |
274 ExceptionState es(args.GetIsolate()); | 274 ExceptionState es(args.GetIsolate()); |
275 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 275 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
276 RefPtr<Element> element = document->createElementNS(namespaceURI, tagName, m
aybeType->IsNull() ? nullAtom : type, es); | 276 RefPtr<Element> element = document->createElementNS(namespaceURI, tagName, m
aybeType->IsNull() ? nullAtom : type, es); |
277 if (es.throwIfNeeded()) | 277 if (es.throwIfNeeded()) |
278 return; | 278 return; |
279 v8SetReturnValueFast(args, element.release(), document); | 279 v8SetReturnValueFast(args, element.release(), document); |
280 } | 280 } |
281 | 281 |
282 } // namespace WebCore | 282 } // namespace WebCore |
OLD | NEW |