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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 ASSERT(m_constructor->HasOwnProperty(prototypeKey)); | 195 ASSERT(m_constructor->HasOwnProperty(prototypeKey)); |
196 // This sets the property *value*; calling Set is safe because | 196 // This sets the property *value*; calling Set is safe because |
197 // "prototype" is a non-configurable data property so there can be | 197 // "prototype" is a non-configurable data property so there can be |
198 // no side effects. | 198 // no side effects. |
199 m_constructor->Set(prototypeKey, m_prototype); | 199 m_constructor->Set(prototypeKey, m_prototype); |
200 // This *configures* the property. ForceSet of a function's | 200 // This *configures* the property. ForceSet of a function's |
201 // "prototype" does not affect the value, but can reconfigure the | 201 // "prototype" does not affect the value, but can reconfigure the |
202 // property. | 202 // property. |
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()); | 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()).IsEmpty()) { |
214 CustomElementException::throwException(CustomElementException::Prototype
InUse, type, es); | 214 CustomElementException::throwException(CustomElementException::Prototype
InUse, type, es); |
215 return false; | 215 return false; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |