| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (!constructorBuilder->isFeatureAllowed()) | 90 if (!constructorBuilder->isFeatureAllowed()) |
| 91 return; | 91 return; |
| 92 | 92 |
| 93 AtomicString type = userSuppliedName.lower(); | 93 AtomicString type = userSuppliedName.lower(); |
| 94 if (!isValidName(type)) { | 94 if (!isValidName(type)) { |
| 95 ec = InvalidCharacterError; | 95 ec = InvalidCharacterError; |
| 96 return; | 96 return; |
| 97 } | 97 } |
| 98 | 98 |
| 99 if (!constructorBuilder->validateOptions()) { | 99 if (!constructorBuilder->validateOptions()) { |
| 100 ec = INVALID_STATE_ERR; | 100 ec = InvalidStateError; |
| 101 return; | 101 return; |
| 102 } | 102 } |
| 103 | 103 |
| 104 QualifiedName tagName = nullQName(); | 104 QualifiedName tagName = nullQName(); |
| 105 if (!constructorBuilder->findTagName(type, tagName)) { | 105 if (!constructorBuilder->findTagName(type, tagName)) { |
| 106 ec = NAMESPACE_ERR; | 106 ec = NamespaceError; |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.nam
espaceURI() == SVGNames::svgNamespaceURI); | 109 ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.nam
espaceURI() == SVGNames::svgNamespaceURI); |
| 110 | 110 |
| 111 if (m_definitions.contains(type)) { | 111 if (m_definitions.contains(type)) { |
| 112 ec = INVALID_STATE_ERR; | 112 ec = InvalidStateError; |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 | 115 |
| 116 RefPtr<CustomElementCallback> lifecycleCallbacks = constructorBuilder->creat
eCallback(document()); | 116 RefPtr<CustomElementCallback> lifecycleCallbacks = constructorBuilder->creat
eCallback(document()); |
| 117 | 117 |
| 118 // Consulting the constructor builder could execute script and | 118 // Consulting the constructor builder could execute script and |
| 119 // kill the document. | 119 // kill the document. |
| 120 if (!document()) { | 120 if (!document()) { |
| 121 ec = INVALID_STATE_ERR; | 121 ec = InvalidStateError; |
| 122 return; | 122 return; |
| 123 } | 123 } |
| 124 | 124 |
| 125 RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create
(type, tagName.localName(), tagName.namespaceURI(), lifecycleCallbacks); | 125 RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create
(type, tagName.localName(), tagName.namespaceURI(), lifecycleCallbacks); |
| 126 | 126 |
| 127 if (!constructorBuilder->createConstructor(document(), definition.get())) { | 127 if (!constructorBuilder->createConstructor(document(), definition.get())) { |
| 128 ec = NotSupportedError; | 128 ec = NotSupportedError; |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 | 131 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 ASSERT(element->isCustomElement()); | 245 ASSERT(element->isCustomElement()); |
| 246 m_candidates.remove(element); | 246 m_candidates.remove(element); |
| 247 } | 247 } |
| 248 | 248 |
| 249 inline Document* CustomElementRegistry::document() const | 249 inline Document* CustomElementRegistry::document() const |
| 250 { | 250 { |
| 251 return toDocument(m_scriptExecutionContext); | 251 return toDocument(m_scriptExecutionContext); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } | 254 } |
| OLD | NEW |