mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1131382 - Don't trust numCompartments when getting compartment stats (r=luke)
This commit is contained in:
parent
b56ef398b7
commit
1f4d6cf04f
@ -168,12 +168,11 @@ JS_GetEmptyString(JSRuntime *rt)
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_GetCompartmentStats(JSRuntime *rt, CompartmentStatsVector &stats)
|
||||
{
|
||||
if (!stats.resizeUninitialized(rt->numCompartments))
|
||||
return false;
|
||||
|
||||
size_t pos = 0;
|
||||
for (CompartmentsIter c(rt, WithAtoms); !c.done(); c.next()) {
|
||||
CompartmentTimeStats *stat = &stats[pos];
|
||||
if (!stats.growBy(1))
|
||||
return false;
|
||||
|
||||
CompartmentTimeStats *stat = &stats.back();
|
||||
stat->time = c.get()->totalTime;
|
||||
stat->compartment = c.get();
|
||||
stat->addonId = c.get()->addonId;
|
||||
@ -184,7 +183,6 @@ JS_GetCompartmentStats(JSRuntime *rt, CompartmentStatsVector &stats)
|
||||
} else {
|
||||
strcpy(stat->compartmentName, "<unknown>");
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -774,7 +774,9 @@ struct JSRuntime : public JS::shadow::Runtime,
|
||||
return numExclusiveThreads > 0;
|
||||
}
|
||||
|
||||
/* How many compartments there are across all zones. */
|
||||
// How many compartments there are across all zones. This number includes
|
||||
// ExclusiveContext compartments, so it isn't necessarily equal to the
|
||||
// number of compartments visited by CompartmentsIter.
|
||||
size_t numCompartments;
|
||||
|
||||
/* Locale-specific callbacks for string conversion. */
|
||||
|
Loading…
Reference in New Issue
Block a user