test_xrayed_arguments.js (396B)
1 function run_test() { 2 var sbContent = Cu.Sandbox(null); 3 let xrayedArgs = sbContent.eval("(function(a, b) { return arguments; })('hi', 42)"); 4 5 function checkArgs(a) { 6 Assert.equal(a.length, 2); 7 Assert.equal(a[0], 'hi'); 8 Assert.equal(a[1], 42); 9 } 10 11 // Check Xrays to the args. 12 checkArgs(xrayedArgs); 13 14 // Make sure the spread operator works. 15 checkArgs([...xrayedArgs]); 16 }