Title: [89727] branches/safari-534-branch/Source/WebKit2

Diff

Modified: branches/safari-534-branch/Source/WebKit2/ChangeLog (89726 => 89727)


--- branches/safari-534-branch/Source/WebKit2/ChangeLog	2011-06-25 02:05:09 UTC (rev 89726)
+++ branches/safari-534-branch/Source/WebKit2/ChangeLog	2011-06-25 02:12:10 UTC (rev 89727)
@@ -1,3 +1,34 @@
+2011-06-24  Lucas Forschler  <[email protected]>
+
+    Merged 89706.
+
+    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-22  Lucas Forschler  <[email protected]>
 
     Merged 89436.

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (89726 => 89727)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2011-06-25 02:05:09 UTC (rev 89726)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2011-06-25 02:12:10 UTC (rev 89727)
@@ -1104,8 +1104,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()
@@ -1127,8 +1127,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: branches/safari-534-branch/Source/WebKit2/WebProcess/WebProcess.cpp (89726 => 89727)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebProcess.cpp	2011-06-25 02:05:09 UTC (rev 89726)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebProcess.cpp	2011-06-25 02:12:10 UTC (rev 89727)
@@ -722,6 +722,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: branches/safari-534-branch/Source/WebKit2/WebProcess/WebProcess.h (89726 => 89727)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebProcess.h	2011-06-25 02:05:09 UTC (rev 89726)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebProcess.h	2011-06-25 02:12:10 UTC (rev 89727)
@@ -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

Reply via email to