summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/try
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/statements/try')
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-10.js25
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-11.js27
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-12.js25
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-13.js36
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-14.js29
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-15.js31
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-16.js34
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-3.js28
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-4.js28
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-6.js30
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-7.js38
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-8.js30
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-9.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A1.js56
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T1.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T2.js118
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T3.js153
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T4.js58
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T5.js41
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A11_T1.js22
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A11_T2.js125
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A11_T3.js152
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A11_T4.js58
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A12_T1.js28
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A12_T2.js134
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A12_T3.js164
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A12_T4.js64
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A13_T1.js79
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A13_T2.js182
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A13_T3.js186
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A14.js81
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A15.js94
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T1.js19
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T10.js21
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T11.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T12.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T13.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T14.js21
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T15.js23
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T2.js19
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T3.js19
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T5.js22
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T6.js22
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T7.js22
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T8.js23
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T9.js20
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A17.js45
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T1.js18
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T2.js18
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T3.js62
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T4.js45
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T5.js102
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T6.js55
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T7.js66
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A19_T1.js68
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A19_T2.js102
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A2.js54
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A3.js53
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A4.js37
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A5.js53
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A6.js69
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A7_T1.js140
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A7_T2.js154
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A7_T3.js171
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A8.js35
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T1.js25
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T2.js126
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T3.js162
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T4.js62
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T5.js44
-rw-r--r--js/src/tests/test262/language/statements/try/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws-strict.js16
-rw-r--r--js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws-strict.js16
-rw-r--r--js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/try/completion-values-fn-finally-abrupt.js81
-rw-r--r--js/src/tests/test262/language/statements/try/completion-values-fn-finally-normal.js82
-rw-r--r--js/src/tests/test262/language/statements/try/completion-values-fn-finally-return.js82
-rw-r--r--js/src/tests/test262/language/statements/try/completion-values.js67
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch-empty-break.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch-empty-continue.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-break.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-continue.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch.js32
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-empty-break.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-empty-continue.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-from-catch.js45
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-skip-catch.js32
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-wo-catch.js24
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-try.js25
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-init-iter-close.js52
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err-array-prototype.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err.js36
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-init-iter-no-close.js52
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-name-iter-val.js51
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-init.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-iter.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-init.js50
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-iter.js47
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-init.js46
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-iter.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-init.js47
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-iter.js50
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-val-null.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-exhausted.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-class.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-cover.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-fn.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-gen.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-hole.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-skipped.js47
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-throws.js34
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-undef.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-complete.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-done.js40
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-step-err.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js61
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-err.js54
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val.js51
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id-init.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id-init.js53
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id.js53
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-null.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-undef.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-exhausted.js48
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-step-err.js50
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision.js57
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-empty.js40
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elem.js64
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elision.js70
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-empty.js53
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-rest.js49
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-direct.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision-next-err.js36
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-exhausted.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-step-err.js47
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-val-err.js49
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-ary.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-id.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-obj.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-ary.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-id.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-obj.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-id.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-prop-id.js49
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-init-null.js30
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-init-undefined.js30
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-empty.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-get-value-err.js37
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-arrow.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-class.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-cover.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-fn.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-gen.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-skipped.js46
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-throws.js37
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-trailing-comma.js36
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-list-err.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-init.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-trailing-comma.js36
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-value-null.js32
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-eval-err.js34
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-get-value-err.js39
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-skipped.js58
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-throws.js37
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init.js39
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-trailing-comma.js40
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id.js39
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-init.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-null.js32
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-undef.js32
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-getter.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-skip-non-enumerable.js46
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-val-obj.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/try/early-catch-duplicates.js17
-rw-r--r--js/src/tests/test262/language/statements/try/early-catch-function.js26
-rw-r--r--js/src/tests/test262/language/statements/try/early-catch-lex.js18
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding-finally.js19
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding-lexical.js40
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding-parens.js22
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding-throws.js27
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding.js19
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-block-lex-close.js26
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-block-lex-open.js26
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-block-var-none.js27
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-param-lex-close.js20
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-param-lex-open.js22
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-param-var-none.js28
-rw-r--r--js/src/tests/test262/language/statements/try/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/try/static-init-await-binding-invalid.js27
-rw-r--r--js/src/tests/test262/language/statements/try/static-init-await-binding-valid.js20
-rw-r--r--js/src/tests/test262/language/statements/try/tco-catch-finally-strict.js25
-rw-r--r--js/src/tests/test262/language/statements/try/tco-catch-strict.js27
-rw-r--r--js/src/tests/test262/language/statements/try/tco-finally-strict.js25
205 files changed, 9470 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/try/12.14-10.js b/js/src/tests/test262/language/statements/try/12.14-10.js
new file mode 100644
index 0000000000..b20f4deebc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-10.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-10
+description: catch introduces scope - name lookup finds function parameter
+---*/
+
+ function f(o) {
+
+ function innerf(o, x) {
+ try {
+ throw o;
+ }
+ catch (e) {
+ return x;
+ }
+ }
+
+ return innerf(o, 42);
+ }
+
+assert.sameValue(f({}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-11.js b/js/src/tests/test262/language/statements/try/12.14-11.js
new file mode 100644
index 0000000000..cc7fa1e0aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-11.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-11
+description: catch introduces scope - name lookup finds inner variable
+---*/
+
+ function f(o) {
+
+ function innerf(o) {
+ var x = 42;
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+assert.sameValue(f({}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-12.js b/js/src/tests/test262/language/statements/try/12.14-12.js
new file mode 100644
index 0000000000..4a29c3775a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-12.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-12
+description: catch introduces scope - name lookup finds property
+---*/
+
+ function f(o) {
+
+ function innerf(o) {
+ try {
+ throw o;
+ }
+ catch (e) {
+ return e.x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+assert.sameValue(f({x:42}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-13.js b/js/src/tests/test262/language/statements/try/12.14-13.js
new file mode 100644
index 0000000000..b04aae5e59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-13.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-13
+description: catch introduces scope - updates are based on scope
+flags: [noStrict]
+---*/
+
+ var res1 = false;
+ var res2 = false;
+ var res3 = false;
+
+(function() {
+ var x_12_14_13 = 'local';
+
+ function foo() {
+ this.x_12_14_13 = 'instance';
+ }
+
+ try {
+ throw foo;
+ }
+ catch (e) {
+ res1 = (x_12_14_13 === 'local');
+ e();
+ res2 = (x_12_14_13 === 'local');
+ }
+ res3 = (x_12_14_13 === 'local');
+})();
+
+assert(res1, 'res1 !== true');
+assert(res2, 'res2 !== true');
+assert(res3, 'res3 !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-14.js b/js/src/tests/test262/language/statements/try/12.14-14.js
new file mode 100644
index 0000000000..93340a2877
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-14.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-14
+description: >
+ Exception object is a function, when an exception parameter is
+ called as a function in catch block, global object is passed as
+ the this value
+flags: [noStrict]
+---*/
+
+var global = this;
+var result;
+
+(function() {
+ try {
+ throw function () {
+ this._12_14_14_foo = "test";
+ };
+ } catch (e) {
+ e();
+ result = global._12_14_14_foo;
+ }
+})();
+
+assert.sameValue(result, "test", 'result');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-15.js b/js/src/tests/test262/language/statements/try/12.14-15.js
new file mode 100644
index 0000000000..b2765d3d75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-15.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-15
+description: >
+ Exception object is a function which is a property of an object,
+ when an exception parameter is called as a function in catch
+ block, global object is passed as the this value
+flags: [noStrict]
+---*/
+
+var global = this;
+var result;
+
+(function() {
+ var obj = {};
+ obj.test = function () {
+ this._12_14_15_foo = "test";
+ };
+ try {
+ throw obj.test;
+ } catch (e) {
+ e();
+ result = global._12_14_15_foo;
+ }
+})();
+
+assert.sameValue(result, "test", 'result');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-16.js b/js/src/tests/test262/language/statements/try/12.14-16.js
new file mode 100644
index 0000000000..e206deac32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-16.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-16
+description: >
+ Exception object is a function which update in catch block, when
+ an exception parameter is called as a function in catch block,
+ global object is passed as the this value
+flags: [noStrict]
+---*/
+
+var global = this;
+var result;
+
+(function() {
+ try {
+ throw function () {
+ this._12_14_16_foo = "test";
+ };
+ } catch (e) {
+ var obj = {};
+ obj.test = function () {
+ this._12_14_16_foo = "test1";
+ };
+ e = obj.test;
+ e();
+ result = global._12_14_16_foo;
+ }
+})();
+
+assert.sameValue(result, "test1", 'result');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-3.js b/js/src/tests/test262/language/statements/try/12.14-3.js
new file mode 100644
index 0000000000..3e799519cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-3.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-3
+description: >
+ catch doesn't change declaration scope - var declaration are
+ visible outside when name different from catch parameter
+---*/
+
+ try {
+ throw new Error();
+ }
+ catch (e) {
+ var foo = "declaration in catch";
+ }
+
+assert.sameValue(foo, "declaration in catch");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-4.js b/js/src/tests/test262/language/statements/try/12.14-4.js
new file mode 100644
index 0000000000..0a01749a41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-4.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-4
+description: catch introduces scope - block-local vars must shadow outer vars
+---*/
+
+ var o = { foo : 42};
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ var foo;
+ }
+
+assert.sameValue(foo, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-6.js b/js/src/tests/test262/language/statements/try/12.14-6.js
new file mode 100644
index 0000000000..95f4a8ed6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-6.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-6
+description: >
+ catch introduces scope - block-local function expression must
+ shadow outer function expression
+---*/
+
+ var o = {foo : function () { return 42;}};
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ var foo = function () {};
+ }
+
+assert.sameValue(foo(), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-7.js b/js/src/tests/test262/language/statements/try/12.14-7.js
new file mode 100644
index 0000000000..6f444447e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-7.js
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-7
+description: catch introduces scope - scope removed when exiting catch block
+---*/
+
+ var o = {foo: 1};
+ var catchAccessed = false;
+
+ try {
+ throw o;
+ }
+ catch (expObj) {
+ catchAccessed = (expObj.foo == 1);
+ }
+ assert(catchAccessed, '(expObj.foo == 1)');
+
+
+ catchAccessed = false;
+ try {
+ expObj;
+ }
+ catch (e) {
+ catchAccessed = e instanceof ReferenceError
+ }
+ assert(catchAccessed, 'e instanceof ReferenceError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-8.js b/js/src/tests/test262/language/statements/try/12.14-8.js
new file mode 100644
index 0000000000..4eca6770db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-8.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-8
+description: >
+ catch introduces scope - scope removed when exiting catch block
+ (properties)
+---*/
+
+ var o = {foo: 42};
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ var foo = 1;
+ }
+
+assert.sameValue(o.foo, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-9.js b/js/src/tests/test262/language/statements/try/12.14-9.js
new file mode 100644
index 0000000000..bcd2874785
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-9.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-9
+description: catch introduces scope - name lookup finds outer variable
+---*/
+
+ function f(o) {
+ var x = 42;
+
+ function innerf(o) {
+ try {
+ throw o;
+ }
+ catch (e) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+assert.sameValue(f({}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A1.js b/js/src/tests/test262/language/statements/try/S12.14_A1.js
new file mode 100644
index 0000000000..805af392cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A1.js
@@ -0,0 +1,56 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production TryStatement : try Block Catch is evaluated as follows: 2.
+ If Result(1).type is not throw, return Result(1)
+es5id: 12.14_A1
+description: >
+ Executing TryStatement : try Block Catch. The statements doesn't
+ cause actual exceptions
+---*/
+
+// CHECK#1
+try {
+ var x=0;
+}
+catch (e) {
+ throw new Test262Error('#1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))');
+}
+
+// CHECK#2
+var c1=0;
+try{
+ var x1=1;
+}
+finally
+{
+ c1=1;
+}
+if(x1!==1){
+ throw new Test262Error('#2.1: "try" block must be evaluated. Actual: try Block has not been evaluated');
+}
+if (c1!==1){
+ throw new Test262Error('#2.2: "finally" block must be evaluated. Actual: finally Block has not been evaluated');
+}
+
+// CHECK#3
+var c2=0;
+try{
+ var x2=1;
+}
+catch(e){
+ throw new Test262Error('#3.1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))');
+}
+finally{
+ c2=1;
+}
+if(x2!==1){
+ throw new Test262Error('#3.2: "try" block must be evaluated. Actual: try Block has not been evaluated');
+}
+if (c2!==1){
+ throw new Test262Error('#3.3: "finally" block must be evaluated. Actual: finally Block has not been evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T1.js
new file mode 100644
index 0000000000..af9981bc1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T1.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T1
+description: >
+ Throwing exception while executing iteration statement placed into
+ try Block
+---*/
+
+// CHECK#1
+var i=0;
+try{
+while(i<10){
+ if(i===5) throw i;
+ i++;
+}
+}
+catch(e){
+ if(e!==5)throw new Test262Error('#1: Exception === 5. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T2.js
new file mode 100644
index 0000000000..89b5757262
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T2.js
@@ -0,0 +1,118 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T2
+description: Try statement inside loop, where use continue loop
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+while(c1<2){
+ try{
+ c1+=1;
+ continue;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+};
+if(fin!==1){
+ throw new Test262Error('#1: "finally" block must be evaluated at "try{continue} catch finally" construction');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+while(c2<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ continue;
+ }
+ finally{
+ fin2=1;
+ }
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2: "finally" block must be evaluated at "try catch{continue} finally" construction');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+while(c3<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ continue;
+ }
+ fin3=0;
+}
+if(fin3!==1){
+ throw new Test262Error('#3: "finally" block must be evaluated at "try catch finally{continue}" construction');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+while(c4<2){
+ try{
+ c4+=1;
+ continue;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+};
+if(fin4!==1){
+ throw new Test262Error('#4: "finally" block must be evaluated at "try{continue} finally" construction');
+}
+
+// CHECK#5
+var c5=0;
+while(c5<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c5+=1;
+ continue;
+ }
+}
+if(c5!==2){
+ throw new Test262Error('#5: "try catch{continue}" must work correctly');
+}
+
+// CHECK#6
+var c6=0,fin6=0;
+while(c6<2){
+ try{
+ c6+=1;
+ throw "ex1"
+ }
+ finally{
+ fin6=1;
+ continue;
+ }
+ fin6=-1;
+}
+if(fin6!==1){
+ throw new Test262Error('#6.1: "finally" block must be evaluated');
+}
+if(c6!==2){
+ throw new Test262Error('#6.2: "try finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T3.js
new file mode 100644
index 0000000000..b52f28cd2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T3.js
@@ -0,0 +1,153 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T3
+description: Try statement inside loop, where use break
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+while(c1<2){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+ c1+=2;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==1){
+ throw new Test262Error('#1.2: "try{break}catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+while(c2<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==1){
+ throw new Test262Error('#2.2: "try catch{break} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+while(c3<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ break;
+ }
+ c3+=2;
+ fin3=0;
+}
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==1){
+ throw new Test262Error('#3.2: "try catch finally{break}" must work correctly');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+while(c4<2){
+ try{
+ c4+=1;
+ break;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+ c4+=2;
+}
+if(fin4!==1){
+ throw new Test262Error('#4.1: "finally" block must be evaluated');
+}
+if(c4!==1){
+ throw new Test262Error('#4.2: "try{break} finally" must work correctly');
+}
+
+// CHECK#5
+var c5=0;
+while(c5<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ break;
+ }
+}
+if(c5!==0){
+ throw new Test262Error('#5: "try catch{break}" must work correctly');
+}
+
+// CHECK#6
+var c6=0;
+while(c6<2){
+ try{
+ c6+=1;
+ break;
+ }
+ catch(er1){}
+ c6+=2;
+}
+if(c6!==1){
+ throw new Test262Error('#6: "try{break} catch" must work correctly');
+}
+
+// CHECK#7
+var c7=0,fin7=0;
+try{
+ while(c7<2){
+ try{
+ c7+=1;
+ throw "ex1";
+ }
+ finally{
+ fin7=1;
+ break;
+ }
+ fin7=-1;
+ c7+=2;
+ }
+}
+catch(ex1){
+ c7=10;
+}
+if(fin7!==1){
+ throw new Test262Error('#7.1: "finally" block must be evaluated');
+}
+if(c7!==1){
+ throw new Test262Error('#7.2: "try finally{break}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T4.js
new file mode 100644
index 0000000000..0d258279e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T4.js
@@ -0,0 +1,58 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T4
+description: Try statement inside loop, where combinate using break and continue
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+while(c1<2){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ continue;
+ }
+ fin=-1;
+ c1+=2;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==2){
+ throw new Test262Error('#1.2: "try{break} catch finally{continue}" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+while(c2<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ continue;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==2){
+ throw new Test262Error('#2.2: "try catch{break} finally{continue} must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T5.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T5.js
new file mode 100644
index 0000000000..12bbe9d0f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T5.js
@@ -0,0 +1,41 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T5
+description: Throw some exceptions from different place of loop body
+---*/
+
+// CHECK#1
+var c=0, i=0;
+var fin=0;
+while(i<10){
+ i+=1;
+ try{
+ if(c===0){
+ throw "ex1";
+ throw new Test262Error('#1.1: throw "ex1" lead to throwing exception');
+ }
+ c+=2;
+ if(c===1){
+ throw "ex2";
+ throw new Test262Error('#1.2: throw "ex2" lead to throwing exception');
+ }
+ }
+ catch(er1){
+ c-=1;
+ continue;
+ throw new Test262Error('#1.3: "try catch{continue} finally" must work correctly');
+ }
+ finally{
+ fin+=1;
+ }
+}
+if(fin!==10){
+ throw new Test262Error('#1.4: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A11_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A11_T1.js
new file mode 100644
index 0000000000..95a5bec864
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A11_T1.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for"
+ statement
+es5id: 12.14_A11_T1
+description: Loop inside try Block, where throw exception
+---*/
+
+// CHECK#1
+try{
+ for(var i=0;i<10;i++){
+ if(i===5) throw i;
+ }
+}
+catch(e){
+ if(e!==5)throw new Test262Error('#1: Exception === 5. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A11_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A11_T2.js
new file mode 100644
index 0000000000..20089d9a78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A11_T2.js
@@ -0,0 +1,125 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for"
+ statement
+es5id: 12.14_A11_T2
+description: Try statement inside loop, where use continue loop
+---*/
+
+// CHECK#1
+var fin=0;
+for(var i=0;i<5;i++){
+ try{
+ i+=1;
+ continue;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+}
+if(fin!==1){
+ throw new Test262Error('#1: "finally" block must be evaluated at "try{continue} catch finally" construction');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ continue;
+ }
+ finally{
+ fin2=1;
+ }
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==5){
+ throw new Test262Error('#2.1: "try catch{continue} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ continue;
+ }
+ fin3=0;
+}
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==5){
+ throw new Test262Error('#3.2: "try catch finally{continue}" must work correctly');
+}
+
+// CHECK#4
+var fin=0;
+for(var i=0;i<5;i++){
+ try{
+ i+=1;
+ continue;
+ }
+ finally{
+ fin=1;
+ }
+ fin=-1;
+};
+if(fin!==1){
+ throw new Test262Error('#4: "finally" block must be evaluated at "try{continue} finally" construction');
+}
+
+// CHECK#5
+var c5=0;
+for(var c5=0;c5<10;){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c5+=1;
+ continue;
+ }
+ c5+=12;
+};
+if(c5!==10){
+ throw new Test262Error('#5: "try catch{continue} must work correctly');
+}
+
+// CHECK#6
+var c6=0,fin6=0;
+for(var c6=0;c6<10;){
+ try{
+ c6+=1;
+ throw "ex1"
+ }
+ finally{
+ fin6=1;
+ continue;
+ }
+ fin6=-1;
+};
+if(fin6!==1){
+ throw new Test262Error('#6.1: "finally" block must be evaluated');
+}
+if(c6!==10){
+ throw new Test262Error('#6.2: "try finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A11_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A11_T3.js
new file mode 100644
index 0000000000..14e46c8243
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A11_T3.js
@@ -0,0 +1,152 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for"
+ statement
+es5id: 12.14_A11_T3
+description: Try statement inside loop, where use break
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+for(var i=0;i<5;i++){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+ c1+=2;
+};
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==1){
+ throw new Test262Error('#1.2: "try{break}catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ }
+ c2+=2;
+ fin2=-1;
+};
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==1){
+ throw new Test262Error('#2.2: "try catch{break} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ break;
+ }
+ c3+=2;
+ fin3=0;
+};
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==1){
+ throw new Test262Error('#3.2: "try catch finally{break}" must work correctly');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+for(var i=0;i<5;i++){
+ try{
+ c4+=1;
+ break;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+ c4+=2;
+};
+if(fin4!==1){
+ throw new Test262Error('#4.1: "finally" block must be evaluated');
+}
+if(c4!==1){
+ throw new Test262Error('#4.2: "try{break} finally" must work correctly');
+}
+
+// CHECK#5
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ break;
+ }
+};
+if(i!==0){
+ throw new Test262Error('#5: "try catch{break}" must work correctly');
+}
+
+// CHECK#6
+var c6=0;
+for(var c6=0;c6<5;){
+ try{
+ c6+=1;
+ break;
+ }
+ catch(er1){}
+ c6+=2;
+};
+if(c6!==1){
+ throw new Test262Error('#6: "try{break} catch" must work correctly');
+}
+
+// CHECK#7
+var c7=0,fin7=0;
+try{
+ for(var c7=0;c7<5;){
+ try{
+ c7+=1;
+ throw "ex1";
+ }
+ finally{
+ fin7=1;
+ break;
+ }
+ fin7=-1;
+ c7+=2;
+ }
+}
+catch(ex1){
+ c7=10;
+}
+if(fin7!==1){
+ throw new Test262Error('#7.1: "finally" block must be evaluated');
+}
+if(c7!==1){
+ throw new Test262Error('#7.2: "try finally{break}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A11_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A11_T4.js
new file mode 100644
index 0000000000..a16faad9f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A11_T4.js
@@ -0,0 +1,58 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for"
+ statement
+es5id: 12.14_A11_T4
+description: Try statement inside loop, where combinate using break and continue
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+for(var i=0;i<5;i++){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ continue;
+ }
+ fin=-1;
+ c1+=2;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==5){
+ throw new Test262Error('#1.2: "try{break} catch finally{continue}" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ continue;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==5){
+ throw new Test262Error('#2.2: "try catch{break} finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A12_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A12_T1.js
new file mode 100644
index 0000000000..b46b682563
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A12_T1.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for-in"
+ statement
+es5id: 12.14_A12_T1
+description: Loop inside try Block, where throw exception
+---*/
+
+var x;
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+// CHECK#1
+try{
+ for (x in mycars){
+ if (mycars[x]==="BMW") throw "ex";
+ }
+}
+catch(e){
+ if(e!=="ex")throw new Test262Error('#1: Exception ==="ex". Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A12_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A12_T2.js
new file mode 100644
index 0000000000..8b16f4e286
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A12_T2.js
@@ -0,0 +1,134 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for-in"
+ statement
+es5id: 12.14_A12_T2
+description: Try statement inside loop, where use continue loop
+---*/
+
+var x;
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+// CHECK#1
+var fin=0;
+var i=0;
+for (x in mycars){
+ try{
+ i+=1;
+ continue;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(i!==3){
+ throw new Test262Error('#1.2: "try{continue} catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ continue;
+ }
+ finally{
+ fin2=1;
+ }
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==3){
+ throw new Test262Error('#2.1: "try catch{continue} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ continue;
+ }
+ fin3=0;
+}
+if(c3!==3){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(fin3!==1){
+ throw new Test262Error('#3.2: "try catch finally{continue}" must work correctly');
+}
+
+// CHECK#4
+var fin=0;
+for (x in mycars){
+ try{
+ continue;
+ }
+ finally{
+ fin=1;
+ }
+ fin=-1;
+}
+if(fin!==1){
+ throw new Test262Error('#4: "finally" block must be evaluated at "try{continue} finally" construction');
+}
+
+// CHECK#5
+var c5=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c5+=1;
+ continue;
+ }
+ c5+=12;
+}
+if(c5!==3){
+ throw new Test262Error('#5: "try catch{continue}" must work correctly');
+}
+
+// CHECK#6
+var c6=0,fin6=0;
+for (x in mycars){
+ try{
+ c6+=1;
+ throw "ex1";
+ }
+ finally{
+ fin6=1;
+ continue;
+ }
+ fin6=-1;
+}
+if(fin6!==1){
+ throw new Test262Error('#6.1: "finally" block must be evaluated');
+}
+if(c6!==3){
+ throw new Test262Error('#6.2: "try finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A12_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A12_T3.js
new file mode 100644
index 0000000000..515c51c836
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A12_T3.js
@@ -0,0 +1,164 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for-in"
+ statement
+es5id: 12.14_A12_T3
+description: Try statement inside loop, where use break
+---*/
+
+var x;
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+// CHECK#1
+var c1=0,fin=0;
+for (x in mycars){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){
+ c1+=1;
+ }
+ finally{
+ fin=1;
+ }
+ fin=-1;
+ c1+=2;
+};
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==1){
+ throw new Test262Error('#1.2: "try{break}catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==1){
+ throw new Test262Error('#2.2: "try catch{break} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ break;
+ }
+ c3+=2;
+ fin3=0;
+}
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==1){
+ throw new Test262Error('#3.2: "try catch finally{break}" must work correctly');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+for (x in mycars){
+ try{
+ c4+=1;
+ break;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+ c4+=2;
+}
+if(fin4!==1){
+ throw new Test262Error('#4.1: "finally" block must be evaluated');
+}
+if(c4!==1){
+ throw new Test262Error('#4.2: "try{break} finally" must work correctly');
+}
+
+// CHECK#5
+var c5=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ c5++;
+ }
+ catch(er1){
+ break;
+ c5++;
+ }
+ c5++;
+}
+if(c5!==0){
+ throw new Test262Error('#5: "try catch{break}" must work correctly');
+}
+
+// CHECK#6
+var c6=0;
+for (x in mycars){
+ try{
+ c6+=1;
+ break;
+ }
+ catch(er1){}
+ c6+=2;
+}
+if(c6!==1){
+ throw new Test262Error('#6: "try{break} catch" must work correctly');
+}
+
+// CHECK#7
+var c7=0,fin7=0;
+try{
+ for (x in mycars){
+ try{
+ c7+=1;
+ throw "ex1";
+ }
+ finally{
+ fin7=1;
+ break;
+ }
+ fin7=-1;
+ c7+=2;
+ }
+}
+catch(ex1){
+ c7=10;
+}
+if(fin7!==1){
+ throw new Test262Error('#7.1: "finally" block must be evaluated');
+}
+if(c7!==1){
+ throw new Test262Error('#7.2: "try finally{break}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A12_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A12_T4.js
new file mode 100644
index 0000000000..5fd433d0d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A12_T4.js
@@ -0,0 +1,64 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for-in"
+ statement
+es5id: 12.14_A12_T4
+description: Try statement inside loop, where combinate using break and continue
+---*/
+
+var x;
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+// CHECK#1
+var c1=0,fin=0;
+for (x in mycars){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ continue;
+ }
+ fin=-1;
+ c1+=2;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==3){
+ throw new Test262Error('#1.2: "try{break} catch finally{continue}" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ continue;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==3){
+ throw new Test262Error('#2.2: "try catch{break} finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A13_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A13_T1.js
new file mode 100644
index 0000000000..b4178b6a4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A13_T1.js
@@ -0,0 +1,79 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Using "try" with "catch" or "finally" statement with a "return" statement
+es5id: 12.14_A13_T1
+description: Using try/catch syntax construction
+---*/
+
+// CHECK#1
+function myFunction1(){
+ try{
+ return 1;
+ }
+ catch(err){
+ throw new Test262Error('#1.1: "return 1" inside function does not lead to throwing exception');
+ return 0;
+ }
+ return 2;
+}
+var x1=myFunction1();
+if(x1!==1){
+ throw new Test262Error('#1.2: x1===1. Actual: x1==='+x1);
+}
+
+// CHECK#2
+function myFunction2(){
+ try{
+ throw "exc";
+ return 1;
+ }catch(err){
+ return 2;
+ }
+ return 3;
+}
+var x2=myFunction2();
+if (x2!==2){
+ throw new Test262Error('#2: x2===2. Actual: x2==='+x2);
+}
+
+// CHECK#3
+function myFunction3(){
+ try{
+ return someValue;
+ }catch(err){
+ return 1;
+ }
+ return 2;
+}
+var x3=myFunction3();
+if (x3!==1){
+ throw new Test262Error('#3: x3===1. Actual: x3==='+x3);
+}
+
+// CHECK#4
+function myFunction4(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ throw "ex2"
+ return 0;
+ }
+ return 2;
+}
+try{
+ var x4=myFunction4();
+ throw new Test262Error('#4.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#4.2: Exception !=="ex1". Actual: catch previous exception');
+ }
+ if(e!=="ex2"){
+ throw new Test262Error('#4.3: Exception ==="ex2". Actual: Exception ==='+ e );
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A13_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A13_T2.js
new file mode 100644
index 0000000000..320d3f4394
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A13_T2.js
@@ -0,0 +1,182 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Using "try" with "catch" or "finally" statement with a "return" statement
+es5id: 12.14_A13_T2
+description: Using try/finally syntax construction
+---*/
+
+// CHECK#1
+var c1=0;
+function myFunction1(){
+ try{
+ return 1;
+ }finally{
+ c1=1;
+ }
+ return 2;
+}
+var x1=myFunction1();
+if(x1!==1){
+ throw new Test262Error('#1.1: x1===1. Actual: x1==='+x1);
+}
+if (c1!==1){
+ throw new Test262Error('#1.2: "finally" block must be evaluated');
+}
+
+// CHECK#2
+var c2=0;
+function myFunction2(){
+ try{
+ throw "exc";
+ return 1;
+ }finally{
+ c2=1;
+ }
+ return 2;
+}
+try{
+ var x2=myFunction2();
+ throw new Test262Error('#2.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if (c2!==1){
+ throw new Test262Error('#2.2: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#3
+var c3=0;
+function myFunction3(){
+ try{
+ return someValue;
+ }finally{
+ c3=1;
+ }
+ return 2;
+}
+try{
+ var x3=myFunction3();
+ throw new Test262Error('#3.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if (c3!==1){
+ throw new Test262Error('#3.2: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#4
+var c4=0;
+function myFunction4(){
+ try{
+ return 1;
+ }finally{
+ c4=1;
+ throw "exc";
+ return 0;
+ }
+ return 2;
+}
+try{
+ var x4=myFunction4();
+ throw new Test262Error('#4.2: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if (c4!==1){
+ throw new Test262Error('#4.3: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#5
+var c5=0;
+function myFunction5(){
+ try{
+ return 1;
+ }finally{
+ c5=1;
+ return someValue;
+ return 0;
+ }
+ return 2;
+}
+try{
+ var x5=myFunction5();
+ throw new Test262Error('#5.2: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if (c5!==1){
+ throw new Test262Error('#5.3: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#6
+var c6=0;
+function myFunction6(){
+ try{
+ throw "ex1";
+ return 1;
+ }finally{
+ c6=1;
+ throw "ex2";
+ return 2;
+ }
+ return 3;
+}
+try{
+ var x6=myFunction6();
+ throw new Test262Error('#6.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#6.2: Exception !=="ex1". Actual: catch previous exception');
+ }
+ if(e!=="ex2"){
+ throw new Test262Error('#6.3: Exception !=="ex1". Actual: '+e);
+ }
+ if (c6!==1){
+ throw new Test262Error('#6.4: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#7
+var c7=0;
+function myFunction7(){
+ try{
+ return 1;
+ }finally{
+ c7=1;
+ return 2;
+ }
+ return 3;
+}
+var x7=myFunction7();
+if(x7!==2){
+ throw new Test262Error('#7.1: "catch" block must be evaluated');
+}
+if (c7!==1){
+ throw new Test262Error('#7.2: "finally" block must be evaluated');
+}
+
+// CHECK#8
+var c8=0;
+function myFunction8(){
+ try{
+ throw "ex1";
+ }finally{
+ c8=1;
+ return 2;
+ }
+ return 3;
+}
+try{
+ var x8=myFunction8();
+}
+catch(ex1){
+ c8=10;
+}
+if (c8!==1){
+ throw new Test262Error('#8: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A13_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A13_T3.js
new file mode 100644
index 0000000000..f7b9fd39ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A13_T3.js
@@ -0,0 +1,186 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Using "try" with "catch" or "finally" statement with a "return" statement
+es5id: 12.14_A13_T3
+description: Using try/catch/finally syntax construction
+---*/
+
+// CHECK#1
+var c1=0;
+function myFunction1(){
+ try{
+ return 1;
+ }catch(err){
+ throw new Test262Error('#1.1: "return 1" inside function does not lead to throwing exception');
+ return 0;
+ }finally{
+ c1=1;
+ }
+ return 2;
+}
+var x1=myFunction1();
+if(x1!==1){
+ throw new Test262Error('#1.3: x1===1. Actual: x1==='+x1);
+}
+if (c1!==1){
+ throw new Test262Error('#1.4: "finally" block must be evaluated');
+}
+
+// CHECK#2
+var c2=0;
+function myFunction2(){
+ try{
+ throw "exc";
+ return 1;
+ }catch(err){
+ return 0;
+ }finally{
+ c2=1;
+ }
+ return 2;
+}
+var x2=myFunction2();
+if (c2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if (x2!==0){
+ throw new Test262Error('#2.2: x2===0. Actual: x2==='+x2);
+}
+
+// CHECK#3
+var c3=0;
+function myFunction3(){
+ try{
+ return someValue;
+ }catch(err){
+ return 1;
+ }finally{
+ c3=1;
+ }
+ return 2;
+}
+var x3=myFunction3();
+if (c3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if (x3!==1){
+ throw new Test262Error('#3.2: x3===1. Actual: x3==='+x3);
+}
+
+// CHECK#4
+var c4=0;
+function myFunction4(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ throw "ex2"
+ return 0;
+ }finally{
+ c4=1;
+ }
+ return 2;
+}
+try{
+ var x4=myFunction4();
+ throw new Test262Error('#4.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#4.2: Exception !== "ex1". Actual: catch previous exception');
+ }
+ if(e!=="ex2"){
+ throw new Test262Error('#4.3: Exception === "ex2". Actual: Exception ==='+ e );
+ }
+ if (c4!==1){
+ throw new Test262Error('#4.4: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#5
+var c5=0;
+function myFunction5(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ return 0;
+ }finally{
+ c5=1;
+ throw "ex2";
+ }
+ return 2;
+}
+try{
+ var x5=myFunction5();
+ throw new Test262Error('#5.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#5.2: Exception !== "ex1". Actual: catch previous exception');
+ }
+ if(e!=="ex2"){
+ throw new Test262Error('#5.3: Exception === "ex2". Actual: Exception ==='+ e );
+ }
+ if (c5!==1){
+ throw new Test262Error('#5.4: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#6
+var c6=0;
+function myFunction6(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ throw "ex2";
+ return 0;
+ }finally{
+ c6=1;
+ throw "ex3";
+ }
+ return 2;
+}
+try{
+ var x6=myFunction6();
+ throw new Test262Error('#6.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#6.2: Exception !== "ex1". Actual: catch previous exception');
+ }
+ if(e==="ex2"){
+ throw new Test262Error('#6.3: Exception !== "ex2". Actual: catch previous exception');
+ }
+ if(e!=="ex3"){
+ throw new Test262Error('#6.4: Exception === "ex3". Actual: Exception ==='+ e );
+ }
+ if(c6!==1) throw new Test262Error('#6.5: "finally" block must be evaluated');
+}
+
+// CHECK#7
+var c7=0;
+function myFunction7(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ throw "ex2";
+ return 0;
+ }finally{
+ c7=1;
+ return 2;
+ }
+ return 3;
+}
+try{
+ var x7=myFunction7();
+ if(x7!==2) throw new Test262Error('#7.1: x7===2. Actual: x7==='+x7);
+}
+catch(e){}
+if(c7!==1) throw new Test262Error('#7.2: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A14.js b/js/src/tests/test262/language/statements/try/S12.14_A14.js
new file mode 100644
index 0000000000..4610f9fcc9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A14.js
@@ -0,0 +1,81 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "with"
+ statement
+es5id: 12.14_A14
+description: Using try/catch/finally in With and With in try/catch/finally
+flags: [noStrict]
+---*/
+
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+
+// CHECK#1
+try{
+ with(myObj){
+ throw "ex";
+ }
+}
+catch(e){
+ if (e!=="ex") throw new Test262Error('#1: Exception ==="ex". Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+with(myObj){
+ try{
+ throw p1;
+ }
+ catch(e){
+ if (e!=="a") throw new Test262Error('#2.1: Exception ==="a". Actual: Exception ==='+ e );
+ p1='pass';
+ }
+}
+if(myObj.p1!=='pass') throw new Test262Error('#2.2: "throw p1" lead to throwing exception');
+
+// CHECK#3
+with(myObj){
+ try{
+ p1='fail';
+ throw p2;
+ }
+ catch(e){
+ if (e!=="b") throw new Test262Error('#3.1: Exception ==="b". Actual: Exception ==='+ e );
+ p1='pass';
+ }
+ finally{
+ p2='pass';
+ }
+}
+if(myObj.p1!=='pass') throw new Test262Error('#3.2: "throw p2" lead to throwing exception');
+if(myObj.p2!=='pass') throw new Test262Error('#3.3: "finally" block must be evaluated');
+
+// CHECK#4
+myObj.p1='fail';
+try{
+ with(myObj){
+ try{
+ throw p3;
+ }
+ finally{
+ p1='pass';
+ }
+ }
+}
+catch(e){}
+if(myObj.p1!=='pass') throw new Test262Error('#4: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A15.js b/js/src/tests/test262/language/statements/try/S12.14_A15.js
new file mode 100644
index 0000000000..bc4f85154d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A15.js
@@ -0,0 +1,94 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "switch"
+ statement
+es5id: 12.14_A15
+description: Insert try/catch/finally to switch statement
+---*/
+
+// CHECK#1
+function SwitchTest1(value){
+ var result = 0;
+ try{
+ switch(value) {
+ case 1:
+ result += 4;
+ throw result;
+ break;
+ default:
+ result += 32;
+ break;
+ case 4:
+ result += 64;
+ throw "ex";
+ }
+ return result;
+ }
+ catch(e){
+ if ((value===1)&&(e!==4)) throw new Test262Error('#1.1: Exception ===4. Actual: Exception ==='+ e );
+ if ((value===4)&&(e!=="ex")) throw new Test262Error('#1.2: Exception ==="ex". Actual: Exception ==='+ e );
+ }
+ finally{
+ return result;
+ }
+}
+if (SwitchTest1(1)!==4) throw new Test262Error('#1.3: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) );
+if (SwitchTest1(4)!==64) throw new Test262Error('#1.4: SwitchTest1(4)===64. Actual: SwitchTest1(4)==='+ SwitchTest1(4) );
+
+// CHECK#2
+var c2=0;
+function SwitchTest2(value){
+ var result = 0;
+ switch(value) {
+ case 0:
+ try{
+ result += 2;
+ break;
+ }
+ finally{
+ c2=1;
+ }
+ case 1:
+ result += 4;
+ break;
+ default:
+ result += 32;
+ break;
+ }
+ return result;
+}
+if (SwitchTest2(1)!==4) throw new Test262Error('#2.1: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) );
+if (c2===1) throw new Test262Error('#2.2: Evaluate finally block');
+if (SwitchTest2(0)!==2) throw new Test262Error('#2.3: SwitchTest1(0)===2. Actual: SwitchTest1(0)==='+ SwitchTest1(0) );
+if (c2!==1) throw new Test262Error('#2.4: "finally" block must be evaluated');
+
+// CHECK#3
+function SwitchTest3(value){
+ var result = 0;
+ switch(value) {
+ case 0:
+ try{
+ result += 2;
+ throw "ex";
+ }
+ finally{
+ break;
+ }
+ default:
+ result += 32;
+ break;
+ }
+ return result;
+}
+try{
+ var x3=SwitchTest3(0);
+ if (x3!==2) throw new Test262Error('#3.1: x3===2. Actual: x3==='+x3);
+}
+catch(e){
+ throw new Test262Error('#3.2: Catching exception inside function does not lead to throwing exception outside this function');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T1.js
new file mode 100644
index 0000000000..ed248811ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T1.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T1
+description: Checking if pure "try" syntax construction passes
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T10.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T10.js
new file mode 100644
index 0000000000..f3d201e690
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T10.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T10
+description: "Catch: \"catch (Identifier ) Block\""
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{}
+catch(){}
+finally{}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T11.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T11.js
new file mode 100644
index 0000000000..a2c9400ad6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T11.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T11
+description: >
+ Catch and Finally are placed into the Block of "try" (whitle
+ expected outside)
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{
+ {
+ }
+ catch(e){}
+ finally{}
+}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T12.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T12.js
new file mode 100644
index 0000000000..8e7fb25480
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T12.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T12
+description: Embedded "try" statements followed by two "catch" statements
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try
+{
+ try
+ {
+ }
+}
+catch(e1){}
+catch(e2){}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T13.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T13.js
new file mode 100644
index 0000000000..f76eb318e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T13.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T13
+description: >
+ Catch: "catch (Identifier ) Block". Checking if execution of "22"
+ passes at the place of Identifier of "catch"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try
+{
+}
+catch("22")
+{
+}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T14.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T14.js
new file mode 100644
index 0000000000..52a69b2c49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T14.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T14
+description: Checking if passing argument to "try" statement fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try(e1){
+}
+catch(e){}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T15.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T15.js
new file mode 100644
index 0000000000..3aff065fa7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T15.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T15
+description: >
+ Finally: "finally Block". Checking if passing argument to "try"
+ statement fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{
+}
+finally(e){}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T2.js
new file mode 100644
index 0000000000..bf1414bcc4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T2.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T2
+description: Checking if execution of "catch" with no "try" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+catch
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T3.js
new file mode 100644
index 0000000000..cbfaccdcdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T3.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T3
+description: Checking if execution of "finally" with no "try" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+finally
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T5.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T5.js
new file mode 100644
index 0000000000..58a128d023
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T5.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T5
+description: >
+ Catch: "catch (Identifier ) Block". Checking if execution of
+ "catch" with no Block fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{}
+catch()
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T6.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T6.js
new file mode 100644
index 0000000000..453b77faee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T6.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T6
+description: >
+ Block: "{ StatementList }". Checking if execution of "try{
+ catch{}{}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{
+catch(){}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T7.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T7.js
new file mode 100644
index 0000000000..ca04f6ea89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T7.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T7
+description: >
+ Block: "{ StatementList }". Checking if execution of "try{}
+ catch(){" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{}
+catch(){
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T8.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T8.js
new file mode 100644
index 0000000000..f4ca2f9242
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T8.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T8
+description: >
+ Block: "{ StatementList }". Catch: "catch (Identifier ) Block".
+ Checking if execution of "try{} catch(){finally{}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{}
+catch(){
+finally{}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T9.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T9.js
new file mode 100644
index 0000000000..43466a669d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T9.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T9
+description: Checking if execution of "catch(){} finally{}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+catch(){}
+finally{}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A17.js b/js/src/tests/test262/language/statements/try/S12.14_A17.js
new file mode 100644
index 0000000000..8f55f74ebf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A17.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Using "try" with "catch" or "finally" statement in a constructor
+es5id: 12.14_A17
+description: Creating exceptions within constructor
+---*/
+
+var i=1;
+function Integer( value, exception ) {
+ try{
+ this.value = checkValue( value );
+ if(exception) throw new Test262Error('#'+i+'.1: Must be exception');
+ }
+ catch(e){
+ this.value = e.toString();
+ if(!exception) throw new Test262Error('#'+i+'.2: Don`t must be exception');
+ }
+ i++;
+}
+
+function checkValue(value){
+ if(Math.floor(value)!=value||isNaN(value)){
+ throw (INVALID_INTEGER_VALUE +": " + value);
+ }
+ else{
+ return value;
+ }
+}
+
+// CHECK#1
+new Integer(13, false);
+// CHECK#2
+new Integer(NaN, true);
+// CHECK#3
+new Integer(0, false);
+// CHECK#4
+new Integer(Infinity, false);
+// CHECK#5
+new Integer(-1.23, true);
+// CHECK#6
+new Integer(Math.LN2, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T1.js
new file mode 100644
index 0000000000..c9e098fba3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T1.js
@@ -0,0 +1,18 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T1
+description: Catching undefined
+---*/
+
+// CHECK#1
+try{
+ throw undefined;
+}
+catch(e){
+ if (e!==undefined) throw new Test262Error('#1: Exception === undefined. Actual: '+e);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T2.js
new file mode 100644
index 0000000000..144a7dc7c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T2.js
@@ -0,0 +1,18 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T2
+description: Catching null
+---*/
+
+// CHECK#1
+try{
+ throw null;
+}
+catch(e){
+ if (e!==null) throw new Test262Error('#1: Exception ===null. Actual: '+e);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T3.js
new file mode 100644
index 0000000000..988ba55ec9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T3.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T3
+description: Catching boolean
+---*/
+
+// CHECK#1
+try{
+ throw true;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#1: Exception ===true. Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+try{
+ throw false;
+}
+catch(e){
+ if (e!==false) throw new Test262Error('#2: Exception ===false. Actual: Exception ==='+ e );
+}
+
+// CHECK#3
+var b=false;
+try{
+ throw b;
+}
+catch(e){
+ if (e!==false) throw new Test262Error('#3: Exception ===false. Actual: Exception ==='+ e );
+}
+
+// CHECK#4
+var b=true;
+try{
+ throw b;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#4: Exception ===true. Actual: Exception ==='+ e );
+}
+
+// CHECK#5
+var b=true;
+try{
+ throw b&&false;
+}
+catch(e){
+ if (e!==false) throw new Test262Error('#5: Exception ===false. Actual: Exception ==='+ e );
+}
+
+// CHECK#5
+var b=true;
+try{
+ throw b||false;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#6: Exception ===true. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T4.js
new file mode 100644
index 0000000000..20e6a62645
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T4.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T4
+description: Catching string
+---*/
+
+// CHECK#1
+try{
+ throw "exception #1";
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#1: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+try{
+ throw "exception"+" #1";
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#2: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+// CHECK#3
+var b="exception #1";
+try{
+ throw b;
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#3: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+// CHECK#4
+var a="exception";
+var b=" #1";
+try{
+ throw a+b;
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#4: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T5.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T5.js
new file mode 100644
index 0000000000..ac92d818d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T5.js
@@ -0,0 +1,102 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T5
+description: Catching Number
+---*/
+
+// CHECK#1
+try{
+ throw 13;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#1: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+try{
+ throw 10+3;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#2: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#3
+var b=13;
+try{
+ throw b;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#3: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#4
+var a=3;
+var b=10;
+try{
+ throw a+b;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#4: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#5
+try{
+ throw 2.13;
+}
+catch(e){
+ if (e!==2.13) throw new Test262Error('#5: Exception ===2.13. Actual: Exception ==='+ e );
+}
+
+// CHECK#6
+var ex=2/3;
+try{
+ throw 2/3;
+}
+catch(e){
+ if (e!==ex) throw new Test262Error('#6: Exception ===2/3. Actual: Exception ==='+ e );
+}
+
+// CHECK#7
+try{
+ throw NaN;
+}
+catch(e){
+ assert.sameValue(e, NaN, "e is NaN");
+}
+
+// CHECK#8
+try{
+ throw +Infinity;
+}
+catch(e){
+ if (e!==+Infinity) throw new Test262Error('#8: Exception ===+Infinity. Actual: Exception ==='+ e );
+}
+
+// CHECK#9
+try{
+ throw -Infinity;
+}
+catch(e){
+ if (e!==-Infinity) throw new Test262Error('#9: Exception ===-Infinity. Actual: Exception ==='+ e );
+}
+
+// CHECK#10
+try{
+ throw +0;
+}
+catch(e){
+ if (e!==+0) throw new Test262Error('#10: Exception ===+0. Actual: Exception ==='+ e );
+}
+
+// CHECK#11
+try{
+ throw -0;
+}
+catch(e){
+ assert.sameValue(e, -0);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T6.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T6.js
new file mode 100644
index 0000000000..1a4ba300cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T6.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T6
+description: Catching Object
+---*/
+
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';},
+ i:7,
+}
+
+try{
+ throw myObj;
+}
+catch(e){
+// CHECK#1
+ if (e.p1!=="a") throw new Test262Error('#1: e.p1==="a". Actual: e.p1==='+ e.p1 );
+// CHECK#2
+ if (e.value!=='myObj_value') throw new Test262Error('#2: e.value===\'myObj_value\'. Actual: e.value==='+ e.value );
+// CHECK#3
+ if (e.eval()!=='obj_eval') throw new Test262Error('#3: e.eval()===\'obj_eval\'. Actual: e.eval()==='+ e.eval() );
+}
+
+// CHECK#4
+myObj.i=6;
+try{
+ throw myObj;
+}
+catch(e){}
+if (myObj.i!==6) throw new Test262Error('#4: Handling of catch must be correct');
+
+// CHECK#5
+myObj.i=6;
+try{
+ throw myObj;
+}
+catch(e){
+ e.i=10;
+}
+if (myObj.i!==10) throw new Test262Error('#5: Handling of catch must be correct');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T7.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T7.js
new file mode 100644
index 0000000000..c4408e8c5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T7.js
@@ -0,0 +1,66 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T7
+description: Catching Array
+---*/
+
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+var mycars2 = new Array();
+mycars2[0] = "Mercedes";
+mycars2[1] = "Jeep";
+mycars2[2] = "Suzuki";
+
+// CHECK#1
+try{
+ throw mycars;
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars[i]) throw new Test262Error('#1.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] );
+ }
+}
+
+// CHECK#2
+try{
+ throw mycars.concat(mycars2);
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars[i]) throw new Test262Error('#2.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] );
+ }
+ for (var i=3;i<6;i++){
+ if (e[i]!==mycars2[i-3]) throw new Test262Error('#2.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i] );
+ }
+}
+
+// CHECK#3
+try{
+ throw new Array("Mercedes","Jeep","Suzuki");
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars2[i]) throw new Test262Error('#3.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i]);
+ }
+}
+
+// CHECK#4
+try{
+ throw mycars.concat(new Array("Mercedes","Jeep","Suzuki"));
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars[i]) throw new Test262Error('#4.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] );
+ }
+ for (var i=3;i<6;i++){
+ if (e[i]!==mycars2[i-3]) throw new Test262Error('#4.'+i+': Exception['+i+']===mycars2['+(i-3)+']. Actual: Exception['+i+']==='+ e[i]);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A19_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A19_T1.js
new file mode 100644
index 0000000000..3411c326a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A19_T1.js
@@ -0,0 +1,68 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching system exceptions of different types with try statement
+es5id: 12.14_A19_T1
+description: Testing try/catch syntax construction
+---*/
+
+// CHECK#1
+try{
+ throw (Error("hello"));
+}
+catch(e){
+ if (e.toString()!=="Error: hello") throw new Test262Error('#1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
+}
+
+// CHECK#2
+try{
+ throw (new Error("hello"));
+}
+catch(e){
+ if (e.toString()!=="Error: hello") throw new Test262Error('#2: Exception.toString()==="Error: hello". Actual: Exception is '+e);
+}
+
+// CHECK#3
+var c3=0;
+try{
+ throw EvalError(1);
+}
+catch(e){
+ if (e.toString()!=="EvalError: 1") throw new Test262Error('#3: Exception.toString()==="EvalError: 1". Actual: Exception is '+e);
+}
+
+// CHECK#4
+try{
+ throw RangeError(1);
+}
+catch(e){
+ if (e.toString()!=="RangeError: 1") throw new Test262Error('#4: Exception.toString()==="RangeError: 1". Actual: Exception is '+e);
+}
+
+// CHECK#5
+try{
+ throw ReferenceError(1);
+}
+catch(e){
+ if (e.toString()!=="ReferenceError: 1") throw new Test262Error('#5: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e);
+}
+
+// CHECK#6
+var c6=0;
+try{
+ throw TypeError(1);
+}
+catch(e){
+ if (e.toString()!=="TypeError: 1") throw new Test262Error('#6: Exception.toString()==="TypeError: 1". Actual: Exception is '+e);
+}
+
+// CHECK#7
+try{
+ throw URIError("message", "fileName", "1");
+}
+catch(e){
+ if (e.toString()!=="URIError: message") throw new Test262Error('#7: Exception.toString()==="URIError: message". Actual: Exception is '+e);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A19_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A19_T2.js
new file mode 100644
index 0000000000..e68f4e7651
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A19_T2.js
@@ -0,0 +1,102 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching system exceptions of different types with try statement
+es5id: 12.14_A19_T2
+description: Testing try/catch/finally syntax construction
+---*/
+
+var fin=0;
+// CHECK#1
+try{
+ throw (Error("hello"));
+}
+catch(e){
+ if (e.toString()!=="Error: hello") throw new Test262Error('#1.1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#1.2: "finally" block must be evaluated');
+
+// CHECK#2
+fin=0;
+try{
+ throw (new Error("hello"));
+}
+catch(e){
+ if (e.toString()!=="Error: hello") throw new Test262Error('#2.1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#2.2: "finally" block must be evaluated');
+
+// CHECK#3
+fin=0;
+var c3=0;
+try{
+ throw EvalError(1);
+}
+catch(e){
+ if (e.toString()!=="EvalError: 1") throw new Test262Error('#3.1: Exception.toString()==="EvalError: 1". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#3.2: "finally" block must be evaluated');
+
+// CHECK#4
+fin=0;
+try{
+ throw RangeError(1);
+}
+catch(e){
+ if (e.toString()!=="RangeError: 1") throw new Test262Error('#4.1: Exception.toString()==="RangeError: 1". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#4.2: "finally" block must be evaluated');
+
+// CHECK#5
+fin=0;
+try{
+ throw ReferenceError(1);
+}
+catch(e){
+ if (e.toString()!=="ReferenceError: 1") throw new Test262Error('#5.1: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#5.2: "finally" block must be evaluated');
+
+// CHECK#6
+fin=0;
+try{
+ throw TypeError(1);
+}
+catch(e){
+ if (e.toString()!=="TypeError: 1") throw new Test262Error('#6.1: Exception.toString()==="TypeError: 1". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#6.2: "finally" block must be evaluated');
+
+// CHECK#7
+fin=0;
+try{
+ throw URIError("message", "fileName", "1");
+}
+catch(e){
+ if (e.toString()!=="URIError: message") throw new Test262Error('#7.1: Exception.toString()==="URIError: message". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#7.2: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A2.js b/js/src/tests/test262/language/statements/try/S12.14_A2.js
new file mode 100644
index 0000000000..fdb077f90b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A2.js
@@ -0,0 +1,54 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Throwing exception with "throw" and catching it with "try" statement
+es5id: 12.14_A2
+description: >
+ Checking if execution of "catch" catches an exception thrown with
+ "throw"
+---*/
+
+// CHECK#1
+try {
+ throw "catchme";
+ throw new Test262Error('#1: throw "catchme" lead to throwing exception');
+}
+catch(e){}
+
+// CHECK#2
+var c2=0;
+try{
+ try{
+ throw "exc";
+ throw new Test262Error('#2.1: throw "exc" lead to throwing exception');
+ }finally{
+ c2=1;
+ }
+}
+catch(e){
+ if (c2!==1){
+ throw new Test262Error('#2.2: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#3
+var c3=0;
+try{
+ throw "exc";
+ throw new Test262Error('#3.1: throw "exc" lead to throwing exception');
+}
+catch(err){
+ var x3=1;
+}
+finally{
+ c3=1;
+}
+if (x3!==1){
+ throw new Test262Error('#3.2: "catch" block must be evaluated');
+}
+if (c3!==1){
+ throw new Test262Error('#3.3: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A3.js b/js/src/tests/test262/language/statements/try/S12.14_A3.js
new file mode 100644
index 0000000000..264b44084e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A3.js
@@ -0,0 +1,53 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching system exception with "try" statement
+es5id: 12.14_A3
+description: Checking if execution of "catch" catches system exceptions
+---*/
+
+// CHECK#1
+try{
+ y;
+ throw new Test262Error('#1: "y" lead to throwing exception');
+}
+catch(e){}
+
+// CHECK#2
+var c2=0;
+try{
+ try{
+ someValue;
+ throw new Test262Error('#3.1: "someValues" lead to throwing exception');
+ }
+ finally{
+ c2=1;
+ }
+}
+catch(e){
+ if (c2!==1){
+ throw new Test262Error('#3.2: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#3
+var c3=0,x3=0;
+try{
+ x3=someValue;
+ throw new Test262Error('#3.1: "x3=someValues" lead to throwing exception');
+}
+catch(err){
+ x3=1;
+}
+finally{
+ c3=1;
+}
+if (x3!==1){
+ throw new Test262Error('#3.2: "catch" block must be evaluated');
+}
+if (c3!==1){
+ throw new Test262Error('#3.3: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A4.js b/js/src/tests/test262/language/statements/try/S12.14_A4.js
new file mode 100644
index 0000000000..9e03cf1989
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A4.js
@@ -0,0 +1,37 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Sanity test for "catch(Indetifier) statement"
+es5id: 12.14_A4
+description: Checking if deleting an exception fails
+flags: [noStrict]
+---*/
+
+// CHECK#1
+try {
+ throw "catchme";
+ throw new Test262Error('#1.1: throw "catchme" lead to throwing exception');
+}
+catch (e) {
+ if (delete e){
+ throw new Test262Error('#1.2: Exception has DontDelete property');
+ }
+ if (e!=="catchme") {
+ throw new Test262Error('#1.3: Exception === "catchme". Actual: Exception ==='+ e );
+ }
+}
+
+// CHECK#2
+try {
+ throw "catchme";
+ throw new Test262Error('#2.1: throw "catchme" lead to throwing exception');
+}
+catch(e){}
+try{
+ e;
+ throw new Test262Error('#2.2: Deleting catching exception after ending "catch" block');
+}
+catch(err){}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A5.js b/js/src/tests/test262/language/statements/try/S12.14_A5.js
new file mode 100644
index 0000000000..f03fd6652a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A5.js
@@ -0,0 +1,53 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production TryStatement: "try Block Finally" and the production
+ TryStatement: "try Block Catch Finally"
+es5id: 12.14_A5
+description: Checking "catch" catches the Identifier in appropriate way
+---*/
+
+// CHECK#1
+try {
+ throw "catchme";
+ throw "dontcatchme";
+ throw new Test262Error('#1.1: throw "catchme" lead to throwing exception');
+}
+catch (e) {
+ if(e==="dontcatchme"){
+ throw new Test262Error('#1.2: Exception !== "dontcatchme"');
+ }
+ if (e!=="catchme") {
+ throw new Test262Error('#1.3: Exception === "catchme". Actual: Exception ==='+ e );
+ }
+}
+
+// CHECK#2
+function SwitchTest1(value){
+ var result = 0;
+ try{
+ switch(value) {
+ case 1:
+ result += 4;
+ throw result;
+ break;
+ case 4:
+ result += 64;
+ throw "ex";
+ }
+ return result;
+ }
+ catch(e){
+ if ((value===1)&&(e!==4)) throw new Test262Error('#2.1: Exception === 4. Actual: '+e);
+ if ((value===4)&&(e!=="ex"))throw new Test262Error('#2.2: Exception === "ex". Actual: '+e);
+ }
+ finally{
+ return result;
+ }
+}
+if (SwitchTest1(1)!==4) throw new Test262Error('#2.3: "finally" block must be evaluated');
+if (SwitchTest1(4)!==64)throw new Test262Error('#2.4: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A6.js b/js/src/tests/test262/language/statements/try/S12.14_A6.js
new file mode 100644
index 0000000000..78423b7946
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A6.js
@@ -0,0 +1,69 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "The production TryStatement: \"try Block Catch Finally\""
+es5id: 12.14_A6
+description: >
+ Executing sequence of "try" statements, using counters with
+ varying values within
+---*/
+
+// CHECK#1
+var c1=0;
+try {
+ c1+=1;
+ y;
+ throw new Test262Error('#1.1: "y" lead to throwing exception');
+}
+catch (e) {
+ c1*=2;
+}
+if (c1!==2){
+ throw new Test262Error('#1.2: Sequence evaluation of commands try/catch is 1. try, 2. catch');
+}
+
+// CHECK#2
+var c2=0;
+try{
+ c2+=1;
+}
+finally{
+ c2*=2;
+}
+if (c2!==2){
+ throw new Test262Error('#2: Sequence evaluation of commands try/finally is 1. try, 2. finally');
+}
+
+// CHECK#3
+var c3=0;
+try{
+ c3=1;
+ z;
+}
+catch(err){
+ c3*=2;
+}
+finally{
+ c3+=1;
+}
+if (c3!==3){
+ throw new Test262Error('#3: Sequence evaluation of commands try/catch/finally(with exception) is 1. try, 2. catch, 3. finally');
+}
+
+// CHECK#4
+var c4=0;
+try{
+ c4=1;
+}
+catch(err){
+ c4*=3;
+}
+finally{
+ c4+=1;
+}
+if (c4!==2){
+ throw new Test262Error('#4: Sequence evaluation of commands try/catch/finally(without exception) is 1. try, 2. finally');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A7_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A7_T1.js
new file mode 100644
index 0000000000..8f3071f5f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A7_T1.js
@@ -0,0 +1,140 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Evaluating the nested productions TryStatement
+es5id: 12.14_A7_T1
+description: >
+ Checking if the production of nested TryStatement statements
+ evaluates correct
+---*/
+
+// CHECK#1
+try{
+ try{
+ throw "ex2";
+ }
+ catch(er2){
+ if (er2!=="ex2")
+ throw new Test262Error('#1.1: Exception === "ex2". Actual: Exception ==='+ e );
+ throw "ex1";
+ }
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#1.2: Exception === "ex1". Actual: '+er1);
+ if (er1==="ex2") throw new Test262Error('#1.3: Exception !== "ex2". Actual: catch previous embedded exception');
+}
+
+// CHECK#2
+try{
+ throw "ex1";
+}
+catch(er1){
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#2.1: Exception !== "ex1". Actual: catch previous catching exception');
+ if (er1!=="ex2") throw new Test262Error('#2.2: Exception === "ex2". Actual: Exception ==='+ er1 );
+ }
+ if (er1!=="ex1") throw new Test262Error('#2.3: Exception === "ex1". Actual: Exception ==='+ er1 );
+ if (er1==="ex2") throw new Test262Error('#2.4: Exception !== "ex2". Actual: catch previous catching exception');
+}
+
+// CHECK#3
+try{
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#3.1: Exception ==="ex1". Actual: Exception ==='+ er1 );
+}
+finally{
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#3.2: Exception !=="ex1". Actual: catch previous embedded exception');
+ if (er1!=="ex2") throw new Test262Error('#3.3: Exception ==="ex2". Actual: Exception ==='+ er1 );
+ }
+}
+
+// CHECK#4
+var c4=0;
+try{
+ throw "ex1";
+}
+catch(er1){
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#4.1: Exception !=="ex1". Actual: catch previous catching exception');
+ if (er1!=="ex2") throw new Test262Error('#4.2: Exception ==="ex2". Actual: Exception ==='+ er1 );
+ }
+ if (er1!=="ex1") throw new Test262Error('#4.3: Exception ==="ex1". Actual: Exception ==='+ er1 );
+ if (er1==="ex2") throw new Test262Error('#4.4: Exception !=="ex2". Actual: Catch previous embedded exception');
+}
+finally{
+ c4=1;
+}
+if (c4!==1) throw new Test262Error('#4.5: "finally" block must be evaluated');
+
+// CHECK#5
+var c5=0;
+try{
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#5.1: Exception ==="ex2". Actual: Exception ==='+ er1 );
+ }
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#5.2: Exception ==="ex1". Actual: Exception ==='+ er1 );
+ if (er1==="ex2") throw new Test262Error('#5.3: Exception !=="ex2". Actual: catch previous embedded exception');
+}
+finally{
+ c5=1;
+}
+if (c5!==1) throw new Test262Error('#5.4: "finally" block must be evaluated');
+
+// CHECK#6
+var c6=0;
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#6.1: Exception ==="ex1". Actual: Exception ==='+ er1 );
+ }
+}
+finally{
+ c6=1;
+}
+if (c6!==1) throw new Test262Error('#6.2: "finally" block must be evaluated');
+
+// CHECK#7
+var c7=0;
+try{
+ try{
+ throw "ex1";
+ }
+ finally{
+ try{
+ c7=1;
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#7.1: Exception ==="ex2". Actual: Exception ==='+ er1 );
+ if (er1==="ex1") throw new Test262Error('#7.2: Exception !=="ex1". Actual: catch previous embedded exception');
+ c7++;
+ }
+ }
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#7.3: Exception ==="ex1". Actual: Exception ==='+ er1 );
+}
+if (c7!==2) throw new Test262Error('#7.4: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A7_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A7_T2.js
new file mode 100644
index 0000000000..d821ca61fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A7_T2.js
@@ -0,0 +1,154 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Evaluating the nested productions TryStatement
+es5id: 12.14_A7_T2
+description: >
+ Checking if the production of nested TryStatement statements
+ evaluates correct
+---*/
+
+// CHECK#1
+try{
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex1";
+ }
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#1.2: Exception === "ex1". Actual: Exception ==='+er1 );
+ if (er1==="ex2") throw new Test262Error('#1.3: Exception !== "ex2". Actual: catch previous embedded exception');
+}
+
+// CHECK#2
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#2.1: Exception === "ex1". Actual: Exception ==='+er1 );
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex3";
+ }
+ throw new Test262Error('#2.2: throw "ex1" lead to throwing exception');
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#2.3: Exception === "ex3". Actual: Exception ==='+er1 );
+}
+
+// CHECK#3
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#3.1: Exception === "ex1". Actual: Exception ==='+er1 );
+ }
+ finally{
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex3";
+ }
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#3.2: Exception === "ex3". Actual: Exception ==='+er1 );
+}
+
+// CHECK#4
+var c4=0;
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#4.1: Exception === "ex1". Actual: Exception ==='+er1 );
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex3";
+ }
+ }
+ finally{
+ c4=1;
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#4.2: Exception === "ex3". Actual: Exception ==='+er1 );
+}
+if (c4!==1) throw new Test262Error('#4.3: "finally" block must be evaluated');
+
+// CHECK#5
+var c5=0;
+try{
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex3";
+ }
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#5.1: Exception === "ex3". Actual: Exception ==='+er1 );
+ if (er1==="ex2") throw new Test262Error('#5.2: Exception !== "ex2". Actual: catch previous embedded exception');
+ if (er1==="ex1") throw new Test262Error('#5.3: Exception !=="ex1". Actual: catch previous embedded exception');
+}
+finally{
+ c5=1;
+}
+if (c5!==1) throw new Test262Error('#5.4: "finally" block must be evaluated');
+
+// CHECK#6
+var c6=0;
+try{
+ try{
+ try{
+ throw "ex1";
+ }
+ finally{
+ throw "ex2";
+ }
+ }
+ finally{
+ c6=1;
+ }
+}
+catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#6.1: Exception === "ex2". Actual: Exception ==='+er1 );
+}
+if (c6!==1) throw new Test262Error('#6.2: "finally" block must be evaluated');
+
+// CHECK#7
+var c7=0;
+try{
+ try{
+ throw "ex1";
+ }
+ finally{
+ try{
+ c7=1;
+ throw "ex2";
+ }
+ finally{
+ c7++;
+ throw "ex3";
+ }
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#7.1: Exception === "ex3". Actual: Exception ==='+er1 );
+}
+if (c7!==2) throw new Test262Error('#7.2: Embedded "try/finally" blocks must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A7_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A7_T3.js
new file mode 100644
index 0000000000..1ce40acb3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A7_T3.js
@@ -0,0 +1,171 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Evaluating the nested productions TryStatement
+es5id: 12.14_A7_T3
+description: >
+ Checking if the production of nested TryStatement statements
+ evaluates correct
+---*/
+
+// CHECK#1
+try{
+ try{
+ throw "ex2";
+ }
+ catch(er2){
+ if (er2!=="ex2") throw new Test262Error('#1.1: Exception === "ex2". Actual: Exception ==='+er2);
+ throw "ex1";
+ }
+ finally{
+ throw "ex3";
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#1.2: Exception === "ex3". Actual: Exception ==='+er1);
+ if (er1==="ex2") throw new Test262Error('#1.3: Exception !=="ex2". Actual: catch previous catched exception');
+ if (er1==="ex1") throw new Test262Error('#1.4: Exception !=="ex1". Actual: catch previous embedded exception');
+}
+
+// CHECK#2
+var c2=0;
+try{
+ throw "ex1";
+}
+catch(er1){
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#2.1: Exception !=="ex1". Actual: catch previous catched exception');
+ if (er1!=="ex2") throw new Test262Error('#2.2: Exception === "ex2". Actual: Exception ==='+er1);
+ }
+ finally{
+ c2=1;
+ }
+ if (er1!=="ex1") throw new Test262Error('#2.3: Exception === "ex1". Actual: Exception ==='+er1);
+ if (er1==="ex2") throw new Test262Error('#2.4: Exception !== "ex2". Actual: catch previous embedded exception');
+}
+if (c2!==1) throw new Test262Error('#2.5: "finally" block must be evaluated');
+
+// CHECK#3
+var c3=0;
+try{
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#3.1: Exception === "ex1". Actual: Exception ==='+er1);
+}
+finally{
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#3.2: Exception !=="ex1". Actual: catch previous catched exception');
+ if (er1!=="ex2") throw new Test262Error('#3.3: Exception === "ex2". Actual: Exception ==='+er1);
+ }
+ finally{
+ c3=1;
+ }
+}
+if (c3!==1) throw new Test262Error('#3.4: "finally" block must be evaluated');
+
+// CHECK#4
+var c4=0;
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#4.1: Exception !=="ex2". Actual: catch previous catched exception');
+ if (er1!=="ex2") throw new Test262Error('#4.2: Exception === "ex2". Actual: Exception ==='+er1);
+ }
+ finally{
+ c4=2;
+ throw "ex3";
+ }
+ if (er1!=="ex1") throw new Test262Error('#4.3: Exception === "ex2". Actual: Exception ==='+er1);
+ if (er1==="ex2") throw new Test262Error('#4.4: Exception !=="ex2". Actual: catch previous catched exception');
+ if (er1==="ex3") throw new Test262Error('#4.5: Exception !=="ex3". Actual: Catch previous embedded exception');
+ }
+ finally{
+ c4*=2;
+ }
+}
+catch(er1){}
+if (c4!==4) throw new Test262Error('#4.6: "finally" block must be evaluated');
+
+// CHECK#5
+var c5=0;
+try{
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#5.1: Exception === "ex2". Actual: Exception ==='+er1);
+ }
+ finally{
+ throw "ex3";
+ }
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#5.2: Exception === "ex3". Actual: Exception ==='+er1);
+ if (er1==="ex2") throw new Test262Error('#5.3: Exception !=="ex2". Actual: catch previous catched exception');
+ if (er1==="ex1") throw new Test262Error('#5.4: Exception !=="ex1". Actual: catch previous embedded exception');
+}
+finally{
+ c5=1;
+}
+if (c5!==1) throw new Test262Error('#5.5: "finally" block must be evaluated');
+
+// CHECK#6
+var c6=0;
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#6.1: Exception === "ex1". Actual: Exception ==='+er1);
+ }
+ finally{
+ c6=2;
+ }
+}
+finally{
+ c6*=2;
+}
+if (c6!==4) throw new Test262Error('#6.2: "finally" block must be evaluated');
+
+// CHECK#7
+var c7=0;
+try{
+ try{
+ throw "ex1";
+ }
+ finally{
+ try{
+ c7=1;
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#7.1: Exception === "ex2". Actual: Exception ==='+er1);
+ if (er1==="ex1") throw new Test262Error('#7.2: Exception !=="ex2". Actual: catch previous catched exception');
+ c7++;
+ }
+ finally{
+ c7*=2;
+ }
+ }
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#7.3: Exception === "ex1". Actual: Exception ==='+er1);
+}
+if (c7!==4) throw new Test262Error('#7.4: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A8.js b/js/src/tests/test262/language/statements/try/S12.14_A8.js
new file mode 100644
index 0000000000..4c171ea2cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A8.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"try\" with \"catch\" or \"finally\" statement within/without an \"if\" statement"
+es5id: 12.14_A8
+description: Throwing exception within an "if" statement
+---*/
+
+// CHECK#1
+var c1=1;
+try{
+ if(c1===1){
+ throw "ex1";
+ throw new Test262Error('#1.1: throw "ex1" lead to throwing exception');
+ }
+ throw new Test262Error('#1.2: throw "ex1" inside the "if" statement lead to throwing exception');
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#1.3: Exception ==="ex1". Actual: Exception ==='+er1);
+}
+
+// CHECK#2
+var c2=1;
+if(c2===1){
+ try{
+ throw "ex1";
+ throw new Test262Error('#2.1: throw "ex1" lead to throwing exception');
+ }
+ catch(er1){
+ if(er1!="ex1") throw new Test262Error('#2.2: Exception ==="ex1". Actual: Exception ==='+er1);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T1.js
new file mode 100644
index 0000000000..20ca431d8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T1
+description: Loop within a "try" Block, from where exception is thrown
+---*/
+
+// CHECK#1
+var i=0;
+try{
+ do{
+ if(i===5) throw i;
+ i++;
+ }
+ while(i<10);
+}
+catch(e){
+ if(e!==5)throw new Test262Error('#1: Exception ===5. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T2.js
new file mode 100644
index 0000000000..0b2b895887
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T2.js
@@ -0,0 +1,126 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T2
+description: >
+ "try" statement within a loop, the statement contains "continue"
+ statement
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+do{
+ try{
+ c1+=1;
+ continue;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+}
+while(c1<2);
+if(fin!==1){
+ throw new Test262Error('#1: "finally" block must be evaluated at "try{continue} catch finally" construction');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ continue;
+ }
+ finally{
+ fin2=1;
+ }
+ fin2=-1;
+}
+while(c2<2);
+if(fin2!==1){
+ throw new Test262Error('#2: "finally" block must be evaluated at "try catch{continue} finally" construction');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ continue;
+ }
+ fin3=0;
+}
+while(c3<2);
+if(fin3!==1){
+ throw new Test262Error('#3: "finally" block must be evaluated at "try catch finally{continue}" construction');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+do{
+ try{
+ c4+=1;
+ continue;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+}
+while(c4<2);
+if(fin4!==1){
+ throw new Test262Error('#4: "finally" block must be evaluated at "try{continue} finally" construction');
+}
+
+// CHECK#5
+var c5=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c5+=1;
+ continue;
+ }
+}
+while(c5<2);
+if(c5!==2){
+ throw new Test262Error('#5: "try catch{continue}" must work correctly');
+}
+
+// CHECK#6
+var c6=0,fin6=0;
+do{
+ try{
+ c6+=1;
+ throw "ex1"
+ }
+ finally{
+ fin6=1;
+ continue;
+ }
+ fin6=-1;
+}
+while(c6<2);
+if(fin6!==1){
+ throw new Test262Error('#6.1: "finally" block must be evaluated');
+}
+if(c6!==2){
+ throw new Test262Error('#6.2: "try finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T3.js
new file mode 100644
index 0000000000..2489cebd21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T3.js
@@ -0,0 +1,162 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T3
+description: >
+ "try" statement within a loop, the statement contains "break"
+ statement
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+do{
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+ c1+=2;
+}
+while(c1<2);
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==1){
+ throw new Test262Error('#1.2: "try{break}catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ }
+ c2+=2;
+ fin2=-1;
+}
+while(c2<2);
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==1){
+ throw new Test262Error('#2.2: "try catch{break} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ break;
+ }
+ c3+=2;
+ fin3=0;
+}
+while(c3<2);
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==1){
+ throw new Test262Error('#3.2: "try catch finally{break}" must work correctly');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+do{
+ try{
+ c4+=1;
+ break;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+ c4+=2;
+}
+while(c4<2);
+if(fin4!==1){
+ throw new Test262Error('#4.1: "finally" block must be evaluated');
+}
+if(c4!==1){
+ throw new Test262Error('#4.2: "try{break} finally" must work correctly');
+}
+
+// CHECK#5
+var c5=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ break;
+ }
+}
+while(c5<2);
+if(c5!==0){
+ throw new Test262Error('#5: "try catch{break}" must work correctly');
+}
+
+// CHECK#6
+var c6=0;
+do{
+ try{
+ c6+=1;
+ break;
+ }
+ catch(er1){}
+ c6+=2;
+}
+while(c6<2);
+if(c6!==1){
+ throw new Test262Error('#6: "try{break} catch" must work correctly');
+}
+
+// CHECK#7
+var c7=0,fin7=0;
+try{
+ do{
+ try{
+ c7+=1;
+ throw "ex1";
+ }
+ finally{
+ fin7=1;
+ break;
+ }
+ fin7=-1;
+ c7+=2;
+ }
+ while(c7<2);
+}
+catch(ex1){
+ c7=10;
+}
+if(fin7!==1){
+ throw new Test262Error('#7.1: "finally" block must be evaluated');
+}
+if(c7!==1){
+ throw new Test262Error('#7.2: try finally{break} error');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T4.js
new file mode 100644
index 0000000000..44f4a4d9db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T4.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T4
+description: >
+ "try" statement within a loop, the statement contains "continue"
+ and "break" statements
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+do{
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ continue;
+ }
+ fin=-1;
+ c1+=2;
+}
+while(c1<2);
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==2){
+ throw new Test262Error('#1.2: "try{break} catch finally{continue}" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ continue;
+ }
+ c2+=2;
+ fin2=-1;
+}
+while(c2<2);
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==2){
+ throw new Test262Error('#2.2: "try catch{break} finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T5.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T5.js
new file mode 100644
index 0000000000..96d0bafdb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T5.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T5
+description: >
+ Checking if exceptions are thrown correctly from wherever of loop
+ body
+---*/
+
+// CHECK#1
+var c=0, i=0;
+var fin=0;
+do{
+ i+=1;
+ try{
+ if(c===0){
+ throw "ex1";
+ throw new Test262Error('#1.1: throw "ex1" lead to throwing exception');
+ }
+ c+=2;
+ if(c===1){
+ throw "ex2";
+ throw new Test262Error('#1.2: throw "ex2" lead to throwing exception');
+ }
+ }
+ catch(er1){
+ c-=1;
+ continue;
+ throw new Test262Error('#1.3: "try catch{continue} finally" must work correctly');
+ }
+ finally{
+ fin+=1;
+ }
+}
+while(i<10);
+if(fin!==10){
+ throw new Test262Error('#1.4: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/browser.js b/js/src/tests/test262/language/statements/try/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/browser.js
diff --git a/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws-strict.js b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws-strict.js
new file mode 100644
index 0000000000..816ae2e2f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws-strict.js
@@ -0,0 +1,16 @@
+'use strict';
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+ It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+flags: [onlyStrict]
+---*/
+
+assert.throws(SyntaxError, function() {
+ eval("try {} catch (arguments) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early-strict.js b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early-strict.js
new file mode 100644
index 0000000000..6b2338904e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+ It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (arguments) { }
diff --git a/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws-strict.js b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws-strict.js
new file mode 100644
index 0000000000..4fd4fbb3a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws-strict.js
@@ -0,0 +1,16 @@
+'use strict';
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+ It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+flags: [onlyStrict]
+---*/
+
+assert.throws(SyntaxError, function() {
+ eval("try {} catch (eval) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early-strict.js b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early-strict.js
new file mode 100644
index 0000000000..8823cc1e28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+ It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (eval) { }
diff --git a/js/src/tests/test262/language/statements/try/completion-values-fn-finally-abrupt.js b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-abrupt.js
new file mode 100644
index 0000000000..b81cbb7f71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-abrupt.js
@@ -0,0 +1,81 @@
+// Copyright (C) 2020 Salesforce.com. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: >
+ Returns the correct completion values of try-catch-finally(Abrupt) in functions
+info: |
+ TryStatement : try Block Catch Finally
+
+ Let B be the result of evaluating Block.
+ If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with argument B.[[Value]].
+ Else, let C be B.
+ Let F be the result of evaluating Finally.
+ If F.[[Type]] is normal, set F to C.
+ Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+var fn, count = {};
+
+// 1: try Abrupt, catch Abrupt, finally Abrupt; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ throw 'catch';
+ } finally {
+ count.finally += 1;
+ throw new Test262Error('finally'); // If F.[[Type]] is normal, set F to C.
+ }
+ return 'wat';
+};
+
+assert.throws(Test262Error, fn, '1: try Abrupt, catch Abrupt, finally Abrupt; Completion: finally');
+assert.sameValue(count.catch, 1, '1: catch count');
+assert.sameValue(count.finally, 1, '1: finally count');
+
+// 2: try Abrupt, catch Return, finally Abrupt; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ throw new Test262Error('finally'); // If F.[[Type]] is normal, set F to C.
+ }
+ return 'wat';
+};
+
+assert.throws(Test262Error, fn, '2: try Abrupt, catch Return, finally Abrupt; Completion: finally');
+assert.sameValue(count.catch, 1, '2: catch count');
+assert.sameValue(count.finally, 1, '2: fiinally count');
+
+// 3: try Return, catch Return, finally Abrupt; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ return 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ throw new Test262Error('finally'); // If F.[[Type]] is normal, set F to C.
+ }
+ return 'wat';
+};
+
+assert.throws(Test262Error, fn, '3: try Normal, catch Normal, finally Abrupt; Completion: finally');
+assert.sameValue(count.catch, 0, '3: catch count');
+assert.sameValue(count.finally, 1, '3: fiinally count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/completion-values-fn-finally-normal.js b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-normal.js
new file mode 100644
index 0000000000..f341a0ff32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-normal.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2020 Salesforce.com. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: >
+ Returns the correct completion values of try-catch-finally(Normal) in functions
+info: |
+ TryStatement : try Block Catch Finally
+
+ Let B be the result of evaluating Block.
+ If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with argument B.[[Value]].
+ Else, let C be B.
+ Let F be the result of evaluating Finally.
+ If F.[[Type]] is normal, set F to C.
+ Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// 1: try Return, catch Return, finally Normal; Completion: try
+var count = {
+ catch: 0,
+ finally: 0
+};
+
+var fn = function() {
+ try {
+ return 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ 'normal';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'try', '1: try Return, catch Return, finally Normal; Completion: try');
+assert.sameValue(count.catch, 0, '1');
+assert.sameValue(count.finally, 1, '1');
+
+// 2: try Abrupt, catch Return, finally Normal; Completion: catch
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ 'finally';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'catch', '2: try Abrupt, catch Return, finally Normal; Completion: catch');
+assert.sameValue(count.catch, 1, '2: catch count');
+assert.sameValue(count.finally, 1, '2: fiinally count');
+
+// 3: try Abrupt, catch Abrupt, finally Normal; Completion: catch
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ throw new Test262Error('catch');
+ } finally {
+ count.finally += 1;
+ 'finally';
+ }
+ return 'wat';
+};
+
+assert.throws(Test262Error, fn, '3: try Abrupt, catch Abrupt, finally Normal; Completion: catch');
+assert.sameValue(count.catch, 1, '3: catch count');
+assert.sameValue(count.finally, 1, '3: fiinally count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/completion-values-fn-finally-return.js b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-return.js
new file mode 100644
index 0000000000..2c80bbff1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-return.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2020 Salesforce.com. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: >
+ Returns the correct completion values of try-catch-finally(Return) in functions
+info: |
+ TryStatement : try Block Catch Finally
+
+ Let B be the result of evaluating Block.
+ If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with argument B.[[Value]].
+ Else, let C be B.
+ Let F be the result of evaluating Finally.
+ If F.[[Type]] is normal, set F to C.
+ Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// 1: try Return, catch Return, finally Return; Completion: finally
+var count = {
+ catch: 0,
+ finally: 0
+};
+
+var fn = function() {
+ try {
+ return 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ return 'finally';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'finally', '1: try Return, catch Return, finally Return; Completion: finally');
+assert.sameValue(count.catch, 0, '1');
+assert.sameValue(count.finally, 1, '1');
+
+// 2: try Abrupt, catch Return, finally Return; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ return 'finally';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'finally', '2: try Abrupt, catch Return, finally Return; Completion: finally');
+assert.sameValue(count.catch, 1, '2: catch count');
+assert.sameValue(count.finally, 1, '2: fiinally count');
+
+// 3: try Abrupt, catch Abrupt, finally Normal; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ throw 'catch';
+ } finally {
+ count.finally += 1;
+ return 'finally';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'finally', fn, '3: try Abrupt, catch Abrupt, finally Normal; Completion: finally');
+assert.sameValue(count.catch, 1, '3: catch count');
+assert.sameValue(count.finally, 1, '3: fiinally count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/completion-values.js b/js/src/tests/test262/language/statements/try/completion-values.js
new file mode 100644
index 0000000000..2959b82189
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/completion-values.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: >
+ Direct eval try/catch/finally for completion value
+info: |
+ TryStatement : try Block Catch Finally
+
+ Let B be the result of evaluating Block.
+ If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with argument B.[[Value]].
+ Else, let C be B.
+ Let F be the result of evaluating Finally.
+ If F.[[Type]] is normal, set F to C.
+ Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; break; -2 }; } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { 42; break; -3 }; } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { break; -2 }; } while (false);'),
+ undefined
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { break; -3 }; } while (false);'),
+ undefined
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; break; -3 }; -77 } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { 42; break; -3 }; -77 } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { break; -3 }; -77 } while (false);'),
+ undefined
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { break; -3 }; -77 } while (false);'),
+ undefined
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; continue; -3 }; } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { 42; continue; -3 }; } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; continue; -3 }; -77 } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1 } finally { 42; continue; -3 }; -77 } while (false);'),
+ 42
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch-empty-break.js b/js/src/tests/test262/language/statements/try/cptn-catch-empty-break.js
new file mode 100644
index 0000000000..6023c27da7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch-empty-break.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from catch block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Catch
+ ...
+ 2. If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with parameter B.[[Value]].
+ ...
+ 4. Return Completion(UpdateEmpty(C, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try { throw null; } catch (e) { break; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch-empty-continue.js b/js/src/tests/test262/language/statements/try/cptn-catch-empty-continue.js
new file mode 100644
index 0000000000..74c60141f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch-empty-continue.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from catch block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Catch
+ ...
+ 2. If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with parameter B.[[Value]].
+ ...
+ 4. Return Completion(UpdateEmpty(C, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try { throw null; } catch (e) { continue; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-break.js b/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-break.js
new file mode 100644
index 0000000000..b666c9435d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-break.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from finally block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Catch Finally
+ ...
+ 4. Let F be the result of evaluating Finally.
+ ...
+ 6. Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try { throw null; } catch (e) {} finally { break; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-continue.js b/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-continue.js
new file mode 100644
index 0000000000..e4b4856ee7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-continue.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from finally block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Catch Finally
+ ...
+ 4. Let F be the result of evaluating Finally.
+ ...
+ 6. Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try { throw null; } catch (e) {} finally { continue; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch.js b/js/src/tests/test262/language/statements/try/cptn-catch.js
new file mode 100644
index 0000000000..464e8942b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: Completion value from `catch` clause of a try..catch statement
+info: |
+ TryStatement : try Block Catch
+
+ 1. Let B be the result of evaluating Block.
+ 2. If B.[[type]] is throw, then
+ a. Let C be CatchClauseEvaluation of Catch with parameter B.[[value]].
+ 3. Else B.[[type]] is not throw,
+ [...]
+ 4. If C.[[type]] is return, or C.[[type]] is throw, return Completion(C).
+ 5. If C.[[value]] is not empty, return Completion(C).
+ 6. Return Completion{[[type]]: C.[[type]], [[value]]: undefined,
+ [[target]]: C.[[target]]}.
+
+ 13.15.7 Runtime Semantics: CatchClauseEvaluation
+
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 7. Let B be the result of evaluating Block.
+ 8. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 9. Return Completion(B).
+---*/
+
+assert.sameValue(eval('1; try { throw null; } catch (err) { }'), undefined);
+assert.sameValue(eval('2; try { throw null; } catch (err) { 3; }'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-empty-break.js b/js/src/tests/test262/language/statements/try/cptn-finally-empty-break.js
new file mode 100644
index 0000000000..ce20a53a84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-empty-break.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from finally block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Finally
+ ...
+ 2. Let F be the result of evaluating Finally.
+ ...
+ 4. Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try {} finally { break; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-empty-continue.js b/js/src/tests/test262/language/statements/try/cptn-finally-empty-continue.js
new file mode 100644
index 0000000000..8a1e408116
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-empty-continue.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from finally block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Finally
+ ...
+ 2. Let F be the result of evaluating Finally.
+ ...
+ 4. Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try {} finally { continue; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-from-catch.js b/js/src/tests/test262/language/statements/try/cptn-finally-from-catch.js
new file mode 100644
index 0000000000..ef997301b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-from-catch.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: >
+ Completion value from `finally` clause of a try..catch..finally statement
+ (following execution of `catch` block)
+info: |
+ TryStatement : try Block Catch Finally
+
+ 1. Let B be the result of evaluating Block.
+ 2. If B.[[type]] is throw, then
+ a. Let C be CatchClauseEvaluation of Catch with parameter B.[[value]].
+ [...]
+ 4. Let F be the result of evaluating Finally.
+ 5. If F.[[type]] is normal, let F be C.
+ 6. If F.[[type]] is return, or F.[[type]] is throw, return Completion(F).
+ 7. If F.[[value]] is not empty, return NormalCompletion(F.[[value]]).
+ 8. Return Completion{[[type]]: F.[[type]], [[value]]: undefined,
+ [[target]]: F.[[target]]}.
+
+ 13.15.7 Runtime Semantics: CatchClauseEvaluation
+
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 7. Let B be the result of evaluating Block.
+ 8. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 9. Return Completion(B).
+---*/
+
+assert.sameValue(
+ eval('1; try { throw null; } catch (err) { } finally { }'), undefined
+);
+assert.sameValue(
+ eval('2; try { throw null; } catch (err) { 3; } finally { }'), 3
+);
+assert.sameValue(
+ eval('4; try { throw null; } catch (err) { } finally { 5; }'), undefined
+);
+assert.sameValue(
+ eval('6; try { throw null; } catch (err) { 7; } finally { 8; }'), 7
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-skip-catch.js b/js/src/tests/test262/language/statements/try/cptn-finally-skip-catch.js
new file mode 100644
index 0000000000..3fac6eaa32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-skip-catch.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: >
+ Completion value from `finally` clause of a try..catch..finally statement
+ (when `catch` block is not executed)
+info: |
+ TryStatement : try Block Catch Finally
+
+ 1. Let B be the result of evaluating Block.
+ 2. If B.[[type]] is throw, then
+ [...]
+ 3. Else B.[[type]] is not throw, let C be B.
+ 4. Let F be the result of evaluating Finally.
+ 5. If F.[[type]] is normal, let F be C.
+ 6. If F.[[type]] is return, or F.[[type]] is throw, return Completion(F).
+ 7. If F.[[value]] is not empty, return NormalCompletion(F.[[value]]).
+ 8. Return Completion{[[type]]: F.[[type]], [[value]]: undefined,
+ [[target]]: F.[[target]]}.
+---*/
+
+assert.sameValue(eval('1; try { } catch (err) { } finally { }'), undefined);
+assert.sameValue(eval('2; try { } catch (err) { 3; } finally { }'), undefined);
+assert.sameValue(eval('4; try { } catch (err) { } finally { 5; }'), undefined);
+assert.sameValue(eval('6; try { } catch (err) { 7; } finally { 8; }'), undefined);
+assert.sameValue(eval('9; try { 10; } catch (err) { } finally { }'), 10);
+assert.sameValue(eval('11; try { 12; } catch (err) { 13; } finally { }'), 12);
+assert.sameValue(eval('14; try { 15; } catch (err) { } finally { 16; }'), 15);
+assert.sameValue(eval('17; try { 18; } catch (err) { 19; } finally { 20; }'), 18);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-wo-catch.js b/js/src/tests/test262/language/statements/try/cptn-finally-wo-catch.js
new file mode 100644
index 0000000000..3cf191337a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-wo-catch.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: Completion value from `finally` clause of a try..finally statement
+info: |
+ TryStatement : try Block Finally
+
+ 1. Let B be the result of evaluating Block.
+ 2. Let F be the result of evaluating Finally.
+ 3. If F.[[type]] is normal, let F be B.
+ 4. If F.[[type]] is return, or F.[[type]] is throw, return Completion(F).
+ 5. If F.[[value]] is not empty, return Completion(F).
+ 6. Return Completion{[[type]]: F.[[type]], [[value]]: undefined,
+ [[target]]: F.[[target]]}.
+---*/
+
+
+assert.sameValue(eval('1; try { } finally { }'), undefined);
+assert.sameValue(eval('2; try { 3; } finally { }'), 3);
+assert.sameValue(eval('4; try { } finally { 5; }'), undefined);
+assert.sameValue(eval('6; try { 7; } finally { 8; }'), 7);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-try.js b/js/src/tests/test262/language/statements/try/cptn-try.js
new file mode 100644
index 0000000000..50b5ac4828
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-try.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: Completion value from `try` clause of a try..catch statement
+info: |
+ TryStatement : try Block Catch
+
+ 1. Let B be the result of evaluating Block.
+ 2. If B.[[type]] is throw, then
+ [...]
+ 3. Else B.[[type]] is not throw,
+ a. Let C be B.
+ 4. If C.[[type]] is return, or C.[[type]] is throw, return Completion(C).
+ 5. If C.[[value]] is not empty, return Completion(C).
+ 6. Return Completion{[[type]]: C.[[type]], [[value]]: undefined,
+ [[target]]: C.[[target]]}.
+---*/
+
+assert.sameValue(eval('1; try { } catch (err) { }'), undefined);
+assert.sameValue(eval('2; try { 3; } catch (err) { }'), 3);
+assert.sameValue(eval('4; try { } catch (err) { 5; }'), undefined);
+assert.sameValue(eval('6; try { 7; } catch (err) { 8; }'), 7);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-close.js
new file mode 100644
index 0000000000..d41ab2cdac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-close.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ [...]
+ 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator,
+ result).
+ [...]
+
+---*/
+var doneCallCount = 0;
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { value: null, done: false };
+ },
+ return: function() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var ranCatch = false;
+
+try {
+ throw iter;
+} catch ([x]) {
+ assert.sameValue(doneCallCount, 1);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..f01ceecb54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Abrupt completion returned by GetIterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ try {
+ throw [1, 2, 3];
+ } catch ([x, y, z]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err.js
new file mode 100644
index 0000000000..015d7ce02d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Abrupt completion returned by GetIterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-no-close.js
new file mode 100644
index 0000000000..df581d9257
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-no-close.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ [...]
+ 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator,
+ result).
+ [...]
+
+---*/
+var doneCallCount = 0;
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { value: null, done: true };
+ },
+ return: function() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var ranCatch = false;
+
+try {
+ throw iter;
+} catch ([x]) {
+ assert.sameValue(doneCallCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/statements/try/dstr/ary-name-iter-val.js
new file mode 100644
index 0000000000..230c622325
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-name-iter-val.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding with normal value iteration (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
+ c. ReturnIfAbrupt(next).
+ d. If next is false, set iteratorRecord.[[done]] to true.
+ e. Else,
+ [...]
+ i. Let v be IteratorValue(next).
+ ii. If v is an abrupt completion, set
+ iteratorRecord.[[done]] to true.
+ iii. ReturnIfAbrupt(v).
+ 5. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..7efdc12521
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ [...]
+ 2. If iteratorRecord.[[done]] is true, let v be undefined.
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..5c19e09ec1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ [...]
+ e. Else,
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [[7, 8, 9]];
+} catch ([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..d351df4dc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ [...]
+ 2. If iteratorRecord.[[done]] is true, let v be undefined.
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+---*/
+var first = 0;
+var second = 0;
+function* g() {
+ first += 1;
+ yield;
+ second += 1;
+};
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..1d7f26c237
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ [...]
+ e. Else,
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+---*/
+var callCount = 0;
+function* g() {
+ callCount += 1;
+};
+
+var ranCatch = false;
+
+try {
+ throw [[]];
+} catch ([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..088fb1a245
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ [...]
+ 2. If iteratorRecord.[[done]] is true, let v be undefined.
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+---*/
+var initCount = 0;
+var iterCount = 0;
+var iter = function*() { iterCount += 1; }();
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..cd1142a4ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ [...]
+ e. Else,
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+---*/
+var initCount = 0;
+
+var ranCatch = false;
+
+try {
+ throw [[23]];
+} catch ([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..48aac25420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ [...]
+ 2. If iteratorRecord.[[done]] is true, let v be undefined.
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+---*/
+var values = [2, 1, 3];
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([[...x] = values]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x[0], 2);
+ assert.sameValue(x[1], 1);
+ assert.sameValue(x[2], 3);
+ assert.sameValue(x.length, 3);
+ assert.notSameValue(x, values);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..d33a10a266
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ [...]
+ e. Else,
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+---*/
+var values = [2, 1, 3];
+var initCount = 0;
+
+var ranCatch = false;
+
+try {
+ throw [values];
+} catch ([[...x] = function() { initCount += 1; }()]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x[0], 2);
+ assert.sameValue(x[1], 1);
+ assert.sameValue(x[2], 3);
+ assert.sameValue(x.length, 3);
+ assert.notSameValue(x, values);
+ assert.sameValue(initCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..0e6088e9ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Nested array destructuring with a null value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw [null];
+ } catch ([[x]]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..34684ab78b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer with an exhausted iterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 5. If iteratorRecord.[[done]] is true, let v be undefined.
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([x = 23]) {
+ assert.sameValue(x, 23);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..99a386d1fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..6f54b97552
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..6eee0b0d32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..9a0f13ea57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..78de727bfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 8. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..643280c006
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer with a "hole" (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+ SingleNameBinding : BindingIdentifier Initializeropt
+ [...] 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [,];
+} catch ([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..6893e38431
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var ranCatch = false;
+
+try {
+ throw [null, 0, false, ''];
+} catch ([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..081ab2d6d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Destructuring initializer returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+---*/
+
+assert.throws(Test262Error, function() {
+ try {
+ throw [undefined];
+ } catch ([x = (function() { throw new Test262Error(); })()]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..1deb600a64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer with an undefined value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [undefined];
+} catch ([x = 23]) {
+ assert.sameValue(x, 23);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..88352786b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Destructuring initializer is an unresolvable reference (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ try {
+ throw [];
+ } catch ([ x = unresolvableReference ]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..418607b613
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding when value iteration completes (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
+ c. ReturnIfAbrupt(next).
+ d. If next is false, set iteratorRecord.[[done]] to true.
+ e. Else,
+ [...]
+ 5. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([x]) {
+ assert.sameValue(x, undefined);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..41eb272e1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is false, then
+ [...]
+ 5. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([_, x]) {
+ assert.sameValue(x, undefined);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..2d71680d83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
+ c. ReturnIfAbrupt(next).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ try {
+ throw g;
+ } catch ([x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..c9479ccf14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true.
+ c. ReturnIfAbrupt(next).
+ d. If next is false, set iteratorRecord.[[Done]] to true.
+ e. Else,
+ i. Let v be IteratorValue(next).
+ ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true.
+ iii. ReturnIfAbrupt(v).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..6ce13a0da7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
+ c. ReturnIfAbrupt(next).
+ d. If next is false, set iteratorRecord.[[done]] to true.
+ e. Else,
+ i. Let v be IteratorValue(next).
+ ii. If v is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(v).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ try {
+ throw g;
+ } catch ([x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..8b1848d36e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
+ c. ReturnIfAbrupt(next).
+ d. If next is false, set iteratorRecord.[[done]] to true.
+ e. Else,
+ [...]
+ i. Let v be IteratorValue(next).
+ ii. If v is an abrupt completion, set
+ iteratorRecord.[[done]] to true.
+ iii. ReturnIfAbrupt(v).
+ 5. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..094218a510
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ [...]
+ 2. If iteratorRecord.[[done]] is true, let v be undefined.
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..fd578d90a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ [...]
+ 2. If iteratorRecord.[[done]] is true, let v be undefined.
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [{ x: 11, y: 22, z: 33 }];
+} catch ([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..8ff30194e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ [...]
+ 2. If iteratorRecord.[[done]] is true, let v be undefined.
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ assert.sameValue(v, 444);
+ assert.sameValue(x, 555);
+ assert.sameValue(z, 666);
+
+ assert.throws(ReferenceError, function() {
+ u;
+ });
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ assert.throws(ReferenceError, function() {
+ y;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..2d87609e0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPatternInitializer opt
+
+ [...]
+ 2. If iteratorRecord.[[done]] is true, let v be undefined.
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [{ u: 777, w: 888, y: 999 }];
+} catch ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ assert.sameValue(v, 777);
+ assert.sameValue(x, 888);
+ assert.sameValue(z, 999);
+
+ assert.throws(ReferenceError, function() {
+ u;
+ });
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ assert.throws(ReferenceError, function() {
+ y;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..a31061b40a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Nested object destructuring with a null value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw [null];
+ } catch ([{ x }]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..cb201ef7a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Nested object destructuring with a value of `undefined` (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw [];
+ } catch ([{ x }]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..548c23271b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-exhausted.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Elision accepts exhausted iterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ Elision ]
+
+ 1. Return the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
+ as the argument.
+
+ 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
+
+ Elision : ,
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ 2. Return NormalCompletion(empty).
+
+---*/
+var iter = function*() {}();
+iter.next();
+
+var ranCatch = false;
+
+try {
+ throw iter;
+} catch ([,]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..61b2b4a2fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-step-err.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ Elision ]
+
+ 1. Return the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
+ as the argument.
+
+ 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
+
+ Elision : ,
+
+ 1. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
+ c. ReturnIfAbrupt(next).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([,]) {}
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision.js
new file mode 100644
index 0000000000..9d4a12470e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Elision advances iterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ Elision ]
+
+ 1. Return the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
+ as the argument.
+
+ 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
+
+ Elision : ,
+
+ 1. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
+ c. ReturnIfAbrupt(next).
+ d. If next is false, set iteratorRecord.[[done]] to true.
+ 2. Return NormalCompletion(empty).
+
+---*/
+var first = 0;
+var second = 0;
+function* g() {
+ first += 1;
+ yield;
+ second += 1;
+};
+
+var ranCatch = false;
+
+try {
+ throw g();
+} catch ([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-empty.js
new file mode 100644
index 0000000000..21ffbd3fd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-empty.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/try.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var ranCatch = false;
+
+try {
+ throw iter;
+} catch ([]) {
+ assert.sameValue(iterations, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..fbba3cbe50
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an array BindingElementList pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingPattern
+
+ 1. Let A be ArrayCreate(0).
+ [...]
+ 3. Repeat
+ [...]
+ b. If iteratorRecord.[[done]] is true, then
+ i. Return the result of performing BindingInitialization of
+ BindingPattern with A and environment as the arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
+ c. ReturnIfAbrupt(next).
+ d. If next is false, set iteratorRecord.[[done]] to true.
+ e. Else,
+ [...]
+ i. Let v be IteratorValue(next).
+ ii. If v is an abrupt completion, set
+ iteratorRecord.[[done]] to true.
+ iii. ReturnIfAbrupt(v).
+ 5. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [3, 4, 5];
+} catch ([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..7f7162bc84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an elision (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingPattern
+
+ 1. Let A be ArrayCreate(0).
+ [...]
+ 3. Repeat
+ [...]
+ b. If iteratorRecord.[[done]] is true, then
+ i. Return the result of performing BindingInitialization of
+ BindingPattern with A and environment as the arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ Elision ]
+
+ 1. Return the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
+ as the argument.
+
+ 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
+
+ Elision : ,
+
+ 1. If iteratorRecord.[[done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
+ c. ReturnIfAbrupt(next).
+ d. If next is false, set iteratorRecord.[[done]] to true.
+ 2. Return NormalCompletion(empty).
+
+---*/
+var first = 0;
+var second = 0;
+function* g() {
+ first += 1;
+ yield;
+ second += 1;
+};
+
+var ranCatch = false;
+
+try {
+ throw g();
+} catch ([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..c193f1b75c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an "empty" array pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingPattern
+
+ 1. Let A be ArrayCreate(0).
+ [...]
+ 3. Repeat
+ [...]
+ b. If iteratorRecord.[[done]] is true, then
+ i. Return the result of performing BindingInitialization of
+ BindingPattern with A and environment as the arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var ranCatch = false;
+
+try {
+ throw iter;
+} catch ([...[]]) {
+ assert.sameValue(iterations, 1);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..c7516b95bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing a rest element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingPattern
+
+ 1. Let A be ArrayCreate(0).
+ [...]
+ 3. Repeat
+ [...]
+ b. If iteratorRecord.[[done]] is true, then
+ i. Return the result of performing BindingInitialization of
+ BindingPattern with A and environment as the arguments.
+ [...]
+---*/
+var values = [1, 2, 3];
+
+var ranCatch = false;
+
+try {
+ throw values;
+} catch ([...[...x]]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 3);
+ assert.sameValue(x[0], 1);
+ assert.sameValue(x[1], 2);
+ assert.sameValue(x[2], 3);
+ assert.notSameValue(x, values);
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..af9ad6c4f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-direct.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Lone rest element (direct binding) (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [1];
+} catch ([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..21f0a58f66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Rest element following elision elements (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+ ArrayBindingPattern : [ Elisionopt BindingRestElement ]
+ 1. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. ReturnIfAbrupt(status).
+ 2. Return the result of performing IteratorBindingInitialization for
+ BindingRestElement with iteratorRecord and environment as arguments.
+
+---*/
+var iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([, ...x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..be5b0791a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element following elision elements (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+ ArrayBindingPattern : [ Elisionopt BindingRestElement ]
+ 1. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. ReturnIfAbrupt(status).
+ 2. Return the result of performing IteratorBindingInitialization for
+ BindingRestElement with iteratorRecord and environment as arguments.
+---*/
+var values = [1, 2, 3, 4, 5];
+
+var ranCatch = false;
+
+try {
+ throw values;
+} catch ([ , , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 3);
+ assert.sameValue(x[0], 3);
+ assert.sameValue(x[1], 4);
+ assert.sameValue(x[2], 5);
+ assert.notSameValue(x, values);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..5bf9eef652
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/try.template
+/*---
+description: RestElement applied to an exhausted iterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+ BindingRestElement : ... BindingIdentifier
+ 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
+ environment).
+ 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
+ [...]
+ b. If iteratorRecord.[[done]] is true, then
+ i. If environment is undefined, return PutValue(lhs, A).
+ ii. Return InitializeReferencedBinding(lhs, A).
+
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [1, 2];
+} catch ([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..2bbd1c296d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+ BindingRestElement : ... BindingIdentifier
+ 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
+ environment).
+ 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([...x]) {}
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..dca33915de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+ BindingRestElement : ... BindingIdentifier
+ 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
+ environment).
+ 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([...x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..bf01791203
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Lone rest element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+ BindingRestElement : ... BindingIdentifier
+ [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat
+ [...]
+ f. Let status be CreateDataProperty(A, ToString (n), nextValue).
+ [...]
+---*/
+var values = [1, 2, 3];
+
+var ranCatch = false;
+
+try {
+ throw values;
+} catch ([...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 3);
+ assert.sameValue(x[0], 1);
+ assert.sameValue(x[1], 2);
+ assert.sameValue(x[2], 3);
+ assert.notSameValue(x, values);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..dd1b187d98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-ary.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([...[ x ] = []]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..c61b65927f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-id.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (identifier) does not support initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([...x = []]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..cea566a275
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-obj.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([...{ x } = []]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..a056a5472f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([...[x], y]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..54763c08e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (identifier) may not be followed by any element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([...x, y]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..179a4cfbd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([...{ x }, y]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..bc04d33472
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-id.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an object binding pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingPattern
+
+ 1. Let A be ArrayCreate(0).
+ [...]
+ 3. Repeat
+ [...]
+ b. If iteratorRecord.[[done]] is true, then
+ i. Return the result of performing BindingInitialization of
+ BindingPattern with A and environment as the arguments.
+ [...]
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([...{ length }]) {
+ assert.sameValue(length, 3);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..6e2d42230a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an object binding pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingPattern
+
+ 1. Let A be ArrayCreate(0).
+ [...]
+ 3. Repeat
+ [...]
+ b. If iteratorRecord.[[done]] is true, then
+ i. Return the result of performing BindingInitialization of
+ BindingPattern with A and environment as the arguments.
+ [...]
+---*/
+let length = "outer";
+
+var ranCatch = false;
+
+try {
+ throw [7, 8, 9];
+} catch ([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/browser.js b/js/src/tests/test262/language/statements/try/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-init-null.js b/js/src/tests/test262/language/statements/try/dstr/obj-init-null.js
new file mode 100644
index 0000000000..291971cbd0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-init-null.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw null;
+ } catch ({}) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-init-undefined.js b/js/src/tests/test262/language/statements/try/dstr/obj-init-undefined.js
new file mode 100644
index 0000000000..6eec2d6a48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-init-undefined.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw undefined;
+ } catch ({}) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-empty.js
new file mode 100644
index 0000000000..549b80531b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-empty.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/try.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var ranCatch = false;
+
+try {
+ throw obj;
+} catch ({}) {
+ assert.sameValue(accessCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..a3b7d820f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-get-value-err.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ try {
+ throw poisonedProperty;
+ } catch ({ poisoned }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..cfc6fbee3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ i. Let hasNameProperty be HasOwnProperty(v, "name").
+ ii. ReturnIfAbrupt(hasNameProperty).
+ iii. If hasNameProperty is false, perform SetFunctionName(v,
+ bindingId).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw {};
+} catch ({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..ea50c490a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ i. Let hasNameProperty be HasOwnProperty(v, "name").
+ ii. ReturnIfAbrupt(hasNameProperty).
+ iii. If hasNameProperty is false, perform SetFunctionName(v,
+ bindingId).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw {};
+} catch ({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..51fe56bc2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ i. Let hasNameProperty be HasOwnProperty(v, "name").
+ ii. ReturnIfAbrupt(hasNameProperty).
+ iii. If hasNameProperty is false, perform SetFunctionName(v,
+ bindingId).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw {};
+} catch ({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..a80ed00fb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ i. Let hasNameProperty be HasOwnProperty(v, "name").
+ ii. ReturnIfAbrupt(hasNameProperty).
+ iii. If hasNameProperty is false, perform SetFunctionName(v,
+ bindingId).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw {};
+} catch ({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..97103ccdb4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ d. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ i. Let hasNameProperty be HasOwnProperty(v, "name").
+ ii. ReturnIfAbrupt(hasNameProperty).
+ iii. If hasNameProperty is false, perform SetFunctionName(v,
+ bindingId).
+
+---*/
+
+var ranCatch = false;
+
+try {
+ throw {};
+} catch ({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..e4282b7dcf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-skipped.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var ranCatch = false;
+
+try {
+ throw { w: null, x: 0, y: false, z: '' };
+} catch ({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..11930c89eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-throws.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error thrown when evaluating the initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ try {
+ throw {};
+ } catch ({ x = thrower() }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..b078767f64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Destructuring initializer is an unresolvable reference (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ try {
+ throw {};
+ } catch ({ x = unresolvableReference }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..b8ab86d372
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { x: 23 };
+} catch ({ x, }) {
+ assert.sameValue(x, 23);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-list-err.js
new file mode 100644
index 0000000000..560b49bc04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-list-err.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ try {
+ throw {};
+ } catch ({ a, b = thrower(), c = ++initCount }) {}
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..988cec6e7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-init.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw {};
+} catch ({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..4407d98762
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { x: [45] };
+} catch ({ x: [y], }) {
+ assert.sameValue(y,45);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..6161491155
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw { w: null };
+ } catch ({ w: [x, y, z] = [4, 5, 6] }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..0d2d737803
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { w: [7, undefined, ] };
+} catch ({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..714a3e2343
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-eval-err.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Evaluation of property name returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ try {
+ throw {};
+ } catch ({ [thrower()]: x }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..c02a9aaa45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ try {
+ throw poisonedProperty;
+ } catch ({ poisoned: x = ++initEvalCount }) {}
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..93a7e09e5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var ranCatch = false;
+
+try {
+ throw { s: null, u: 0, w: false, y: '' };
+} catch ({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ assert.sameValue(t, null);
+ assert.sameValue(v, 0);
+ assert.sameValue(x, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ assert.throws(ReferenceError, function() {
+ s;
+ });
+ assert.throws(ReferenceError, function() {
+ u;
+ });
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ assert.throws(ReferenceError, function() {
+ y;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..dfa4fd11c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error thrown when evaluating the initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ try {
+ throw {};
+ } catch ({ x: y = thrower() }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..6edb704086
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Destructuring initializer is an unresolvable reference (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ try {
+ throw {};
+ } catch ({ x: y = unresolvableReference }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..c4e9d47964
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { };
+} catch ({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..6d64a66c42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { x: 23 };
+} catch ({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..827f3a3699
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Binding as specified via property name and identifier (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { x: 23 };
+} catch ({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..4730f557ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-init.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { w: undefined };
+} catch ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..2bc8fd29d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw { w: null };
+ } catch ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..5e368068f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw { };
+ } catch ({ w: { x, y, z } = undefined }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..538a5a8137
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { w: { x: undefined, z: 7 } };
+} catch ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..1ea2ac5a86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-getter.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+---*/
+var count = 0;
+
+var ranCatch = false;
+
+try {
+ throw { get v() { count++; return 2; } };
+} catch ({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..c9fd0c7f96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var ranCatch = false;
+
+try {
+ throw o;
+} catch ({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..c5390b4a2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-val-obj.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest object contains just unextracted data (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+---*/
+
+var ranCatch = false;
+
+try {
+ throw {x: 1, y: 2, a: 5, b: 3};
+} catch ({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/shell.js b/js/src/tests/test262/language/statements/try/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/try/early-catch-duplicates.js b/js/src/tests/test262/language/statements/try/early-catch-duplicates.js
new file mode 100644
index 0000000000..0a89fa78ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/early-catch-duplicates.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-try-statement-static-semantics-early-errors
+es6id: 13.15.1
+description: >
+ It is a Syntax Error if BoundNames of CatchParameter contains any duplicate
+ elements.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch ([x, x]) {}
diff --git a/js/src/tests/test262/language/statements/try/early-catch-function.js b/js/src/tests/test262/language/statements/try/early-catch-function.js
new file mode 100644
index 0000000000..30e53c80b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/early-catch-function.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-static-semantics-early-errors
+description: >
+ Redeclaration of CatchParameter with directly nested FunctionDeclaration in function context.
+info: |
+ 13.15.1 Static Semantics: Early Errors
+
+ It is a Syntax Error if any element of the BoundNames of CatchParameter also
+ occurs in the LexicallyDeclaredNames of Block.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ try {
+ } catch (e) {
+ function e(){}
+ }
+}
diff --git a/js/src/tests/test262/language/statements/try/early-catch-lex.js b/js/src/tests/test262/language/statements/try/early-catch-lex.js
new file mode 100644
index 0000000000..1ba4a3c6b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/early-catch-lex.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-try-statement-static-semantics-early-errors
+es6id: 13.15.1
+description: >
+ It is a Syntax Error if any element of the BoundNames of CatchParameter
+ also occurs in the LexicallyDeclaredNames of Block.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [let]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (x) { let x; }
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding-finally.js b/js/src/tests/test262/language/statements/try/optional-catch-binding-finally.js
new file mode 100644
index 0000000000..9d0dbb43fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding-finally.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: try/catch/finally syntax with omission of the catch binding
+features: [optional-catch-binding]
+info: |
+ Optional Catch Binding
+
+ Catch[Yield, Await, Return]:
+ (...)
+ catch Block[?Yield, ?Await, ?Return]
+---*/
+
+try {} catch {} finally {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding-lexical.js b/js/src/tests/test262/language/statements/try/optional-catch-binding-lexical.js
new file mode 100644
index 0000000000..a9d9f55ae5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding-lexical.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: lexical environment runtime semantics for optional catch binding
+features: [optional-catch-binding]
+info: |
+ Runtime Semantics: CatchClauseEvaluation
+
+ Catch : catch Block
+ Let oldEnv be the running execution context's LexicalEnvironment.
+ Let catchEnv be NewDeclarativeEnvironment(oldEnv).
+ Set the running execution context's LexicalEnvironment to catchEnv.
+ (...)
+ Set the running execution context's LexicalEnvironment to oldEnv.
+ Return Completion(B).
+---*/
+
+let x = 1;
+let ranCatch = false;
+
+try {
+ x = 2;
+ throw new Error();
+} catch {
+ let x = 3;
+ let y = true;
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+assert.sameValue(x, 2);
+
+assert.throws(ReferenceError, function() {
+ y;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding-parens.js b/js/src/tests/test262/language/statements/try/optional-catch-binding-parens.js
new file mode 100644
index 0000000000..75ad4bf1fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding-parens.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: >
+ It is a SyntaxError to have a try/catch statement with an empty CatchParameter
+features: [optional-catch-binding]
+info: |
+ Catch[Yield, Await, Return]:
+ catch ( CatchParameter[?Yield, ?Await] ) Block[?Yield, ?Await, ?Return]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try {} catch () {}
+
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding-throws.js b/js/src/tests/test262/language/statements/try/optional-catch-binding-throws.js
new file mode 100644
index 0000000000..f9e5976c4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding-throws.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: errors can be thrown from catch clause without binding
+features: [optional-catch-binding]
+info: |
+ Runtime Semantics: CatchClauseEvaluation
+
+ Catch : catch Block
+ (...)
+ Let B be the result of evaluating Block.
+ (...)
+ Return Completion(B).
+---*/
+
+assert.throws(Test262Error, function() {
+ try {
+ throw new Error();
+ } catch {
+ throw new Test262Error();
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding.js b/js/src/tests/test262/language/statements/try/optional-catch-binding.js
new file mode 100644
index 0000000000..d405f720d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: try/catch syntax with omission of the catch binding
+features: [optional-catch-binding]
+info: |
+ Optional Catch Binding
+
+ Catch[Yield, Await, Return]:
+ (...)
+ catch Block[?Yield, ?Await, ?Return]
+---*/
+
+try {} catch {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-block-lex-close.js b/js/src/tests/test262/language/statements/try/scope-catch-block-lex-close.js
new file mode 100644
index 0000000000..b106e19733
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-block-lex-close.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Removal of lexical environment for `catch` block
+info: |
+ [...]
+ 8. Let B be the result of evaluating Block.
+ [...]
+features: [let]
+---*/
+
+var probe, x;
+
+try {
+ throw null;
+} catch (_) {
+ let x = 'inside';
+ probe = function() { return x; };
+}
+x = 'outside';
+
+assert.sameValue(x, 'outside');
+assert.sameValue(probe(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-block-lex-open.js b/js/src/tests/test262/language/statements/try/scope-catch-block-lex-open.js
new file mode 100644
index 0000000000..576833a663
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-block-lex-open.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Creation of new lexical environment for `catch` block
+info: |
+ [...]
+ 8. Let B be the result of evaluating Block.
+ [...]
+features: [let]
+---*/
+
+var probeParam, probeBlock;
+let x = 'outside';
+
+try {
+ throw [];
+} catch ([_ = probeParam = function() { return x; }]) {
+ probeBlock = function() { return x; };
+ let x = 'inside';
+}
+
+assert.sameValue(probeParam(), 'outside');
+assert.sameValue(probeBlock(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-block-var-none.js b/js/src/tests/test262/language/statements/try/scope-catch-block-var-none.js
new file mode 100644
index 0000000000..1a2f6017bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-block-var-none.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Retainment of existing variable environment for `catch` block
+info: |
+ [...]
+ 8. Let B be the result of evaluating Block.
+ [...]
+---*/
+
+var x = 1;
+var probeBefore = function() { return x; };
+var probeInside;
+
+try {
+ throw null;
+} catch (_) {
+ var x = 2;
+ probeInside = function() { return x; };
+}
+
+assert.sameValue(probeBefore(), 2, 'reference preceding statement');
+assert.sameValue(probeInside(), 2, 'reference within statement');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-param-lex-close.js b/js/src/tests/test262/language/statements/try/scope-catch-param-lex-close.js
new file mode 100644
index 0000000000..c7023236df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-param-lex-close.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Removal of lexical environment for `catch` parameter
+---*/
+
+var probe, x;
+
+try {
+ throw 'inside';
+} catch (x) {
+ probe = function() { return x; };
+}
+x = 'outside';
+
+assert.sameValue(x, 'outside');
+assert.sameValue(probe(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-param-lex-open.js b/js/src/tests/test262/language/statements/try/scope-catch-param-lex-open.js
new file mode 100644
index 0000000000..aefc3603a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-param-lex-open.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Creation of new lexical environment for `catch` parameter
+---*/
+
+var probeBefore = function() { return x; };
+var probeTry, probeParam;
+var x = 'outside';
+
+try {
+ probeTry = function() { return x; };
+
+ throw ['inside'];
+} catch ([x, _ = probeParam = function() { return x; }]) {}
+
+assert.sameValue(probeBefore(), 'outside');
+assert.sameValue(probeTry(), 'outside');
+assert.sameValue(probeParam(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-param-var-none.js b/js/src/tests/test262/language/statements/try/scope-catch-param-var-none.js
new file mode 100644
index 0000000000..ef674c8d1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-param-var-none.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Retainment of existing variable environment for `catch` parameter
+flags: [noStrict]
+---*/
+
+var x = 1;
+var probeBefore = function() { return x; };
+var probeTry, probeParam, probeBlock;
+
+try {
+ var x = 2;
+ probeTry = function() { return x; };
+ throw [];
+} catch ([_ = (eval('var x = 3;'), probeParam = function() { return x; })]) {
+ var x = 4;
+ probeBlock = function() { return x; };
+}
+
+assert.sameValue(probeBefore(), 4, 'reference preceding statement');
+assert.sameValue(probeTry(), 4, 'reference from `try` block');
+assert.sameValue(probeParam(), 4, 'reference within CatchParameter');
+assert.sameValue(probeBlock(), 4, 'reference from `catch` block');
+assert.sameValue(x, 4, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/shell.js b/js/src/tests/test262/language/statements/try/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/try/static-init-await-binding-invalid.js b/js/src/tests/test262/language/statements/try/static-init-await-binding-invalid.js
new file mode 100644
index 0000000000..49e4dc764b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/static-init-await-binding-invalid.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: BindingIdentifier may not be `await` within class static blocks
+info: |
+ BindingIdentifier : Identifier
+
+ [...]
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ try {} catch (await) {}
+ }
+}
diff --git a/js/src/tests/test262/language/statements/try/static-init-await-binding-valid.js b/js/src/tests/test262/language/statements/try/static-init-await-binding-valid.js
new file mode 100644
index 0000000000..a16094d374
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/static-init-await-binding-valid.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The `await` keyword is interpreted as an identifier within arrow function bodies
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ [...]
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+features: [class-static-block]
+---*/
+
+class C {
+ static {
+ (() => { try {} catch (await) {} });
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/tco-catch-finally-strict.js b/js/src/tests/test262/language/statements/try/tco-catch-finally-strict.js
new file mode 100644
index 0000000000..3366875c07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/tco-catch-finally-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ try { } catch (err) { } finally {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/tco-catch-strict.js b/js/src/tests/test262/language/statements/try/tco-catch-strict.js
new file mode 100644
index 0000000000..63523c0f8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/tco-catch-strict.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ try {
+ throw null;
+ } catch (err) {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/tco-finally-strict.js b/js/src/tests/test262/language/statements/try/tco-finally-strict.js
new file mode 100644
index 0000000000..125d808f71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/tco-finally-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ try { } finally {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);