Skip to content

Commit

Permalink
Compilation failure using gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264442
rdar://118141764

Reviewed by Alex Christensen.

Fix compilation error "error: possibly dangling reference to a temporary [-Werror=dangling-reference]"
No change in observable behaviour.

* Source/WebCore/dom/TreeScope.cpp:
(WebCore::TreeScope::findAnchor):
* Source/WebCore/dom/TreeScopeOrderedMap.cpp:
(WebCore::TreeScopeOrderedMap::get const):

Canonical link: https://commits.webkit.org/270421@main
  • Loading branch information
jyavenard committed Nov 9, 2023
1 parent df2e0bf commit f738f43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Source/WebCore/dom/TreeScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@ RefPtr<Element> TreeScope::findAnchor(StringView name)
if (RefPtr element = getElementById(name))
return element;
auto inQuirksMode = documentScope().inQuirksMode();
for (Ref anchor : descendantsOfType<HTMLAnchorElement>(protectedRootNode())) {
Ref rootNode = m_rootNode;
for (Ref anchor : descendantsOfType<HTMLAnchorElement>(rootNode)) {
if (inQuirksMode) {
// Quirks mode, ASCII case-insensitive comparison of names.
// FIXME: This behavior is not mentioned in the HTML specification.
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/dom/TreeScopeOrderedMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ inline RefPtr<Element> TreeScopeOrderedMap::get(const AtomString& key, const Tre
}

// We know there's at least one node that matches; iterate to find the first one.
for (Ref element : descendantsOfType<Element>(scope.protectedRootNode().get())) {
Ref rootNode = scope.rootNode();
for (Ref element : descendantsOfType<Element>(rootNode.get())) {
if (!element->isInTreeScope())
continue;
if (!keyMatches(key, element))
Expand Down

0 comments on commit f738f43

Please sign in to comment.