| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // "prototype" is a non-configurable data property so there can be | 192 // "prototype" is a non-configurable data property so there can be |
| 193 // no side effects. | 193 // no side effects. |
| 194 if (!v8CallBoolean(m_constructor->Set(context, prototypeKey, m_prototype))) | 194 if (!v8CallBoolean(m_constructor->Set(context, prototypeKey, m_prototype))) |
| 195 return false; | 195 return false; |
| 196 // This *configures* the property. ForceSet of a function's | 196 // This *configures* the property. ForceSet of a function's |
| 197 // "prototype" does not affect the value, but can reconfigure the | 197 // "prototype" does not affect the value, but can reconfigure the |
| 198 // property. | 198 // property. |
| 199 if (!v8CallBoolean(m_constructor->ForceSet(context, prototypeKey, m_prototyp
e, v8::PropertyAttribute(v8::ReadOnly | v8::DontEnum | v8::DontDelete)))) | 199 if (!v8CallBoolean(m_constructor->ForceSet(context, prototypeKey, m_prototyp
e, v8::PropertyAttribute(v8::ReadOnly | v8::DontEnum | v8::DontDelete)))) |
| 200 return false; | 200 return false; |
| 201 | 201 |
| 202 v8::Local<v8::String> constructorKey = v8String(isolate, "constructor"); |
| 203 // The generated constructor should inherit from constructor. |
| 204 if (!v8CallBoolean(m_constructor->SetPrototype(context, m_prototype->Get(con
structorKey)))) |
| 205 return false; |
| 206 |
| 202 V8HiddenValue::setHiddenValue(isolate, m_prototype, V8HiddenValue::customEle
mentIsInterfacePrototypeObject(isolate), v8::True(isolate)); | 207 V8HiddenValue::setHiddenValue(isolate, m_prototype, V8HiddenValue::customEle
mentIsInterfacePrototypeObject(isolate), v8::True(isolate)); |
| 203 if (!v8CallBoolean(m_prototype->ForceSet(context, v8String(isolate, "constru
ctor"), m_constructor, v8::DontEnum))) | 208 if (!v8CallBoolean(m_prototype->ForceSet(context, constructorKey, m_construc
tor, v8::DontEnum))) |
| 204 return false; | 209 return false; |
| 205 | 210 |
| 206 return true; | 211 return true; |
| 207 } | 212 } |
| 208 | 213 |
| 209 bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type,
ExceptionState& exceptionState) const | 214 bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type,
ExceptionState& exceptionState) const |
| 210 { | 215 { |
| 211 if (m_prototype->InternalFieldCount() || !V8HiddenValue::getHiddenValue(m_sc
riptState->isolate(), m_prototype, V8HiddenValue::customElementIsInterfaceProtot
ypeObject(m_scriptState->isolate())).IsEmpty()) { | 216 if (m_prototype->InternalFieldCount() || !V8HiddenValue::getHiddenValue(m_sc
riptState->isolate(), m_prototype, V8HiddenValue::customElementIsInterfaceProtot
ypeObject(m_scriptState->isolate())).IsEmpty()) { |
| 212 CustomElementException::throwException(CustomElementException::Prototype
InUse, type, exceptionState); | 217 CustomElementException::throwException(CustomElementException::Prototype
InUse, type, exceptionState); |
| 213 return false; | 218 return false; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 277 |
| 273 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); | 278 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); |
| 274 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 279 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
| 275 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI
, tagName, maybeType->IsNull() ? nullAtom : type, exceptionState); | 280 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI
, tagName, maybeType->IsNull() ? nullAtom : type, exceptionState); |
| 276 if (exceptionState.throwIfNeeded()) | 281 if (exceptionState.throwIfNeeded()) |
| 277 return; | 282 return; |
| 278 v8SetReturnValueFast(info, element.release(), document); | 283 v8SetReturnValueFast(info, element.release(), document); |
| 279 } | 284 } |
| 280 | 285 |
| 281 } // namespace blink | 286 } // namespace blink |
| OLD | NEW |