mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 273953 Crash during GC after leaving page in URL
patch by dbradley@gmail.com r=jst sr=brendan
This commit is contained in:
parent
9c18978f3a
commit
3a6409e18e
@ -240,7 +240,7 @@ JSBool XPCIDispatchExtension::DefineProperty(XPCCallContext & ccx,
|
||||
if(iface == nsnull)
|
||||
return JS_FALSE;
|
||||
XPCWrappedNativeTearOff* to =
|
||||
wrapperToReflectInterfaceNames->FindTearOff(ccx, iface, JS_TRUE);
|
||||
wrapperToReflectInterfaceNames->LocateTearOff(ccx, iface);
|
||||
if(to == nsnull)
|
||||
return JS_FALSE;
|
||||
// get the JS Object for the tea
|
||||
|
@ -1892,6 +1892,8 @@ public:
|
||||
inline JSBool HasInterfaceNoQI(XPCNativeInterface* aInterface);
|
||||
inline JSBool HasInterfaceNoQI(const nsIID& iid);
|
||||
|
||||
XPCWrappedNativeTearOff* LocateTearOff(XPCCallContext& ccx,
|
||||
XPCNativeInterface* aInterface);
|
||||
XPCWrappedNativeTearOff* FindTearOff(XPCCallContext& ccx,
|
||||
XPCNativeInterface* aInterface,
|
||||
JSBool needJSObject = JS_FALSE,
|
||||
|
@ -1220,6 +1220,34 @@ XPCWrappedNative::ExtendSet(XPCCallContext& ccx, XPCNativeInterface* aInterface)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
XPCWrappedNativeTearOff*
|
||||
XPCWrappedNative::LocateTearOff(XPCCallContext& ccx,
|
||||
XPCNativeInterface* aInterface)
|
||||
{
|
||||
XPCAutoLock al(GetLock()); // hold the lock throughout
|
||||
|
||||
for(
|
||||
XPCWrappedNativeTearOffChunk* chunk = &mFirstChunk;
|
||||
chunk != nsnull;
|
||||
chunk = chunk->mNextChunk)
|
||||
{
|
||||
XPCWrappedNativeTearOff* tearOff = chunk->mTearOffs;
|
||||
XPCWrappedNativeTearOff* const end = tearOff +
|
||||
XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK;
|
||||
for(
|
||||
tearOff = chunk->mTearOffs;
|
||||
tearOff < end;
|
||||
tearOff++)
|
||||
{
|
||||
if(tearOff->GetInterface() == aInterface)
|
||||
{
|
||||
return tearOff;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
XPCWrappedNativeTearOff*
|
||||
XPCWrappedNative::FindTearOff(XPCCallContext& ccx,
|
||||
XPCNativeInterface* aInterface,
|
||||
@ -1239,7 +1267,12 @@ XPCWrappedNative::FindTearOff(XPCCallContext& ccx,
|
||||
lastChunk = chunk, chunk = chunk->mNextChunk)
|
||||
{
|
||||
to = chunk->mTearOffs;
|
||||
for(int i = XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK; i > 0; i--, to++)
|
||||
XPCWrappedNativeTearOff* const end = chunk->mTearOffs +
|
||||
XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK;
|
||||
for(
|
||||
to = chunk->mTearOffs;
|
||||
to < end;
|
||||
to++)
|
||||
{
|
||||
if(to->GetInterface() == aInterface)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user