| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>&); | 52 static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>&); |
| 53 | 53 |
| 54 CustomElementConstructorBuilder::CustomElementConstructorBuilder(ScriptState* sc
riptState, const Dictionary* options) | 54 CustomElementConstructorBuilder::CustomElementConstructorBuilder(ScriptState* sc
riptState, const Dictionary* options) |
| 55 : m_scriptState(scriptState) | 55 : m_scriptState(scriptState) |
| 56 , m_options(options) | 56 , m_options(options) |
| 57 , m_wrapperType(0) | 57 , m_wrapperType(0) |
| 58 { | 58 { |
| 59 ASSERT(m_scriptState->context() == m_scriptState->isolate()->GetCurrentConte
xt()); | 59 ASSERT(m_scriptState->context() == m_scriptState->isolate()->GetCurrentConte
xt()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool CustomElementConstructorBuilder::isFeatureAllowed() const | |
| 63 { | |
| 64 return m_scriptState->world().isMainWorld(); | |
| 65 } | |
| 66 | |
| 67 bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type,
QualifiedName& tagName, ExceptionState& exceptionState) | 62 bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type,
QualifiedName& tagName, ExceptionState& exceptionState) |
| 68 { | 63 { |
| 69 ASSERT(m_prototype.IsEmpty()); | 64 ASSERT(m_prototype.IsEmpty()); |
| 70 | 65 |
| 71 v8::TryCatch tryCatch; | 66 v8::TryCatch tryCatch; |
| 72 | 67 |
| 73 ScriptValue prototypeScriptValue; | 68 ScriptValue prototypeScriptValue; |
| 74 if (DictionaryHelper::get(*m_options, "prototype", prototypeScriptValue) &&
!prototypeScriptValue.isNull()) { | 69 if (DictionaryHelper::get(*m_options, "prototype", prototypeScriptValue) &&
!prototypeScriptValue.isNull()) { |
| 75 ASSERT(!tryCatch.HasCaught()); | 70 ASSERT(!tryCatch.HasCaught()); |
| 76 if (!prototypeScriptValue.isObject()) { | 71 if (!prototypeScriptValue.isObject()) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 269 |
| 275 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); | 270 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); |
| 276 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 271 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
| 277 RefPtr<Element> element = document->createElement(tagName, exceptionState); | 272 RefPtr<Element> element = document->createElement(tagName, exceptionState); |
| 278 if (exceptionState.throwIfNeeded()) | 273 if (exceptionState.throwIfNeeded()) |
| 279 return; | 274 return; |
| 280 v8SetReturnValueFast(info, element.release(), document); | 275 v8SetReturnValueFast(info, element.release(), document); |
| 281 } | 276 } |
| 282 | 277 |
| 283 } // namespace blink | 278 } // namespace blink |
| OLD | NEW |