2 <html xmlns=
"http://www.w3.org/1999/xhtml">
4 https://bugzilla.mozilla.org/show_bug.cgi?id=398825
7 <title>Test for Bug
398825</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
12 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=398825">Mozilla Bug
398825</a>
14 <div id=
"content" style=
"display: none"></div>
16 <iframe id=
"svg" src=
"selectSubString-helper.svg"></iframe>
19 <script class=
"testbody" type=
"application/javascript">
20 SimpleTest.waitForExplicitFinish();
23 var document = $(
"svg").contentWindow.document;
24 var text = document.getElementById(
"text");
26 function expectThrow(charnum, nchars) {
28 text.selectSubString(charnum, nchars);
30 "text.selectSubString(" + charnum +
"," + nchars +
") " +
31 "should have thrown");
33 is(e.name,
"IndexSizeError",
34 "expected an index error for " +
35 "text.selectSubString(" + charnum +
"," + nchars +
")");
36 is(e.code, DOMException.INDEX_SIZE_ERR,
37 "expected an index error for " +
38 "text.selectSubString(" + charnum +
"," + nchars +
")");
42 function expectNoThrow(charnum, nchars) {
44 text.selectSubString(charnum, nchars);
46 "text.selectSubString(" + charnum +
"," + nchars +
") " +
47 "should not have thrown");
50 "unexpected exception for " +
51 "text.selectSubString(" + charnum +
"," + nchars +
")");
60 expectThrow(
100,
100);
62 expectNoThrow(
1,
100);
63 expectNoThrow(
2,
100);
70 window.addEventListener(
"load", runTests);