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

Unified Diff: third_party/WebKit/Source/core/dom/NodeListsNodeData.h

Issue 2903373002: Fix a crash when getElementsByClassName() is called twice with the same argument including capital … (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/ElementTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/NodeListsNodeData.h
diff --git a/third_party/WebKit/Source/core/dom/NodeListsNodeData.h b/third_party/WebKit/Source/core/dom/NodeListsNodeData.h
index 6fdf91b8f78b14f952c1e6740a7f1c184e4946a7..12d43d36aa2b6bde1870e1738555de55f34b39ff 100644
--- a/third_party/WebKit/Source/core/dom/NodeListsNodeData.h
+++ b/third_party/WebKit/Source/core/dom/NodeListsNodeData.h
@@ -65,21 +65,21 @@ class NodeListsNodeData final : public GarbageCollected<NodeListsNodeData> {
struct NodeListAtomicCacheMapEntryHash {
STATIC_ONLY(NodeListAtomicCacheMapEntryHash);
static unsigned GetHash(
- const std::pair<unsigned char, StringImpl*>& entry) {
- return DefaultHash<StringImpl*>::Hash::GetHash(entry.second) +
+ const std::pair<unsigned char, AtomicString>& entry) {
+ return DefaultHash<AtomicString>::Hash::GetHash(entry.second) +
entry.first;
}
- static bool Equal(const std::pair<unsigned char, StringImpl*>& a,
- const std::pair<unsigned char, StringImpl*>& b) {
+ static bool Equal(const std::pair<unsigned char, AtomicString>& a,
+ const std::pair<unsigned char, AtomicString>& b) {
return a == b;
}
static const bool safe_to_compare_to_empty_or_deleted =
- DefaultHash<StringImpl*>::Hash::safe_to_compare_to_empty_or_deleted;
+ DefaultHash<AtomicString>::Hash::safe_to_compare_to_empty_or_deleted;
};
// Oilpan: keep a weak reference to the collection objects.
// Object unregistration is handled by GC's weak processing.
- typedef HeapHashMap<std::pair<unsigned char, StringImpl*>,
+ typedef HeapHashMap<std::pair<unsigned char, AtomicString>,
WeakMember<LiveNodeListBase>,
NodeListAtomicCacheMapEntryHash>
NodeListAtomicNameCacheMap;
@@ -181,13 +181,10 @@ class NodeListsNodeData final : public GarbageCollected<NodeListsNodeData> {
private:
NodeListsNodeData() : child_node_list_(nullptr) {}
- std::pair<unsigned char, StringImpl*> NamedNodeListKey(
+ std::pair<unsigned char, AtomicString> NamedNodeListKey(
CollectionType type,
const AtomicString& name) {
- // Holding the raw StringImpl is safe because |name| is retained by the
- // NodeList and the NodeList is reponsible for removing itself from the
- // cache on deletion.
- return std::pair<unsigned char, StringImpl*>(type, name.Impl());
+ return std::pair<unsigned char, AtomicString>(type, name);
}
// Can be a ChildNodeList or an EmptyNodeList.
« no previous file with comments | « third_party/WebKit/Source/core/dom/ElementTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698