tor-browser

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

duplicate-__proto__.js (1395B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 
      6 // Destructuring assignment.
      7 var a, b;
      8 ({__proto__: a, __proto__: b} = {});
      9 assertEq(a, Object.prototype);
     10 assertEq(b, Object.prototype);
     11 
     12 // Destructuring binding with "var".
     13 var {__proto__: a, __proto__: b} = {};
     14 assertEq(a, Object.prototype);
     15 assertEq(b, Object.prototype);
     16 
     17 // Destructuring binding with "let".
     18 {
     19    let {__proto__: a, __proto__: b} = {};
     20    assertEq(a, Object.prototype);
     21    assertEq(b, Object.prototype);
     22 }
     23 
     24 // Destructuring binding with "const".
     25 {
     26    const {__proto__: a, __proto__: b} = {};
     27    assertEq(a, Object.prototype);
     28    assertEq(b, Object.prototype);
     29 }
     30 
     31 // Function parameters.
     32 function f1({__proto__: a, __proto__: b}) {
     33    assertEq(a, Object.prototype);
     34    assertEq(b, Object.prototype);
     35 }
     36 f1({});
     37 
     38 // Arrow function parameters.
     39 var f2 = ({__proto__: a, __proto__: b}) => {
     40    assertEq(a, Object.prototype);
     41    assertEq(b, Object.prototype);
     42 };
     43 f2({});
     44 
     45 // Arrow function parameters with defaults (initially parsed as destructuring assignment).
     46 var f3 = ({__proto__: a, __proto__: b} = {}) => {
     47    assertEq(a, Object.prototype);
     48    assertEq(b, Object.prototype);
     49 };
     50 f3({});
     51 
     52 
     53 if (typeof reportCompare === "function")
     54    reportCompare(0, 0);