Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | // Copyright 2009 the Sputnik authors. All rights reserved. |
michael@0 | 2 | // This code is governed by the BSD license found in the LICENSE file. |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * The production StatementList Statement is evaluated as follows |
michael@0 | 6 | * 1. Evaluate Statement. |
michael@0 | 7 | * 2. If an exception was thrown, return (throw, V, empty) where V is the exception |
michael@0 | 8 | * |
michael@0 | 9 | * @path ch12/12.1/S12.1_A2.js |
michael@0 | 10 | * @description Throwing exception within a Block |
michael@0 | 11 | */ |
michael@0 | 12 | |
michael@0 | 13 | ////////////////////////////////////////////////////////////////////////////// |
michael@0 | 14 | //CHECK#1 |
michael@0 | 15 | try { |
michael@0 | 16 | x(); |
michael@0 | 17 | $ERROR('#1: "x()" lead to throwing exception'); |
michael@0 | 18 | } catch (e) { |
michael@0 | 19 | $PRINT(e.message); |
michael@0 | 20 | } |
michael@0 | 21 | // |
michael@0 | 22 | ////////////////////////////////////////////////////////////////////////////// |
michael@0 | 23 | |
michael@0 | 24 | ////////////////////////////////////////////////////////////////////////////// |
michael@0 | 25 | //CHECK#2 |
michael@0 | 26 | try { |
michael@0 | 27 | throw "catchme"; |
michael@0 | 28 | $ERROR('#2: throw "catchme" lead to throwing exception'); |
michael@0 | 29 | } catch (e) { |
michael@0 | 30 | if (e!=="catchme") { |
michael@0 | 31 | $ERROR('#2.1: Exception === "catchme". Actual: Exception ==='+ e ); |
michael@0 | 32 | } |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | // |
michael@0 | 36 | ////////////////////////////////////////////////////////////////////////////// |
michael@0 | 37 |