http://codereview.appspot.com/135054/diff/1/3
File src/com/google/caja/cajita.js (right):

http://codereview.appspot.com/135054/diff/1/3#newcode98
Line 98: if (arguments.length < 3) end = self.length;
Please use curlies around if bodies.

http://codereview.appspot.com/135054/diff/1/3#newcode1598
Line 1598: var args = [self].concat(Array.slice(opt_args, 0));
How about
  var args = [self];
  if (opt_args !== void 0 && opt_args !== null) {
    args.push.apply(args, opt_args);
  }
?
It avoids an unnecessary array creation, and the apply will do the same
TypeError checks for opt_args === 9.

http://codereview.appspot.com/135054/diff/1/3#newcode3030
Line 3030: return toFunc(this).apply(USELESS, opt_args || []);
Is this where you would throw a TypeError if you wanted to be strict re
foo.apply(bar, 9)?

http://codereview.appspot.com/135054/diff/1/2
File tests/com/google/caja/plugin/domita_test_untrusted.html (right):

http://codereview.appspot.com/135054/diff/1/2#newcode1723
Line 1723: assertArray([],  Array.slice([9], void 0, 0), '([9], void 0,
0)');
How about a quick check of provided bounds:
assetArray([2,3,4], Array.slice([0,1,2,3,4,5,6], 2, 5);
assetArray([2,3,void 0], Array.slice([0,1,2,3], 2, 5);

http://codereview.appspot.com/135054/diff/1/2#newcode1756
Line 1756: //expectFailure(function() { inc.apply({}, 'x'); }, 'apply
"x"');
ok

http://codereview.appspot.com/135054/diff/1/2#newcode1765
Line 1765: assertEquals('add(4, 5)', 5, count);
Maybe test with an array like object.

foo.apply({}, { 0: 'zero', 1: 'one', 3: 'three', length: 5 });

http://codereview.appspot.com/135054

Reply via email to