| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if (!constructorBuilder->isFeatureAllowed()) { | 74 if (!constructorBuilder->isFeatureAllowed()) { |
| 75 CustomElementException::throwException(CustomElementException::CannotReg
isterFromExtension, type, exceptionState); | 75 CustomElementException::throwException(CustomElementException::CannotReg
isterFromExtension, type, exceptionState); |
| 76 return 0; | 76 return 0; |
| 77 } | 77 } |
| 78 | 78 |
| 79 if (!CustomElement::isValidName(type, validNames)) { | 79 if (!CustomElement::isValidName(type, validNames)) { |
| 80 CustomElementException::throwException(CustomElementException::InvalidNa
me, type, exceptionState); | 80 CustomElementException::throwException(CustomElementException::InvalidNa
me, type, exceptionState); |
| 81 return 0; | 81 return 0; |
| 82 } | 82 } |
| 83 | 83 |
| 84 if (m_registeredTypeNames.contains(type)) { |
| 85 CustomElementException::throwException(CustomElementException::TypeAlrea
dyRegistered, type, exceptionState); |
| 86 return 0; |
| 87 } |
| 88 |
| 84 QualifiedName tagName = QualifiedName::null(); | 89 QualifiedName tagName = QualifiedName::null(); |
| 85 if (!constructorBuilder->validateOptions(type, tagName, exceptionState)) | 90 if (!constructorBuilder->validateOptions(type, tagName, exceptionState)) |
| 86 return 0; | 91 return 0; |
| 87 | 92 |
| 88 ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.nam
espaceURI() == SVGNames::svgNamespaceURI); | 93 ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.nam
espaceURI() == SVGNames::svgNamespaceURI); |
| 89 | 94 |
| 90 // FIXME: This should be done earlier in validateOptions. | |
| 91 if (m_registeredTypeNames.contains(type)) { | |
| 92 CustomElementException::throwException(CustomElementException::TypeAlrea
dyRegistered, type, exceptionState); | |
| 93 return 0; | |
| 94 } | |
| 95 | |
| 96 ASSERT(!observer.registrationContextWentAway()); | 95 ASSERT(!observer.registrationContextWentAway()); |
| 97 | 96 |
| 98 RefPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuil
der->createCallbacks(); | 97 RefPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuil
der->createCallbacks(); |
| 99 | 98 |
| 100 // Consulting the constructor builder could execute script and | 99 // Consulting the constructor builder could execute script and |
| 101 // kill the document. | 100 // kill the document. |
| 102 if (observer.registrationContextWentAway()) { | 101 if (observer.registrationContextWentAway()) { |
| 103 CustomElementException::throwException(CustomElementException::ContextDe
stroyedCreatingCallbacks, type, exceptionState); | 102 CustomElementException::throwException(CustomElementException::ContextDe
stroyedCreatingCallbacks, type, exceptionState); |
| 104 return 0; | 103 return 0; |
| 105 } | 104 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 120 | 119 |
| 121 return definition.get(); | 120 return definition.get(); |
| 122 } | 121 } |
| 123 | 122 |
| 124 CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescript
or& descriptor) const | 123 CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescript
or& descriptor) const |
| 125 { | 124 { |
| 126 return m_definitions.get(descriptor); | 125 return m_definitions.get(descriptor); |
| 127 } | 126 } |
| 128 | 127 |
| 129 } // namespace blink | 128 } // namespace blink |
| OLD | NEW |