From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- js/src/jit-test/tests/regexp/match-stub-realms.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 js/src/jit-test/tests/regexp/match-stub-realms.js (limited to 'js/src/jit-test/tests/regexp/match-stub-realms.js') diff --git a/js/src/jit-test/tests/regexp/match-stub-realms.js b/js/src/jit-test/tests/regexp/match-stub-realms.js new file mode 100644 index 0000000000..9cf082f015 --- /dev/null +++ b/js/src/jit-test/tests/regexp/match-stub-realms.js @@ -0,0 +1,19 @@ +// Ensure regexp match stub uses the correct realm for the match object and +// the regexp statics. +function test() { + var g1 = newGlobal({sameCompartmentAs: this}); + var g2 = newGlobal({sameCompartmentAs: this}); + g1.evaluate("function match(s) { return /(.)([\\d]+)/.exec(s); }"); + g2.evaluate("function match(s) { return /(.)([\\d]+)/.exec(s); }"); + for (var i = 0; i < 25; i++) { + var res1 = g1.match(`A${i}`); + var res2 = g2.match(`B${i}`); + assertEq(objectGlobal(res1), g1); + assertEq(objectGlobal(res2), g2); + assertEq(g1.RegExp.$1, "A"); + assertEq(g1.RegExp.$2, String(i)); + assertEq(g2.RegExp.$1, "B"); + assertEq(g2.RegExp.$2, String(i)); + } +} +test(); -- cgit v1.2.3