mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 15:15:23 +00:00
Bug 774104 - Avoid leaks during JS_TransplantObject (r=mccr8)
This commit is contained in:
parent
010c5317a8
commit
167e14d9a8
@ -1573,6 +1573,15 @@ JS_TransplantObject(JSContext *cx, JSObject *origobj, JSObject *target)
|
||||
JS_ASSERT(!IsCrossCompartmentWrapper(origobj));
|
||||
JS_ASSERT(!IsCrossCompartmentWrapper(target));
|
||||
|
||||
/*
|
||||
* Transplantation typically allocates new wrappers in every compartment. If
|
||||
* an incremental GC is active, this causes every compartment to be leaked
|
||||
* for that GC. Hence, we finish any ongoing incremental GC before the
|
||||
* transplant to avoid leaks.
|
||||
*/
|
||||
if (cx->runtime->gcIncrementalState != NO_INCREMENTAL)
|
||||
FinishIncrementalGC(cx->runtime, gcreason::TRANSPLANT);
|
||||
|
||||
JSCompartment *destination = target->compartment();
|
||||
WrapperMap &map = destination->crossCompartmentWrappers;
|
||||
Value origv = ObjectValue(*origobj);
|
||||
|
@ -611,7 +611,7 @@ SizeOfJSContext();
|
||||
D(ALLOC_TRIGGER) \
|
||||
D(DEBUG_GC) \
|
||||
D(DEBUG_MODE_GC) \
|
||||
D(UNUSED3) /* was REFILL */ \
|
||||
D(TRANSPLANT) \
|
||||
\
|
||||
/* Reasons from Firefox */ \
|
||||
D(DOM_WINDOW_UTILS) \
|
||||
|
Loading…
Reference in New Issue
Block a user