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 --- .../extensions/uneval/strict-function-toSource.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 js/src/tests/non262/extensions/uneval/strict-function-toSource.js (limited to 'js/src/tests/non262/extensions/uneval/strict-function-toSource.js') diff --git a/js/src/tests/non262/extensions/uneval/strict-function-toSource.js b/js/src/tests/non262/extensions/uneval/strict-function-toSource.js new file mode 100644 index 0000000000..383da34df6 --- /dev/null +++ b/js/src/tests/non262/extensions/uneval/strict-function-toSource.js @@ -0,0 +1,19 @@ +// |reftest| skip-if(!this.uneval) + +/* + * Bug 800407 - Functions defined with Function construcor + * do have strict mode when JSOPTION_STRICT_MODE is on. + */ + +options("strict_mode"); +function testRunOptionStrictMode(str, arg, result) { + var strict_inner = new Function('return typeof this == "undefined";'); + return strict_inner; +} +let inner = testRunOptionStrictMode(); +assertEq(inner(), true); +assertEq(eval(uneval(inner))(), true); + +assertEq((new Function('x', 'return x*2;')).toSource().includes('"use strict"'), false); + +reportCompare(true, true); -- cgit v1.2.3