metadata-hook-regexp-result.js (580B)
1 var g = newGlobal({sameCompartmentAs: this}); 2 g.evaluate(`enableShellAllocationMetadataBuilder()`); 3 4 function f() { 5 // Ensure a match stub is created for the zone. 6 var re = /abc.+/; 7 for (var i = 0; i < 100; i++) { 8 assertEq(re.exec("..abcd").index, 2); 9 } 10 // Allocated match result objects in the realm with the metadata hook 11 // must have metadata. 12 g.evaluate(` 13 var re = /abc.+/; 14 for (var i = 0; i < 100; i++) { 15 var obj = re.exec("..abcd"); 16 assertEq(getAllocationMetadata(obj).stack.length > 0, true); 17 } 18 `) 19 } 20 f();