From 4d0463bed4b2ea80fa3a8060c353ded53aa7b0e6 Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Fri, 3 Mar 2000 23:14:09 +0000 Subject: [PATCH] Bug 29148. Don't abort in the case where an invalid stylesheet reference has somehow made it into the prototype document, but the stylesheet was never put into the cache (an empty CSS file will cause this to happen). Instead, just keep on truckin'. r=rjc, a=jar git-svn-id: svn://10.0.0.236/trunk@62168 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/xul/document/src/nsXULDocument.cpp | 13 +++++++++++-- mozilla/rdf/content/src/nsXULDocument.cpp | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index e22e2974ca9..9e8bbcb803b 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -5383,9 +5383,18 @@ nsXULDocument::AddPrototypeSheets() rv = gXULCache->GetStyleSheet(uri, getter_AddRefs(sheet)); if (NS_FAILED(rv)) return rv; - NS_ASSERTION(sheet != nsnull, "uh oh, sheet wasn't in the cache. go reload it"); + // If we don't get a style sheet from the cache, then the + // really rigorous thing to do here would be to go out and try + // to load it again. (This would allow us to do partial + // invalidation of the cache, which would be cool, but would + // also require some more thinking.) + // + // Reality is, we end up in this situation if, when parsing + // the original XUL document, there -was- no style sheet at + // the specified URL, or the stylesheet was empty. So, just + // skip it. if (! sheet) - return NS_ERROR_UNEXPECTED; + continue; nsCOMPtr newsheet; rv = sheet->Clone(*getter_AddRefs(newsheet)); diff --git a/mozilla/rdf/content/src/nsXULDocument.cpp b/mozilla/rdf/content/src/nsXULDocument.cpp index e22e2974ca9..9e8bbcb803b 100644 --- a/mozilla/rdf/content/src/nsXULDocument.cpp +++ b/mozilla/rdf/content/src/nsXULDocument.cpp @@ -5383,9 +5383,18 @@ nsXULDocument::AddPrototypeSheets() rv = gXULCache->GetStyleSheet(uri, getter_AddRefs(sheet)); if (NS_FAILED(rv)) return rv; - NS_ASSERTION(sheet != nsnull, "uh oh, sheet wasn't in the cache. go reload it"); + // If we don't get a style sheet from the cache, then the + // really rigorous thing to do here would be to go out and try + // to load it again. (This would allow us to do partial + // invalidation of the cache, which would be cool, but would + // also require some more thinking.) + // + // Reality is, we end up in this situation if, when parsing + // the original XUL document, there -was- no style sheet at + // the specified URL, or the stylesheet was empty. So, just + // skip it. if (! sheet) - return NS_ERROR_UNEXPECTED; + continue; nsCOMPtr newsheet; rv = sheet->Clone(*getter_AddRefs(newsheet));