[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 16:15:02 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 4cc1758c7bad6cc49abd2d53abdbe2c9ba3920eb
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Nov 20 01:43:52 2010 +0000
Extend sandbox when downloading files
https://bugs.webkit.org/show_bug.cgi?id=49844
Reviewed by Sam Weinig.
* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction):
Add new overload.
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
Create a sandbox extension handle if necessary.
* UIProcess/Downloads/DownloadProxy.messages.in:
Add a sandbox extension handle out parameter to the DecideDestinationWithSuggestedFilename message.
* WebProcess/Downloads/Download.cpp:
(WebKit::Download::decideDestinationWithSuggestedFilename):
Create and consume the returned sandbox extension handle.
(WebKit::Download::didFinish):
(WebKit::Download::didFail):
Invalidate the sandbox extension handles.
* WebProcess/Downloads/mac/DownloadMac.mm:
(-[WKDownloadAsDelegate download:shouldDecodeSourceDataOfMIMEType:]):
Whoops, fix inverted logic.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 617d01a..2c45ca4 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,33 @@
+2010-11-19 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Extend sandbox when downloading files
+ https://bugs.webkit.org/show_bug.cgi?id=49844
+
+ * Platform/CoreIPC/HandleMessage.h:
+ (CoreIPC::callMemberFunction):
+ Add new overload.
+
+ * UIProcess/Downloads/DownloadProxy.cpp:
+ (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
+ Create a sandbox extension handle if necessary.
+
+ * UIProcess/Downloads/DownloadProxy.messages.in:
+ Add a sandbox extension handle out parameter to the DecideDestinationWithSuggestedFilename message.
+
+ * WebProcess/Downloads/Download.cpp:
+ (WebKit::Download::decideDestinationWithSuggestedFilename):
+ Create and consume the returned sandbox extension handle.
+
+ (WebKit::Download::didFinish):
+ (WebKit::Download::didFail):
+ Invalidate the sandbox extension handles.
+
+ * WebProcess/Downloads/mac/DownloadMac.mm:
+ (-[WKDownloadAsDelegate download:shouldDecodeSourceDataOfMIMEType:]):
+ Whoops, fix inverted logic.
+
2010-11-19 Steve Falkenburg <sfalken at apple.com>
Reviewed by Adam Roben.
diff --git a/WebKit2/Platform/CoreIPC/HandleMessage.h b/WebKit2/Platform/CoreIPC/HandleMessage.h
index f166e2b..6adbe1d 100644
--- a/WebKit2/Platform/CoreIPC/HandleMessage.h
+++ b/WebKit2/Platform/CoreIPC/HandleMessage.h
@@ -91,6 +91,12 @@ void callMemberFunction(const Arguments1<P1>& args, Arguments2<R1, R2>& replyArg
(object->*function)(args.argument1, replyArgs.argument1, replyArgs.argument2);
}
+template<typename C, typename MF, typename P1, typename R1, typename R2, typename R3>
+void callMemberFunction(const Arguments1<P1>& args, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function)
+{
+ (object->*function)(args.argument1, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3);
+}
+
template<typename C, typename MF, typename P1, typename P2>
void callMemberFunction(const Arguments2<P1, P2>& args, Arguments0&, C* object, MF function)
{
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
index 265b535..7dd2a4e 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
@@ -95,12 +95,15 @@ void DownloadProxy::shouldDecodeSourceDataOfMIMEType(const String& mimeType, boo
result = m_webContext->downloadClient().shouldDecodeSourceDataOfMIMEType(m_webContext, this, mimeType);
}
-void DownloadProxy::decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite)
+void DownloadProxy::decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite, SandboxExtension::Handle& sandboxExtensionHandle)
{
if (!m_webContext)
return;
destination = m_webContext->downloadClient().decideDestinationWithSuggestedFilename(m_webContext, this, filename, allowOverwrite);
+
+ if (!destination.isNull())
+ SandboxExtension::createHandle(destination, SandboxExtension::WriteOnly, sandboxExtensionHandle);
}
void DownloadProxy::didCreateDestination(const String& path)
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.h b/WebKit2/UIProcess/Downloads/DownloadProxy.h
index 762d808..0e3c43f 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.h
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.h
@@ -28,6 +28,7 @@
#include "APIObject.h"
#include "Connection.h"
+#include "SandboxExtension.h"
#include <WebCore/ResourceRequest.h>
#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
@@ -66,7 +67,7 @@ private:
void didReceiveResponse(const WebCore::ResourceResponse&);
void didReceiveData(uint64_t length);
void shouldDecodeSourceDataOfMIMEType(const String& mimeType, bool& result);
- void decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite);
+ void decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite, SandboxExtension::Handle& sandboxExtensionHandle);
void didCreateDestination(const String& path);
void didFinish();
void didFail(const WebCore::ResourceError&);
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in b/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
index d29a090..243deb7 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
@@ -25,7 +25,7 @@ messages -> DownloadProxy {
DidReceiveResponse(WebCore::ResourceResponse response)
DidReceiveData(uint64_t length)
ShouldDecodeSourceDataOfMIMEType(String mimeType) -> (bool result)
- DecideDestinationWithSuggestedFilename(String filename) -> (String destination, bool allowOverwrite)
+ DecideDestinationWithSuggestedFilename(String filename) -> (String destination, bool allowOverwrite, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
DidCreateDestination(WTF::String path)
DidFinish()
DidFail(WebCore::ResourceError error)
diff --git a/WebKit2/WebProcess/Downloads/Download.cpp b/WebKit2/WebProcess/Downloads/Download.cpp
index 129e295..e70d927 100644
--- a/WebKit2/WebProcess/Downloads/Download.cpp
+++ b/WebKit2/WebProcess/Downloads/Download.cpp
@@ -28,6 +28,7 @@
#include "Connection.h"
#include "DownloadProxyMessages.h"
#include "DownloadManager.h"
+#include "SandboxExtension.h"
#include "WebCoreArgumentCoders.h"
#include "WebProcess.h"
@@ -84,9 +85,14 @@ bool Download::shouldDecodeSourceDataOfMIMEType(const String& mimeType)
String Download::decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite)
{
String destination;
- if (!sendSync(Messages::DownloadProxy::DecideDestinationWithSuggestedFilename(filename), Messages::DownloadProxy::DecideDestinationWithSuggestedFilename::Reply(destination, allowOverwrite)))
+ SandboxExtension::Handle sandboxExtensionHandle;
+ if (!sendSync(Messages::DownloadProxy::DecideDestinationWithSuggestedFilename(filename), Messages::DownloadProxy::DecideDestinationWithSuggestedFilename::Reply(destination, allowOverwrite, sandboxExtensionHandle)))
return String();
+ m_sandboxExtension = SandboxExtension::create(sandboxExtensionHandle);
+ if (m_sandboxExtension)
+ m_sandboxExtension->consume();
+
return destination;
}
@@ -99,6 +105,8 @@ void Download::didFinish()
{
send(Messages::DownloadProxy::DidFinish());
+ if (m_sandboxExtension)
+ m_sandboxExtension->invalidate();
DownloadManager::shared().downloadFinished(this);
}
@@ -106,6 +114,8 @@ void Download::didFail(const WebCore::ResourceError& error)
{
send(Messages::DownloadProxy::DidFail(error));
+ if (m_sandboxExtension)
+ m_sandboxExtension->invalidate();
DownloadManager::shared().downloadFinished(this);
}
diff --git a/WebKit2/WebProcess/Downloads/Download.h b/WebKit2/WebProcess/Downloads/Download.h
index c31dd3b..37faca8 100644
--- a/WebKit2/WebProcess/Downloads/Download.h
+++ b/WebKit2/WebProcess/Downloads/Download.h
@@ -50,6 +50,7 @@ namespace WebCore {
namespace WebKit {
+class SandboxExtension;
class WebPage;
class Download : public CoreIPC::MessageSender<Download> {
@@ -85,6 +86,8 @@ private:
uint64_t m_downloadID;
WebCore::ResourceRequest m_request;
+ RefPtr<SandboxExtension> m_sandboxExtension;
+
#if PLATFORM(MAC)
RetainPtr<NSURLDownload> m_nsURLDownload;
RetainPtr<WKDownloadAsDelegate> m_delegate;
diff --git a/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm b/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
index 099470a..6ca49ad 100644
--- a/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
+++ b/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
@@ -231,7 +231,7 @@ void Download::platformInvalidate()
- (BOOL)download:(NSURLDownload *)download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType
{
- if (!_download)
+ if (_download)
return _download->shouldDecodeSourceDataOfMIMEType(encodingType);
return YES;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list