Open Bug 1850076 Opened 1 year ago Updated 1 year ago

Use well-known atom in DOM binding code

Categories

(Core :: DOM: Bindings (WebIDL), task, P3)

task

Tracking

()

People

(Reporter: arai, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Currently bindings code uses JSAPI which receives raw string pointer as property/function name.
bug 1848322 is going to make the WellKnownAtomId public, and using it can skip the atomization step.

https://searchfox.org/mozilla-central/rev/07548591c7125357ea27e7c2dbe9d610ea2d8f35/dom/bindings/BindingUtils.cpp#849,854,871

if (!JS_DefineProperty(cx, constructor, "length", ctorNargs,
...
if (!JS_DefineProperty(cx, constructor, "name", name, JSPROP_READONLY)) {
...
if (isChrome && !JS_DefineFunction(cx, constructor, "isInstance",

Also, the interface name is atomized in CreateInterfaceObjects,

https://searchfox.org/mozilla-central/rev/8be17dcf81d9bd894c398b53282d43d782815967/dom/bindings/BindingUtils.cpp#1047,1085

void CreateInterfaceObjects(
...
  JS::Rooted<JSString*> nameStr(cx, JS_AtomizeString(cx, name));
Whiteboard: [sp3]
You need to log in before you can comment on or make changes to this bug.