Closed Bug 1909220 Opened 2 years ago Closed 2 years ago

Allow embeddings to define classes without a globally available constructor

Categories

(Core :: JavaScript Engine, enhancement, P1)

Firefox 128
enhancement

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: me, Assigned: me)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Steps to reproduce:

Currently it is not possible for an embedding to create builtin classes using JS_InitClass without exposing the class' constructor globally, this is an issue if the embedding wants to create classes which are not found on the global.

I propose we modify JS_InitClass to respect js::ClassSpec::DontDefineConstructor so that it would be possible for an embedding to create such builtin classes

The flag was previously only respected for internal builtins, not classes defined by the embedding using JS_InitClass. That meant one couldn't use JS_InitClass to define classes without a globally available constructor.

Assignee: nobody → me
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Blocks: sm-embedding
Severity: -- → N/A
Priority: -- → P1
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7898786b44c9 Respect js::ClassSpec::DontDefineConstructor in DefineConstructorAndPrototype. r=jandem
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: