Closed Bug 1548304 Opened 5 years ago Closed 5 years ago

Audit uses of Maybe<JSAutoRealm> for the Maybe not getting constructed based on _compartments_ instead of realms

Categories

(Core :: General, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox68 --- affected

People

(Reporter: bzbarsky, Assigned: jandem)

References

Details

Looking at things like https://searchfox.org/mozilla-central/rev/7944190ad1668a94223b950a19f1fffe8662d6b8/dom/base/Element.cpp#3455-3459 where we should either JSAutoRealm unconditionally or base it on whether the realms match, not on whether compartments match.

Jan, is this something you might have time for, or know someone who might?

Flags: needinfo?(jdemooij)
Depends on: 1548305

I looked at uses of Maybe<JSAutoRealm> and GetObjectCompartment. I didn't find other instances of the pattern in Element::Animate, but I did notice:

This is correct right? Because the reflector's realm does not depend on who's asking?

These could be global/realm asserts instead of compartment assertions I think?

Flags: needinfo?(jdemooij) → needinfo?(bzbarsky)

This is correct right? Because the reflector's realm does not depend on who's asking?

Right. And importantly, this callee does not have the context to know whether to wrap into the current compartment or not, so it can't make that decision itself: some of its consumers do not want the wrapping.

That said, I kinda wish this function would go away...

These could be global/realm asserts instead of compartment assertions I think?

Yes. I had actually changed those in https://phabricator.services.mozilla.com/D29706#change-dhTgUTQSN3nc yesterday; it just hasn't landed yet.

Thank you for looking through this stuff!

Assignee: nobody → jdemooij
Status: NEW → RESOLVED
Type: defect → task
Closed: 5 years ago
Flags: needinfo?(bzbarsky)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.