tor-browser

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

nested-private-indirect-eval-err-contains-newtarget.js (1233B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/class-elements/eval-err-contains-newtarget.case
      3 // - src/class-elements/initializer-eval-newtarget/cls-decl-private-fields-indirect-eval-nested.template
      4 /*---
      5 description: error if `new.target` in StatementList of eval (indirect eval)
      6 esid: sec-performeval-rules-in-initializer
      7 features: [class, new.target, class-fields-private]
      8 flags: [generated]
      9 info: |
     10    Additional Early Error Rules for Eval Inside Initializer
     11    These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
     12    ScriptBody : StatementList
     13 
     14      ...
     15      The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
     16 
     17    Additional Early Error Rules for Eval Outside Functions
     18    These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
     19    ScriptBody : StatementList
     20 
     21      It is a Syntax Error if StatementList Contains NewTarget.
     22 
     23 ---*/
     24 
     25 
     26 var executed = false;
     27 class C {
     28  #x = (0, eval)('executed = true; new.target;');
     29 }
     30 
     31 assert.throws(SyntaxError, function() {
     32  new C();
     33 });
     34 
     35 assert.sameValue(executed, false);
     36 
     37 reportCompare(0, 0);