Normalise and partially disable RegExp legacy features
Categories
(Core :: JavaScript: Standard Library, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox148 | --- | fixed |
People
(Reporter: claude.pache, Assigned: snderi)
References
(Blocks 3 open bugs, )
Details
(Keywords: dev-doc-complete, site-compat)
Attachments
(2 files, 4 obsolete files)
Updated•9 years ago
|
Comment 1•8 years ago
|
||
Comment 2•8 years ago
|
||
Comment 3•8 years ago
|
||
Updated•8 years ago
|
Updated•8 years ago
|
Updated•8 years ago
|
Updated•3 years ago
|
Comment 4•1 year ago
|
||
Current Status: Failing the following Test262 tests:
test262/annexB/built-ins/RegExp/prototype/compile/this-cross-realm-instance.js
test262/annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js
test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-subclass-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js
test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-not-regexp-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/rightContext/this-cross-realm-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/input/this-subclass-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js
test262/annexB/built-ins/RegExp/legacy-accessors/input/this-not-regexp-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/input/this-cross-realm-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-cross-realm-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-not-regexp-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js
test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-subclass-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-cross-realm-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js
test262/annexB/built-ins/RegExp/legacy-accessors/lastParen/this-not-regexp-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-subclass-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js
test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-cross-realm-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/leftContext/this-not-regexp-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/index/this-subclass-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/index/this-cross-realm-constructor.js
test262/annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js
test262/annexB/built-ins/RegExp/legacy-accessors/index/this-not-regexp-constructor.js
Comment 5•9 months ago
|
||
Hi all,
I'm currently working on this as part of my Igalia Coding Experience. Iβll be pushing related commits to GitLab/Igalia and coordinating review through Phabricator once ready.
Thanks,
Serah Nderi
Comment 6•7 months ago
|
||
Updated•7 months ago
|
Comment 7•7 months ago
|
||
Comment 8•7 months ago
|
||
Comment 9•7 months ago
|
||
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
| Assignee | ||
Comment 10•7 months ago
|
||
Updated•7 months ago
|
Comment 11•4 months ago
|
||
Comment 12•4 months ago
|
||
Comment 13•4 months ago
|
||
Comment 14•3 months ago
|
||
Comment 15•3 months ago
|
||
| bugherder | ||
Updated•2 months ago
|
Comment 16•2 months ago
|
||
FF148 MDN docs can be tracked in https://github.com/mdn/content/issues/42746
I don't understand this change (at all). Is there any developer facing change, and if so, does it need to be captured in our docs and compatibility data? If so, can you spell it out for me, or I will hand this to a more JS experienced writer.
Would you like to propose a release note?
There is some info in https://bugzilla.mozilla.org/show_bug.cgi?id=1306461#c0 .
Taking just one thing from that
2. disable `RegExp.prototype.compile()` for cross-realm calls:
`RegExp.prototype.compile.call(otherRealm_regexp)` must throw.
3. disable `RegExp.prototype.compile()` on instances of proper subclasses of RegExp:
`var rx = new (class extends RegExp {})(''); rx.complile('x');` must throw.
If you look at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/compile we could perhaps add exceptions for the throw case if needed. But not sure how we'd represent the compatibility data. It also doesn't feel all that important given this is marked as deprecated.
| Assignee | ||
Comment 17•2 months ago
|
||
Hey Hamish, I had written a blog post on the implementation of the proposal: https://blogs.igalia.com/compilers/2026/01/20/legacy-regexp-features-in-javascript/ .
Here, I explain the change(s) I introduced to the codebase and the reasoning behind them. Now, as for if there's a developer facing this change and if it'd be needed to add to the developer docs, that I'm unsure but since the proposal says : "The design of our semantics is very simple: any attempt to use a feature when it is disabled will throw a TypeError." in https://github.com/tc39/proposal-regexp-legacy-features/blob/918a4b09723b34e4f857f10b4576028a8a02e97d/web-breaking-hazards.md
the deprecated RegExp.prototype.compile() documentation could potentially be updated to show the new throw cases. I wanted to provide this context, but an experienced JS writer might have a differing opinion on whether it's worth documenting given the deprecation status.
Updated•2 months ago
|
Description
•