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

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

Issue 2701253003: Selection API: Add diagnostic code for extend() crash (Closed)
Patch Set: . Created 3 years, 10 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 bb6e173919ba4199fe6b7bb9a67fccceaed84d45..ae438372f5031fe19ac97d7639391e87a3002aa9 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -459,6 +459,17 @@ void DOMSelection::extend(Node* node,
// 3. Let oldAnchor and oldFocus be the context object's anchor and focus, and
// let newFocus be the boundary point (node, offset).
const Position& oldAnchor = anchorPosition();
+ // TODO(tkent): Diagnostic checks for crbug.com/693578. They should be
+ // removed before M58 branch.
+ if (oldAnchor.isNull()) {
+ if (Range* range = documentCachedRange()) {
+ LOG(FATAL)
+ << "Selection has a cached Range, but anchorPosition is null. start="
+ << range->startContainer() << " end=" << range->endContainer();
+ } else if (frame() && !frame()->selection().isNone()) {
+ LOG(FATAL) << "FrameSelection is not none, but anchorPosition is null.";
+ }
+ }
DCHECK(!oldAnchor.isNull());
const Position newFocus(node, offset);
« 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