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

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

Issue 2686663004: Selection API: Selection.extend() should throw if rangeCount is 0. (Closed)
Patch Set: focus() -> collapse() 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 | « third_party/WebKit/LayoutTests/fast/text/selection-exceptions.html ('k') | 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 34c9a1c8e64719d26bfc41d5b133c9a5c5b780e6..4c937826c3254d9752547ddc99192218535456be 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -365,8 +365,11 @@ void DOMSelection::extend(Node* node,
ExceptionState& exceptionState) {
DCHECK(node);
- if (!isAvailable())
+ if (rangeCount() == 0) {
+ exceptionState.throwDOMException(
+ InvalidStateError, "This Selection object doesn't have any Ranges.");
return;
+ }
if (offset < 0) {
exceptionState.throwDOMException(
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/text/selection-exceptions.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698