1 description('This test exercises the source URL and line number that is embedded in JavaScript exceptions, which is displayed in places like the JavaScript console.');
3 function exceptionInFunction()
11 // Raises an exception that gets picked up by KJS_CHECKEXCEPTION
12 document
.documentElement
.innerHTML(foo
);
16 shouldBe("typeof e.sourceURL", '"string"');
17 shouldBe("e.line", '12');
21 // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONVALUE
22 document
.documentElement
.appendChild('').prefix
= '';
26 shouldBe("typeof e.sourceURL", '"string"');
27 shouldBe("e.line", '22');
31 // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONREFERENCE
32 document
.documentElement
.appendChild('').innerHTML
= '';
36 shouldBe("typeof e.sourceURL", '"string"');
37 shouldBe("e.line", '32');
41 // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONLIST
42 document
.getElementById(1());
46 shouldBe("typeof e.sourceURL", '"string"');
47 shouldBe("e.line", '42');
50 // Raises an exception inside a function to check that its line number
51 // isn't overwritten in the assignment node.
53 var a
= exceptionInFunction();
57 shouldBe("typeof e.sourceURL", '"string"');
58 shouldBe("e.line", '5');
70 shouldBe("typeof e.sourceURL", '"string"');
71 shouldBe("e.line", '64');
73 var firstPropIsGetter
= {
74 get getter() { throw {} }
76 var secondPropIsGetter
= {
78 get getter() { throw {} }
80 var firstPropIsSetter
= {
81 set setter(a
) { throw {} }
83 var secondPropIsSetter
= {
85 set setter(a
) { throw {} }
89 firstPropIsGetter
.getter
;
92 shouldBe("e.line", "74");
96 secondPropIsGetter
.getter
;
99 shouldBe("e.line", "78");
103 firstPropIsSetter
.setter
= '';
106 shouldBe("e.line", "81");
110 secondPropIsSetter
.setter
= '';
113 shouldBe("e.line", "85");