From 735002051dfb0540908f9b2a6b4ea717c21a6000 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Sat, 19 Jan 2002 20:15:17 +0000 Subject: [PATCH] Fix for 116306, r=dbaron, sr=blake --- content/xul/document/src/nsXULDocument.cpp | 31 +++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index e36f520650e..63946d352c2 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -6465,19 +6465,26 @@ nsXULDocument::AddPrototypeSheets() rv = gXULCache->GetStyleSheet(uri, getter_AddRefs(sheet)); if (NS_FAILED(rv)) return rv; - // 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) - continue; + if (!sheet) { + if (!IsChromeURI(uri)) + continue; + // If the sheet is a chrome URL, then we can refetch the + // sheet synchronously, since we know the sheet is local. + // It's not too late! :) + // Otherwise we just bail. It shouldn't currently + // be possible to get into this situation for any reason + // other than a skin switch anyway (since skin switching is the + // only system that partially invalidates the XUL cache). + // - dwh + PRBool complete; + nsCOMPtr loader; + GetCSSLoader(*getter_AddRefs(loader)); + rv = loader->LoadAgentSheet(uri, *getter_AddRefs(sheet), complete, + nsnull); + if (NS_FAILED(rv)) return rv; + } + nsCOMPtr newsheet; rv = sheet->Clone(*getter_AddRefs(newsheet)); if (NS_FAILED(rv)) return rv;