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 --- js/src/tests/shell/warning.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 js/src/tests/shell/warning.js (limited to 'js/src/tests/shell/warning.js') diff --git a/js/src/tests/shell/warning.js b/js/src/tests/shell/warning.js new file mode 100644 index 0000000000..3a390b0864 --- /dev/null +++ b/js/src/tests/shell/warning.js @@ -0,0 +1,33 @@ +// |reftest| skip-if(!xulRuntime.shell) + +var BUGNUMBER = 1170716; +var summary = 'Add js shell functions to get last warning'; + +print(BUGNUMBER + ": " + summary); + +// Warning with JSEXN_SYNTAXERR. + +enableLastWarning(); +eval(`function f() { if (false) { "use asm"; } }`); + +warning = getLastWarning(); +assertEq(warning !== null, true); +assertEq(warning.name, "SyntaxError"); +assertEq(warning.message.includes("Directive Prologue"), true); +assertEq(warning.lineNumber, 1); +assertEq(warning.columnNumber, 28); + +// Disabled. + +disableLastWarning(); + +eval(`function f() { if (false) { "use asm"; } }`); + +enableLastWarning(); +warning = getLastWarning(); +assertEq(warning, null); + +disableLastWarning(); + +if (typeof reportCompare === "function") + reportCompare(true, true); -- cgit v1.2.3