diff -r 79859ed3eea9 -r 919f36ff910f webengine/osswebengine/WebKit/s60/webview/WebPolicyManager.cpp --- a/webengine/osswebengine/WebKit/s60/webview/WebPolicyManager.cpp Tue Aug 31 16:17:46 2010 +0300 +++ b/webengine/osswebengine/WebKit/s60/webview/WebPolicyManager.cpp Wed Sep 01 12:28:30 2010 +0100 @@ -29,15 +29,14 @@ #include "WebUtil.h" #include "StaticObjectsContainer.h" #include "PlugInInfoStore.h" -#include "MimeTypeRegistry.h" -#include +#include "MIMETypeRegistry.h" +#include #include using namespace WebCore; // CONSTANTS const char* typeTextHtml = "text/html"; -const char* typeTextXml = "text/xml"; const char* typeApplicationXhtml = "application/xhtml+xml"; const char* typeTextPlain = "text/plain"; const char* typeApplicationWapXhtml = "application/vnd.wap.xhtml+xml"; @@ -47,6 +46,8 @@ const char* typeSvg = "svg"; _LIT(KPathBegin,""); +_LIT8(KFileSchema, "file://"); +_LIT8(KFileSchemaUnixStyle, "file:///"); WebPolicyManager::WebPolicyManager(WebFrameLoaderClient* webFrameLoaderClient) : m_webFrameLoaderClient(webFrameLoaderClient) @@ -161,8 +162,7 @@ if (MIMEType == typeTextHtml || MIMEType == typeApplicationXhtml || MIMEType == typeApplicationWapXhtml || - MIMEType == typeMultipartMixed || - MIMEType == typeTextXml) { + MIMEType == typeMultipartMixed) { found = true; } //Check if the image type can be handled by the browser. If not @@ -181,8 +181,19 @@ else if( MIMEType == typeTextPlain || MIMEType == typeApplicationOctetStream ) { TPtrC8 url = (core(m_webFrameLoaderClient->webFrame()))->loader()->activeDocumentLoader()->responseURL().des(); + //Converting TPtrC8 to TPtr8 as Delete() is supported in TPtr8. + HBufC8* lUrl = HBufC8::NewLC(url.Length()); + lUrl->Des().Copy( url ); + TPtr8 tempurl = lUrl->Des(); + //Truncate file:// or file:///(Unix style) from the URI as the path + //file:\\c:\\...\\... is not recognised as a valid path by TUriParser + if(url.FindF(KFileSchema)!= KErrNotFound) + tempurl.Delete(0,KFileSchema().Length()); + else if(url.FindF(KFileSchemaUnixStyle)!= KErrNotFound) + tempurl.Delete(0,KFileSchemaUnixStyle().Length()); + TUriParser8 parser; - if( parser.Parse(url) == KErrNone ) { + if( parser.Parse(tempurl) == KErrNone ) { TPtrC8 path = parser.Extract( EUriPath ); // path == 1 means only / (no filename) if( path.Length() > 1 ) { @@ -194,6 +205,7 @@ path.Find(_L8(".txt")) != KErrNotFound); } } + CleanupStack::PopAndDestroy(lUrl); } // tot:fixme defaultcontenthandler is only for selfdownloadable, go through the list return found;