| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 211 } |
| 212 | 212 |
| 213 if (m_prototype->GetPropertyAttributes(v8String("constructor", m_context->Ge
tIsolate())) & v8::DontDelete) { | 213 if (m_prototype->GetPropertyAttributes(v8String("constructor", m_context->Ge
tIsolate())) & v8::DontDelete) { |
| 214 // "constructor" is not configurable. | 214 // "constructor" is not configurable. |
| 215 return false; | 215 return false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 return true; | 218 return true; |
| 219 } | 219 } |
| 220 | 220 |
| 221 bool CustomElementConstructorBuilder::didRegisterDefinition(CustomElementDefinit
ion* definition, const HashSet<Element*>& upgradeCandidates) const | 221 bool CustomElementConstructorBuilder::didRegisterDefinition(CustomElementDefinit
ion* definition) const |
| 222 { | 222 { |
| 223 ASSERT(!m_constructor.IsEmpty()); | 223 ASSERT(!m_constructor.IsEmpty()); |
| 224 | 224 |
| 225 V8PerContextData* perContextData = V8PerContextData::from(m_context); | 225 V8PerContextData* perContextData = V8PerContextData::from(m_context); |
| 226 if (!perContextData) | 226 if (!perContextData) |
| 227 return false; | 227 return false; |
| 228 | 228 |
| 229 // Bindings retrieve the prototype when needed from per-context data. | 229 // Bindings retrieve the prototype when needed from per-context data. |
| 230 v8::Persistent<v8::Object> persistentPrototype(m_context->GetIsolate(), m_pr
ototype); | 230 v8::Persistent<v8::Object> persistentPrototype(m_context->GetIsolate(), m_pr
ototype); |
| 231 perContextData->customElementPrototypes()->add(definition->type(), UnsafePer
sistent<v8::Object>(persistentPrototype)); | 231 perContextData->customElementPrototypes()->add(definition->type(), UnsafePer
sistent<v8::Object>(persistentPrototype)); |
| 232 | 232 |
| 233 // Upgrade any wrappers alcreated created for this definition | |
| 234 for (HashSet<Element*>::const_iterator it = upgradeCandidates.begin(); it !=
upgradeCandidates.end(); ++it) { | |
| 235 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(*i
t); | |
| 236 if (wrapper.IsEmpty()) { | |
| 237 // The wrapper will be created with the right prototype when | |
| 238 // retrieved; we don't need to eagerly create the wrapper. | |
| 239 continue; | |
| 240 } | |
| 241 wrapper->SetPrototype(m_prototype); | |
| 242 } | |
| 243 | |
| 244 return true; | 233 return true; |
| 245 } | 234 } |
| 246 | 235 |
| 247 ScriptValue CustomElementConstructorBuilder::bindingsReturnValue() const | 236 ScriptValue CustomElementConstructorBuilder::bindingsReturnValue() const |
| 248 { | 237 { |
| 249 return ScriptValue(m_constructor); | 238 return ScriptValue(m_constructor); |
| 250 } | 239 } |
| 251 | 240 |
| 252 bool CustomElementConstructorBuilder::hasValidPrototypeChainFor(V8PerContextData
* perContextData, WrapperTypeInfo* typeInfo) const | 241 bool CustomElementConstructorBuilder::hasValidPrototypeChainFor(V8PerContextData
* perContextData, WrapperTypeInfo* typeInfo) const |
| 253 { | 242 { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 281 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| 293 RefPtr<Element> element = document->createElementNS(namespaceURI, name, mayb
eType->IsNull() ? nullAtom : type, ec); | 282 RefPtr<Element> element = document->createElementNS(namespaceURI, name, mayb
eType->IsNull() ? nullAtom : type, ec); |
| 294 if (ec) { | 283 if (ec) { |
| 295 setDOMException(ec, isolate); | 284 setDOMException(ec, isolate); |
| 296 return; | 285 return; |
| 297 } | 286 } |
| 298 v8SetReturnValue(args, toV8Fast(element.release(), args, document)); | 287 v8SetReturnValue(args, toV8Fast(element.release(), args, document)); |
| 299 } | 288 } |
| 300 | 289 |
| 301 } // namespace WebCore | 290 } // namespace WebCore |
| OLD | NEW |