Bug 819443 - Make sure we don't finalize on background thread (r=luke)

This commit is contained in:
Bill McCloskey 2012-12-12 13:17:45 -08:00
parent 17f16ce86d
commit bd1e47165c
2 changed files with 7 additions and 0 deletions

View File

@ -482,7 +482,11 @@ struct JSRuntime : js::RuntimeFriendFields
void clearOwnerThread();
void setOwnerThread();
JS_FRIEND_API(void) abortIfWrongThread() const;
#ifdef DEBUG
JS_FRIEND_API(void) assertValidThread() const;
#else
void assertValidThread() const {}
#endif
private:
void *ownerThread_;
public:

View File

@ -225,6 +225,9 @@ JSObject::finalize(js::FreeOp *fop)
js::Probes::finalizeObject(this);
if (!IsBackgroundFinalized(getAllocKind())) {
/* Assert we're on the main thread. */
fop->runtime()->assertValidThread();
/*
* Finalize obj first, in case it needs map and slots. Objects with
* finalize hooks are not finalized in the background, as the class is