Commit df5c03c8 authored by bfulgham@apple.com's avatar bfulgham@apple.com

[Windows] Loader is not properly determining supported MIME types

https://bugs.webkit.org/show_bug.cgi?id=120383

Reviewed by Eric Carlson.

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::canShowMIMEType): Modify to ask WebView if it can
display the media type. Use new helper function to avoid converting a String
to BSTR, only to immediatly be converted from BSTR back to String.
(WebFrameLoaderClient::canShowMIMETypeAsHTML): Ditto.
* WebView.cpp:
(WebView::canShowMIMEType): Move logic to a new (similarly named) helper function.
(WebView::canShowMIMETypeAsHTML): Ditto.
* WebView.h: Add declaration for two new helper functions.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154759 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent edd1f691
2013-08-27 Brent Fulgham <bfulgham@apple.com>
[Windows] Loader is not properly determining supported MIME types
https://bugs.webkit.org/show_bug.cgi?id=120383
Reviewed by Eric Carlson.
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::canShowMIMEType): Modify to ask WebView if it can
display the media type. Use new helper function to avoid converting a String
to BSTR, only to immediatly be converted from BSTR back to String.
(WebFrameLoaderClient::canShowMIMETypeAsHTML): Ditto.
* WebView.cpp:
(WebView::canShowMIMEType): Move logic to a new (similarly named) helper function.
(WebView::canShowMIMETypeAsHTML): Ditto.
* WebView.h: Add declaration for two new helper functions.
2013-08-26 Ryosuke Niwa <rniwa@webkit.org>
Another Windows build fix after r154658.
......
......@@ -923,16 +923,14 @@ bool WebFrameLoaderClient::canHandleRequest(const ResourceRequest& request) cons
return WebView::canHandleRequest(request);
}
bool WebFrameLoaderClient::canShowMIMEType(const String& /*MIMEType*/) const
bool WebFrameLoaderClient::canShowMIMEType(const String& mimeType) const
{
notImplemented();
return true;
return m_webFrame->webView()->canShowMIMEType(mimeType);
}
bool WebFrameLoaderClient::canShowMIMETypeAsHTML(const String& /*MIMEType*/) const
bool WebFrameLoaderClient::canShowMIMETypeAsHTML(const String& mimeType) const
{
notImplemented();
return true;
return m_webFrame->webView()->canShowMIMETypeAsHTML(mimeType);
}
bool WebFrameLoaderClient::representationExistsForURLScheme(const String& /*URLScheme*/) const
......
......@@ -111,6 +111,7 @@
#include <WebCore/Logging.h>
#include <WebCore/MIMETypeRegistry.h>
#include <WebCore/MemoryCache.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/Page.h>
#include <WebCore/PageCache.h>
#include <WebCore/PageGroup.h>
......@@ -2530,39 +2531,51 @@ ULONG STDMETHODCALLTYPE WebView::Release(void)
// IWebView --------------------------------------------------------------------
HRESULT STDMETHODCALLTYPE WebView::canShowMIMEType(
/* [in] */ BSTR mimeType,
/* [retval][out] */ BOOL* canShow)
HRESULT WebView::canShowMIMEType(/* [in] */ BSTR mimeType, /* [retval][out] */ BOOL* canShow)
{
String mimeTypeStr = toString(mimeType);
if (!canShow)
return E_POINTER;
*canShow = canShowMIMEType(toString(mimeType));
return S_OK;
}
bool WebView::canShowMIMEType(const String& mimeType)
{
Frame* coreFrame = core(m_mainFrame);
bool allowPlugins = coreFrame && coreFrame->loader().subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin);
*canShow = MIMETypeRegistry::isSupportedImageMIMEType(mimeTypeStr)
|| MIMETypeRegistry::isSupportedNonImageMIMEType(mimeTypeStr);
bool canShow = MIMETypeRegistry::isSupportedImageMIMEType(mimeType)
|| MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)
|| MIMETypeRegistry::isSupportedMediaMIMEType(mimeType);
if (!*canShow && m_page) {
*canShow = (m_page->pluginData().supportsMimeType(mimeTypeStr, PluginData::AllPlugins) && allowPlugins)
|| m_page->pluginData().supportsMimeType(mimeTypeStr, PluginData::OnlyApplicationPlugins);
if (!canShow && m_page) {
canShow = (m_page->pluginData().supportsMimeType(mimeType, PluginData::AllPlugins) && allowPlugins)
|| m_page->pluginData().supportsMimeType(mimeType, PluginData::OnlyApplicationPlugins);
}
if (!*canShow)
*canShow = shouldUseEmbeddedView(mimeTypeStr);
if (!canShow)
canShow = shouldUseEmbeddedView(mimeType);
return canShow;
}
HRESULT WebView::canShowMIMETypeAsHTML(/* [in] */ BSTR mimeType, /* [retval][out] */ BOOL* canShow)
{
if (!canShow)
return E_POINTER;
*canShow = canShowMIMETypeAsHTML(toString(mimeType));
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebView::canShowMIMETypeAsHTML(
/* [in] */ BSTR /*mimeType*/,
/* [retval][out] */ BOOL* canShow)
bool WebView::canShowMIMETypeAsHTML(const String& /*mimeType*/)
{
// FIXME
*canShow = TRUE;
return S_OK;
notImplemented();
return true;
}
HRESULT STDMETHODCALLTYPE WebView::MIMETypesShownAsHTML(
......
......@@ -975,6 +975,9 @@ public:
WebCore::Element* fullScreenElement() const { return m_fullScreenElement.get(); }
#endif
bool canShowMIMEType(const String& mimeType);
bool canShowMIMETypeAsHTML(const String& mimeType);
// Used by TextInputController in DumpRenderTree
HRESULT STDMETHODCALLTYPE setCompositionForTesting(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment