tor-browser

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

target-member-computed-reference-null.js (1297B)


      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 esid: sec-assignment-operators
      6 description: Assignment Operator evaluates the value prior validating a MemberExpression's reference (null)
      7 info: |
      8  # 13.15.2 Runtime Semantics: Evaluation
      9  AssignmentExpression : LeftHandSideExpression = AssignmentExpression
     10 
     11  1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral,
     12     then
     13     a. Let lref be the result of evaluating LeftHandSideExpression.
     14     [...]
     15     e. Perform ? PutValue(lref, rval).
     16 
     17  # 6.2.4.5 PutValue ( V, W )
     18 
     19  [...]
     20  5. If IsPropertyReference(V) is true, then
     21     a. Let baseObj be ? ToObject(V.[[Base]]).
     22 ---*/
     23 
     24 function DummyError() { }
     25 
     26 assert.throws(DummyError, function() {
     27  var base = null;
     28  var prop = function() {
     29    throw new DummyError();
     30  };
     31  var expr = function() {
     32    throw new Test262Error("right-hand side expression evaluated");
     33  };
     34 
     35  base[prop()] = expr();
     36 });
     37 
     38 assert.throws(DummyError, function() {
     39  var base = null;
     40  var prop = {
     41    toString: function() {
     42      throw new Test262Error("property key evaluated");
     43    }
     44  };
     45  var expr = function() {
     46    throw new DummyError();
     47  };
     48 
     49  base[prop] = expr();
     50 });
     51 
     52 reportCompare(0, 0);