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

Unified Diff: third_party/WebKit/Source/core/editing/DOMSelection.cpp

Issue 2760273002: Dispose temporary Range in Selection::collapse (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | 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/editing/DOMSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
index 5b9f4478aeffe04440a068ad91d83ed2e7a5bbb3..1c73eeedc0565ef287fb6d733d629df7b7920849 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -258,11 +258,15 @@ void DOMSelection::collapse(Node* node,
// 5. Set ([DOM4]) the start and the end of newRange to (node, offset).
newRange->setStart(node, offset, exceptionState);
- if (exceptionState.hadException())
+ if (exceptionState.hadException()) {
+ newRange->dispose();
return;
+ }
newRange->setEnd(node, offset, exceptionState);
- if (exceptionState.hadException())
+ if (exceptionState.hadException()) {
+ newRange->dispose();
return;
+ }
// 6. Set the context object's range to newRange.
updateFrameSelection(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698