(regex)
| 737 | |
| 738 | const crossRealmRegexes = new SafeWeakMap(); |
| 739 | function getCrossRealmRegex(regex) { |
| 740 | const cached = crossRealmRegexes.get(regex); |
| 741 | if (cached) return cached; |
| 742 | |
| 743 | let flagString = ''; |
| 744 | if (RegExpPrototypeGetHasIndices(regex)) flagString += 'd'; |
| 745 | if (RegExpPrototypeGetGlobal(regex)) flagString += 'g'; |
| 746 | if (RegExpPrototypeGetIgnoreCase(regex)) flagString += 'i'; |
| 747 | if (RegExpPrototypeGetMultiline(regex)) flagString += 'm'; |
| 748 | if (RegExpPrototypeGetDotAll(regex)) flagString += 's'; |
| 749 | if (RegExpPrototypeGetUnicode(regex)) flagString += 'u'; |
| 750 | if (RegExpPrototypeGetSticky(regex)) flagString += 'y'; |
| 751 | |
| 752 | const { RegExp: RegExpFromAnotherRealm } = getInternalGlobal(); |
| 753 | const crossRealmRegex = new RegExpFromAnotherRealm(RegExpPrototypeGetSource(regex), flagString); |
| 754 | crossRealmRegexes.set(regex, crossRealmRegex); |
| 755 | return crossRealmRegex; |
| 756 | } |
| 757 | |
| 758 | function SideEffectFreeRegExpPrototypeSymbolReplace(regex, string, replacement) { |
| 759 | return getCrossRealmRegex(regex)[SymbolReplace](string, replacement); |
no test coverage detected
searching dependent graphs…