Mozilla has transitioned to using a shared regular expression engine with Chromium

The JavaScript engine SpiderMonkey used in Firefox translated for utilizing an updated implementation of regular expressions, based on current code , which allowed for the implementation of all missing elements of ECMAScript 2018 (assertions from the V8 JavaScript engine used in Chromium-based browsers. The new RegExp implementation will be proposed in Firefox version 78, scheduled for June 30, and will enable the browser to implement all the missing ECMAScript features related to regular expressions.

It is noted that the RegExp engine in SpiderMonkey is designed as a separate component, making it relatively independent and suitable for replacement without the need for significant changes to the codebase. Modularity allowed for the 2014 replacement of the originally used RegExp engine YARR in Firefox with a fork of the Irregexp engine from V8. Irregexp is tied to the V8 API, linked to the garbage collector, and utilizes V8-specific string representation and object model. During the adaptation to SpiderMonkey's internal API in 2014, the Irregexp engine was partially rewritten, and emerging changes, such as the '\u' flag, were carried over whenever possible moved to a branch supported by Mozilla.

Unfortunately, maintaining a synchronized fork is a challenging task and requires substantial resources. With the introduction of new features related to regular expressions in the ECMAScript 2018 standard, Mozilla developers considered how to simplify the transfer of changes from Irregexp. As a solution, the concept of wrapping was proposed, allowing SpiderMonkey to use the Irregexp engine almost unchanged (the changes are limited to automatic replacement of ‘#include’ blocks).

Mozilla has transitioned to using a shared regular expression engine with Chromium

The wrapper provides Irregexp with necessary V8-specific capabilities, including memory management and code generation functions, as well as the original data structures implemented based on SpiderMonkey's memory management, code generators, and structures.

The update to the RegExp engine will ensure support in Firefox for features such as named captures, escaping of Unicode character classes, the dotAll flag, and Lookbehind mode:

The project was carried out with the participation of V8 developers, who worked on reducing Irregexp's dependency on V8 and moved some features that cannot be implemented on the SpiderMonkey base into optional blocks '#ifdef'. The cooperation turned out to be mutually beneficial. On their side, Mozilla developers contributed changes to Irregexp that eliminated some inconsistencies with the JavaScript standard and improving the code quality. Also, during fuzz testing of Firefox, previously unnoticed bugs in the Irregexp code that led to crashes were identified and fixed.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster