tor-browser

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

13.2-18-1.js (1050B)


      1 // Copyright (c) 2012 Ecma International.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 es5id: 13.2-18-1
      6 description: >
      7    Function Object has 'prototype' as its own property, it is not
      8    enumerable and does not invoke the setter defined on
      9    Function.prototype (Step 18)
     10 includes: [propertyHelper.js]
     11 ---*/
     12 
     13 try {
     14    var getFunc = function () {
     15        return 100;
     16    };
     17 
     18    var data = "data";
     19    var setFunc = function (value) {
     20        data = value;
     21    };
     22    Object.defineProperty(Function.prototype, "prototype", {
     23        get: getFunc,
     24        set: setFunc,
     25        configurable: true
     26    });
     27 
     28    var fun = function () { };
     29 
     30    assert.notSameValue(fun.prototype, 100);
     31    assert.sameValue(fun.prototype.toString(), "[object Object]");
     32 
     33    verifyProperty(fun, "prototype", {
     34        writable: true,
     35        enumerable: false,
     36        configurable: false,
     37    });
     38 
     39    assert.sameValue(data, "data");
     40 } finally {
     41    delete Function.prototype.prototype;
     42 }
     43 
     44 reportCompare(0, 0);