Closed Bug 1131382 Opened 10 years ago Closed 10 years ago

Compartment stats code uses wrong number of compartments

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: billm, Assigned: billm)

References

Details

Attachments

(1 file)

Attached patch comp-statsSplinter Review
We added some code recently to return some information about compartments in the JS engine. Unfortunately, it relies on rt->numCompartments being the same as the number of compartments you get when you use CompartmentsIter. That turns out not to be true since CompartmentsIter skips over ExclusiveContext compartments.
Attachment #8561771 - Flags: review?(luke)
Comment on attachment 8561771 [details] [diff] [review] comp-stats Review of attachment 8561771 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jsapi.cpp @@ +168,5 @@ > > JS_PUBLIC_API(bool) > JS_GetCompartmentStats(JSRuntime *rt, CompartmentStatsVector &stats) > { > + if (!stats.reserve(rt->numCompartments)) Perhaps give a comment explaining the situation for future visitors; or just remove this reserve() since perf doesn't really matter here and you're checking growBy() for failure anyway.
Attachment #8561771 - Flags: review?(luke) → review+
Assignee: nobody → wmccloskey
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: