tor-browser

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

switch-dflt-decl-nostrict.js (803B)


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