gecko-dev/js/xpconnect/tests/unit/test_xrayed_arguments.js
Bobby Holley 6cceb08363 Bug 1453057 - Make Xrays to Arguments objects work correctly. r=bzbarsky
MozReview-Commit-ID: XeWrs0cNL5

Differential Revision: https://phabricator.services.mozilla.com/D5074

--HG--
extra : moz-landing-system : lando
2018-09-14 16:14:49 +00:00

16 lines
396 B
JavaScript

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]);
}