tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

13.2-30-s.js (967B)


      1 // Copyright (C) 2015 Caitlin Potter. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: >
      6    Functions created using Function.prototype.bind() do not have own
      7    properties "caller" or "arguments", but inherit them from
      8    %FunctionPrototype%.
      9 ---*/
     10 
     11 function target() {}
     12 var self = {};
     13 var bound = target.bind(self);
     14 
     15 assert.sameValue(bound.hasOwnProperty('caller'), false, 'Functions created using Function.prototype.bind() do not have own property "caller"');
     16 assert.sameValue(bound.hasOwnProperty('arguments'), false, 'Functions created using Function.prototype.bind() do not have own property "arguments"');
     17 
     18 assert.throws(TypeError, function() {
     19  return bound.caller;
     20 });
     21 
     22 assert.throws(TypeError, function() {
     23  bound.caller = {};
     24 });
     25 
     26 assert.throws(TypeError, function() {
     27  return bound.arguments;
     28 });
     29 
     30 assert.throws(TypeError, function() {
     31  bound.arguments = {};
     32 });
     33 
     34 reportCompare(0, 0);