tor-browser

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

throw-from-finally.js (999B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 13.6.4.13
      5 description: >
      6    Control flow during body evaluation should honor `throw` statements within
      7    the `finally` block of `try` statements.
      8 features: [generators]
      9 ---*/
     10 
     11 function* values() {
     12  yield 1;
     13  throw new Test262Error('This code is unreachable (following `yield` statement).');
     14 }
     15 var CustomError = function() {};
     16 var iterator = values();
     17 var i = 0;
     18 var error = new CustomError();
     19 
     20 assert.throws(CustomError, function() {
     21  for (var x of iterator) {
     22    try {
     23    } finally {
     24      i++;
     25      throw error;
     26 
     27      throw new Test262Error('This code is unreachable (following `throw` statement).');
     28    }
     29 
     30    throw new Test262Error('This code is unreachable (following `try` statement).');
     31  }
     32 
     33  throw new Test262Error('This code is unreachable (following `for..in` statement).');
     34 });
     35 
     36 assert.sameValue(i, 1);
     37 
     38 reportCompare(0, 0);