Need way to leave a JSAutoEnterCompartment without waiting for the destructor to be called

RESOLVED FIXED in mozilla16

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: bholley, Assigned: bholley)

Tracking

unspecified
mozilla16
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 3 obsolete attachments)

This has been annoying me. In general, it's great to use scoping. But sometimes, it unnecessarily complicates the code. For example, sometimes we want to leave the compartment before doing a tail function call. Currently, we have to unnecessarily brace/indent a lot of things to make this happen.

Patch coming up.
Created attachment 632171 [details] [diff] [review]
Introduce JSAutoEnterCompartment::leave(). v1

Attaching a patch, flagging luke for review.
Attachment #632171 - Flags: review?(luke)
Created attachment 632209 [details] [diff] [review]
Part 1 - Clarify compartment semantics for ExposedPropertiesOnly. v1
Attachment #632209 - Flags: review?(mrbkap)
Created attachment 632210 [details] [diff] [review]
Part 2 - Clarify compartment situation in Xray wrapper. v1

Adding to the mess of the NodePrincipal (et al) check isn't great, but I'm refactoring that in bug 761704.
Attachment #632210 - Flags: review?(mrbkap)
Created attachment 632211 [details] [diff] [review]
Part 1 - Clarify compartment semantics for ExposedPropertiesOnly. v2

Added an updated comment to clarify why two JSAutoEnterCompartments are necessary.
Attachment #632209 - Attachment is obsolete: true
Attachment #632209 - Flags: review?(mrbkap)
Attachment #632211 - Flags: review?(mrbkap)
Gah! Wrong bug number for those other patches. Sorry blake. :-(
Attachment #632210 - Attachment is obsolete: true
Attachment #632210 - Flags: review?(mrbkap)
Attachment #632211 - Attachment is obsolete: true
Attachment #632211 - Flags: review?(mrbkap)
One thing I realized about this patch is that it allows the consumer to pooch the compartment situation by leaving compartments out of order. I suspect it's not worth worrying about, but maybe we should add some asserts somehow?

Updated

5 years ago
Attachment #632171 - Flags: review?(luke) → review+
Pushed to m-i:
http://hg.mozilla.org/integration/mozilla-inbound/rev/f195d6de172f
Target Milestone: --- → mozilla16
https://hg.mozilla.org/mozilla-central/rev/f195d6de172f
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.