Mozilla je prešla na uporabo skupnega motorja pravilnikov z Chromiumom.

JavaScript engine SpiderMonkey used in Firefox je bil to implement an updated version of regular expressions based on current code Irregexp from the V8 JavaScript engine used in browsers based on the Chromium project. The new RegExp implementation will be proposed in the Firefox 78 release scheduled for June 30, enabling 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 necessitating significant changes to the codebase. Modularity allowed for the replacement of the originally used RegExp engine YARR in Firefox with a fork of the Irregexp engine from V8 back in 2014. Irregexp is tied to the V8 API, linked to the garbage collector, and utilizes V8's 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 flag ‘\u’, were transferred where possible to a branch maintained by Mozilla. Unfortunately, maintaining a synchronized fork is a challenging task and requires significant resources. With the introduction of new features related to regular expressions in the ECMAScript 2018 standard, Mozilla developers contemplated how to simplify the transfer of changes from Irregexp. As a solution, a wrapper concept was proposed that allows for the nearly unchanged Irregexp engine to be used in SpiderMonkey (the changes are limited to automatic replacement of ‘#include’ blocks).

The wrapper provides Irregexp with the necessary V8-specific features, including memory management and code generation functions, as well as data structures that are implemented based on memory management mechanisms, code generators, and SpiderMonkey structures.

Mozilla je prešla na uporabo skupnega motorja pravilnikov z Chromiumom.

Updating the RegExp engine will enable Firefox to support features like named groups, Unicode character class escapes, the dotAll flag, and Lookbehind mode:

Posodobitev RegExp motorja bo omogočila Firefoxu podporo funkcionalnostim, kot so poimenovane skupine (named captures), eskapiranje razredov Unicode znakov, zastavica dotAll in način Lookbehind:

  • Imenovane grupe omogućavaju povezivanje dijelova stringa koji odgovaraju regularnom izrazu sa određenim imenima umjesto redoslednih brojeva poklapanja (na primjer, umjesto „/(\d{4})-(\d{2})-(\d{2})/“ može se navesti „/(?\d{4})-(?\d{2})-(?\d{2})/“ i dobiti pristup godini ne kroz result[1], već kroz result.groups.year).
  • Escaping classes Unicode simbola dodaje konstrukcije \p{…} i \P{…}, na primjer, \p{Number} definiše sve moguće znakove sa prikazom cifara (uključujući simbole tipa ①), \p{Alphabetic} — slova (uključujući hijeroglife), \p{Math} — matematičke simbole itd.
  • Zastava dotAll uzrokuje da se maska „.“ aktivira također i za simbole za prelom reda.
  • Način Lookbehind omogućava određivanje u regularnom izrazu da jedan obrazac prethodi drugom (na primjer, poklapanje iznosa u dolarima bez hvatanja znaka dolara).

Projekt je bil izveden s sodelovanjem razvijalcev V8, ki so na svoji strani opravili delo pri zmanjšanju odvisnosti Irregexp od V8 ter prenesli nekatere značilnosti, katerih ni mogoče uresničiti na osnovi SpiderMonkey, v onemogočene bloke „#ifdef“. Sodelovanje se je izkazalo za obojestransko koristno. Na svoji strani so razvijalci Mozilla prenesli v Irregexp spremembe, ki odpravljajo nekatere neskladnosti z zahtevami standarda JavaScript in izboljšujejo kakovost kode. Poleg tega so bili med fuzzing testiranjem Firefox odkriti in odpravljeni prej neopaženi napaki v kodeksu Irregexp, ki sta privedla do zrušitev.

Izvor: opennet.ru

Kupite zanesljivo gostovanje za spletne strani z zaščito pred DDoS, VPS VDS strežniki 🔥 Kupite zanesljivo gostovanje za spletne strani z zaščito pred DDoS, VPS VDS strežniki | ProHoster