Diff
Modified: trunk/Source/WebKit2/ChangeLog (139008 => 139009)
--- trunk/Source/WebKit2/ChangeLog 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/ChangeLog 2013-01-08 00:20:54 UTC (rev 139009)
@@ -1,3 +1,48 @@
+2013-01-07 Alexey Proskuryakov <a...@apple.com>
+
+ [WK2] Make SecItemShim messages work with any process
+ https://bugs.webkit.org/show_bug.cgi?id=106269
+
+ Reviewed by Sam Weinig.
+
+ Add SecItemShim and SecItemShimProxy classes to manage message sending, and moved
+ relevant code from WebProcess(Proxy).
+
+ * DerivedSources.make:
+ * Platform/CoreIPC/MessageID.h:
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::didFinishLaunching):
+ * UIProcess/WebProcessProxy.h:
+ (WebProcessProxy):
+ * UIProcess/WebProcessProxy.messages.in:
+ * Shared/mac/SecItemShim.cpp: Added.
+ (WebKit::SecItemShim::shared):
+ (WebKit::SecItemShim::SecItemShim):
+ (WebKit::SecItemShim::secItemResponse):
+ (WebKit::SecItemShim::install):
+ (WebKit::SecItemShim::didReceiveMessageOnConnectionWorkQueue):
+ * Shared/mac/SecItemShim.h: Added.
+ * Shared/mac/SecItemShim.messages.in: Added.
+ * UIProcess/mac/SecItemShimProxy.cpp: Added.
+ (WebKit::SecItemShimProxy::shared):
+ (WebKit::SecItemShimProxy::SecItemShimProxy):
+ (WebKit::handleSecItemRequest):
+ (WebKit::dispatchFunctionOnQueue):
+ (WebKit::SecItemShimProxy::secItemRequest):
+ (WebKit::SecItemShimProxy::didReceiveMessageOnConnectionWorkQueue):
+ * UIProcess/mac/SecItemShimProxy.h: Added.
+ * UIProcess/mac/SecItemShimProxy.messages.in: Added.
+ * UIProcess/mac/WebProcessProxyMac.mm:
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::initializeConnection):
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+ * WebProcess/mac/SecItemShimMethods.mm:
+ (WebKit::sendSeqItemRequest):
+ * WebProcess/mac/WebProcessMac.mm:
+ (WebKit::WebProcess::platformInitializeProcess):
+
2013-01-07 Anders Carlsson <ander...@apple.com>
Remove Windows files from WebKit2
Modified: trunk/Source/WebKit2/DerivedSources.make (139008 => 139009)
--- trunk/Source/WebKit2/DerivedSources.make 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/DerivedSources.make 2013-01-08 00:20:54 UTC (rev 139009)
@@ -27,6 +27,7 @@
$(WebKit2)/PluginProcess/mac \
$(WebKit2)/Shared/Plugins \
$(WebKit2)/Shared \
+ $(WebKit2)/Shared/mac \
$(WebKit2)/Shared/Network/CustomProtocols \
$(WebKit2)/SharedWorkerProcess \
$(WebKit2)/WebProcess/ApplicationCache \
@@ -81,6 +82,8 @@
NetworkConnectionToWebProcess \
NetworkResourceLoader \
RemoteLayerTreeHost \
+ SecItemShim \
+ SecItemShimProxy \
WebContext \
WebDatabaseManager \
WebDatabaseManagerProxy \
Modified: trunk/Source/WebKit2/Platform/CoreIPC/MessageID.h (139008 => 139009)
--- trunk/Source/WebKit2/Platform/CoreIPC/MessageID.h 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/Platform/CoreIPC/MessageID.h 2013-01-08 00:20:54 UTC (rev 139009)
@@ -136,6 +136,14 @@
// Messages sent by a web process (soon the network process) to the UI process.
MessageClassCustomProtocolManagerProxy,
#endif
+
+#if USE(SECURITY_FRAMEWORK)
+ // Messages sent by a web process or a network process to the UI process.
+ MessageClassSecItemShimProxy,
+
+ // Responses to SecItemShimProxy that are sent back.
+ MessageClassSecItemShim,
+#endif
};
template<typename> struct MessageKindTraits { };
Added: trunk/Source/WebKit2/Shared/mac/SecItemShim.cpp (0 => 139009)
--- trunk/Source/WebKit2/Shared/mac/SecItemShim.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/mac/SecItemShim.cpp 2013-01-08 00:20:54 UTC (rev 139009)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SecItemShim.h"
+
+#if USE(SECURITY_FRAMEWORK)
+
+#include "SecItemShimMethods.h"
+
+namespace WebKit {
+
+SecItemShim& SecItemShim::shared()
+{
+ AtomicallyInitializedStatic(SecItemShim*, proxy = new SecItemShim);
+ return *proxy;
+}
+
+SecItemShim::SecItemShim()
+{
+}
+
+void SecItemShim::secItemResponse(CoreIPC::Connection*, uint64_t requestID, const SecItemResponseData& response)
+{
+ didReceiveSecItemResponse(requestID, response);
+}
+
+void SecItemShim::install()
+{
+ initializeSecItemShim();
+}
+
+void SecItemShim::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)
+{
+ if (messageID.is<CoreIPC::MessageClassSecItemShim>()) {
+ didReceiveSecItemShimMessageOnConnectionWorkQueue(connection, messageID, decoder, didHandleMessage);
+ return;
+ }
+}
+
+}
+
+#endif
Added: trunk/Source/WebKit2/Shared/mac/SecItemShim.h (0 => 139009)
--- trunk/Source/WebKit2/Shared/mac/SecItemShim.h (rev 0)
+++ trunk/Source/WebKit2/Shared/mac/SecItemShim.h 2013-01-08 00:20:54 UTC (rev 139009)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SecItemShim_h
+#define SecItemShim_h
+
+#if USE(SECURITY_FRAMEWORK)
+
+#include "Connection.h"
+
+namespace WebKit {
+
+class SecItemResponseData;
+
+class SecItemShim : public CoreIPC::Connection::QueueClient {
+WTF_MAKE_NONCOPYABLE(SecItemShim);
+public:
+ static SecItemShim& shared();
+
+ void install();
+
+private:
+ SecItemShim();
+
+ // QueueClient
+ virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, bool& didHandleMessage);
+
+ // Implemented in generated SecItemShimMessageReceiver.cpp.
+ void didReceiveSecItemShimMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, bool& didHandleMessage);
+
+ void secItemResponse(CoreIPC::Connection*, uint64_t requestID, const SecItemResponseData&);
+};
+
+} // namespace WebKit
+
+#endif // USE(SECURITY_FRAMEWORK)
+
+#endif // SecItemShim_h
Added: trunk/Source/WebKit2/Shared/mac/SecItemShim.messages.in (0 => 139009)
--- trunk/Source/WebKit2/Shared/mac/SecItemShim.messages.in (rev 0)
+++ trunk/Source/WebKit2/Shared/mac/SecItemShim.messages.in 2013-01-08 00:20:54 UTC (rev 139009)
@@ -0,0 +1,29 @@
+# Copyright (C) 2013 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> SecItemShim {
+
+#if USE(SECURITY_FRAMEWORK)
+ SecItemResponse(uint64_t requestID, WebKit::SecItemResponseData response) DispatchOnConnectionQueue
+#endif
+
+}
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (139008 => 139009)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-01-08 00:20:54 UTC (rev 139009)
@@ -53,6 +53,10 @@
#endif
#endif
+#if USE(SECURITY_FRAMEWORK)
+#include "SecItemShimProxy.h"
+#endif
+
using namespace WebCore;
using namespace std;
@@ -502,6 +506,10 @@
{
ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
+#if USE(SECURITY_FRAMEWORK)
+ connection()->addQueueClient(&SecItemShimProxy::shared());
+#endif
+
m_webConnection = WebConnectionToWebProcess::create(this);
// Tell the context that we finished launching.
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (139008 => 139009)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h 2013-01-08 00:20:54 UTC (rev 139009)
@@ -51,11 +51,6 @@
namespace WebKit {
-#if USE(SECURITY_FRAMEWORK)
-class SecItemRequestData;
-class SecItemResponseData;
-#endif
-
class DownloadProxyMap;
class WebBackForwardListItem;
class WebContext;
@@ -153,10 +148,6 @@
void getSharedWorkerProcessConnection(const String& url, const String& name, PassRefPtr<Messages::WebProcessProxy::GetSharedWorkerProcessConnection::DelayedReply>);
#endif
-#if USE(SECURITY_FRAMEWORK)
- void secItemRequest(CoreIPC::Connection*, uint64_t requestID, const SecItemRequestData&);
-#endif
-
// CoreIPC::Connection::Client
friend class WebConnectionToWebProcess;
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.messages.in (139008 => 139009)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.messages.in 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.messages.in 2013-01-08 00:20:54 UTC (rev 139009)
@@ -52,8 +52,4 @@
GetSharedWorkerProcessConnection(WTF::String url, WTF::String name) -> (CoreIPC::Attachment connectionHandle) Delayed
#endif
-#if USE(SECURITY_FRAMEWORK)
- SecItemRequest(uint64_t requestID, WebKit::SecItemRequestData request) DispatchOnConnectionQueue
-#endif
-
}
Added: trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.cpp (0 => 139009)
--- trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.cpp 2013-01-08 00:20:54 UTC (rev 139009)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SecItemShimProxy.h"
+
+#if USE(SECURITY_FRAMEWORK)
+
+#include "SecItemRequestData.h"
+#include "SecItemResponseData.h"
+#include "SecItemShimMessages.h"
+#include <Security/SecItem.h>
+
+namespace WebKit {
+
+SecItemShimProxy& SecItemShimProxy::shared()
+{
+ AtomicallyInitializedStatic(SecItemShimProxy*, proxy = new SecItemShimProxy);
+ return *proxy;
+}
+
+SecItemShimProxy::SecItemShimProxy()
+{
+}
+
+static void handleSecItemRequest(CoreIPC::Connection* connection, uint64_t requestID, const SecItemRequestData& request)
+{
+ SecItemResponseData response;
+
+ switch (request.type()) {
+ case SecItemRequestData::Invalid:
+ ASSERT_NOT_REACHED();
+ return;
+
+ case SecItemRequestData::CopyMatching: {
+ CFTypeRef resultObject = 0;
+ OSStatus resultCode = SecItemCopyMatching(request.query(), &resultObject);
+ response = SecItemResponseData(resultCode, adoptCF(resultObject).get());
+ break;
+ }
+
+ case SecItemRequestData::Add: {
+ CFTypeRef resultObject = 0;
+ OSStatus resultCode = SecItemAdd(request.query(), &resultObject);
+ response = SecItemResponseData(resultCode, adoptCF(resultObject).get());
+ break;
+ }
+
+ case SecItemRequestData::Update: {
+ OSStatus resultCode = SecItemUpdate(request.query(), request.attributesToMatch());
+ response = SecItemResponseData(resultCode, 0);
+ break;
+ }
+
+ case SecItemRequestData::Delete: {
+ OSStatus resultCode = SecItemDelete(request.query());
+ response = SecItemResponseData(resultCode, 0);
+ break;
+ }
+ }
+
+ connection->send(Messages::SecItemShim::SecItemResponse(requestID, response), 0);
+}
+
+static void dispatchFunctionOnQueue(dispatch_queue_t queue, const Function<void ()>& function)
+{
+#if COMPILER(CLANG)
+ dispatch_async(queue, function);
+#else
+ Function<void ()>* functionPtr = new Function<void ()>(function);
+ dispatch_async(queue, ^{
+ (*functionPtr)();
+ delete functionPtr;
+ });
+#endif
+}
+
+void SecItemShimProxy::secItemRequest(CoreIPC::Connection* connection, uint64_t requestID, const SecItemRequestData& request)
+{
+ // Since we don't want the connection work queue to be held up, we do all
+ // keychain interaction work on a global dispatch queue.
+ dispatch_queue_t keychainWorkQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
+ dispatchFunctionOnQueue(keychainWorkQueue, bind(handleSecItemRequest, RefPtr<CoreIPC::Connection>(connection), requestID, request));
+}
+
+void SecItemShimProxy::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, bool& didHandleMessage)
+{
+ if (messageID.is<CoreIPC::MessageClassSecItemShimProxy>()) {
+ didReceiveSecItemShimProxyMessageOnConnectionWorkQueue(connection, messageID, decoder, didHandleMessage);
+ return;
+ }
+}
+
+}
+
+#endif // USE(SECURITY_FRAMEWORK)
Added: trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.h (0 => 139009)
--- trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.h 2013-01-08 00:20:54 UTC (rev 139009)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SecItemShimProxy_h
+#define SecItemShimProxy_h
+
+#if USE(SECURITY_FRAMEWORK)
+
+#include "Connection.h"
+
+namespace WebKit {
+
+class SecItemRequestData;
+
+class SecItemShimProxy : public CoreIPC::Connection::QueueClient {
+WTF_MAKE_NONCOPYABLE(SecItemShimProxy);
+public:
+ static SecItemShimProxy& shared();
+
+private:
+ SecItemShimProxy();
+
+ // QueueClient
+ virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, bool& didHandleMessage);
+
+ // Implemented in generated SecItemShimProxyMessageReceiver.cpp.
+ void didReceiveSecItemShimProxyMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, bool& didHandleMessage);
+
+ void secItemRequest(CoreIPC::Connection*, uint64_t requestID, const SecItemRequestData&);
+};
+
+} // namespace WebKit
+
+#endif // USE(SECURITY_FRAMEWORK)
+
+#endif // SecItemShimProxy_h
Added: trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.messages.in (0 => 139009)
--- trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.messages.in (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.messages.in 2013-01-08 00:20:54 UTC (rev 139009)
@@ -0,0 +1,29 @@
+# Copyright (C) 2013 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> SecItemShimProxy {
+
+#if USE(SECURITY_FRAMEWORK)
+ SecItemRequest(uint64_t requestID, WebKit::SecItemRequestData request) DispatchOnConnectionQueue
+#endif
+
+}
Modified: trunk/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm (139008 => 139009)
--- trunk/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/UIProcess/mac/WebProcessProxyMac.mm 2013-01-08 00:20:54 UTC (rev 139009)
@@ -26,74 +26,11 @@
#import "config.h"
#import "WebProcessProxy.h"
-#import "SecItemRequestData.h"
-#import "SecItemResponseData.h"
#import "WebProcessMessages.h"
#import "WKFullKeyboardAccessWatcher.h"
-#import <Security/SecItem.h>
namespace WebKit {
-static void handleSecItemRequest(CoreIPC::Connection* connection, uint64_t requestID, const SecItemRequestData& request)
-{
- SecItemResponseData response;
-
- switch (request.type()) {
- case SecItemRequestData::Invalid:
- ASSERT_NOT_REACHED();
- return;
-
- case SecItemRequestData::CopyMatching: {
- CFTypeRef resultObject = 0;
- OSStatus resultCode = SecItemCopyMatching(request.query(), &resultObject);
- response = SecItemResponseData(resultCode, adoptCF(resultObject).get());
- break;
- }
-
- case SecItemRequestData::Add: {
- CFTypeRef resultObject = 0;
- OSStatus resultCode = SecItemAdd(request.query(), &resultObject);
- response = SecItemResponseData(resultCode, adoptCF(resultObject).get());
- break;
- }
-
- case SecItemRequestData::Update: {
- OSStatus resultCode = SecItemUpdate(request.query(), request.attributesToMatch());
- response = SecItemResponseData(resultCode, 0);
- break;
- }
-
- case SecItemRequestData::Delete: {
- OSStatus resultCode = SecItemDelete(request.query());
- response = SecItemResponseData(resultCode, 0);
- break;
- }
- }
-
- connection->send(Messages::WebProcess::SecItemResponse(requestID, response), 0);
-}
-
-static void dispatchFunctionOnQueue(dispatch_queue_t queue, const Function<void ()>& function)
-{
-#if COMPILER(CLANG)
- dispatch_async(queue, function);
-#else
- Function<void ()>* functionPtr = new Function<void ()>(function);
- dispatch_async(queue, ^{
- (*functionPtr)();
- delete functionPtr;
- });
-#endif
-}
-
-void WebProcessProxy::secItemRequest(CoreIPC::Connection* connection, uint64_t requestID, const SecItemRequestData& request)
-{
- // Since we don't want the connection work queue to be held up, we do all
- // keychain interaction work on a global dispatch queue.
- dispatch_queue_t keychainWorkQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
- dispatchFunctionOnQueue(keychainWorkQueue, bind(handleSecItemRequest, RefPtr<CoreIPC::Connection>(connection), requestID, request));
-}
-
bool WebProcessProxy::fullKeyboardAccessEnabled()
{
return [WKFullKeyboardAccessWatcher fullKeyboardAccessEnabled];
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (139008 => 139009)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2013-01-08 00:20:54 UTC (rev 139009)
@@ -1035,6 +1035,14 @@
E17BF99614D0A73E00A5A069 /* NetscapeSandboxFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E17BF99514D0A73E00A5A069 /* NetscapeSandboxFunctions.h */; };
E17BF99814D0AA8300A5A069 /* NetscapeSandboxFunctions.mm in Sources */ = {isa = PBXBuildFile; fileRef = E17BF99714D0AA8300A5A069 /* NetscapeSandboxFunctions.mm */; };
E18C92F412DB9E7100CF2AEB /* PrintInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */; };
+ E18E690B169B563F009B6670 /* SecItemShimProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E6909169B563F009B6670 /* SecItemShimProxy.cpp */; };
+ E18E690C169B563F009B6670 /* SecItemShimProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E690A169B563F009B6670 /* SecItemShimProxy.h */; };
+ E18E6915169B667B009B6670 /* SecItemShimMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E6911169B667B009B6670 /* SecItemShimMessageReceiver.cpp */; };
+ E18E6916169B667B009B6670 /* SecItemShimMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E6912169B667B009B6670 /* SecItemShimMessages.h */; };
+ E18E6917169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E6913169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp */; };
+ E18E6918169B667B009B6670 /* SecItemShimProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E6914169B667B009B6670 /* SecItemShimProxyMessages.h */; };
+ E18E6949169B77C8009B6670 /* SecItemShim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E6947169B77C8009B6670 /* SecItemShim.cpp */; };
+ E18E694A169B77C8009B6670 /* SecItemShim.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E6948169B77C8009B6670 /* SecItemShim.h */; };
E19582D3153CBFD700B60875 /* PDFKitImports.h in Headers */ = {isa = PBXBuildFile; fileRef = E19582D2153CBFD700B60875 /* PDFKitImports.h */; };
E19582D6153CC05400B60875 /* PDFKitImports.mm in Sources */ = {isa = PBXBuildFile; fileRef = E19582D4153CC05300B60875 /* PDFKitImports.mm */; };
E1967E36150AB5D500C73169 /* com.apple.WebKit.PluginProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = E1967E35150AB5D500C73169 /* com.apple.WebKit.PluginProcess.sb */; };
@@ -2339,6 +2347,16 @@
E17BF99714D0AA8300A5A069 /* NetscapeSandboxFunctions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapeSandboxFunctions.mm; sourceTree = "<group>"; };
E17BF99914D0CBF100A5A069 /* com.apple.WebKit.PluginProcess.sb.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.WebKit.PluginProcess.sb.in; sourceTree = "<group>"; };
E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintInfo.cpp; sourceTree = "<group>"; };
+ E18E6909169B563F009B6670 /* SecItemShimProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecItemShimProxy.cpp; sourceTree = "<group>"; };
+ E18E690A169B563F009B6670 /* SecItemShimProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecItemShimProxy.h; sourceTree = "<group>"; };
+ E18E690D169B57DF009B6670 /* SecItemShimProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SecItemShimProxy.messages.in; sourceTree = "<group>"; };
+ E18E690F169B5928009B6670 /* SecItemShim.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SecItemShim.messages.in; sourceTree = "<group>"; };
+ E18E6911169B667B009B6670 /* SecItemShimMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecItemShimMessageReceiver.cpp; sourceTree = "<group>"; };
+ E18E6912169B667B009B6670 /* SecItemShimMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecItemShimMessages.h; sourceTree = "<group>"; };
+ E18E6913169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecItemShimProxyMessageReceiver.cpp; sourceTree = "<group>"; };
+ E18E6914169B667B009B6670 /* SecItemShimProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecItemShimProxyMessages.h; sourceTree = "<group>"; };
+ E18E6947169B77C8009B6670 /* SecItemShim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecItemShim.cpp; sourceTree = "<group>"; };
+ E18E6948169B77C8009B6670 /* SecItemShim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecItemShim.h; sourceTree = "<group>"; };
E19582D2153CBFD700B60875 /* PDFKitImports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFKitImports.h; sourceTree = "<group>"; };
E19582D4153CC05300B60875 /* PDFKitImports.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PDFKitImports.mm; sourceTree = "<group>"; };
E1967E35150AB5D500C73169 /* com.apple.WebKit.PluginProcess.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.WebKit.PluginProcess.sb; sourceTree = "<group>"; };
@@ -3835,6 +3853,9 @@
51D130501382EAC000351EDD /* SecItemRequestData.h */,
51D130511382EAC000351EDD /* SecItemResponseData.cpp */,
51D130521382EAC000351EDD /* SecItemResponseData.h */,
+ E18E690F169B5928009B6670 /* SecItemShim.messages.in */,
+ E18E6947169B77C8009B6670 /* SecItemShim.cpp */,
+ E18E6948169B77C8009B6670 /* SecItemShim.h */,
BCE23262122C6CF300D5C35A /* WebCoreArgumentCodersMac.mm */,
BC111B5B112F629800337BAB /* WebEventFactory.h */,
BC111B5C112F629800337BAB /* WebEventFactory.mm */,
@@ -4139,6 +4160,9 @@
1AA3D75A1651B44F008713D0 /* RemoteLayerTreeHost.h */,
1AA3D75D1651B5C5008713D0 /* RemoteLayerTreeHost.messages.in */,
1AA3D7591651B44F008713D0 /* RemoteLayerTreeHost.mm */,
+ E18E690D169B57DF009B6670 /* SecItemShimProxy.messages.in */,
+ E18E6909169B563F009B6670 /* SecItemShimProxy.cpp */,
+ E18E690A169B563F009B6670 /* SecItemShimProxy.h */,
1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */,
1AF05D8514688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h */,
1AF05D8414688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.mm */,
@@ -4315,6 +4339,10 @@
1A8EFA6F1252B84100F7067F /* PluginProxyMessages.h */,
1AA3D75F1651B7D3008713D0 /* RemoteLayerTreeHostMessageReceiver.cpp */,
1AA3D7601651B7D3008713D0 /* RemoteLayerTreeHostMessages.h */,
+ E18E6911169B667B009B6670 /* SecItemShimMessageReceiver.cpp */,
+ E18E6912169B667B009B6670 /* SecItemShimMessages.h */,
+ E18E6913169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp */,
+ E18E6914169B667B009B6670 /* SecItemShimProxyMessages.h */,
E1EDFDB11628AD730039ECDA /* SharedWorkerProcessMessageReceiver.cpp */,
E1EDFDB21628AD730039ECDA /* SharedWorkerProcessMessages.h */,
E1EDFDB31628AD730039ECDA /* SharedWorkerProcessProxyMessageReceiver.cpp */,
@@ -5038,7 +5066,11 @@
BCF4DE23168E4BD500C94AFC /* NetworkProcessSupplement.h in Headers */,
BCF4DE25168FA44800C94AFC /* WebContextSupplement.h in Headers */,
BC9BA5051697C45300E44616 /* WebKit2Initialize.h in Headers */,
+ E18E690C169B563F009B6670 /* SecItemShimProxy.h in Headers */,
+ E18E6916169B667B009B6670 /* SecItemShimMessages.h in Headers */,
+ E18E6918169B667B009B6670 /* SecItemShimProxyMessages.h in Headers */,
BC9BA50916991C3C00E44616 /* ChildProcessMain.h in Headers */,
+ E18E694A169B77C8009B6670 /* SecItemShim.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -6013,7 +6045,11 @@
2989A411167D1834004F96D2 /* CustomProtocolManagerMac.mm in Sources */,
31A505F91680025500A930EB /* WebContextClient.cpp in Sources */,
BC9BA5041697C45300E44616 /* WebKit2Initialize.cpp in Sources */,
+ E18E690B169B563F009B6670 /* SecItemShimProxy.cpp in Sources */,
+ E18E6915169B667B009B6670 /* SecItemShimMessageReceiver.cpp in Sources */,
+ E18E6917169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp in Sources */,
BC9BA50816991C3C00E44616 /* ChildProcessMain.mm in Sources */,
+ E18E6949169B77C8009B6670 /* SecItemShim.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (139008 => 139009)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2013-01-08 00:20:54 UTC (rev 139009)
@@ -120,6 +120,10 @@
#include "PluginProcessConnectionManager.h"
#endif
+#if USE(SECURITY_FRAMEWORK)
+#include "SecItemShim.h"
+#endif
+
using namespace JSC;
using namespace WebCore;
@@ -208,6 +212,10 @@
connection->addQueueClient(&m_eventDispatcher);
connection->addQueueClient(this);
+#if USE(SECURITY_FRAMEWORK)
+ connection->addQueueClient(&SecItemShim::shared());
+#endif
+
m_webConnection = WebConnectionToUIProcess::create(this);
}
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (139008 => 139009)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2013-01-08 00:20:54 UTC (rev 139009)
@@ -92,10 +92,6 @@
class NetworkProcessConnection;
#endif
-#if USE(SECURITY_FRAMEWORK)
-class SecItemResponseData;
-#endif
-
#if ENABLE(NETWORK_PROCESS)
class WebResourceLoadScheduler;
#endif
@@ -270,10 +266,6 @@
void postInjectedBundleMessage(const CoreIPC::DataReference& messageData);
-#if USE(SECURITY_FRAMEWORK)
- void secItemResponse(CoreIPC::Connection*, uint64_t requestID, const SecItemResponseData&);
-#endif
-
// ChildProcess
virtual void initializeProcess(const ChildProcessInitializationParameters&) OVERRIDE;
virtual void initializeProcessName(const ChildProcessInitializationParameters&) OVERRIDE;
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (139008 => 139009)
--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2013-01-08 00:20:54 UTC (rev 139009)
@@ -98,10 +98,6 @@
PostInjectedBundleMessage(CoreIPC::DataReference messageData);
-#if USE(SECURITY_FRAMEWORK)
- SecItemResponse(uint64_t requestID, WebKit::SecItemResponseData response) DispatchOnConnectionQueue
-#endif
-
#if PLATFORM(MAC)
SetApplicationIsOccluded(bool flag);
#endif
Modified: trunk/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm (139008 => 139009)
--- trunk/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/WebProcess/mac/SecItemShimMethods.mm 2013-01-08 00:20:54 UTC (rev 139009)
@@ -30,7 +30,7 @@
#import "SecItemRequestData.h"
#import "SecItemResponseData.h"
#import "WebProcess.h"
-#import "WebProcessProxyMessages.h"
+#import "SecItemShimProxyMessages.h"
#import "WebProcessShim.h"
#import <Security/SecItem.h>
#import <dlfcn.h>
@@ -57,7 +57,7 @@
static PassOwnPtr<SecItemResponseData> sendSeqItemRequest(SecItemRequestData::Type requestType, CFDictionaryRef query, CFDictionaryRef attributesToMatch = 0)
{
uint64_t requestID = generateSecItemRequestID();
- if (!WebProcess::shared().connection()->send(Messages::WebProcessProxy::SecItemRequest(requestID, SecItemRequestData(requestType, query, attributesToMatch)), 0))
+ if (!WebProcess::shared().connection()->send(Messages::SecItemShimProxy::SecItemRequest(requestID, SecItemRequestData(requestType, query, attributesToMatch)), 0))
return nullptr;
return responseMap().waitForResponse(requestID);
Modified: trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm (139008 => 139009)
--- trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm 2013-01-08 00:20:20 UTC (rev 139008)
+++ trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm 2013-01-08 00:20:54 UTC (rev 139009)
@@ -28,7 +28,6 @@
#import "CustomProtocolManager.h"
#import "SandboxExtension.h"
-#import "SecItemShimMethods.h"
#import "WKFullKeyboardAccessWatcher.h"
#import "WebInspector.h"
#import "WebPage.h"
@@ -48,6 +47,10 @@
#import <objc/runtime.h>
#import <stdio.h>
+#if USE(SECURITY_FRAMEWORK)
+#import "SecItemShim.h"
+#endif
+
#if ENABLE(WEB_PROCESS_SANDBOX)
#import <pwd.h>
#import <stdlib.h>
@@ -308,7 +311,10 @@
void WebProcess::platformInitializeProcess(const ChildProcessInitializationParameters&)
{
WKAXRegisterRemoteApp();
- initializeSecItemShim();
+
+#if USE(SECURITY_FRAMEWORK)
+ SecItemShim::shared().install();
+#endif
}
void WebProcess::platformTerminate()
@@ -320,9 +326,4 @@
}
}
-void WebProcess::secItemResponse(CoreIPC::Connection*, uint64_t requestID, const SecItemResponseData& response)
-{
- didReceiveSecItemResponse(requestID, response);
-}
-
} // namespace WebKit