Bug 752340 - ensure swap preserves finalizerness. r=billm

This commit is contained in:
Andrew McCreight 2012-07-02 20:05:00 -07:00
parent 3240af8316
commit 9b2678f99a

View File

@ -3566,6 +3566,10 @@ JSObject::TradeGuts(JSContext *cx, JSObject *a, JSObject *b, TradeGutsReserved &
bool
JSObject::swap(JSContext *cx, JSObject *other)
{
// Ensure swap doesn't cause a finalizer to not be run.
JS_ASSERT(IsBackgroundAllocKind(getAllocKind()) ==
IsBackgroundAllocKind(other->getAllocKind()));
if (this->compartment() == other->compartment()) {
TradeGutsReserved reserved(cx);
if (!ReserveForTradeGuts(cx, this, other, reserved))