|
1 // Passing bad query properties to Debugger.prototype.findScripts throws. |
|
2 load(libdir + 'asserts.js'); |
|
3 |
|
4 var dbg = new Debugger(); |
|
5 var g = newGlobal(); |
|
6 assertEq(dbg.findScripts().length, 0); |
|
7 assertEq(dbg.findScripts({}).length, 0); |
|
8 |
|
9 assertEq(dbg.findScripts({global:g}).length, 0); |
|
10 assertThrowsInstanceOf(function () { dbg.findScripts({global:null}); }, TypeError); |
|
11 assertThrowsInstanceOf(function () { dbg.findScripts({global:true}); }, TypeError); |
|
12 assertThrowsInstanceOf(function () { dbg.findScripts({global:4}); }, TypeError); |
|
13 assertThrowsInstanceOf(function () { dbg.findScripts({global:"I must have fruit!"}); }, TypeError); |
|
14 |
|
15 assertEq(dbg.findScripts({url:""}).length, 0); |
|
16 assertThrowsInstanceOf(function () { dbg.findScripts({url:null}); }, TypeError); |
|
17 assertThrowsInstanceOf(function () { dbg.findScripts({url:true}); }, TypeError); |
|
18 assertThrowsInstanceOf(function () { dbg.findScripts({url:4}); }, TypeError); |
|
19 assertThrowsInstanceOf(function () { dbg.findScripts({url:{}}); }, TypeError); |
|
20 |
|
21 assertEq(dbg.findScripts({url:"", line:1}).length, 0); |
|
22 assertEq(dbg.findScripts({url:"", line:Math.sqrt(4)}).length, 0); |
|
23 |
|
24 // A 'line' property without a 'url' property is verboten. |
|
25 assertThrowsInstanceOf(function () { dbg.findScripts({line:1}); }, TypeError); |
|
26 |
|
27 assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:null}); }, TypeError); |
|
28 assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:{}}); }, TypeError); |
|
29 assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:true}); }, TypeError); |
|
30 assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:""}); }, TypeError); |
|
31 assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:0}); }, TypeError); |
|
32 assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:-1}); }, TypeError); |
|
33 assertThrowsInstanceOf(function () { dbg.findScripts({url:"",line:1.5}); }, TypeError); |
|
34 |
|
35 // Values of any type for 'innermost' are accepted. |
|
36 assertEq(dbg.findScripts({url:"", line:1, innermost:true}).length, 0); |
|
37 assertEq(dbg.findScripts({url:"", line:1, innermost:1}).length, 0); |
|
38 assertEq(dbg.findScripts({url:"", line:1, innermost:"yes"}).length, 0); |
|
39 assertEq(dbg.findScripts({url:"", line:1, innermost:{}}).length, 0); |
|
40 assertEq(dbg.findScripts({url:"", line:1, innermost:[]}).length, 0); |
|
41 |
|
42 // An 'innermost' property without 'url' and 'line' properties is verboten. |
|
43 assertThrowsInstanceOf(function () { dbg.findScripts({innermost:true}); }, TypeError); |
|
44 assertThrowsInstanceOf(function () { dbg.findScripts({innermost:true, line:1}); }, TypeError); |
|
45 assertThrowsInstanceOf(function () { dbg.findScripts({innermost:true, url:"foo"}); }, TypeError); |