Open
Bug 1070222
Opened 10 years ago
Updated 2 years ago
Investigate if we could statically check "correct" compartment usage
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
NEW
People
(Reporter: smaug, Unassigned)
Details
Compartment usage is close to black magic, and it is _very_ easy to get
compartment mismatches. We have been getting better, but mismatches do still happen.
Either we need to change JSAPI so that one _must_ think about the right
compartment whenever touching any JS stuff, or, if possible, some static checking to
at least prevent common compartment mismatches.
Comment 1•10 years ago
|
||
Interesting - any concrete suggestions?
Comment 2•10 years ago
|
||
(Note that things are getting better with AutoJSAPI and friends, since they automatically enter the correct initial compartment).
Comment 3•10 years ago
|
||
One thing that would be worth doing would be to rename AutoSafeJSContext to DeprecatedAutoSafeJSContext and forbid adding new instances to the tree.
Reporter | ||
Comment 4•10 years ago
|
||
AutoJSAPI doesn't exactly force one to use itself.
I guess all the JSAPI-y things should take a pointer to a compartment or so to force developer to think about compartments. But that might affect to performance.
Even better would be if it was somehow possible to automatically enter the right compartment,
but I don't see how that could be doable.
Reporter | ||
Comment 5•10 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #4)
> I guess all the JSAPI-y things should take a pointer to a compartment or so
> to force developer to think about compartments. But that might affect to
> performance.
This would be annoying for writing code,
but the main issue with compartments is that they are something which
happen mostly hidden in the background. And given that they are so crucial for many things, they
really shouldn't be hidden.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•