test_exception_line_column.html (1511B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1997216 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1997216</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 13 /** Test for Bug 1997216 */ 14 15 // Test 1: DOMException from querySelector 16 try { 17 document.querySelector('###INVALID_SELECTOR###'); 18 ok(false, "Should have thrown"); 19 } catch (e) { 20 is(e.lineNumber, 17, "querySelector exception should be on line 17"); 21 is(e.columnNumber, 14, "querySelector exception should be on column 14"); 22 } 23 24 // Test 2: Manually created DOMException 25 try { 26 throw new DOMException('Test exception', 'NotFoundError'); 27 } catch (e) { 28 is(e.lineNumber, 26, "Manual DOMException should be on line 26"); 29 is(e.columnNumber, 11, "Manual DOMException should be on column 11"); 30 } 31 32 // Test 3: DOMException from invalid appendChild 33 try { 34 document.documentElement.appendChild(null); 35 ok(false, "Should have thrown"); 36 } catch (e) { 37 is(e.lineNumber, 34, "appendChild exception should be on line 34"); 38 is(e.columnNumber, 30, "appendChild exception should be on column 30"); 39 } 40 41 </script> 42 </head> 43 <body> 44 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1997216">Mozilla Bug 1997216</a> 45 <p id="display"></p> 46 <div id="content" style="display: none"> 47 48 </div> 49 <pre id="test"> 50 </pre> 51 </body> 52 </html>