tor-browser

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

block-decl-onlystrict-strict.js (808B)


      1 'use strict';
      2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 esid: sec-web-compat-functiondeclarationinstantiation
      6 description: >
      7    AnnexB extension not honored in strict mode, Block statement
      8    in function code containing a function declaration
      9 info: |
     10    B.3.3.1 Changes to FunctionDeclarationInstantiation
     11 
     12    1. If strict is false, then
     13      ...
     14 
     15 flags: [onlyStrict]
     16 ---*/
     17 
     18 var err1, err2;
     19 
     20 (function() {
     21  try {
     22    f;
     23  } catch (exception) {
     24    err1 = exception;
     25  }
     26 
     27  {
     28    function f() {  }
     29  }
     30 
     31  try {
     32    f;
     33  } catch (exception) {
     34    err2 = exception;
     35  }
     36 }());
     37 
     38 assert.sameValue(err1.constructor, ReferenceError);
     39 assert.sameValue(err2.constructor, ReferenceError);
     40 
     41 reportCompare(0, 0);