Bug 829817 - Cycle collect nsCSSPageRule. r=dbaron

This commit is contained in:
Andrew McCreight 2013-06-13 15:13:13 -07:00
parent b937e3404f
commit e749b7057e
4 changed files with 37 additions and 5 deletions

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<style>
@page {}
</style>
<script>
function boom()
{
// This shouldn't cause a shutdown leak.
document.styleSheets[0].cssRules[0].style.someExpando = "set an expando to preserve the wrapper";
}
</script>
</head>
<body onload="boom();"></body>
</html>

View File

@ -88,6 +88,7 @@ load 812824.html
load 822842.html
load 822766-1.html
load 827591-1.html
load 829817.html
load 840898.html
load 842134.html
load 862113.html

View File

@ -2261,7 +2261,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCSSKeyframeRule)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCSSKeyframeRule)
if (tmp->mDOMDeclaration) {
tmp->mDOMDeclaration->DropReference();
ImplCycleCollectionUnlink(tmp->mDOMDeclaration);
tmp->mDOMDeclaration = nullptr;
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCSSKeyframeRule)
@ -2744,13 +2744,23 @@ nsCSSPageRule::Clone() const
return clone.forget();
}
NS_IMPL_ADDREF(nsCSSPageRule)
NS_IMPL_RELEASE(nsCSSPageRule)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsCSSPageRule)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCSSPageRule)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsCSSPageRule)
if (tmp->mDOMDeclaration) {
tmp->mDOMDeclaration->DropReference();
tmp->mDOMDeclaration = nullptr;
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsCSSPageRule)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDOMDeclaration)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
DOMCI_DATA(CSSPageRule, nsCSSPageRule)
// QueryInterface implementation for nsCSSPageRule
NS_INTERFACE_MAP_BEGIN(nsCSSPageRule)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCSSPageRule)
NS_INTERFACE_MAP_ENTRY(nsIStyleRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSPageRule)
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRule)

View File

@ -554,7 +554,8 @@ private:
nsCSSPageRule(const nsCSSPageRule& aCopy);
~nsCSSPageRule();
public:
NS_DECL_ISUPPORTS
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsCSSPageRule, nsIDOMCSSPageRule)
// nsIStyleRule methods
#ifdef DEBUG