From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../annexB/language/statements/try/browser.js | 0 .../statements/try/catch-redeclared-for-in-var.js | 29 ++++++++++++++++++++++ .../statements/try/catch-redeclared-for-of-var.js | 29 ++++++++++++++++++++++ .../statements/try/catch-redeclared-for-var.js | 29 ++++++++++++++++++++++ .../try/catch-redeclared-var-statement-captured.js | 23 +++++++++++++++++ .../try/catch-redeclared-var-statement.js | 22 ++++++++++++++++ .../annexB/language/statements/try/shell.js | 0 7 files changed, 132 insertions(+) create mode 100644 js/src/tests/test262/annexB/language/statements/try/browser.js create mode 100644 js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-in-var.js create mode 100644 js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js create mode 100644 js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-var.js create mode 100644 js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js create mode 100644 js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement.js create mode 100644 js/src/tests/test262/annexB/language/statements/try/shell.js (limited to 'js/src/tests/test262/annexB/language/statements/try') diff --git a/js/src/tests/test262/annexB/language/statements/try/browser.js b/js/src/tests/test262/annexB/language/statements/try/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-in-var.js b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-in-var.js new file mode 100644 index 0000000000..2a8efd5591 --- /dev/null +++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-in-var.js @@ -0,0 +1,29 @@ +// 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-variablestatements-in-catch-blocks +es6id: B.3.5 +description: Re-declaration of catch parameter (for-in statement) +info: | + It is a Syntax Error if any element of the BoundNames of CatchParameter + also occurs in the VarDeclaredNames of Block, unless CatchParameter is + CatchParameter : BindingIdentifier. +---*/ + +var before, during, after; + +try { + throw 'exception'; +} catch (err) { + before = err; + for (var err in { propertyName: null }) { + during = err; + } + after = err; +} + +assert.sameValue(before, 'exception'); +assert.sameValue(during, 'propertyName', 'during loop body evaluation'); +assert.sameValue(after, 'propertyName', 'after loop body evaluation'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js new file mode 100644 index 0000000000..2a9da1e1f9 --- /dev/null +++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js @@ -0,0 +1,29 @@ +// Copyright (C) 2019 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +author: Ross Kirsling +esid: sec-variablestatements-in-catch-blocks +description: Re-declaration of catch parameter (for-of statement) +info: | + It is a Syntax Error if any element of the BoundNames of CatchParameter + also occurs in the VarDeclaredNames of Block, unless CatchParameter is + CatchParameter : BindingIdentifier. +---*/ + +var before, during, after; + +try { + throw 'exception'; +} catch (err) { + before = err; + for (var err of [2]) { + during = err; + } + after = err; +} + +assert.sameValue(before, 'exception'); +assert.sameValue(during, 2, 'during loop body evaluation'); +assert.sameValue(after, 2, 'after loop body evaluation'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-var.js b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-var.js new file mode 100644 index 0000000000..0ca15f0af9 --- /dev/null +++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-var.js @@ -0,0 +1,29 @@ +// 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-variablestatements-in-catch-blocks +es6id: B.3.5 +description: Re-declaration of catch parameter (for statement) +info: | + It is a Syntax Error if any element of the BoundNames of CatchParameter + also occurs in the VarDeclaredNames of Block, unless CatchParameter is + CatchParameter : BindingIdentifier. +---*/ + +var before, during, after; + +try { + throw 'exception'; +} catch (err) { + before = err; + for (var err = 'loop initializer'; err !== 'increment'; err = 'increment') { + during = err; + } + after = err; +} + +assert.sameValue(before, 'exception'); +assert.sameValue(during, 'loop initializer'); +assert.sameValue(after, 'increment'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js new file mode 100644 index 0000000000..b9865d0a03 --- /dev/null +++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.14-2 +es6id: B.3.5 +description: > + catch doesn't change declaration scope - var initializer in catch + with same name as catch parameter changes parameter +---*/ + + function capturedFoo() {return foo}; + foo = "prior to throw"; + try { + throw new Error(); + } + catch (foo) { + var foo = "initializer in catch"; + } + +assert.sameValue(capturedFoo(), "prior to throw"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement.js b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement.js new file mode 100644 index 0000000000..6cfcbde4f7 --- /dev/null +++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.14-1 +es6id: B.3.5 +description: > + catch doesn't change declaration scope - var initializer in catch + with same name as catch parameter changes parameter +---*/ + + foo = "prior to throw"; + try { + throw new Error(); + } + catch (foo) { + var foo = "initializer in catch"; + } + +assert.sameValue(foo, "prior to throw"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/annexB/language/statements/try/shell.js b/js/src/tests/test262/annexB/language/statements/try/shell.js new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3