зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1025638 - Traverse and unlink nsXBLPrototypeResources members. r=mccr8
This commit is contained in:
Родитель
4c297ef8c0
Коммит
9e3dccff15
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body onload="f()">
|
||||
<div></div>
|
||||
<style>
|
||||
div { color: blue; }
|
||||
</style>
|
||||
<script>
|
||||
function f() {
|
||||
// This should not leak.
|
||||
var div = document.querySelector("div");
|
||||
var shadow = div.createShadowRoot();
|
||||
shadow.innerHTML = '<div><style scoped>p { color: green; }</style>';
|
||||
}
|
||||
</script>
|
||||
</body>
|
|
@ -149,3 +149,4 @@ load 864448.html
|
|||
load 930250.html
|
||||
load 942979.html
|
||||
load 978646.html
|
||||
load 1026714.html
|
||||
|
|
|
@ -51,9 +51,9 @@ TraverseProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClo
|
|||
}
|
||||
|
||||
static PLDHashOperator
|
||||
UnlinkProtoJSObjects(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
|
||||
UnlinkProto(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
|
||||
{
|
||||
aProto->UnlinkJSObjects();
|
||||
aProto->Unlink();
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLDocumentInfo)
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXBLDocumentInfo)
|
||||
if (tmp->mBindingTable) {
|
||||
tmp->mBindingTable->EnumerateRead(UnlinkProtoJSObjects, nullptr);
|
||||
tmp->mBindingTable->EnumerateRead(UnlinkProto, nullptr);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
|
|
@ -155,10 +155,15 @@ nsXBLPrototypeBinding::Traverse(nsCycleCollectionTraversalCallback &cb) const
|
|||
}
|
||||
|
||||
void
|
||||
nsXBLPrototypeBinding::UnlinkJSObjects()
|
||||
nsXBLPrototypeBinding::Unlink()
|
||||
{
|
||||
if (mImplementation)
|
||||
if (mImplementation) {
|
||||
mImplementation->UnlinkJSObjects();
|
||||
}
|
||||
|
||||
if (mResources) {
|
||||
mResources->Unlink();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -241,7 +241,7 @@ public:
|
|||
bool aFirstBinding = false);
|
||||
|
||||
void Traverse(nsCycleCollectionTraversalCallback &cb) const;
|
||||
void UnlinkJSObjects();
|
||||
void Unlink();
|
||||
void Trace(const TraceCallbacks& aCallbacks, void *aClosure) const;
|
||||
|
||||
// Internal member functions.
|
||||
|
|
|
@ -117,10 +117,20 @@ nsXBLPrototypeResources::Write(nsIObjectOutputStream* aStream)
|
|||
}
|
||||
|
||||
void
|
||||
nsXBLPrototypeResources::Traverse(nsCycleCollectionTraversalCallback &cb) const
|
||||
nsXBLPrototypeResources::Traverse(nsCycleCollectionTraversalCallback &cb)
|
||||
{
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "proto mResources mLoader");
|
||||
cb.NoteXPCOMChild(mLoader);
|
||||
|
||||
CycleCollectionNoteChild(cb, mRuleProcessor.get(), "mRuleProcessor");
|
||||
ImplCycleCollectionTraverse(cb, mStyleSheetList, "mStyleSheetList");
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLPrototypeResources::Unlink()
|
||||
{
|
||||
mStyleSheetList.Clear();
|
||||
mRuleProcessor = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -146,8 +156,7 @@ nsXBLPrototypeResources::AppendStyleSheet(CSSStyleSheet* aSheet)
|
|||
void
|
||||
nsXBLPrototypeResources::RemoveStyleSheet(CSSStyleSheet* aSheet)
|
||||
{
|
||||
DebugOnly<bool> found = mStyleSheetList.RemoveElement(aSheet);
|
||||
MOZ_ASSERT(found, "Trying to remove a sheet that does not exist.");
|
||||
mStyleSheetList.RemoveElement(aSheet);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -35,7 +35,8 @@ public:
|
|||
|
||||
nsresult Write(nsIObjectOutputStream* aStream);
|
||||
|
||||
void Traverse(nsCycleCollectionTraversalCallback &cb) const;
|
||||
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
||||
void Unlink();
|
||||
|
||||
void ClearLoader();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче