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

Side by Side Diff: LayoutTests/editing/selection/selection-invalid-offset.html

Issue 225303002: Let Selection.collapse remember a raw Position instead of a canonicalized one. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 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 unified diff | Download patch
OLDNEW
1 <body> 1 <body>
2 You should see six OKs below (and not hang): <br> 2 You should see 7 OKs below (and not hang): <br>
3 <script> 3 <script>
4 if (window.testRunner) 4 if (window.testRunner)
5 testRunner.dumpAsText(); 5 testRunner.dumpAsText();
6 var body = document.body; 6 var body = document.body;
7 var selection = window.getSelection(); 7 var selection = window.getSelection();
8 try { 8 try {
9 selection.collapse(body, -1); 9 selection.collapse(body, -1);
10 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); } 10 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); }
11 11
12 try { 12 try {
13 selection.setBaseAndExtent(body, -1, body, 0); 13 selection.setBaseAndExtent(body, -1, body, 0);
14 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); } 14 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); }
15 15
16 try { 16 try {
17 selection.setBaseAndExtent(body, 0, body, -1); 17 selection.setBaseAndExtent(body, 0, body, -1);
18 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); } 18 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); }
19 19
20 try { 20 try {
21 selection.collapse(body, -1); 21 selection.collapse(body, -1);
22 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); } 22 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); }
23 23
24 try { 24 try {
25 selection.getRangeAt(-1); 25 selection.getRangeAt(-1);
26 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); } 26 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); }
27 27
28 try { 28 try {
29 selection.getRangeAt(10000); 29 selection.getRangeAt(10000);
30 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); } 30 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); }
31 31
32 // these should throw as well but don't at the moment. Just checking they don't crash. 32 // these should throw as well but don't at the moment. Just checking they don't crash.
Yuta Kitamura 2014/06/05 09:09:28 The location of this comment is inappropriate.
yoichio 2014/06/06 07:54:49 Done.
33 try {
33 selection.collapse(body, 10000); 34 selection.collapse(body, 10000);
35 } catch (e) {document.write(((e.code==DOMException.INDEX_SIZE_ERR) ? "OK" : "FAI L")+"<br>"); }
Yuta Kitamura 2014/06/05 09:09:28 optional: I know it's not your fault, but the form
yoichio 2014/06/06 07:54:49 Done.
36
34 selection.setBaseAndExtent(body, 1000, body, 0); 37 selection.setBaseAndExtent(body, 1000, body, 0);
35 selection.setBaseAndExtent(body, 0, body, 10000); 38 selection.setBaseAndExtent(body, 0, body, 10000);
36 selection.collapse(body, 10000);
37 </script> 39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698