XPCContext::~XPCContext() { MOZ_COUNT_DTOR(XPCContext); MOZ_ASSERT(JS_GetSecondContextPrivate(mJSContext) == this, "Must match this"); JS_SetSecondContextPrivate(mJSContext, nullptr); // Iterate over our scopes and tell them that we have been destroyed for (PRCList *scopeptr = PR_NEXT_LINK(&mScopes); scopeptr != &mScopes; scopeptr = PR_NEXT_LINK(scopeptr)) { XPCWrappedNativeScope *scope = static_cast<XPCWrappedNativeScope*>(scopeptr); scope->ClearContext(); } }
XPCContext::~XPCContext() { MOZ_COUNT_DTOR(XPCContext); NS_ASSERTION(JS_GetSecondContextPrivate(mJSContext) == this, "Must match this"); JS_SetSecondContextPrivate(mJSContext, nsnull); NS_IF_RELEASE(mException); NS_IF_RELEASE(mSecurityManager); // Iterate over our scopes and tell them that we have been destroyed for (PRCList *scopeptr = PR_NEXT_LINK(&mScopes); scopeptr != &mScopes; scopeptr = PR_NEXT_LINK(scopeptr)) { XPCWrappedNativeScope *scope = static_cast<XPCWrappedNativeScope*>(scopeptr); scope->ClearContext(); } // we do not call JS_RemoveArgumentFormatter because we now only // delete XPCContext *after* the underlying JSContext is dead }