Don't call SetSheet with a null sheet. (Bug 645951) r=bzbarsky

This commit is contained in:
L. David Baron 2011-03-29 20:46:12 -07:00
Родитель 340a9e98d8
Коммит b431403ede
5 изменённых файлов: 24 добавлений и 4 удалений

Просмотреть файл

@ -0,0 +1,4 @@
<!DOCTYPE HTML>
<title>Test, bug 645951</title>
<body>
<p style="color: green">Should not crash, and should be green too.</p>

Просмотреть файл

@ -0,0 +1 @@
@import url(chrome:///browser/skin/);

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<title>Test, bug 645951</title>
<link rel=stylesheet href="645951-1.css">
<link id="two" rel=stylesheet href="645951-1.css">
<body onload="run()">
<script>
function run() {
document.getElementById("two").sheet.insertRule("p { color: green}", 1);
}
</script>
<p>Should not crash, and should be green too.</p>

Просмотреть файл

@ -64,3 +64,4 @@ load 592698-1.html
load 601437-1.html
load 601439-1.html
load 605689-1.html
== 645951-1.html 645951-1-ref.html

Просмотреть файл

@ -368,12 +368,15 @@ ImportRule::ImportRule(const ImportRule& aCopy)
: nsCSSRule(aCopy),
mURLSpec(aCopy.mURLSpec)
{
nsRefPtr<nsCSSStyleSheet> sheet;
// Whether or not an @import rule has a null sheet is a permanent
// property of that @import rule, since it is null only if the target
// sheet failed security checks.
if (aCopy.mChildSheet) {
sheet = aCopy.mChildSheet->Clone(nsnull, this, nsnull, nsnull);
nsRefPtr<nsCSSStyleSheet> sheet =
aCopy.mChildSheet->Clone(nsnull, this, nsnull, nsnull);
SetSheet(sheet);
// SetSheet sets mMedia appropriately
}
SetSheet(sheet);
// SetSheet sets mMedia appropriately
}
ImportRule::~ImportRule()