Closed Bug 326693 Opened 20 years ago Closed 20 years ago

filechannel ignores content type hint

Categories

(Core :: Networking: File, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: timeless, Assigned: Biesinger)

Details

Attachments

(1 file, 3 obsolete files)

03 xpcom_core!NSGlue_Warning(char * aStr = 0x021a5fa0 "NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed", char * aFile = 0x021a5f60 "r:/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp", int aLine = 526)+0x51 (FPO: [Non-Fpo]) (CONV: fastcall) [r:\mozilla\dbg-i686-pc-cygwin\xpcom\build\nsdebug.cpp @ 102] 04 docshell!nsExternalHelperAppService::InitDataSource(void)+0xd8 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\uriloader\exthandler\nsexternalhelperappservice.cpp @ 526] 05 docshell!nsExternalHelperAppService::GetTypeFromDS(class nsACString_internal * aExtension = 0x0012e2d0, class nsACString_internal * aType = 0x0012e3cc)+0x1a (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\uriloader\exthandler\nsexternalhelperappservice.cpp @ 952] 06 docshell!nsExternalHelperAppService::GetTypeFromExtension(class nsACString_internal * aFileExt = 0x0012e2d0, class nsACString_internal * aContentType = 0x0012e3cc)+0x6c (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\uriloader\exthandler\nsexternalhelperappservice.cpp @ 2652] 07 docshell!nsExternalHelperAppService::GetTypeFromFile(class nsIFile * aFile = 0x02311870, class nsACString_internal * aContentType = 0x0012e3cc)+0x140 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\uriloader\exthandler\nsexternalhelperappservice.cpp @ 2807] 08 necko!MakeFileInputStream(class nsIFile * file = 0x02311870, class nsCOMPtr<nsIInputStream> * stream = 0x0012e430, class nsCString * contentType = 0x0012e3cc)+0x117 (FPO: [Non-Fpo]) (CONV: cdecl) [r:\mozilla\netwerk\protocol\file\src\nsfilechannel.cpp @ 300] 09 necko!nsFileChannel::OpenContentStream(int async = 0, class nsIInputStream ** result = 0x0012e4a8)+0x263 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\netwerk\protocol\file\src\nsfilechannel.cpp @ 342] 0a necko!nsBaseChannel::Open(class nsIInputStream ** result = 0x0012e4a8)+0x7c (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\netwerk\base\src\nsbasechannel.cpp @ 428] 0b i18n!nsStringBundle::LoadProperties(void)+0x196 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\intl\strres\src\nsstringbundle.cpp @ 134] 0c i18n!nsStringBundle::GetStringFromName(unsigned short * aName = 0x0012e5e8 "iso-8859-1.LangGroup", unsigned short ** aResult = 0x0012e690)+0x63 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\intl\strres\src\nsstringbundle.cpp @ 279] 0d i18n!nsExtensibleStringBundle::GetStringFromName(unsigned short * aName = 0x0012e5e8 "iso-8859-1.LangGroup", unsigned short ** aResult = 0x0012e690)+0x61 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\intl\strres\src\nsstringbundle.cpp @ 496] 0e uconv!nsCharsetConverterManager::GetBundleValue(class nsIStringBundle * aBundle = 0x02311200, char * aName = 0x0012e7a4 "ISO-8859-1", class nsString * aProp = 0x0012e6c4, unsigned short ** aResult = 0x0012e690)+0x66 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\intl\uconv\src\nscharsetconvertermanager.cpp @ 145] 0f uconv!nsCharsetConverterManager::GetBundleValue(class nsIStringBundle * aBundle = 0x02311200, char * aName = 0x0012e7a4 "ISO-8859-1", class nsString * aProp = 0x0012e6c4, class nsAString_internal * aResult = 0x0012e6d8)+0x44 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\intl\uconv\src\nscharsetconvertermanager.cpp @ 156] 10 uconv!nsCharsetConverterManager::GetCharsetLangGroupRaw(char * aCharset = 0x0012e7a4 "ISO-8859-1", class nsIAtom ** aResult = 0x0012e814)+0x9f (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\intl\uconv\src\nscharsetconvertermanager.cpp @ 460] 11 uconv!nsCharsetConverterManager::GetCharsetLangGroup(char * aCharset = 0x022607a0 "ISO-8859-1", class nsIAtom ** aResult = 0x0012e814)+0x59 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\intl\uconv\src\nscharsetconvertermanager.cpp @ 439] 12 i18n!nsLanguageAtomService::LookupCharSet(char * aCharSet = 0x022607a0 "ISO-8859-1", unsigned int * aError = 0x00000000)+0xa5 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\intl\locale\src\nslanguageatomservice.cpp @ 140] 13 gklayout!nsPresContext::UpdateCharSet(class nsCString * aCharSet = 0x02260540)+0x6d (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\layout\base\nsprescontext.cpp @ 791] 14 gklayout!nsPresContext::SetShell(class nsIPresShell * aShell = 0x02310d10)+0x143 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\layout\base\nsprescontext.cpp @ 784] 15 gklayout!PresShell::Init(class nsIDocument * aDocument = 0x02260518, class nsPresContext * aPresContext = 0x02271410, class nsIViewManager * aViewManager = 0x022f3e98, class nsStyleSet * aStyleSet = 0x02304850, nsCompatibility aCompatMode = eCompatibility_NavQuirks (3))+0x184 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\layout\base\nspresshell.cpp @ 1674] 16 gklayout!nsDocument::doCreateShell(class nsPresContext * aContext = 0x02271410, class nsIViewManager * aViewManager = 0x022f3e98, class nsStyleSet * aStyleSet = 0x02304850, nsCompatibility aCompatMode = eCompatibility_NavQuirks (3), class nsIPresShell ** aInstancePtrResult = 0x0226abe0)+0xd6 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\content\base\src\nsdocument.cpp @ 1506] 17 gklayout!nsHTMLDocument::CreateShell(class nsPresContext * aContext = 0x02271410, class nsIViewManager * aViewManager = 0x022f3e98, class nsStyleSet * aStyleSet = 0x02304850, class nsIPresShell ** aInstancePtrResult = 0x0226abe0)+0x29 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\content\html\document\src\nshtmldocument.cpp @ 454] 18 gklayout!DocumentViewerImpl::InitPresentationStuff(int aDoInitialReflow = 0)+0xcb (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\layout\base\nsdocumentviewer.cpp @ 653] 19 gklayout!DocumentViewerImpl::InitInternal(class nsIWidget * aParentWidget = 0x00d46974, class nsISupports * aState = 0x00000000, class nsIDeviceContext * aDeviceContext = 0x02262e70, struct nsRect * aBounds = 0x0012ecf4, int aDoCreation = 1, int aInPrintPreview = 0)+0x354 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\layout\base\nsdocumentviewer.cpp @ 861] 1a gklayout!DocumentViewerImpl::Init(class nsIWidget * aParentWidget = 0x00d46974, class nsIDeviceContext * aDeviceContext = 0x02262e70, struct nsRect * aBounds = 0x0012ecf4)+0x1d (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\layout\base\nsdocumentviewer.cpp @ 641] 1b docshell!nsDocShell::SetupNewViewer(class nsIContentViewer * aNewViewer = 0x0226aba8)+0xe61 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\docshell\base\nsdocshell.cpp @ 6041] 1c docshell!nsDocShell::Embed(class nsIContentViewer * aContentViewer = 0x0226aba8, char * aCommand = 0x0219e3ad "", class nsISupports * aExtraInfo = 0x00000000)+0x35 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\docshell\base\nsdocshell.cpp @ 4632] 1d docshell!nsDocShell::CreateAboutBlankContentViewer(void)+0x39f (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\docshell\base\nsdocshell.cpp @ 4987] 1e docshell!nsDocShell::EnsureContentViewer(void)+0x36 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\docshell\base\nsdocshell.cpp @ 4894] 1f docshell!nsDocShell::GetInterface(struct nsID * aIID = 0x01680628, void ** aSink = 0x0012ef2c)+0x139 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\docshell\base\nsdocshell.cpp @ 420] 20 docshell!nsWebShell::GetInterface(struct nsID * aIID = 0x01680628, void ** aInstancePtr = 0x0012ef2c)+0xac (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\docshell\base\nswebshell.cpp @ 440] 21 xpcom_core!nsGetInterface::operator()(struct nsID * aIID = 0x01680628, void ** aInstancePtr = 0x0012ef2c)+0x60 (FPO: [Non-Fpo]) (CONV: fastcall) [r:\mozilla\dbg-i686-pc-cygwin\xpcom\build\nsiinterfacerequestorutils.cpp @ 52] 22 gklayout!nsCOMPtr<nsIDOMDocument>::assign_from_helper(class nsCOMPtr_helper * helper = 0x0012ef50, struct nsID * aIID = 0x01680628)+0x1a (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\dbg-i686-pc-cygwin\dist\include\xpcom\nscomptr.h @ 1292] 23 gklayout!nsCOMPtr<nsIDOMDocument>::nsCOMPtr<nsIDOMDocument>(class nsCOMPtr_helper * helper = 0x0012ef50)+0x22 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\dbg-i686-pc-cygwin\dist\include\xpcom\nscomptr.h @ 695] 24 gklayout!nsGlobalWindow::GetDocument(class nsIDOMDocument ** aDocument = 0x0012ef90)+0x41 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\dom\src\base\nsglobalwindow.cpp @ 1856] 25 gklayout!nsDataDocumentContentPolicy::ShouldLoad(unsigned int aContentType = 6, class nsIURI * aContentLocation = 0x00d49988, class nsIURI * aRequestingLocation = 0x00000000, class nsISupports * aRequestingContext = 0x00d4b29c, class nsACString_internal * aMimeGuess = 0x0055d654, class nsISupports * aExtra = 0x00000000, short * aDecision = 0x0012f450)+0xb8 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\content\base\src\nsdatadocumentcontentpolicy.cpp @ 65] 26 gklayout!nsContentPolicy::CheckPolicy(<function> * policyMethod = 0x012e3760, unsigned int contentType = 6, class nsIURI * contentLocation = 0x00d49988, class nsIURI * requestingLocation = 0x00000000, class nsISupports * requestingContext = 0x00d4b29c, class nsACString_internal * mimeType = 0x0055d654, class nsISupports * extra = 0x00000000, short * decision = 0x0012f450)+0x307 (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\content\base\src\nscontentpolicy.cpp @ 217] 27 gklayout!nsContentPolicy::ShouldLoad(unsigned int contentType = 6, class nsIURI * contentLocation = 0x00d49988, class nsIURI * requestingLocation = 0x00000000, class nsISupports * requestingContext = 0x00d4b29c, class nsACString_internal * mimeType = 0x0055d654, class nsISupports * extra = 0x00000000, short * decision = 0x0012f450)+0x56 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\content\base\src\nscontentpolicy.cpp @ 278] 28 docshell!NS_CheckContentLoadPolicy(unsigned int contentType = 6, class nsIURI * contentLocation = 0x00d49988, class nsIURI * requestOrigin = 0x00000000, class nsISupports * context = 0x00d4b29c, class nsACString_internal * mimeType = 0x0055d654, class nsISupports * extra = 0x00000000, short * decision = 0x0012f450, class nsIContentPolicy * policyService = 0x00000000)+0xa5 (FPO: [Non-Fpo]) (CONV: cdecl) [r:\mozilla\dbg-i686-pc-cygwin\dist\include\content\nscontentpolicyutils.h @ 180] 29 docshell!nsDocShell::InternalLoad(class nsIURI * aURI = 0x00d49988, class nsIURI * aReferrer = 0x00000000, class nsISupports * aOwner = 0x00000000, unsigned int aFlags = 1, unsigned short * aWindowTarget = 0x00ce8818 "", char * aTypeHint = 0x00000000 "", class nsIInputStream * aPostData = 0x00000000, class nsIInputStream * aHeadersData = 0x00000000, unsigned int aLoadType = 1, class nsISHEntry * aSHEntry = 0x00000000, int aFirstParty = 1, class nsIDocShell ** aDocShell = 0x00000000, class nsIRequest ** aRequest = 0x00000000)+0x244 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\docshell\base\nsdocshell.cpp @ 6314] 2a docshell!nsDocShell::LoadURI(class nsIURI * aURI = 0x00d49988, class nsIDocShellLoadInfo * aLoadInfo = 0x0225f118, unsigned int aLoadFlags = 0, int aFirstParty = 1)+0x8c7 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\docshell\base\nsdocshell.cpp @ 819] 2b embedcomponents!nsWindowWatcher::OpenWindowJS(class nsIDOMWindow * aParent = 0x00000000, char * aUrl = 0x00d47b48 "chrome://communicator/content/profile/profileSelection.xul", char * aName = 0x0200d4c4 "_blank", char * aFeatures = 0x0200d0c8 "centerscreen,chrome,modal,titlebar", int aDialog = 1, unsigned int argc = 1, long * argv = 0x00d42d20, class nsIDOMWindow ** _retval = 0x0012faac)+0x149f (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\embedding\components\windowwatcher\src\nswindowwatcher.cpp @ 811] 2c embedcomponents!nsWindowWatcher::OpenWindow(class nsIDOMWindow * aParent = 0x00000000, char * aUrl = 0x00d47b48 "chrome://communicator/content/profile/profileSelection.xul", char * aName = 0x0200d4c4 "_blank", char * aFeatures = 0x0200d0c8 "centerscreen,chrome,modal,titlebar", class nsISupports * aArguments = 0x00d47bf0, class nsIDOMWindow ** _retval = 0x0012faac)+0x76 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\embedding\components\windowwatcher\src\nswindowwatcher.cpp @ 474] 2d profile!nsProfile::LoadDefaultProfileDir(class nsCString * profileURLStr = 0x0012fd74, int canInteract = 1)+0x51a (FPO: [Non-Fpo]) (CONV: thiscall) [r:\mozilla\profile\src\nsprofile.cpp @ 538] 2e profile!nsProfile::StartupWithArgs(class nsICmdLineService * cmdLineArgs = 0x00d05dc0, int canInteract = 1)+0xa5 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\profile\src\nsprofile.cpp @ 352] 2f appcomps!nsAppStartup::DoProfileStartup(class nsICmdLineService * aCmdLineService = 0x00d05dc0, int canInteract = 1)+0x89 (FPO: [Non-Fpo]) (CONV: stdcall) [r:\mozilla\xpfe\components\startup\src\nsappstartup.cpp @ 169] 30 seamonkey!InitializeProfileService(class nsICmdLineService * cmdLineArgs = 0x00d05dc0)+0x13e (FPO: [Non-Fpo]) (CONV: cdecl) [r:\mozilla\xpfe\bootstrap\nsapprunner.cpp @ 900] 31 seamonkey!main1(int argc = 1, char ** argv = 0x003484f8, class nsISupports * nativeApp = 0x00c85fe0)+0x879 (FPO: [Non-Fpo]) (CONV: cdecl) [r:\mozilla\xpfe\bootstrap\nsapprunner.cpp @ 1165] 32 seamonkey!main(int argc = 1, char ** argv = 0x003484f8)+0x1bb (FPO: [Non-Fpo]) (CONV: cdecl) [r:\mozilla\xpfe\bootstrap\nsapprunner.cpp @ 1750] 33 seamonkey!mainCRTStartup(void)+0x12c (FPO: [Non-Fpo]) (CONV: cdecl) [f:\vs70builds\3077\vc\crtbld\crt\src\crtexe.c @ 398] 34 kernel32!BaseProcessStart+0x23 (FPO: [Non-Fpo])
Attached patch testcase (obsolete) — Splinter Review
Assignee: darin → cbiesinger
Status: NEW → ASSIGNED
Attachment #211592 - Flags: review?(darin)
Attached patch patch (obsolete) — Splinter Review
Attachment #211593 - Flags: superreview?(darin)
Attachment #211593 - Flags: review?(darin)
OS: Windows XP → All
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha
Severity: normal → major
Attached patch testcase v2 (obsolete) — Splinter Review
now tests all three cases
Attachment #211592 - Attachment is obsolete: true
Attachment #211594 - Flags: review?(darin)
Attachment #211592 - Flags: review?(darin)
Comment on attachment 211593 [details] [diff] [review] patch >Index: base/src/nsBaseChannel.cpp >+PRBool >+nsBaseChannel::HaveTypeHint() const { >+ return !mContentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE); >+} nit: consider implementing this inline in the header file. >Index: base/src/nsBaseChannel.h >+ // Tests whether a type hint was set. Subclasses can use this to decide >+ // whether to call SetContentType. >+ // NOTE: This is only reliable if the subclass didn't itself call >+ // SetContentType, and should also not be called after OpenContentStream. >+ PRBool HaveTypeHint() const; nit: I think that "HasContentTypeHint()" might be a better name. It may also be worth it to put in some NS_ASSERTION to catch cases where this method is used after OpenContentStream. Maybe you can test IsPending? r+sr=darin
Attachment #211593 - Flags: superreview?(darin)
Attachment #211593 - Flags: superreview+
Attachment #211593 - Flags: review?(darin)
Attachment #211593 - Flags: review+
(In reply to comment #4) > nit: consider implementing this inline in the header file. I actually did consider that, but that means the header file would have to include nsMimeTypes.h, and I wanted to avoid adding includes. > nit: I think that "HasContentTypeHint()" might be a better name. > > It may also be worth it to put in some NS_ASSERTION to catch cases where > this method is used after OpenContentStream. Maybe you can test IsPending? good idea, will do that.
Attachment #211594 - Flags: review?(darin) → review+
Attached patch final patchSplinter Review
Attachment #211593 - Attachment is obsolete: true
Attachment #211594 - Attachment is obsolete: true
Checking in netwerk/base/src/nsBaseChannel.cpp; /cvsroot/mozilla/netwerk/base/src/nsBaseChannel.cpp,v <-- nsBaseChannel.cpp new revision: 1.2; previous revision: 1.1 done Checking in netwerk/base/src/nsBaseChannel.h; /cvsroot/mozilla/netwerk/base/src/nsBaseChannel.h,v <-- nsBaseChannel.h new revision: 1.3; previous revision: 1.2 done Checking in netwerk/protocol/file/src/nsFileChannel.cpp; /cvsroot/mozilla/netwerk/protocol/file/src/nsFileChannel.cpp,v <-- nsFileChannel.cpp new revision: 1.157; previous revision: 1.156 done Checking in netwerk/protocol/file/src/nsFileChannel.h; /cvsroot/mozilla/netwerk/protocol/file/src/nsFileChannel.h,v <-- nsFileChannel.h new revision: 1.65; previous revision: 1.64 done Checking in netwerk/test/unit/test_file_protocol.js; /cvsroot/mozilla/netwerk/test/unit/test_file_protocol.js,v <-- test_file_protocol.js new revision: 1.2; previous revision: 1.1 done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: