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...) 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 v8::Local<v8::Value> constructorPrototype; |
| 204 if (!m_prototype->Get(context, constructorKey).ToLocal(&constructorPrototype
)) |
| 205 return false; |
| 206 |
| 207 if (!v8CallBoolean(m_constructor->SetPrototype(context, constructorPrototype
))) |
| 208 return false; |
| 209 |
202 V8HiddenValue::setHiddenValue(isolate, m_prototype, V8HiddenValue::customEle
mentIsInterfacePrototypeObject(isolate), v8::True(isolate)); | 210 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))) | 211 if (!v8CallBoolean(m_prototype->ForceSet(context, v8String(isolate, "constru
ctor"), m_constructor, v8::DontEnum))) |
204 return false; | 212 return false; |
205 | 213 |
206 return true; | 214 return true; |
207 } | 215 } |
208 | 216 |
209 bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type,
ExceptionState& exceptionState) const | 217 bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type,
ExceptionState& exceptionState) const |
210 { | 218 { |
211 if (m_prototype->InternalFieldCount() || !V8HiddenValue::getHiddenValue(m_sc
riptState->isolate(), m_prototype, V8HiddenValue::customElementIsInterfaceProtot
ypeObject(m_scriptState->isolate())).IsEmpty()) { | 219 if (m_prototype->InternalFieldCount() || !V8HiddenValue::getHiddenValue(m_sc
riptState->isolate(), m_prototype, V8HiddenValue::customElementIsInterfaceProtot
ypeObject(m_scriptState->isolate())).IsEmpty()) { |
(...skipping 60 matching lines...) Loading... |
272 | 280 |
273 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); | 281 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); |
274 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 282 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
275 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI
, tagName, maybeType->IsNull() ? nullAtom : type, exceptionState); | 283 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI
, tagName, maybeType->IsNull() ? nullAtom : type, exceptionState); |
276 if (exceptionState.throwIfNeeded()) | 284 if (exceptionState.throwIfNeeded()) |
277 return; | 285 return; |
278 v8SetReturnValueFast(info, element.release(), document); | 286 v8SetReturnValueFast(info, element.release(), document); |
279 } | 287 } |
280 | 288 |
281 } // namespace blink | 289 } // namespace blink |
OLD | NEW |