Diff
Modified: branches/safari-534.52-branch/Source/WebCore/ChangeLog (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebCore/ChangeLog 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebCore/ChangeLog 2011-10-27 17:54:54 UTC (rev 98605)
@@ -1,5 +1,18 @@
2011-10-27 Lucas Forschler <lforsch...@apple.com>
+ Merge 98503
+
+ 2011-10-25 Alexey Proskuryakov <a...@apple.com>
+
+ Embedded PDFs should be known to DocumentLoader
+ https://bugs.webkit.org/show_bug.cgi?id=70864
+
+ Reviewed by Darin Adler.
+
+ * WebCore.exp.in: Added exports.
+
+2011-10-27 Lucas Forschler <lforsch...@apple.com>
+
Merge 98304
2011-10-24 Anders Carlsson <ander...@apple.com>
Modified: branches/safari-534.52-branch/Source/WebCore/WebCore.exp.in (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebCore/WebCore.exp.in 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebCore/WebCore.exp.in 2011-10-27 17:54:54 UTC (rev 98605)
@@ -284,6 +284,7 @@
__ZN7WebCore12RenderWidget19showSubstituteImageEN3WTF10PassRefPtrINS_5ImageEEE
__ZN7WebCore12RenderWidget28resumeWidgetHierarchyUpdatesEv
__ZN7WebCore12RenderWidget29suspendWidgetHierarchyUpdatesEv
+__ZN7WebCore12SharedBuffer10wrapCFDataEPK8__CFData
__ZN7WebCore12SharedBuffer10wrapNSDataEP6NSData
__ZN7WebCore12SharedBuffer12createNSDataEv
__ZN7WebCore12SharedBuffer24createWithContentsOfFileERKN3WTF6StringE
@@ -554,7 +555,11 @@
__ZN7WebCore19TextResourceDecoderD1Ev
__ZN7WebCore19applicationIsSafariEv
__ZN7WebCore20RenderEmbeddedObject30setShowsCrashedPluginIndicatorEv
+__ZN7WebCore20ResourceResponseBase11setMimeTypeERKN3WTF6StringE
+__ZN7WebCore20ResourceResponseBase17setHTTPStatusCodeEi
+__ZN7WebCore20ResourceResponseBase20setSuggestedFilenameERKN3WTF6StringE
__ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
+__ZN7WebCore20ResourceResponseBase6setURLERKNS_4KURLE
__ZN7WebCore20ResourceResponseBaseC2Ev
__ZN7WebCore20SpaceSplitStringData12createVectorEv
__ZN7WebCore20UserGestureIndicator23s_processingUserGestureE
Modified: branches/safari-534.52-branch/Source/WebKit2/ChangeLog (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/ChangeLog 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/ChangeLog 2011-10-27 17:54:54 UTC (rev 98605)
@@ -1,5 +1,52 @@
2011-10-27 Lucas Forschler <lforsch...@apple.com>
+ Merge 98503
+
+ 2011-10-25 Alexey Proskuryakov <a...@apple.com>
+
+ Embedded PDFs should be known to DocumentLoader
+ https://bugs.webkit.org/show_bug.cgi?id=70864
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/Plugins/Plugin.h: Plugin stream load notifications now contain a suggested
+ file name, in case the plug-in wants to save the file properly.
+
+ * WebProcess/Plugins/PDF/BuiltInPDFView.h:
+ * WebProcess/Plugins/PDF/BuiltInPDFView.cpp:
+ (WebKit::BuiltInPDFView::addArchiveResource): Add the PDF as resource in DocumentLoader.
+ (WebKit::BuiltInPDFView::pdfDocumentDidLoad): Call addArchiveResource.
+ (WebKit::BuiltInPDFView::initialize): We need to remember source URL to create a resource
+ for that. The URL needs to match one in HitTestResult, so we can't use response URL.
+ (WebKit::BuiltInPDFView::streamDidReceiveResponse): Remember suggested file name, so
+ that we could put it in archive resource later.
+ (WebKit::BuiltInPDFView::manualStreamDidReceiveResponse): Ditto.
+
+ * PluginProcess/PluginControllerProxy.cpp:
+ (WebKit::PluginControllerProxy::streamDidReceiveResponse):
+ (WebKit::PluginControllerProxy::manualStreamDidReceiveResponse):
+ Pass an empty string for suggested file name. No plug-in that runs in a separate process
+ cares about it, so it's not sent to the plugin process.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::streamDidReceiveResponse):
+ (WebKit::NetscapePlugin::manualStreamDidReceiveResponse):
+ * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+ Updated for new signatures.
+
+ * WebProcess/Plugins/PluginProxy.cpp:
+ (WebKit::PluginProxy::streamDidReceiveResponse):
+ (WebKit::PluginProxy::manualStreamDidReceiveResponse):
+ * WebProcess/Plugins/PluginProxy.h:
+ Updated for new signatures.
+
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::Stream::didReceiveResponse):
+ (WebKit::PluginView::manualLoadDidReceiveResponse):
+ Pass suggested file name to plug-in, in case the plug-in wants to save the file properly.
+
+2011-10-27 Lucas Forschler <lforsch...@apple.com>
+
Merge 98394
2011-10-25 Anders Carlsson <ander...@apple.com>
Modified: branches/safari-534.52-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp 2011-10-27 17:54:54 UTC (rev 98605)
@@ -459,7 +459,7 @@
void PluginControllerProxy::streamDidReceiveResponse(uint64_t streamID, const String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers)
{
- m_plugin->streamDidReceiveResponse(streamID, KURL(ParsedURLString, responseURLString), streamLength, lastModifiedTime, mimeType, headers);
+ m_plugin->streamDidReceiveResponse(streamID, KURL(ParsedURLString, responseURLString), streamLength, lastModifiedTime, mimeType, headers, String());
}
void PluginControllerProxy::streamDidReceiveData(uint64_t streamID, const CoreIPC::DataReference& data)
@@ -482,7 +482,7 @@
if (m_pluginCanceledManualStreamLoad)
return;
- m_plugin->manualStreamDidReceiveResponse(KURL(ParsedURLString, responseURLString), streamLength, lastModifiedTime, mimeType, headers);
+ m_plugin->manualStreamDidReceiveResponse(KURL(ParsedURLString, responseURLString), streamLength, lastModifiedTime, mimeType, headers, String());
}
void PluginControllerProxy::manualStreamDidReceiveData(const CoreIPC::DataReference& data)
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp 2011-10-27 17:54:54 UTC (rev 98605)
@@ -623,7 +623,7 @@
}
void NetscapePlugin::streamDidReceiveResponse(uint64_t streamID, const KURL& responseURL, uint32_t streamLength,
- uint32_t lastModifiedTime, const String& mimeType, const String& headers)
+ uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& /* suggestedFileName */)
{
ASSERT(m_isStarted);
@@ -656,7 +656,7 @@
}
void NetscapePlugin::manualStreamDidReceiveResponse(const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime,
- const String& mimeType, const String& headers)
+ const String& mimeType, const String& headers, const String& /* suggestedFileName */)
{
ASSERT(m_isStarted);
ASSERT(m_loadManually);
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h 2011-10-27 17:54:54 UTC (rev 98605)
@@ -160,12 +160,12 @@
virtual void frameDidFail(uint64_t requestID, bool wasCancelled);
virtual void didEvaluateJavaScript(uint64_t requestID, const String& result);
virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength,
- uint32_t lastModifiedTime, const String& mimeType, const String& headers);
+ uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName);
virtual void streamDidReceiveData(uint64_t streamID, const char* bytes, int length);
virtual void streamDidFinishLoading(uint64_t streamID);
virtual void streamDidFail(uint64_t streamID, bool wasCancelled);
virtual void manualStreamDidReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength,
- uint32_t lastModifiedTime, const String& mimeType, const String& headers);
+ uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName);
virtual void manualStreamDidReceiveData(const char* bytes, int length);
virtual void manualStreamDidFinishLoading();
virtual void manualStreamDidFail(bool wasCancelled);
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp 2011-10-27 17:54:54 UTC (rev 98605)
@@ -30,6 +30,8 @@
#include "ShareableBitmap.h"
#include "WebEvent.h"
#include "WebEventConversion.h"
+#include <WebCore/ArchiveResource.h>
+#include <WebCore/DocumentLoader.h>
#include <WebCore/FocusController.h>
#include <WebCore/Frame.h>
#include <WebCore/FrameView.h>
@@ -191,8 +193,24 @@
scrollbar = 0;
}
+void BuiltInPDFView::addArchiveResource()
+{
+ // FIXME: It's a hack to force add a resource to DocumentLoader. PDF documents should just be fetched as CachedResources.
+
+ // Add just enough data for context menu handling and web archives to work.
+ ResourceResponse synthesizedResponse;
+ synthesizedResponse.setSuggestedFilename(m_suggestedFilename);
+ synthesizedResponse.setURL(m_sourceURL); // Needs to match the HitTestResult::absolutePDFURL.
+ synthesizedResponse.setMimeType("application/pdf");
+
+ RefPtr<ArchiveResource> resource = ArchiveResource::create(SharedBuffer::wrapCFData(m_dataBuffer.get()), m_sourceURL, "application/pdf", String(), String(), synthesizedResponse);
+ pluginView()->frame()->document()->loader()->addArchiveResource(resource.release());
+}
+
void BuiltInPDFView::pdfDocumentDidLoad()
{
+ addArchiveResource();
+
RetainPtr<CGDataProviderRef> pdfDataProvider(AdoptCF, CGDataProviderCreateWithCFData(m_dataBuffer.get()));
m_pdfDocument.adoptCF(CGPDFDocumentCreateWithProvider(pdfDataProvider.get()));
@@ -226,6 +244,7 @@
m_page->addScrollableArea(this);
// Load the src URL if needed.
+ m_sourceURL = parameters.url;
if (!parameters.loadManually && !parameters.url.isEmpty())
m_pluginController->loadURL(pdfDocumentRequestID, "GET", parameters.url.string(), String(), HTTPHeaderMap(), Vector<uint8_t>(), false);
@@ -388,9 +407,11 @@
ASSERT_NOT_REACHED();
}
-void BuiltInPDFView::streamDidReceiveResponse(uint64_t streamID, const KURL&, uint32_t, uint32_t, const WTF::String&, const WTF::String&)
+void BuiltInPDFView::streamDidReceiveResponse(uint64_t streamID, const KURL&, uint32_t, uint32_t, const String&, const String&, const String& suggestedFilename)
{
ASSERT_UNUSED(streamID, streamID == pdfDocumentRequestID);
+
+ m_suggestedFilename = suggestedFilename;
}
void BuiltInPDFView::streamDidReceiveData(uint64_t streamID, const char* bytes, int length)
@@ -417,8 +438,9 @@
m_dataBuffer.clear();
}
-void BuiltInPDFView::manualStreamDidReceiveResponse(const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers)
+void BuiltInPDFView::manualStreamDidReceiveResponse(const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFilename)
{
+ m_suggestedFilename = suggestedFilename;
}
void BuiltInPDFView::manualStreamDidReceiveData(const char* bytes, int length)
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h 2011-10-27 17:54:54 UTC (rev 98605)
@@ -62,6 +62,7 @@
void willRemoveVerticalScrollbar(WebCore::Scrollbar*);
PassRefPtr<WebCore::Scrollbar> createScrollbar(WebCore::ScrollbarOrientation);
void destroyScrollbar(WebCore::ScrollbarOrientation);
+ void addArchiveResource();
void pdfDocumentDidLoad();
void calculateSizes();
void paintBackground(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect);
@@ -83,11 +84,11 @@
virtual void frameDidFinishLoading(uint64_t requestID);
virtual void frameDidFail(uint64_t requestID, bool wasCancelled);
virtual void didEvaluateJavaScript(uint64_t requestID, const String& result);
- virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers);
+ virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName);
virtual void streamDidReceiveData(uint64_t streamID, const char* bytes, int length);
virtual void streamDidFinishLoading(uint64_t streamID);
virtual void streamDidFail(uint64_t streamID, bool wasCancelled);
- virtual void manualStreamDidReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers);
+ virtual void manualStreamDidReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers, const String& suggestedFileName);
virtual void manualStreamDidReceiveData(const char* bytes, int length);
virtual void manualStreamDidFinishLoading();
virtual void manualStreamDidFail(bool wasCancelled);
@@ -146,7 +147,11 @@
// In window coordinates.
WebCore::IntRect m_frameRect;
+ WebCore::KURL m_sourceURL;
+
+ String m_suggestedFilename;
RetainPtr<CFMutableDataRef> m_dataBuffer;
+
RetainPtr<CGPDFDocumentRef> m_pdfDocument;
Vector<WebCore::IntRect> m_pageBoxes;
WebCore::IntSize m_pdfDocumentSize; // All pages, including gaps.
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Plugin.h 2011-10-27 17:54:54 UTC (rev 98605)
@@ -118,7 +118,7 @@
// Tells the plug-in that a stream has received its HTTP response.
virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength,
- uint32_t lastModifiedTime, const String& mimeType, const String& headers) = 0;
+ uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName) = 0;
// Tells the plug-in that a stream did receive data.
virtual void streamDidReceiveData(uint64_t streamID, const char* bytes, int length) = 0;
@@ -131,7 +131,7 @@
// Tells the plug-in that the manual stream has received its HTTP response.
virtual void manualStreamDidReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength,
- uint32_t lastModifiedTime, const String& mimeType, const String& headers) = 0;
+ uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName) = 0;
// Tells the plug-in that the manual stream did receive data.
virtual void manualStreamDidReceiveData(const char* bytes, int length) = 0;
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp 2011-10-27 17:54:54 UTC (rev 98605)
@@ -245,7 +245,7 @@
m_connection->connection()->send(Messages::PluginControllerProxy::DidEvaluateJavaScript(requestID, result), m_pluginInstanceID);
}
-void PluginProxy::streamDidReceiveResponse(uint64_t streamID, const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers)
+void PluginProxy::streamDidReceiveResponse(uint64_t streamID, const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers, const String& /* suggestedFileName */)
{
m_connection->connection()->send(Messages::PluginControllerProxy::StreamDidReceiveResponse(streamID, responseURL.string(), streamLength, lastModifiedTime, mimeType, headers), m_pluginInstanceID);
}
@@ -265,7 +265,7 @@
m_connection->connection()->send(Messages::PluginControllerProxy::StreamDidFail(streamID, wasCancelled), m_pluginInstanceID);
}
-void PluginProxy::manualStreamDidReceiveResponse(const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers)
+void PluginProxy::manualStreamDidReceiveResponse(const KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers, const String& /* suggestedFileName */)
{
m_connection->connection()->send(Messages::PluginControllerProxy::ManualStreamDidReceiveResponse(responseURL.string(), streamLength, lastModifiedTime, mimeType, headers), m_pluginInstanceID);
}
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PluginProxy.h 2011-10-27 17:54:54 UTC (rev 98605)
@@ -76,11 +76,11 @@
virtual void frameDidFinishLoading(uint64_t requestID);
virtual void frameDidFail(uint64_t requestID, bool wasCancelled);
virtual void didEvaluateJavaScript(uint64_t requestID, const String& result);
- virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers);
+ virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName);
virtual void streamDidReceiveData(uint64_t streamID, const char* bytes, int length);
virtual void streamDidFinishLoading(uint64_t streamID);
virtual void streamDidFail(uint64_t streamID, bool wasCancelled);
- virtual void manualStreamDidReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers);
+ virtual void manualStreamDidReceiveResponse(const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers, const String& suggestedFileName);
virtual void manualStreamDidReceiveData(const char* bytes, int length);
virtual void manualStreamDidFinishLoading();
virtual void manualStreamDidFail(bool wasCancelled);
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (98604 => 98605)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2011-10-27 17:52:17 UTC (rev 98604)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2011-10-27 17:54:54 UTC (rev 98605)
@@ -198,7 +198,7 @@
if (expectedContentLength > 0)
streamLength = expectedContentLength;
- m_pluginView->m_plugin->streamDidReceiveResponse(m_streamID, responseURL, streamLength, response.lastModifiedDate(), mimeType, headers);
+ m_pluginView->m_plugin->streamDidReceiveResponse(m_streamID, responseURL, streamLength, response.lastModifiedDate(), mimeType, headers, response.suggestedFilename());
}
void PluginView::Stream::didReceiveData(NetscapePlugInStreamLoader*, const char* bytes, int length)
@@ -329,7 +329,7 @@
if (expectedContentLength > 0)
streamLength = expectedContentLength;
- m_plugin->manualStreamDidReceiveResponse(responseURL, streamLength, response.lastModifiedDate(), mimeType, headers);
+ m_plugin->manualStreamDidReceiveResponse(responseURL, streamLength, response.lastModifiedDate(), mimeType, headers, response.suggestedFilename());
}
void PluginView::manualLoadDidReceiveData(const char* bytes, int length)