summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/tests/unit/test_xrayed_arguments.js
blob: fae0a0c865c209f4ef7b622c895ccd9ebcae9364 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function run_test() {
  var sbContent = Cu.Sandbox(null);
  let xrayedArgs = sbContent.eval("(function(a, b) { return arguments; })('hi', 42)");

  function checkArgs(a) {
    Assert.equal(a.length, 2);
    Assert.equal(a[0], 'hi');
    Assert.equal(a[1], 42);
  }

  // Check Xrays to the args.
  checkArgs(xrayedArgs);

  // Make sure the spread operator works.
  checkArgs([...xrayedArgs]);
}