diff --git a/layout/style/crashtests/645951-1-ref.html b/layout/style/crashtests/645951-1-ref.html new file mode 100644 index 000000000000..7259e9603db4 --- /dev/null +++ b/layout/style/crashtests/645951-1-ref.html @@ -0,0 +1,4 @@ + +Test, bug 645951 + +

Should not crash, and should be green too.

diff --git a/layout/style/crashtests/645951-1.css b/layout/style/crashtests/645951-1.css new file mode 100644 index 000000000000..25ccf7a26a10 --- /dev/null +++ b/layout/style/crashtests/645951-1.css @@ -0,0 +1 @@ +@import url(chrome:///browser/skin/); diff --git a/layout/style/crashtests/645951-1.html b/layout/style/crashtests/645951-1.html new file mode 100644 index 000000000000..a977e1ed4e03 --- /dev/null +++ b/layout/style/crashtests/645951-1.html @@ -0,0 +1,11 @@ + +Test, bug 645951 + + + + +

Should not crash, and should be green too.

diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list index 3dd7312d0683..9c6dee440893 100644 --- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -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 diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index a90a8507c3e5..b62b88495bac 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -368,12 +368,15 @@ ImportRule::ImportRule(const ImportRule& aCopy) : nsCSSRule(aCopy), mURLSpec(aCopy.mURLSpec) { - nsRefPtr 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 sheet = + aCopy.mChildSheet->Clone(nsnull, this, nsnull, nsnull); + SetSheet(sheet); + // SetSheet sets mMedia appropriately } - SetSheet(sheet); - // SetSheet sets mMedia appropriately } ImportRule::~ImportRule()