Bug 1279618 - Don't touch the js::Class in JSObject::finalize() after having called the finalizer on it; r=jonco

This commit is contained in:
Ehsan Akhgari 2016-06-10 16:49:24 -04:00
parent 6d673a6148
commit 1db86caf2d

View File

@ -78,14 +78,15 @@ JSObject::finalize(js::FreeOp* fop)
#endif
const js::Class* clasp = getClass();
js::NativeObject* nobj = nullptr;
if (clasp->isNative())
nobj = &as<js::NativeObject>();
if (clasp->hasFinalize())
clasp->doFinalize(fop, this);
if (!clasp->isNative())
if (!nobj)
return;
js::NativeObject* nobj = &as<js::NativeObject>();
if (nobj->hasDynamicSlots())
fop->free_(nobj->slots_);