Closed Bug 1469006 Opened 2 years ago Closed 2 years ago

Replace some script->compartment() calls with script->realm()

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(1 file)

Scripts are tied to a specific realm so things like CanReuseScriptForClone need to check the realm instead of the compartment.
Comment on attachment 8985660 [details] [diff] [review]
Replace some script->compartment() calls with script->realm()

Review of attachment 8985660 [details] [diff] [review]:
-----------------------------------------------------------------

Good catch.  Maybe worth removing JSScript::compartment() so people naturally default to realm()?
Attachment #8985660 - Flags: review?(luke) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f1b6b50a1b9a
Replace some script->compartment() calls with script->realm(). r=luke
(In reply to Luke Wagner [:luke] from comment #2)
> Maybe worth removing JSScript::compartment() so people
> naturally default to realm()?

That might be a good idea. It's not entirely trivial though because we have some templated thing->compartment() calls..

https://searchfox.org/mozilla-central/rev/93d2b9860b3d341258c7c5dcd4e278dea544432b/js/src/gc/Tracer.cpp#152
https://hg.mozilla.org/mozilla-central/rev/f1b6b50a1b9a
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.