Bug 867487. Make sure we don't think we're cloning a complete sheet when we're actually cloning a loading one because the complete sheet was dirty. r=dbaron

This commit is contained in:
Boris Zbarsky 2013-05-23 09:20:52 -04:00
parent 3f35d84f0a
commit c18bdb2db8
3 changed files with 32 additions and 0 deletions

View File

@ -1105,6 +1105,7 @@ Loader::CreateSheet(nsIURI* aURI,
LOG((" Not cloning completed sheet %p because it's been modified",
sheet.get()));
sheet = nullptr;
fromCompleteSheets = false;
}
}
@ -1166,6 +1167,8 @@ Loader::CreateSheet(nsIURI* aURI,
// later modified we don't end up with two copies of our inner
// hanging around.
URIPrincipalAndCORSModeHashKey key(aURI, aLoaderPrincipal, aCORSMode);
NS_ASSERTION((*aSheet)->IsComplete(),
"Should only be caching complete sheets");
mCompleteSheets.Put(&key, *aSheet);
}
}
@ -1790,6 +1793,8 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
if (cache && cache->IsEnabled()) {
if (!cache->GetStyleSheet(aLoadData->mURI)) {
LOG((" Putting sheet in XUL prototype cache"));
NS_ASSERTION(sheet->IsComplete(),
"Should only be caching complete sheets");
cache->PutStyleSheet(sheet);
}
}
@ -1799,6 +1804,8 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus,
URIPrincipalAndCORSModeHashKey key(aLoadData->mURI,
aLoadData->mLoaderPrincipal,
aLoadData->mSheet->GetCORSMode());
NS_ASSERTION(sheet->IsComplete(),
"Should only be caching complete sheets");
mCompleteSheets.Put(&key, sheet);
#ifdef MOZ_XUL
}

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="data:text/css,">
<script>
function boom()
{
var s = document.styleSheets[0];
var n = s.ownerNode;
var p = n.parentNode;
s.insertRule("#a { }", 0);
for (var i = 0; i < 3; ++i) {
p.removeChild(n);
p.appendChild(n);
}
}
</script>
</head>
<body onload="boom();"></body>
</html>

View File

@ -90,3 +90,4 @@ load 827591-1.html
load 840898.html
load 842134.html
load 862113.html
load 867487.html