| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return m_scriptState->world().isMainWorld(); | 66 return m_scriptState->world().isMainWorld(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type,
QualifiedName& tagName, ExceptionState& exceptionState) | 69 bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type,
QualifiedName& tagName, ExceptionState& exceptionState) |
| 70 { | 70 { |
| 71 ASSERT(m_prototype.IsEmpty()); | 71 ASSERT(m_prototype.IsEmpty()); |
| 72 | 72 |
| 73 v8::TryCatch tryCatch; | 73 v8::TryCatch tryCatch; |
| 74 | 74 |
| 75 ScriptValue prototypeScriptValue; | 75 ScriptValue prototypeScriptValue; |
| 76 if (DictionaryHelper::get(*m_options, "prototype", prototypeScriptValue) &&
!prototypeScriptValue.isNull()) { | 76 if (m_options->get("prototype", prototypeScriptValue) && !prototypeScriptVal
ue.isNull()) { |
| 77 ASSERT(!tryCatch.HasCaught()); | 77 ASSERT(!tryCatch.HasCaught()); |
| 78 if (!prototypeScriptValue.isObject()) { | 78 if (!prototypeScriptValue.isObject()) { |
| 79 CustomElementException::throwException(CustomElementException::Proto
typeNotAnObject, type, exceptionState); | 79 CustomElementException::throwException(CustomElementException::Proto
typeNotAnObject, type, exceptionState); |
| 80 tryCatch.ReThrow(); | 80 tryCatch.ReThrow(); |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 m_prototype = prototypeScriptValue.v8Value().As<v8::Object>(); | 83 m_prototype = prototypeScriptValue.v8Value().As<v8::Object>(); |
| 84 } else if (!tryCatch.HasCaught()) { | 84 } else if (!tryCatch.HasCaught()) { |
| 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 m_prototype->SetPrototype(basePrototype); | 88 m_prototype->SetPrototype(basePrototype); |
| 89 } | 89 } |
| 90 | 90 |
| 91 if (tryCatch.HasCaught()) { | 91 if (tryCatch.HasCaught()) { |
| 92 tryCatch.ReThrow(); | 92 tryCatch.ReThrow(); |
| 93 return false; | 93 return false; |
| 94 } | 94 } |
| 95 | 95 |
| 96 AtomicString extends; | 96 AtomicString extends; |
| 97 bool extendsProvidedAndNonNull = DictionaryHelper::get(*m_options, "extends"
, extends) && extends != "null"; | 97 bool extendsProvidedAndNonNull = m_options->get("extends", extends) && exten
ds != "null"; |
| 98 | 98 |
| 99 if (tryCatch.HasCaught()) { | 99 if (tryCatch.HasCaught()) { |
| 100 tryCatch.ReThrow(); | 100 tryCatch.ReThrow(); |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 if (!m_scriptState->perContextData()) { | 104 if (!m_scriptState->perContextData()) { |
| 105 // FIXME: This should generate an InvalidContext exception at a later po
int. | 105 // FIXME: This should generate an InvalidContext exception at a later po
int. |
| 106 CustomElementException::throwException(CustomElementException::ContextDe
stroyedCheckingPrototype, type, exceptionState); | 106 CustomElementException::throwException(CustomElementException::ContextDe
stroyedCheckingPrototype, type, exceptionState); |
| 107 tryCatch.ReThrow(); | 107 tryCatch.ReThrow(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); | 286 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); |
| 287 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 287 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
| 288 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI
, tagName, maybeType->IsNull() ? nullAtom : type, exceptionState); | 288 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI
, tagName, maybeType->IsNull() ? nullAtom : type, exceptionState); |
| 289 if (exceptionState.throwIfNeeded()) | 289 if (exceptionState.throwIfNeeded()) |
| 290 return; | 290 return; |
| 291 v8SetReturnValueFast(info, element.release(), document); | 291 v8SetReturnValueFast(info, element.release(), document); |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace blink | 294 } // namespace blink |
| OLD | NEW |