Changeset 223886 in webkit
- Timestamp:
- Oct 24, 2017 1:54:42 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r223885 r223886 1 2017-10-24 Ryosuke Niwa <rniwa@webkit.org> 2 3 DocumentOrderedMap::add should release assert that tree scopes match 4 https://bugs.webkit.org/show_bug.cgi?id=178708 5 6 Reviewed by Antti Koivisto. 7 8 Assert that the tree scope of element matches the given tree scope instead of asserting that 9 element is in tree scope, and replaced the use of RELEASE_ASSERT by the newly added 10 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION to clarify the semantics of these assertions. 11 12 Also removed now redudnant early exits which would never execute due to release assertions. 13 14 * dom/DocumentOrderedMap.cpp: 15 (WebCore::DocumentOrderedMap::add): 16 (WebCore::DocumentOrderedMap::remove): 17 (WebCore::DocumentOrderedMap::get const): 18 1 19 2017-10-24 Michael Catanzaro <mcatanzaro@igalia.com> 2 20 -
trunk/Source/WebCore/dom/DocumentOrderedMap.cpp
r223415 r223886 49 49 void DocumentOrderedMap::add(const AtomicStringImpl& key, Element& element, const TreeScope& treeScope) 50 50 { 51 UNUSED_PARAM(treeScope); 52 RELEASE_ASSERT(element.isInTreeScope()); 51 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(&element.treeScope() == &treeScope); 53 52 ASSERT_WITH_SECURITY_IMPLICATION(treeScope.rootNode().containsIncludingShadowDOM(&element)); 54 53 … … 68 67 return; 69 68 70 RELEASE_ASSERT (entry.count);69 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(entry.count); 71 70 entry.element = nullptr; 72 71 entry.count++; … … 79 78 auto it = m_map.find(&key); 80 79 81 RELEASE_ASSERT(it != m_map.end()); 82 if (it == m_map.end()) 83 return; 80 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(it != m_map.end()); 84 81 85 82 MapEntry& entry = it->value; 86 83 ASSERT_WITH_SECURITY_IMPLICATION(entry.registeredElements.remove(&element)); 87 RELEASE_ASSERT (entry.count);84 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(entry.count); 88 85 if (entry.count == 1) { 89 RELEASE_ASSERT (!entry.element || entry.element == &element);86 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!entry.element || entry.element == &element); 90 87 m_map.remove(it); 91 88 } else { … … 109 106 ASSERT(entry.count); 110 107 if (entry.element) { 111 RELEASE_ASSERT(entry.element->isInTreeScope());112 RELEASE_ASSERT (&entry.element->treeScope() == &scope);113 ASSERT_WITH_SECURITY_IMPLICATION(entry.registeredElements.contains( entry.element));114 return entry.element;108 auto& element = *entry.element; 109 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(&element.treeScope() == &scope); 110 ASSERT_WITH_SECURITY_IMPLICATION(entry.registeredElements.contains(&element)); 111 return &element; 115 112 } 116 113 … … 120 117 continue; 121 118 entry.element = &element; 122 RELEASE_ASSERT(element.isInTreeScope()); 123 RELEASE_ASSERT(&element.treeScope() == &scope); 119 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(&element.treeScope() == &scope); 124 120 ASSERT_WITH_SECURITY_IMPLICATION(entry.registeredElements.contains(entry.element)); 125 121 return &element; … … 188 184 189 185 MapEntry& entry = it->value; 190 RELEASE_ASSERT(entry.count); 191 if (!entry.count) 192 return nullptr; 186 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(entry.count); 193 187 194 188 if (entry.orderedList.isEmpty()) { … … 203 197 entry.orderedList.append(&element); 204 198 } 205 RELEASE_ASSERT (entry.orderedList.size() == entry.count);199 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(entry.orderedList.size() == entry.count); 206 200 } 207 201
Note: See TracChangeset
for help on using the changeset viewer.