Closed Bug 580411 Opened 14 years ago Closed 14 years ago

AutoCompartment and JS_Enter/LeaveCrossCompartmentCall should support the trivial case of not changing compartments

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- beta5+

People

(Reporter: jorendorff, Assigned: jorendorff)

References

Details

(Whiteboard: [fixed-in-tracemonkey])

Attachments

(1 file, 1 obsolete file)

Currently, in AutoCompartment's constructor, we have

  JS_ASSERT(origin != destination);

True for wrappers, but there are cases where it's inconvenient and pointless for the caller to ensure that this is true. Instead we should just allow it.
Attached patch v1 (obsolete) — Splinter Review
Assignee: general → jorendorff
Attachment #458840 - Flags: review?(mrbkap)
Comment on attachment 458840 [details] [diff] [review]
v1

> bool
> AutoCompartment::enter()
> {
>     JS_ASSERT(!entered());

Can we check destination against context->compartment and do nothing if they're the same?

>         context->compartment = origin;
>+		return false;

Hard tabs must die!
Attachment #458840 - Flags: review?(mrbkap)
Attached patch v2Splinter Review
Attachment #458840 - Attachment is obsolete: true
Attachment #459385 - Flags: review?(mrbkap)
Attachment #459385 - Flags: review?(mrbkap) → review+
http://hg.mozilla.org/tracemonkey/rev/4fda7181fac5
Whiteboard: [fixed-in-tracemonkey]
Blocks: compartments
blocking2.0: --- → beta5+
http://hg.mozilla.org/mozilla-central/rev/4fda7181fac5
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: