tor-browser

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

StrictFunction_reservedwords_with.js (936B)


      1 // Copyright (C) 2020 Xing Qu. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-createdynamicfunction
      5 description: Strictfunction shouldn't have the reserved word "with"
      6 info: |
      7    CreateDynamicFunction ( constructor, newTarget, kind, args )
      8    
      9    ...
     10    20 Perform the following substeps in an implementation-dependent order, possibly interleaving parsing and error detection:
     11      ...
     12      c. Let strict be ContainsUseStrict of body.
     13      d. If any static semantics errors are detected for parameters or body, throw a SyntaxError exception. 
     14         If strict is true, the Early Error rules for UniqueFormalParameters:FormalParameters are applied.
     15      ...
     16    ...
     17 ---*/
     18 
     19 assert.throws(SyntaxError, function() {
     20  new Function("'use strict'; with ({}) {}");
     21 }, '`new Function("\'use strict\'; with ({}) {}")` throws a SyntaxError exception');
     22 
     23 reportCompare(0, 0);