diff --git a/mozilla/js/src/xpconnect/src/xpccomponents.cpp b/mozilla/js/src/xpconnect/src/xpccomponents.cpp index 65177dc2408..13bcd746b92 100644 --- a/mozilla/js/src/xpconnect/src/xpccomponents.cpp +++ b/mozilla/js/src/xpconnect/src/xpccomponents.cpp @@ -1553,6 +1553,12 @@ nsXPCComponents::nsXPCComponents() } nsXPCComponents::~nsXPCComponents() +{ + ClearMembers(); +} + +void +nsXPCComponents::ClearMembers() { NS_IF_RELEASE(mInterfaces); NS_IF_RELEASE(mClasses); diff --git a/mozilla/js/src/xpconnect/src/xpcprivate.h b/mozilla/js/src/xpconnect/src/xpcprivate.h index 193f4bc898a..bfe0ff09df7 100644 --- a/mozilla/js/src/xpconnect/src/xpcprivate.h +++ b/mozilla/js/src/xpconnect/src/xpcprivate.h @@ -2808,10 +2808,13 @@ public: XPCWrappedNativeScope* aScope, JSObject* aGlobal); + void SystemIsBeingShutDown() {ClearMembers();} + virtual ~nsXPCComponents(); private: nsXPCComponents(); + void ClearMembers(); private: nsXPCComponents_Interfaces* mInterfaces; diff --git a/mozilla/js/src/xpconnect/src/xpcwrappednativescope.cpp b/mozilla/js/src/xpconnect/src/xpcwrappednativescope.cpp index f84ad357706..fd3755ecd5d 100644 --- a/mozilla/js/src/xpconnect/src/xpcwrappednativescope.cpp +++ b/mozilla/js/src/xpconnect/src/xpcwrappednativescope.cpp @@ -431,6 +431,10 @@ XPCWrappedNativeScope::SystemIsBeingShutDown(XPCCallContext& ccx) for(cur = gDyingScopes; cur; cur = cur->mNext) { + // Give the Components object a chance to try to clean up. + if(cur->mComponents) + cur->mComponents->SystemIsBeingShutDown(); + // Walk the protos first. Wrapper shutdown can leave dangling // proto pointers in the proto map. cur->mWrappedNativeProtoMap->