New issue
Advanced search Search tips

Issue 690240 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 683066



Sign in to add a comment

Selection.prototype.extend() should throw InvalidStateError if no ranges

Project Member Reported by tkent@chromium.org, Feb 9 2017

Issue description

Chrome Version: (copy from chrome://version)
OS: (e.g. Win7, OSX 10.9.5, etc...)

What steps will reproduce the problem?
(1) Open the following URL:
  data:text/html,<script>getSelection().extend(document.currentScript, 0)</script>
(2) Open DevTools, and show Console

What is the expected result?
The console contains an exception message about an InvalidStateError

What happens instead?
Nothing.

Please use labels and text to provide additional information.
Firefox correctly throws an InvalidStateError.

https://www.w3.org/TR/selection-api/#dom-selection-extend
> If the context object is empty, throw an InvalidStateError exception and abort these steps.


For graphics-related bugs, please copy/paste the contents of the about:gpu
page at the end of this report.

 
Project Member

Comment 1 by bugdroid1@chromium.org, Feb 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/de2a69791692ee94fa066dec6bcaf2f2075072c1

commit de2a69791692ee94fa066dec6bcaf2f2075072c1
Author: tkent <tkent@chromium.org>
Date: Thu Feb 09 05:56:25 2017

Selection API: Selection.extend() should throw if rangeCount is 0.

Fixes 88 tests in external/wpt/selection/extend-00.html.
The new behavior matches to the standard and Firefox.

* assert_selection.js:
  Prevent load() from throwing an InvalidStateError while running
  editing/deleting/typing_one_character_delete_crash.html

BUG= 690240 

Review-Url: https://codereview.chromium.org/2686663004
Cr-Commit-Position: refs/heads/master@{#449213}

[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/editing/assert_selection.js
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/editing/execCommand/transpose-backslash-with-euc.html
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/editing/selection/DOMSelection-DocumentType-expected.txt
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/editing/selection/DOMSelection-crossing-document-expected.txt
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/editing/selection/script-tests/DOMSelection-DocumentType.js
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/editing/selection/script-tests/DOMSelection-crossing-document.js
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/external/wpt/selection/extend-00-expected.txt
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/external/wpt/selection/extend-20-expected.txt
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/external/wpt/selection/extend-40-expected.txt
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/external/wpt/selection/interfaces-expected.txt
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/external/wpt/selection/removeAllRanges-expected.txt
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/LayoutTests/fast/text/selection-exceptions.html
[modify] https://crrev.com/de2a69791692ee94fa066dec6bcaf2f2075072c1/third_party/WebKit/Source/core/editing/DOMSelection.cpp

Comment 2 by tkent@chromium.org, Feb 9 2017

Labels: M-58
Status: Fixed (was: Started)
Cc: kkaluri@chromium.org
Labels: Needs-Feedback
Verified this issue on Windows 10, Ubuntu 14.04 and Mac 10.12.3 with chrome dev #58.0.3012.0

In the chrome omnibox, when i entered "data:text/html,<script>getSelection().extend(document.currentScript, 0)</script>" this code, i didn't see any exception message about an InvalidStateError in console 

Observation:
When entered the above code in firefox, in the console it contains an exception message about an InvalidStateError

Attaching the screenshots from both Browsers.

tkent@ could you please look into it and let us know your observations.

Thank You...

Issue 690240 - Chrome.png
102 KB View Download
Issue 690240 - FireFox.png
74.4 KB View Download

Sign in to add a comment