tor-browser

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

S11.1.1_A4.2.js (1135B)


      1 // Copyright 2009 the Sputnik authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: |
      6    Being in anonymous code, "this" and eval("this"), called as a
      7    constructor, return the object
      8 es5id: 11.1.1_A4.2
      9 description: >
     10    Creating function by using new Function() constructor. It has the
     11    property, which returns "this"
     12 ---*/
     13 
     14 //CHECK#1
     15 var MyFunction = new Function("this.THIS = this");
     16 var MyObject = new MyFunction();
     17 if (MyObject.THIS.toString() !== "[object Object]") {
     18  throw new Test262Error('#1: var MyFunction = new Function("this.THIS = this"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString()));
     19 }
     20 
     21 //CHECK#2
     22 MyFunction = new Function("this.THIS = eval(\'this\')");
     23 MyObject = new MyFunction();
     24 if (MyObject.THIS.toString() !== "[object Object]") {
     25  throw new Test262Error('#2: var MyFunction = new Function("this.THIS = eval(\'this\')"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString()));
     26 }
     27 
     28 reportCompare(0, 0);