js/src/jit-test/tests/debug/Debugger-findScripts-09.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial