Title: [89706] trunk/Source/WebKit2
- Revision
- 89706
- Author
- [email protected]
- Date
- 2011-06-24 15:03:55 -0700 (Fri, 24 Jun 2011)
Log Message
2011-06-24 Anders Carlsson <[email protected]>
Reviewed by Kevin Decker.
Not possible for plug-ins to override the internal PDF viewer
https://bugs.webkit.org/show_bug.cgi?id=63356
<rdar://problem/9673382>
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame):
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
Pass the entire resource response to shouldUseCustomRepresentationForResponse.
* WebProcess/WebProcess.cpp:
(WebKit::canPluginHandleResponse):
Ask for the plug-in path for a plug-in that can handle the given resource response.
If we fail to send the message, or if the path comes back empty, we assume that there's no plug-in
that can handle it.
(WebKit::WebProcess::shouldUseCustomRepresentationForResponse):
If the response MIME type is in the m_mimeTypesWithCustomRepresentations map, check if there's
a plug-in that can handle the given response. If that is the case, it should have precedence over
the custom representation.
* WebProcess/WebProcess.h:
Rename shouldUseCustomRepresentationForMIMEType to shouldUseCustomRepresentationForResponse.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (89705 => 89706)
--- trunk/Source/WebKit2/ChangeLog 2011-06-24 21:45:16 UTC (rev 89705)
+++ trunk/Source/WebKit2/ChangeLog 2011-06-24 22:03:55 UTC (rev 89706)
@@ -1,3 +1,30 @@
+2011-06-24 Anders Carlsson <[email protected]>
+
+ Reviewed by Kevin Decker.
+
+ Not possible for plug-ins to override the internal PDF viewer
+ https://bugs.webkit.org/show_bug.cgi?id=63356
+ <rdar://problem/9673382>
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame):
+ (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
+ Pass the entire resource response to shouldUseCustomRepresentationForResponse.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::canPluginHandleResponse):
+ Ask for the plug-in path for a plug-in that can handle the given resource response.
+ If we fail to send the message, or if the path comes back empty, we assume that there's no plug-in
+ that can handle it.
+
+ (WebKit::WebProcess::shouldUseCustomRepresentationForResponse):
+ If the response MIME type is in the m_mimeTypesWithCustomRepresentations map, check if there's
+ a plug-in that can handle the given response. If that is the case, it should have precedence over
+ the custom representation.
+
+ * WebProcess/WebProcess.h:
+ Rename shouldUseCustomRepresentationForMIMEType to shouldUseCustomRepresentationForResponse.
+
2011-06-24 Adam Roben <[email protected]>
Mac build fix after r89685
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (89705 => 89706)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2011-06-24 21:45:16 UTC (rev 89705)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2011-06-24 22:03:55 UTC (rev 89706)
@@ -1121,8 +1121,8 @@
WebPage* webPage = m_frame->page();
bool isMainFrame = webPage->mainFrame() == m_frame;
- const String& mimeType = m_frame->coreFrame()->loader()->documentLoader()->response().mimeType();
- m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForMIMEType(mimeType);
+ const ResourceResponse& response = m_frame->coreFrame()->loader()->documentLoader()->response();
+ m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForResponse(response);
}
void WebFrameLoaderClient::transitionToCommittedForNewPage()
@@ -1144,8 +1144,8 @@
// The HistoryController will update the scroll position later if needed.
m_frame->coreFrame()->view()->setActualVisibleContentRect(IntRect(IntPoint::zero(), currentVisibleContentSize));
#else
- const String& mimeType = m_frame->coreFrame()->loader()->documentLoader()->response().mimeType();
- m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForMIMEType(mimeType);
+ const ResourceResponse& response = m_frame->coreFrame()->loader()->documentLoader()->response();
+ m_frameHasCustomRepresentation = isMainFrame && WebProcess::shared().shouldUseCustomRepresentationForResponse(response);
m_frame->coreFrame()->createView(webPage->size(), backgroundColor, false, IntSize(), false);
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (89705 => 89706)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2011-06-24 21:45:16 UTC (rev 89705)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2011-06-24 22:03:55 UTC (rev 89706)
@@ -721,6 +721,25 @@
return result.first->second.get();
}
+static bool canPluginHandleResponse(const ResourceResponse& response)
+{
+ String pluginPath;
+
+ if (!WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPluginPath(response.mimeType(), response.url().string()), Messages::WebContext::GetPluginPath::Reply(pluginPath), 0))
+ return false;
+
+ return !pluginPath.isEmpty();
+}
+
+bool WebProcess::shouldUseCustomRepresentationForResponse(const ResourceResponse& response) const
+{
+ if (!m_mimeTypesWithCustomRepresentations.contains(response.mimeType()))
+ return false;
+
+ // If a plug-in exists that claims to support this response, it should take precedence over the custom representation.
+ return !canPluginHandleResponse(response);
+}
+
void WebProcess::clearResourceCaches(ResourceCachesToClear resourceCachesToClear)
{
platformClearResourceCaches(resourceCachesToClear);
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (89705 => 89706)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2011-06-24 21:45:16 UTC (rev 89705)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2011-06-24 22:03:55 UTC (rev 89706)
@@ -54,6 +54,7 @@
class IntSize;
class PageGroup;
class ResourceRequest;
+ class ResourceResponse;
}
namespace WebKit {
@@ -111,7 +112,7 @@
QNetworkAccessManager* networkAccessManager() { return m_networkAccessManager; }
#endif
- bool shouldUseCustomRepresentationForMIMEType(const String& mimeType) const { return m_mimeTypesWithCustomRepresentations.contains(mimeType); }
+ bool shouldUseCustomRepresentationForResponse(const WebCore::ResourceResponse&) const;
// Text Checking
const TextCheckerState& textCheckerState() const { return m_textCheckerState; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes