From b4be13929b1aa12e5d7fce718ef150d27e2083fd Mon Sep 17 00:00:00 2001 From: "jst%mozilla.org" Date: Tue, 18 Mar 2008 00:36:14 +0000 Subject: [PATCH] Fixing bug 395110. Give type attribute higher priority when deciding what plugin to use. r=jonas@sicking.cc, sr=bzbarsky@mit.edu git-svn-id: svn://10.0.0.236/trunk@248034 18797224-902f-48f8-a5cc-f745e15eee43 --- .../base/src/nsObjectLoadingContent.cpp | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/mozilla/content/base/src/nsObjectLoadingContent.cpp b/mozilla/content/base/src/nsObjectLoadingContent.cpp index 561db3a5085..642bc5853d0 100644 --- a/mozilla/content/base/src/nsObjectLoadingContent.cpp +++ b/mozilla/content/base/src/nsObjectLoadingContent.cpp @@ -387,15 +387,25 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, nsISupports *aConte channelType = APPLICATION_OCTET_STREAM; chan->SetContentType(channelType); } - - if (mContentType.IsEmpty() || - !channelType.EqualsASCII(APPLICATION_OCTET_STREAM)) { - mContentType = channelType; - } else { + + // We want to use the channel type unless one of the following is + // true: + // + // 1) The channel type is application/octet-stream and we have a + // type hint + // 2) Our type hint is a type that we support with a plugin. + + if ((channelType.EqualsASCII(APPLICATION_OCTET_STREAM) && + !mContentType.IsEmpty()) || + (IsSupportedPlugin(mContentType) && + GetTypeOfContent(mContentType) == eType_Plugin)) { // Set the type we'll use for dispatch on the channel. Otherwise we could // end up trying to dispatch to a nsFrameLoader, which will complain that // it couldn't find a way to handle application/octet-stream + chan->SetContentType(mContentType); + } else { + mContentType = channelType; } // Now find out what type the content is