From 4bbdb86a7aca2e03451002bc11da6574527857ce Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Thu, 2 Dec 2004 01:26:20 +0000 Subject: [PATCH] Back out 252703 due to Txul / Ts regression. git-svn-id: svn://10.0.0.236/trunk@166118 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/public/Makefile.in | 1 - .../content/base/src/nsSyncLoadService.cpp | 4 +- .../xbl/src/nsXBLPrototypeResources.cpp | 17 +-- .../document/public/nsIXULPrototypeCache.h | 2 +- .../xul/document/src/nsXULDocument.cpp | 25 +++-- mozilla/layout/base/nsPresShell.cpp | 49 ++++----- mozilla/layout/html/base/src/nsPresShell.cpp | 49 ++++----- mozilla/modules/libjar/nsJARFactory.cpp | 7 -- mozilla/modules/libjar/nsJARURI.cpp | 100 ++---------------- mozilla/modules/libjar/nsJARURI.h | 15 +-- mozilla/netwerk/base/src/nsStandardURL.cpp | 11 +- mozilla/netwerk/base/src/nsStandardURL.h | 3 - mozilla/netwerk/build/nsNetCID.h | 11 -- mozilla/netwerk/build/nsNetModule.cpp | 6 -- .../protocol/res/src/nsResProtocolHandler.cpp | 26 ++--- .../protocol/res/src/nsResProtocolHandler.h | 11 -- mozilla/rdf/chrome/build/nsChromeFactory.cpp | 8 -- mozilla/rdf/chrome/src/Makefile.in | 1 - .../chrome/src/nsChromeProtocolHandler.cpp | 96 ++++++++++++++--- mozilla/rdf/chrome/src/nsChromeRegistry.cpp | 29 +++-- mozilla/xpcom/io/nsFastLoadFile.cpp | 16 +-- 21 files changed, 192 insertions(+), 295 deletions(-) diff --git a/mozilla/content/base/public/Makefile.in b/mozilla/content/base/public/Makefile.in index 7771209d2a9..0ed2b6115b6 100644 --- a/mozilla/content/base/public/Makefile.in +++ b/mozilla/content/base/public/Makefile.in @@ -87,7 +87,6 @@ SDK_XPIDLSRCS = \ XPIDLSRCS = \ nsIChromeRegistry.idl \ - nsIChromeURL.idl \ nsIContentPolicy.idl \ nsISelectionController.idl \ nsISelectionDisplay.idl \ diff --git a/mozilla/content/base/src/nsSyncLoadService.cpp b/mozilla/content/base/src/nsSyncLoadService.cpp index ccd1878db50..3c5031daf9a 100644 --- a/mozilla/content/base/src/nsSyncLoadService.cpp +++ b/mozilla/content/base/src/nsSyncLoadService.cpp @@ -596,7 +596,9 @@ nsSyncLoadService::LoadLocalXBLDocument(nsIChannel* aChannel, nsCOMPtr in; nsresult rv = aChannel->Open(getter_AddRefs(in)); - NS_ENSURE_SUCCESS(rv, rv); + if (NS_FAILED(rv)) { + return rv; + } // Get uri and loadgroup nsCOMPtr docURI; diff --git a/mozilla/content/xbl/src/nsXBLPrototypeResources.cpp b/mozilla/content/xbl/src/nsXBLPrototypeResources.cpp index 6d81866c8ff..4e5087368e8 100644 --- a/mozilla/content/xbl/src/nsXBLPrototypeResources.cpp +++ b/mozilla/content/xbl/src/nsXBLPrototypeResources.cpp @@ -49,7 +49,6 @@ #include "nsICSSLoader.h" #include "nsIURI.h" #include "nsLayoutCID.h" -#include "nsIChromeURL.h" #include "nsCSSRuleProcessor.h" static NS_DEFINE_CID(kCSSLoaderCID, NS_CSS_LOADER_CID); @@ -96,6 +95,14 @@ nsXBLPrototypeResources::AddResourceListener(nsIContent* aBoundElement) mLoader->AddResourceListener(aBoundElement); } +static PRBool IsChromeURI(nsIURI* aURI) +{ + PRBool isChrome=PR_FALSE; + if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) && isChrome) + return PR_TRUE; + return PR_FALSE; +} + nsresult nsXBLPrototypeResources::FlushSkinSheets() { @@ -124,12 +131,8 @@ nsXBLPrototypeResources::FlushSkinSheets() oldSheet->GetSheetURI(getter_AddRefs(uri)); nsCOMPtr newSheet; - nsCOMPtr chromeURL = do_QueryInterface(uri); - if (chromeURL) { - nsCOMPtr newURL; - rv = chromeURL->ReConvert(getter_AddRefs(newURL)); - NS_ENSURE_SUCCESS(rv, rv); - if (NS_FAILED(loader->LoadAgentSheet(newURL, getter_AddRefs(newSheet)))) + if (IsChromeURI(uri)) { + if (NS_FAILED(loader->LoadAgentSheet(uri, getter_AddRefs(newSheet)))) continue; } else { diff --git a/mozilla/content/xul/document/public/nsIXULPrototypeCache.h b/mozilla/content/xul/document/public/nsIXULPrototypeCache.h index f2b260cf637..1a1c45f1a22 100644 --- a/mozilla/content/xul/document/public/nsIXULPrototypeCache.h +++ b/mozilla/content/xul/document/public/nsIXULPrototypeCache.h @@ -128,7 +128,7 @@ const char XUL_FASTLOAD_FILE_BASENAME[] = "XUL"; // Increase the subtractor when changing version, say when changing the // (opaque to FastLoad code) format of JS script, function, regexp, etc. // XDR serializations. -#define XUL_FASTLOAD_FILE_VERSION (0xfeedbeef - 10) +#define XUL_FASTLOAD_FILE_VERSION (0xfeedbeef - 9) #define XUL_SERIALIZATION_BUFFER_SIZE (64 * 1024) #define XUL_DESERIALIZATION_BUFFER_SIZE (8 * 1024) diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index 524e5c6f634..8ba0df23b12 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -116,7 +116,6 @@ #include "nsContentUtils.h" #include "nsIParser.h" #include "nsICSSStyleSheet.h" -#include "nsIChromeURL.h" #include "nsIScriptError.h" //---------------------------------------------------------------------- @@ -3505,13 +3504,25 @@ nsXULDocument::AddPrototypeSheets() PRUint32 count; sheets->Count(&count); for (PRUint32 i = 0; i < count; ++i) { - nsCOMPtr uri = do_QueryElementAt(sheets, i); - if (!uri) { + nsISupports* isupports = sheets->ElementAt(i); + nsCOMPtr uri = do_QueryInterface(isupports); + NS_IF_RELEASE(isupports); + + NS_ASSERTION(uri, "not a URI!!!"); + if (! uri) + return NS_ERROR_UNEXPECTED; + + nsCAutoString spec; + uri->GetAsciiSpec(spec); + + if (!IsChromeURI(uri)) { // These don't get to be in the prototype cache anyway... // and we can't load non-chrome sheets synchronously continue; } + nsCOMPtr sheet; + // 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! :) If we're lucky, the loader will just pull it @@ -3524,13 +3535,7 @@ nsXULDocument::AddPrototypeSheets() //XXXbz we hit this code from fastload all the time. Bug 183505. nsICSSLoader* loader = GetCSSLoader(); NS_ENSURE_TRUE(loader, NS_ERROR_OUT_OF_MEMORY); - - nsCOMPtr newURL; - rv = uri->ReConvert(getter_AddRefs(newURL)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr sheet; - rv = loader->LoadAgentSheet(newURL, getter_AddRefs(sheet)); + rv = loader->LoadAgentSheet(uri, getter_AddRefs(sheet)); // XXXldb We need to prevent bogus sheets from being held in the // prototype's list, but until then, don't propagate the failure // from LoadAgentSheet (and thus exit the loop). diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index b074e5ba7f7..0a5c3d68bfa 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -182,7 +182,6 @@ #endif #include "nsIXBLBinding.h" #include "nsPlaceholderFrame.h" -#include "nsIDOMMutationEvent.h" // Dummy layout request #include "nsDummyLayoutRequest.h" @@ -1379,7 +1378,9 @@ protected: nsresult GetSelectionForCopy(nsISelection** outSelection); nsICSSStyleSheet* mPrefStyleSheet; // mStyleSet owns it but we maintain a ref, may be null +#ifdef DEBUG PRUint32 mUpdateCount; +#endif // normal reflow commands nsVoidArray mReflowCommands; PLDHashTable mReflowCommandTable; @@ -3421,21 +3422,26 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const void PresShell::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType) { +#ifdef DEBUG + mUpdateCount++; +#endif mFrameConstructor->BeginUpdate(); - if (aUpdateType & UPDATE_STYLE) { - ++mUpdateCount; + if (aUpdateType & UPDATE_STYLE) mStyleSet->BeginUpdate(); - } } void PresShell::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType) { +#ifdef DEBUG + NS_PRECONDITION(0 != mUpdateCount, "too many EndUpdate's"); + --mUpdateCount; +#endif + if (aUpdateType & UPDATE_STYLE) { mStyleSet->EndUpdate(); - NS_ASSERTION(0 != mUpdateCount, "too many EndUpdate's"); - if (--mUpdateCount == 0 && mStylesHaveChanged) + if (mStylesHaveChanged) ReconstructStyleData(); } @@ -6027,7 +6033,6 @@ PresShell::GetAgentStyleSheets(nsCOMArray& aSheets) nsresult PresShell::SetAgentStyleSheets(const nsCOMArray& aSheets) { - mStylesHaveChanged = PR_TRUE; return mStyleSet->ReplaceSheets(nsStyleSet::eAgentSheet, aSheets); } @@ -6474,23 +6479,13 @@ ReResolveMenusAndTrees(nsIFrame *aFrame, void *aClosure) } PR_STATIC_CALLBACK(PRBool) -UpdateImageBoxSrcs(nsIFrame *aFrame, void *aClosure) +ReframeImageBoxes(nsIFrame *aFrame, void *aClosure) { - nsPresContext *presContext = NS_STATIC_CAST(nsPresContext*, aClosure); - - nsIContent *content = aFrame->GetContent(); - if (aFrame->GetType() == nsLayoutAtoms::imageBoxFrame && - content->HasAttr(kNameSpaceID_None, nsHTMLAtoms::src)) { - // If it's a chrome URL containing "/skin/", we want the frame to - // reload its image. - nsAutoString attr; - content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, attr); - if (StringBeginsWith(attr, NS_LITERAL_STRING("chrome:")) && - attr.Find("/skin/") != -1) { - aFrame->AttributeChanged(presContext, content, - kNameSpaceID_None, nsHTMLAtoms::src, - nsIDOMMutationEvent::MODIFICATION); - } + nsStyleChangeList *list = NS_STATIC_CAST(nsStyleChangeList*, aClosure); + if (aFrame->GetType() == nsLayoutAtoms::imageBoxFrame) { + list->AppendChange(aFrame, aFrame->GetContent(), + NS_STYLE_HINT_FRAMECHANGE); + return PR_FALSE; // don't walk descendants } return PR_TRUE; // walk descendants } @@ -6547,10 +6542,12 @@ PresShell::Observe(nsISupports* aSubject, WalkFramesThroughPlaceholders(mPresContext, rootFrame, &ReResolveMenusAndTrees, nsnull); - // Allow to be an additional (to stylesheet - // links) entry point into themes, for convenience. + // Because "chrome:" URL equality is messy, reframe image box + // frames (hack!). + nsStyleChangeList changeList; WalkFramesThroughPlaceholders(mPresContext, rootFrame, - UpdateImageBoxSrcs, mPresContext); + ReframeImageBoxes, &changeList); + mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext); mViewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); } diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index b074e5ba7f7..0a5c3d68bfa 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -182,7 +182,6 @@ #endif #include "nsIXBLBinding.h" #include "nsPlaceholderFrame.h" -#include "nsIDOMMutationEvent.h" // Dummy layout request #include "nsDummyLayoutRequest.h" @@ -1379,7 +1378,9 @@ protected: nsresult GetSelectionForCopy(nsISelection** outSelection); nsICSSStyleSheet* mPrefStyleSheet; // mStyleSet owns it but we maintain a ref, may be null +#ifdef DEBUG PRUint32 mUpdateCount; +#endif // normal reflow commands nsVoidArray mReflowCommands; PLDHashTable mReflowCommandTable; @@ -3421,21 +3422,26 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const void PresShell::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType) { +#ifdef DEBUG + mUpdateCount++; +#endif mFrameConstructor->BeginUpdate(); - if (aUpdateType & UPDATE_STYLE) { - ++mUpdateCount; + if (aUpdateType & UPDATE_STYLE) mStyleSet->BeginUpdate(); - } } void PresShell::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType) { +#ifdef DEBUG + NS_PRECONDITION(0 != mUpdateCount, "too many EndUpdate's"); + --mUpdateCount; +#endif + if (aUpdateType & UPDATE_STYLE) { mStyleSet->EndUpdate(); - NS_ASSERTION(0 != mUpdateCount, "too many EndUpdate's"); - if (--mUpdateCount == 0 && mStylesHaveChanged) + if (mStylesHaveChanged) ReconstructStyleData(); } @@ -6027,7 +6033,6 @@ PresShell::GetAgentStyleSheets(nsCOMArray& aSheets) nsresult PresShell::SetAgentStyleSheets(const nsCOMArray& aSheets) { - mStylesHaveChanged = PR_TRUE; return mStyleSet->ReplaceSheets(nsStyleSet::eAgentSheet, aSheets); } @@ -6474,23 +6479,13 @@ ReResolveMenusAndTrees(nsIFrame *aFrame, void *aClosure) } PR_STATIC_CALLBACK(PRBool) -UpdateImageBoxSrcs(nsIFrame *aFrame, void *aClosure) +ReframeImageBoxes(nsIFrame *aFrame, void *aClosure) { - nsPresContext *presContext = NS_STATIC_CAST(nsPresContext*, aClosure); - - nsIContent *content = aFrame->GetContent(); - if (aFrame->GetType() == nsLayoutAtoms::imageBoxFrame && - content->HasAttr(kNameSpaceID_None, nsHTMLAtoms::src)) { - // If it's a chrome URL containing "/skin/", we want the frame to - // reload its image. - nsAutoString attr; - content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, attr); - if (StringBeginsWith(attr, NS_LITERAL_STRING("chrome:")) && - attr.Find("/skin/") != -1) { - aFrame->AttributeChanged(presContext, content, - kNameSpaceID_None, nsHTMLAtoms::src, - nsIDOMMutationEvent::MODIFICATION); - } + nsStyleChangeList *list = NS_STATIC_CAST(nsStyleChangeList*, aClosure); + if (aFrame->GetType() == nsLayoutAtoms::imageBoxFrame) { + list->AppendChange(aFrame, aFrame->GetContent(), + NS_STYLE_HINT_FRAMECHANGE); + return PR_FALSE; // don't walk descendants } return PR_TRUE; // walk descendants } @@ -6547,10 +6542,12 @@ PresShell::Observe(nsISupports* aSubject, WalkFramesThroughPlaceholders(mPresContext, rootFrame, &ReResolveMenusAndTrees, nsnull); - // Allow to be an additional (to stylesheet - // links) entry point into themes, for convenience. + // Because "chrome:" URL equality is messy, reframe image box + // frames (hack!). + nsStyleChangeList changeList; WalkFramesThroughPlaceholders(mPresContext, rootFrame, - UpdateImageBoxSrcs, mPresContext); + ReframeImageBoxes, &changeList); + mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext); mViewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); } diff --git a/mozilla/modules/libjar/nsJARFactory.cpp b/mozilla/modules/libjar/nsJARFactory.cpp index 5a741a98912..d1e33ede7af 100644 --- a/mozilla/modules/libjar/nsJARFactory.cpp +++ b/mozilla/modules/libjar/nsJARFactory.cpp @@ -56,7 +56,6 @@ #include "nsRecyclingAllocator.h" #include "nsXPTZipLoader.h" #include "nsJARProtocolHandler.h" -#include "nsJARURI.h" extern nsRecyclingAllocator *gZlibAllocator; @@ -64,7 +63,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPTZipLoader) NS_GENERIC_FACTORY_CONSTRUCTOR(nsJAR) NS_GENERIC_FACTORY_CONSTRUCTOR(nsZipReaderCache) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsJARProtocolHandler, Init) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsJARURI) // The list of components we register static const nsModuleComponentInfo components[] = @@ -88,11 +86,6 @@ static const nsModuleComponentInfo components[] = NS_JARPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "jar", nsJARProtocolHandlerConstructor - }, - { NS_JARURI_CLASSNAME, // needed only for fastload - NS_JARURI_CID, - nsnull, - nsJARURIConstructor } }; diff --git a/mozilla/modules/libjar/nsJARURI.cpp b/mozilla/modules/libjar/nsJARURI.cpp index 6fe8b207004..646361c5653 100644 --- a/mozilla/modules/libjar/nsJARURI.cpp +++ b/mozilla/modules/libjar/nsJARURI.cpp @@ -46,11 +46,6 @@ #include "nsIZipReader.h" #include "nsReadableUtils.h" #include "nsAutoPtr.h" -#include "nsNetCID.h" -#include "nsIObjectInputStream.h" -#include "nsIObjectOutputStream.h" - -static NS_DEFINE_CID(kJARURICID, NS_JARURI_CID); static NS_DEFINE_CID(kThisImplCID, NS_THIS_JARURI_IMPL_CID); @@ -64,7 +59,6 @@ nsJARURI::~nsJARURI() { } -// XXX Why is this threadsafe? NS_IMPL_THREADSAFE_ADDREF(nsJARURI) NS_IMPL_THREADSAFE_RELEASE(nsJARURI) NS_INTERFACE_MAP_BEGIN(nsJARURI) @@ -73,7 +67,6 @@ NS_INTERFACE_MAP_BEGIN(nsJARURI) NS_INTERFACE_MAP_ENTRY(nsIURL) NS_INTERFACE_MAP_ENTRY(nsIJARURI) NS_INTERFACE_MAP_ENTRY(nsISerializable) - NS_INTERFACE_MAP_ENTRY(nsIClassInfo) // see nsJARURI::Equals if (aIID.Equals(kThisImplCID)) foundInterface = NS_STATIC_CAST(nsIJARURI *, this); @@ -142,98 +135,17 @@ nsJARURI::CreateEntryURL(const nsACString& entryFilename, // nsISerializable methods: NS_IMETHODIMP -nsJARURI::Read(nsIObjectInputStream* aInputStream) +nsJARURI::Read(nsIObjectInputStream* aStream) { - nsresult rv; - - rv = aInputStream->ReadObject(PR_TRUE, getter_AddRefs(mJARFile)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = aInputStream->ReadObject(PR_TRUE, getter_AddRefs(mJAREntry)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = aInputStream->ReadCString(mCharsetHint); - return rv; + NS_NOTREACHED("nsJARURI::Read"); + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP -nsJARURI::Write(nsIObjectOutputStream* aOutputStream) +nsJARURI::Write(nsIObjectOutputStream* aStream) { - nsresult rv; - - rv = aOutputStream->WriteCompoundObject(mJARFile, NS_GET_IID(nsIURI), - PR_TRUE); - NS_ENSURE_SUCCESS(rv, rv); - - rv = aOutputStream->WriteCompoundObject(mJAREntry, NS_GET_IID(nsIURL), - PR_TRUE); - NS_ENSURE_SUCCESS(rv, rv); - - rv = aOutputStream->WriteStringZ(mCharsetHint.get()); - return rv; -} - -//////////////////////////////////////////////////////////////////////////////// -// nsIClassInfo methods: - -NS_IMETHODIMP -nsJARURI::GetInterfaces(PRUint32 *count, nsIID * **array) -{ - *count = 0; - *array = nsnull; - return NS_OK; -} - -NS_IMETHODIMP -nsJARURI::GetHelperForLanguage(PRUint32 language, nsISupports **_retval) -{ - *_retval = nsnull; - return NS_OK; -} - -NS_IMETHODIMP -nsJARURI::GetContractID(char * *aContractID) -{ - *aContractID = nsnull; - return NS_OK; -} - -NS_IMETHODIMP -nsJARURI::GetClassDescription(char * *aClassDescription) -{ - *aClassDescription = nsnull; - return NS_OK; -} - -NS_IMETHODIMP -nsJARURI::GetClassID(nsCID * *aClassID) -{ - *aClassID = (nsCID*) nsMemory::Alloc(sizeof(nsCID)); - if (!*aClassID) - return NS_ERROR_OUT_OF_MEMORY; - return GetClassIDNoAlloc(*aClassID); -} - -NS_IMETHODIMP -nsJARURI::GetImplementationLanguage(PRUint32 *aImplementationLanguage) -{ - *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; - return NS_OK; -} - -NS_IMETHODIMP -nsJARURI::GetFlags(PRUint32 *aFlags) -{ - // XXX We implement THREADSAFE addref/release, but probably shouldn't. - *aFlags = nsIClassInfo::MAIN_THREAD_ONLY; - return NS_OK; -} - -NS_IMETHODIMP -nsJARURI::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) -{ - *aClassIDNoAlloc = kJARURICID; - return NS_OK; + NS_NOTREACHED("nsJARURI::Write"); + return NS_ERROR_NOT_IMPLEMENTED; } //////////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/modules/libjar/nsJARURI.h b/mozilla/modules/libjar/nsJARURI.h index e16698b199f..ee35a3e5f3d 100644 --- a/mozilla/modules/libjar/nsJARURI.h +++ b/mozilla/modules/libjar/nsJARURI.h @@ -41,7 +41,6 @@ #include "nsIJARURI.h" #include "nsISerializable.h" -#include "nsIClassInfo.h" #include "nsCOMPtr.h" #include "nsString.h" @@ -53,18 +52,7 @@ {0xb7, 0x5b, 0xfa, 0x7d, 0x95, 0x70, 0xa6, 0x91} \ } -#define NS_JARURI_CLASSNAME \ - "nsJARURI" -#define NS_JARURI_CID \ -{ /* 245abae2-b947-4ded-a46d-9829d3cca462 */ \ - 0x245abae2, \ - 0xb947, \ - 0x4ded, \ - {0xa4, 0x6d, 0x98, 0x29, 0xd3, 0xcc, 0xa4, 0x62} \ -} - - -class nsJARURI : public nsIJARURI, nsISerializable, nsIClassInfo +class nsJARURI : public nsIJARURI, nsISerializable { public: NS_DECL_ISUPPORTS @@ -72,7 +60,6 @@ public: NS_DECL_NSIURL NS_DECL_NSIJARURI NS_DECL_NSISERIALIZABLE - NS_DECL_NSICLASSINFO // nsJARURI nsJARURI(); diff --git a/mozilla/netwerk/base/src/nsStandardURL.cpp b/mozilla/netwerk/base/src/nsStandardURL.cpp index b7e39b22df2..c7932d1dc10 100644 --- a/mozilla/netwerk/base/src/nsStandardURL.cpp +++ b/mozilla/netwerk/base/src/nsStandardURL.cpp @@ -1511,18 +1511,11 @@ nsStandardURL::SchemeIs(const char *scheme, PRBool *result) return NS_OK; } -/* virtual */ nsStandardURL* -nsStandardURL::StartClone() -{ - nsStandardURL *clone; - NS_NEWXPCOM(clone, nsStandardURL); - return clone; -} - NS_IMETHODIMP nsStandardURL::Clone(nsIURI **result) { - nsStandardURL *clone = StartClone(); + nsStandardURL *clone; + NS_NEWXPCOM(clone, nsStandardURL); if (!clone) return NS_ERROR_OUT_OF_MEMORY; diff --git a/mozilla/netwerk/base/src/nsStandardURL.h b/mozilla/netwerk/base/src/nsStandardURL.h index 0df5454100f..b80c30ff3ab 100644 --- a/mozilla/netwerk/base/src/nsStandardURL.h +++ b/mozilla/netwerk/base/src/nsStandardURL.h @@ -140,9 +140,6 @@ public: /* internal -- HPUX compiler can't handle this being private */ }; friend class nsSegmentEncoder; -protected: - virtual nsStandardURL* StartClone(); - private: PRInt32 Port() { return mPort == -1 ? mDefaultPort : mPort; } diff --git a/mozilla/netwerk/build/nsNetCID.h b/mozilla/netwerk/build/nsNetCID.h index 02a19c36f9e..d8792d59934 100644 --- a/mozilla/netwerk/build/nsNetCID.h +++ b/mozilla/netwerk/build/nsNetCID.h @@ -537,17 +537,6 @@ {0x8c, 0xda, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \ } -#define NS_RESURL_CLASSNAME \ - "nsResURL" -#define NS_RESURL_CID \ -{ /* ff8fe7ec-2f74-4408-b742-6b7a546029a8 */ \ - 0xff8fe7ec, \ - 0x2f74, \ - 0x4408, \ - {0xb7, 0x42, 0x6b, 0x7a, 0x54, 0x60, 0x29, 0xa8} \ -} - - /****************************************************************************** * netwerk/protocol/file/ classes */ diff --git a/mozilla/netwerk/build/nsNetModule.cpp b/mozilla/netwerk/build/nsNetModule.cpp index c42dd21a964..1f5aea02398 100644 --- a/mozilla/netwerk/build/nsNetModule.cpp +++ b/mozilla/netwerk/build/nsNetModule.cpp @@ -195,7 +195,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpDigestAuth) // resource #include "nsResProtocolHandler.h" NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsResProtocolHandler, Init) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsResURL) #endif /////////////////////////////////////////////////////////////////////////////// @@ -928,11 +927,6 @@ static const nsModuleComponentInfo gNetModuleInfo[] = { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "resource", nsResProtocolHandlerConstructor }, - { NS_RESURL_CLASSNAME, // needed only for fastload - NS_RESURL_CID, - nsnull, - nsResURLConstructor - }, #endif // from netwerk/protocol/about (about:blank is mandatory): diff --git a/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp b/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp index 5ea70bc3ef2..93bd3a1c787 100644 --- a/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp +++ b/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.cpp @@ -52,8 +52,6 @@ #include "nsNetUtil.h" #include "nsURLHelper.h" -static NS_DEFINE_CID(kResURLCID, NS_RESURL_CID); - static nsResProtocolHandler *gResHandler = nsnull; #if defined(PR_LOGGING) @@ -76,6 +74,15 @@ static PRLogModuleInfo *gResLog; // nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution //---------------------------------------------------------------------------- +#include "nsStandardURL.h" + +class nsResURL : public nsStandardURL +{ +public: + nsResURL() : nsStandardURL(PR_TRUE) {} + NS_IMETHOD GetFile(nsIFile **); +}; + NS_IMETHODIMP nsResURL::GetFile(nsIFile **result) { @@ -101,21 +108,6 @@ nsResURL::GetFile(nsIFile **result) return rv; } -/* virtual */ nsStandardURL* -nsResURL::StartClone() -{ - nsResURL *clone; - NS_NEWXPCOM(clone, nsResURL); - return clone; -} - -NS_IMETHODIMP -nsResURL::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) -{ - *aClassIDNoAlloc = kResURLCID; - return NS_OK; -} - //---------------------------------------------------------------------------- // nsResProtocolHandler //---------------------------------------------------------------------------- diff --git a/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.h b/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.h index 37ab875718d..b6316b53d54 100644 --- a/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.h +++ b/mozilla/netwerk/protocol/res/src/nsResProtocolHandler.h @@ -45,17 +45,6 @@ #include "nsISupportsArray.h" #include "nsIIOService.h" #include "nsWeakReference.h" -#include "nsStandardURL.h" - -// nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution -class nsResURL : public nsStandardURL -{ -public: - nsResURL() : nsStandardURL(PR_TRUE) {} - NS_IMETHOD GetFile(nsIFile **); - virtual nsStandardURL* StartClone(); - NS_IMETHOD GetClassIDNoAlloc(nsCID *aCID); -}; class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference { diff --git a/mozilla/rdf/chrome/build/nsChromeFactory.cpp b/mozilla/rdf/chrome/build/nsChromeFactory.cpp index a7fb6498290..61b66c2d763 100644 --- a/mozilla/rdf/chrome/build/nsChromeFactory.cpp +++ b/mozilla/rdf/chrome/build/nsChromeFactory.cpp @@ -46,10 +46,8 @@ #include "rdf.h" #include "nsChromeProtocolHandler.h" #include "nsChromeRegistry.h" -#include "nsChromeURL.h" NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsChromeRegistry, Init) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsChromeURL) // The list of components we register static const nsModuleComponentInfo components[] = @@ -64,12 +62,6 @@ static const nsModuleComponentInfo components[] = NS_CHROMEPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "chrome", nsChromeProtocolHandler::Create - }, - - { "Chrome URL", // needed only for fastload - NS_CHROMEURL_CID, - nsnull, - nsChromeURLConstructor } }; diff --git a/mozilla/rdf/chrome/src/Makefile.in b/mozilla/rdf/chrome/src/Makefile.in index a6ebedddb9b..d1621286d4f 100644 --- a/mozilla/rdf/chrome/src/Makefile.in +++ b/mozilla/rdf/chrome/src/Makefile.in @@ -66,7 +66,6 @@ REQUIRES = xpcom \ CPPSRCS = \ nsChromeRegistry.cpp \ - nsChromeURL.cpp \ nsChromeUIDataSource.cpp \ nsChromeProtocolHandler.cpp \ $(NULL) diff --git a/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp b/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp index d0ffa21574b..20d676f9b17 100644 --- a/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp +++ b/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp @@ -43,12 +43,10 @@ #include "nsChromeProtocolHandler.h" #include "nsCOMPtr.h" -#include "nsAutoPtr.h" #include "nsContentCID.h" #include "nsCRT.h" #include "nsIChannel.h" #include "nsIChromeRegistry.h" -#include "nsChromeURL.h" #include "nsIComponentManager.h" #include "nsIEventQueue.h" #include "nsIEventQueueService.h" @@ -63,6 +61,7 @@ #include "nsIObjectOutputStream.h" #include "nsIScriptSecurityManager.h" #include "nsIServiceManager.h" +#include "nsIStandardURL.h" #include "nsIStreamListener.h" #ifdef MOZ_XUL #include "nsIXULPrototypeCache.h" @@ -77,6 +76,7 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); +static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID); #ifdef MOZ_XUL static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID); #endif @@ -571,17 +571,49 @@ nsChromeProtocolHandler::NewURI(const nsACString &aSpec, nsIURI **result) { NS_PRECONDITION(result, "Null out param"); + + nsresult rv; + *result = nsnull; - nsRefPtr url = new nsChromeURL(); - if (!url) - return NS_ERROR_OUT_OF_MEMORY; + // Chrome: URLs (currently) have no additional structure beyond that provided + // by standard URLs, so there is no "outer" given to CreateInstance - nsresult rv = url->Init(aSpec, aCharset, aBaseURI); + nsCOMPtr url(do_CreateInstance(kStandardURLCID, &rv)); if (NS_FAILED(rv)) return rv; - NS_ADDREF(*result = url); + rv = url->Init(nsIStandardURL::URLTYPE_STANDARD, -1, aSpec, aCharset, aBaseURI); + if (NS_FAILED(rv)) + return rv; + + nsCOMPtr uri(do_QueryInterface(url, &rv)); + if (NS_FAILED(rv)) + return rv; + + // Canonify the "chrome:" URL; e.g., so that we collapse + // "chrome://navigator/content/" and "chrome://navigator/content" + // and "chrome://navigator/content/navigator.xul". + + // Try the global cache first. + nsCOMPtr reg = gChromeRegistry; + + // If that fails, the service has not been instantiated yet; let's + // do that now. + if (!reg) { + reg = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv); + if (NS_FAILED(rv)) + return rv; + } + + NS_ASSERTION(reg, "Must have a chrome registry by now"); + + rv = reg->Canonify(uri); + if (NS_FAILED(rv)) + return rv; + + *result = uri; + NS_ADDREF(*result); return NS_OK; } @@ -591,11 +623,29 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, { NS_ENSURE_ARG_POINTER(aURI); NS_PRECONDITION(aResult, "Null out param"); + +#ifdef DEBUG + // Check that the uri we got is already canonified + nsresult debug_rv; + nsCOMPtr debugReg(do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &debug_rv)); + if (NS_SUCCEEDED(debug_rv)) { + nsCOMPtr debugClone; + debug_rv = aURI->Clone(getter_AddRefs(debugClone)); + if (NS_SUCCEEDED(debug_rv)) { + debug_rv = debugReg->Canonify(debugClone); + if (NS_SUCCEEDED(debug_rv)) { + PRBool same; + debug_rv = aURI->Equals(debugClone, &same); + if (NS_SUCCEEDED(debug_rv)) { + NS_ASSERTION(same, "Non-canonified chrome uri passed to nsChromeProtocolHandler::NewChannel!"); + } + } + + } + } +#endif nsresult rv; - nsCOMPtr chromeURL = do_QueryInterface(aURI, &rv); - NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr result; #ifdef MOZ_XUL @@ -633,14 +683,30 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, else #endif { - // Miss. Get the converted URL and do a normal necko load. - nsCOMPtr convertedURI; - chromeURL->GetConvertedURI(getter_AddRefs(convertedURI)); + // Miss. Resolve the chrome URL using the registry and do a + // normal necko load. + //nsXPIDLCString oldSpec; + //aURI->GetSpec(getter_Copies(oldSpec)); + //printf("*************************** %s\n", (const char*)oldSpec); - nsCOMPtr ioServ = do_GetService(kIOServiceCID, &rv); + nsCOMPtr reg = gChromeRegistry; + if (!reg) { + reg = do_GetService(NS_CHROMEREGISTRY_CONTRACTID, &rv); + if (NS_FAILED(rv)) return rv; + } + + nsCAutoString spec; + rv = reg->ConvertChromeURL(aURI, spec); if (NS_FAILED(rv)) return rv; - rv = ioServ->NewChannelFromURI(convertedURI, getter_AddRefs(result)); + nsCOMPtr ioServ(do_GetService(kIOServiceCID, &rv)); + if (NS_FAILED(rv)) return rv; + + nsCOMPtr chromeURI; + rv = ioServ->NewURI(spec, nsnull, nsnull, getter_AddRefs(chromeURI)); + if (NS_FAILED(rv)) return rv; + + rv = ioServ->NewChannelFromURI(chromeURI, getter_AddRefs(result)); if (NS_FAILED(rv)) return rv; // XXX Will be removed someday when we handle remote chrome. diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index b7dc906b1ed..77eafd22df5 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -95,7 +95,6 @@ #include "nsNetCID.h" #include "nsIJARURI.h" #include "nsIFileURL.h" -#include "nsIChromeURL.h" static char kChromePrefix[] = "chrome://"; nsIAtom* nsChromeRegistry::sCPrefix; // atom for "c" @@ -1354,6 +1353,14 @@ nsChromeRegistry::FlushSkinCaches() NS_CHROME_FLUSH_SKINS_TOPIC, nsnull); } +static PRBool IsChromeURI(nsIURI* aURI) +{ + PRBool isChrome=PR_FALSE; + if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) && isChrome) + return PR_TRUE; + return PR_FALSE; +} + // XXXbsmedberg: move this to windowmediator nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow) { @@ -1381,8 +1388,6 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow) if (!document) return NS_OK; - mozAutoDocUpdate update(document, UPDATE_STYLE, PR_TRUE); - // Deal with the agent sheets first. Have to do all the style sets by hand. PRUint32 shellCount = document->GetNumberOfShells(); for (PRUint32 k = 0; k < shellCount; k++) { @@ -1401,15 +1406,10 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow) rv = sheet->GetSheetURI(getter_AddRefs(uri)); if (NS_FAILED(rv)) return rv; - nsCOMPtr chromeURL = do_QueryInterface(uri); - if (chromeURL) { - // Reload the sheet. Recreate the URI since the chrome URL - // caches its resolved form. - nsCOMPtr newURL; - chromeURL->ReConvert(getter_AddRefs(newURL)); - + if (IsChromeURI(uri)) { + // Reload the sheet. nsCOMPtr newSheet; - rv = LoadStyleSheetWithURL(newURL, getter_AddRefs(newSheet)); + rv = LoadStyleSheetWithURL(uri, getter_AddRefs(newSheet)); if (NS_FAILED(rv)) return rv; if (newSheet) { rv = newAgentSheets.AppendObject(newSheet) ? NS_OK : NS_ERROR_FAILURE; @@ -1451,20 +1451,17 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow) rv = sheet->GetSheetURI(getter_AddRefs(uri)); if (NS_FAILED(rv)) return rv; - nsCOMPtr chromeURL = do_QueryInterface(uri); - if (chromeURL) { + if (IsChromeURI(uri)) { // Reload the sheet. #ifdef DEBUG nsCOMPtr oldCSSSheet = do_QueryInterface(sheet); NS_ASSERTION(oldCSSSheet, "Don't know how to reload a non-CSS sheet"); #endif - nsCOMPtr newURL; - chromeURL->ReConvert(getter_AddRefs(newURL)); nsCOMPtr newSheet; // XXX what about chrome sheets that have a title or are disabled? This // only works by sheer dumb luck. // XXXbz this should really use the document's CSSLoader! - LoadStyleSheetWithURL(newURL, getter_AddRefs(newSheet)); + LoadStyleSheetWithURL(uri, getter_AddRefs(newSheet)); // Even if it's null, we put in in there. newSheets.AppendObject(newSheet); } diff --git a/mozilla/xpcom/io/nsFastLoadFile.cpp b/mozilla/xpcom/io/nsFastLoadFile.cpp index 3b96fa5f798..56b09d22f46 100644 --- a/mozilla/xpcom/io/nsFastLoadFile.cpp +++ b/mozilla/xpcom/io/nsFastLoadFile.cpp @@ -2140,10 +2140,8 @@ nsFastLoadFileWriter::WriteObjectCommon(nsISupports* aObject, // updating after reading. oid |= MFL_OBJECT_DEF_TAG; classInfo = do_QueryInterface(aObject); - if (!classInfo) { - NS_NOTREACHED("aObject must implement nsIClassInfo"); + if (!classInfo) return NS_ERROR_FAILURE; - } PRUint32 flags; if (NS_SUCCEEDED(classInfo->GetFlags(&flags)) && @@ -2177,10 +2175,8 @@ nsFastLoadFileWriter::WriteObjectCommon(nsISupports* aObject, if (oid & MFL_OBJECT_DEF_TAG) { nsCOMPtr serializable(do_QueryInterface(aObject)); - if (!serializable) { - NS_NOTREACHED("aObject must implement nsISerializable"); + if (!serializable) return NS_ERROR_FAILURE; - } nsCID slowCID; rv = classInfo->GetClassIDNoAlloc(&slowCID); @@ -2237,15 +2233,13 @@ nsFastLoadFileWriter::WriteCompoundObject(nsISupports* aObject, { nsresult rv; nsCOMPtr rootObject(do_QueryInterface(aObject)); - - // We could assert that |rootObject != aObject|, but that would prevent - // callers who don't know whether they're dealing with the primary - // nsISupports pointer (e.g., they don't know which implementation of - // nsIURI they have) from using this function. #ifdef NS_DEBUG nsCOMPtr roundtrip; rootObject->QueryInterface(aIID, getter_AddRefs(roundtrip)); + + NS_ASSERTION(rootObject.get() != aObject, + "wasteful call to WriteCompoundObject -- call WriteObject!"); NS_ASSERTION(roundtrip.get() == aObject, "bad aggregation or multiple inheritance detected by call to " "WriteCompoundObject!");