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

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

Issue 2001083002: Explicit management of FrameSelection availability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-08T18:08:39 Created 4 years, 6 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
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 241a657bcd771c2e12fa78ef6126ef94308c2891..cdc69cee04afe11f8fc7636b43acebdfd256224b 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -81,7 +81,7 @@ void DOMSelection::clearTreeScope()
bool DOMSelection::isAvailable() const
{
- return m_frame;
+ return m_frame && m_frame->selection().isAvailable();
}
const VisibleSelection& DOMSelection::visibleSelection() const
@@ -424,6 +424,11 @@ void DOMSelection::addRange(Range* newRange)
FrameSelection& selection = m_frame->selection();
+ if (newRange->ownerDocument() != selection.document()) {
+ // "editing/selection/selection-in-iframe-removed-crash.html" goes here.
+ return;
+ }
+
if (selection.isNone()) {
selection.setSelectedRange(newRange, VP_DEFAULT_AFFINITY);
return;
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/editing/FrameCaret.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698