mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 1ca5723f69d4 (bug 1186780) for dom crashes
This commit is contained in:
parent
3c65c2febb
commit
32eafbd4af
@ -28,11 +28,11 @@ DataContainerEvent::DataContainerEvent(EventTarget* aOwner,
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(DataContainerEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(DataContainerEvent, Event)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mData)
|
||||
tmp->mData.Clear();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(DataContainerEvent, Event)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mData)
|
||||
tmp->mData.EnumerateRead(TraverseEntry, &cb);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(DataContainerEvent, Event)
|
||||
@ -81,6 +81,18 @@ DataContainerEvent::SetData(JSContext* aCx, const nsAString& aKey,
|
||||
aRv = SetData(aKey, val);
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
DataContainerEvent::TraverseEntry(const nsAString& aKey,
|
||||
nsIVariant* aDataItem,
|
||||
void* aUserArg)
|
||||
{
|
||||
nsCycleCollectionTraversalCallback *cb =
|
||||
static_cast<nsCycleCollectionTraversalCallback*>(aUserArg);
|
||||
cb->NoteXPCOMChild(aDataItem);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -51,6 +51,9 @@ protected:
|
||||
~DataContainerEvent() {}
|
||||
|
||||
private:
|
||||
static PLDHashOperator
|
||||
TraverseEntry(const nsAString& aKey, nsIVariant* aDataItem, void* aUserArg);
|
||||
|
||||
nsInterfaceHashtable<nsStringHashKey, nsIVariant> mData;
|
||||
};
|
||||
|
||||
|
@ -39,14 +39,42 @@ using namespace mozilla::dom;
|
||||
static const char kXBLCachePrefix[] = "xblcache";
|
||||
|
||||
/* Implementation file */
|
||||
|
||||
static PLDHashOperator
|
||||
TraverseProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
|
||||
{
|
||||
nsCycleCollectionTraversalCallback *cb =
|
||||
static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
|
||||
aProto->Traverse(*cb);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
UnlinkProto(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
|
||||
{
|
||||
aProto->Unlink();
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
struct ProtoTracer
|
||||
{
|
||||
const TraceCallbacks &mCallbacks;
|
||||
void *mClosure;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
TraceProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
|
||||
{
|
||||
ProtoTracer* closure = static_cast<ProtoTracer*>(aClosure);
|
||||
aProto->Trace(closure->mCallbacks, closure->mClosure);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLDocumentInfo)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXBLDocumentInfo)
|
||||
if (tmp->mBindingTable) {
|
||||
for (auto iter = tmp->mBindingTable->ConstIter();
|
||||
!iter.Done(); iter.Next()) {
|
||||
iter.UserData()->Unlink();
|
||||
}
|
||||
tmp->mBindingTable->EnumerateRead(UnlinkProto, nullptr);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
@ -58,19 +86,14 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXBLDocumentInfo)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocument)
|
||||
if (tmp->mBindingTable) {
|
||||
for (auto iter = tmp->mBindingTable->ConstIter();
|
||||
!iter.Done(); iter.Next()) {
|
||||
iter.UserData()->Traverse(cb);
|
||||
}
|
||||
tmp->mBindingTable->EnumerateRead(TraverseProtos, &cb);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXBLDocumentInfo)
|
||||
if (tmp->mBindingTable) {
|
||||
for (auto iter = tmp->mBindingTable->ConstIter();
|
||||
!iter.Done(); iter.Next()) {
|
||||
iter.UserData()->Trace(aCallbacks, aClosure);
|
||||
}
|
||||
ProtoTracer closure = { aCallbacks, aClosure };
|
||||
tmp->mBindingTable->EnumerateRead(TraceProtos, &closure);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
|
@ -343,6 +343,41 @@ protected:
|
||||
void* aArg);
|
||||
};
|
||||
|
||||
class nsCycleCollectionTraversalCallback;
|
||||
|
||||
struct MOZ_STACK_CLASS nsBaseHashtableCCTraversalData
|
||||
{
|
||||
nsBaseHashtableCCTraversalData(nsCycleCollectionTraversalCallback& aCallback,
|
||||
const char* aName,
|
||||
uint32_t aFlags)
|
||||
: mCallback(aCallback)
|
||||
, mName(aName)
|
||||
, mFlags(aFlags)
|
||||
{
|
||||
}
|
||||
|
||||
nsCycleCollectionTraversalCallback& mCallback;
|
||||
const char* mName;
|
||||
uint32_t mFlags;
|
||||
|
||||
};
|
||||
|
||||
template<typename K, typename T>
|
||||
PLDHashOperator
|
||||
ImplCycleCollectionTraverse_EnumFunc(K aKey,
|
||||
T aData,
|
||||
void* aUserData)
|
||||
{
|
||||
nsBaseHashtableCCTraversalData* userData =
|
||||
static_cast<nsBaseHashtableCCTraversalData*>(aUserData);
|
||||
|
||||
CycleCollectionNoteChild(userData->mCallback,
|
||||
aData,
|
||||
userData->mName,
|
||||
userData->mFlags);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
//
|
||||
// nsBaseHashtableET definitions
|
||||
//
|
||||
|
@ -69,9 +69,10 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
|
||||
const char* aName,
|
||||
uint32_t aFlags = 0)
|
||||
{
|
||||
for (auto iter = aField.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
CycleCollectionNoteChild(aCallback, iter.UserData(), aName, aFlags);
|
||||
}
|
||||
nsBaseHashtableCCTraversalData userData(aCallback, aName, aFlags);
|
||||
|
||||
aField.EnumerateRead(ImplCycleCollectionTraverse_EnumFunc<typename K::KeyType, T*>,
|
||||
&userData);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -84,9 +84,10 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
|
||||
const char* aName,
|
||||
uint32_t aFlags = 0)
|
||||
{
|
||||
for (auto iter = aField.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
CycleCollectionNoteChild(aCallback, iter.UserData(), aName, aFlags);
|
||||
}
|
||||
nsBaseHashtableCCTraversalData userData(aCallback, aName, aFlags);
|
||||
|
||||
aField.EnumerateRead(ImplCycleCollectionTraverse_EnumFunc<typename K::KeyType, T*>,
|
||||
&userData);
|
||||
}
|
||||
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user