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

Unified Diff: Source/core/html/HTMLElement.cpp

Issue 67813002: Protect contextElement during insertAdjacentHTML call (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments Created 7 years, 1 month 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 | « LayoutTests/fast/dom/insertAdjacentHTML-afterend-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLElement.cpp
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index 2500b8a53596aa222e187172cb7312d9e698b7ca..9c9a776281cbb8d71904a31f8dd1135f840f1606 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -522,11 +522,11 @@ static Element* contextElementForInsertion(const String& where, Element* element
void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, ExceptionState& es)
{
- Element* contextElement = contextElementForInsertion(where, this, es);
+ RefPtr<Element> contextElement = contextElementForInsertion(where, this, es);
if (!contextElement)
return;
- RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement, AllowScriptingContent, "insertAdjacentHTML", es);
+ RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement.get(), AllowScriptingContent, "insertAdjacentHTML", es);
if (!fragment)
return;
insertAdjacent(where, fragment.get(), es);
« no previous file with comments | « LayoutTests/fast/dom/insertAdjacentHTML-afterend-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698