tor-browser

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

S11.13.2_A7.1_T2.js (1041B)


      1 // Copyright (C) 2015 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: Compound Assignment Operator evaluates its operands from left to right.
      6 description: >
      7    The left-hand side expression is evaluated before the right-hand side.
      8    Left-hand side expression is MemberExpression: base[prop]. base is the
      9    undefined value.
     10    Check operator is "x *= y".
     11 ---*/
     12 
     13 function DummyError() { }
     14 
     15 assert.throws(DummyError, function() {
     16  var base = undefined;
     17  var prop = function() {
     18    throw new DummyError();
     19  };
     20  var expr = function() {
     21    throw new Test262Error("right-hand side expression evaluated");
     22  };
     23 
     24  base[prop()] *= expr();
     25 });
     26 
     27 assert.throws(TypeError, function() {
     28  var base = undefined;
     29  var prop = {
     30    toString: function() {
     31      throw new Test262Error("property key evaluated");
     32    }
     33  };
     34  var expr = function() {
     35    throw new Test262Error("right-hand side expression evaluated");
     36  };
     37 
     38  base[prop] *= expr();
     39 });
     40 
     41 reportCompare(0, 0);