Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: Source/bindings/core/v8/CustomElementConstructorBuilder.cpp

Issue 373423002: Split Dictionary's get and convert into DictionaryHelper. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/core/v8/Dictionary.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return m_scriptState->world().isMainWorld(); 67 return m_scriptState->world().isMainWorld();
68 } 68 }
69 69
70 bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, QualifiedName& tagName, ExceptionState& exceptionState) 70 bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, QualifiedName& tagName, ExceptionState& exceptionState)
71 { 71 {
72 ASSERT(m_prototype.IsEmpty()); 72 ASSERT(m_prototype.IsEmpty());
73 73
74 v8::TryCatch tryCatch; 74 v8::TryCatch tryCatch;
75 75
76 ScriptValue prototypeScriptValue; 76 ScriptValue prototypeScriptValue;
77 if (m_options->get("prototype", prototypeScriptValue) && !prototypeScriptVal ue.isNull()) { 77 if (DictionaryHelper::get(*m_options, "prototype", prototypeScriptValue) && !prototypeScriptValue.isNull()) {
78 ASSERT(!tryCatch.HasCaught()); 78 ASSERT(!tryCatch.HasCaught());
79 if (!prototypeScriptValue.isObject()) { 79 if (!prototypeScriptValue.isObject()) {
80 CustomElementException::throwException(CustomElementException::Proto typeNotAnObject, type, exceptionState); 80 CustomElementException::throwException(CustomElementException::Proto typeNotAnObject, type, exceptionState);
81 tryCatch.ReThrow(); 81 tryCatch.ReThrow();
82 return false; 82 return false;
83 } 83 }
84 m_prototype = prototypeScriptValue.v8Value().As<v8::Object>(); 84 m_prototype = prototypeScriptValue.v8Value().As<v8::Object>();
85 } else if (!tryCatch.HasCaught()) { 85 } else if (!tryCatch.HasCaught()) {
86 m_prototype = v8::Object::New(m_scriptState->isolate()); 86 m_prototype = v8::Object::New(m_scriptState->isolate());
87 v8::Local<v8::Object> basePrototype = m_scriptState->perContextData()->p rototypeForType(&V8HTMLElement::wrapperTypeInfo); 87 v8::Local<v8::Object> basePrototype = m_scriptState->perContextData()->p rototypeForType(&V8HTMLElement::wrapperTypeInfo);
88 if (!basePrototype.IsEmpty()) 88 if (!basePrototype.IsEmpty())
89 m_prototype->SetPrototype(basePrototype); 89 m_prototype->SetPrototype(basePrototype);
90 } 90 }
91 91
92 if (tryCatch.HasCaught()) { 92 if (tryCatch.HasCaught()) {
93 tryCatch.ReThrow(); 93 tryCatch.ReThrow();
94 return false; 94 return false;
95 } 95 }
96 96
97 AtomicString extends; 97 AtomicString extends;
98 bool extendsProvidedAndNonNull = m_options->get("extends", extends); 98 bool extendsProvidedAndNonNull = DictionaryHelper::get(*m_options, "extends" , extends);
99 99
100 if (tryCatch.HasCaught()) { 100 if (tryCatch.HasCaught()) {
101 tryCatch.ReThrow(); 101 tryCatch.ReThrow();
102 return false; 102 return false;
103 } 103 }
104 104
105 if (!m_scriptState->perContextData()) { 105 if (!m_scriptState->perContextData()) {
106 // FIXME: This should generate an InvalidContext exception at a later po int. 106 // FIXME: This should generate an InvalidContext exception at a later po int.
107 CustomElementException::throwException(CustomElementException::ContextDe stroyedCheckingPrototype, type, exceptionState); 107 CustomElementException::throwException(CustomElementException::ContextDe stroyedCheckingPrototype, type, exceptionState);
108 tryCatch.ReThrow(); 108 tryCatch.ReThrow();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl ement", info.Holder(), info.GetIsolate()); 295 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl ement", info.Holder(), info.GetIsolate());
296 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 296 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
297 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI , tagName, maybeType->IsNull() ? nullAtom : type, exceptionState); 297 RefPtrWillBeRawPtr<Element> element = document->createElementNS(namespaceURI , tagName, maybeType->IsNull() ? nullAtom : type, exceptionState);
298 if (exceptionState.throwIfNeeded()) 298 if (exceptionState.throwIfNeeded())
299 return; 299 return;
300 v8SetReturnValueFast(info, element.release(), document); 300 v8SetReturnValueFast(info, element.release(), document);
301 } 301 }
302 302
303 } // namespace WebCore 303 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/Dictionary.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698