Diff
Modified: trunk/Source/WebKit/ChangeLog (260651 => 260652)
--- trunk/Source/WebKit/ChangeLog 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/ChangeLog 2020-04-24 17:25:31 UTC (rev 260652)
@@ -1,3 +1,27 @@
+2020-04-24 Alex Christensen <[email protected]>
+
+ Use sendWithAsyncReply for ShareSheet related messages
+ https://bugs.webkit.org/show_bug.cgi?id=210828
+ <rdar://problem/61800730>
+
+ Reviewed by Brent Fulgham.
+
+ * Platform/IPC/MessageSender.cpp:
+ We need to call addAsyncReplyHandler before sendMessage in case this is the first async message from this process.
+ Otherwise the reply from the first message is dropped sometimes.
+ * Shared/ShareSheetCallbackID.h: Removed.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::showShareSheet):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::showShareSheet):
+ (WebKit::nextShareSheetCallbackID): Deleted.
+ (WebKit::WebPage::didCompleteShareSheet): Deleted.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2020-04-24 Youenn Fablet <[email protected]> and Luming Yin <[email protected]>
Call STDynamicActivityAttributionPublisher in the WebProcess
Modified: trunk/Source/WebKit/Platform/IPC/MessageSender.cpp (260651 => 260652)
--- trunk/Source/WebKit/Platform/IPC/MessageSender.cpp 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/Platform/IPC/MessageSender.cpp 2020-04-24 17:25:31 UTC (rev 260652)
@@ -28,9 +28,7 @@
namespace IPC {
-MessageSender::~MessageSender()
-{
-}
+MessageSender::~MessageSender() = default;
bool MessageSender::sendMessage(std::unique_ptr<Encoder> encoder, OptionSet<SendOption> sendOptions, Optional<std::pair<CompletionHandler<void(IPC::Decoder*)>, uint64_t>>&& asyncReplyInfo)
{
@@ -37,12 +35,10 @@
auto* connection = messageSenderConnection();
ASSERT(connection);
- if (connection->sendMessage(WTFMove(encoder), sendOptions)) {
- if (asyncReplyInfo)
- IPC::addAsyncReplyHandler(*connection, asyncReplyInfo->second, WTFMove(asyncReplyInfo->first));
- return true;
- }
- return false;
+ if (asyncReplyInfo)
+ IPC::addAsyncReplyHandler(*connection, asyncReplyInfo->second, WTFMove(asyncReplyInfo->first));
+
+ return connection->sendMessage(WTFMove(encoder), sendOptions);
}
} // namespace IPC
Deleted: trunk/Source/WebKit/Shared/ShareSheetCallbackID.h (260651 => 260652)
--- trunk/Source/WebKit/Shared/ShareSheetCallbackID.h 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/Shared/ShareSheetCallbackID.h 2020-04-24 17:25:31 UTC (rev 260652)
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2018-2020 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. ``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
- * 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.
- */
-
-#pragma once
-
-typedef uint64_t ShareSheetCallbackID;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (260651 => 260652)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-04-24 17:25:31 UTC (rev 260652)
@@ -85,7 +85,6 @@
#include "PrintInfo.h"
#include "ProvisionalPageProxy.h"
#include "SafeBrowsingWarning.h"
-#include "ShareSheetCallbackID.h"
#include "SharedBufferDataReference.h"
#include "SyntheticEditingCommandType.h"
#include "TextChecker.h"
@@ -5903,12 +5902,8 @@
}
}
-void WebPageProxy::showShareSheet(const ShareDataWithParsedURL& shareData, ShareSheetCallbackID callbackID)
+void WebPageProxy::showShareSheet(const ShareDataWithParsedURL& shareData, CompletionHandler<void(bool)>&& completionHandler)
{
- CompletionHandler<void(bool)> completionHandler = [this, protectedThis = makeRef(*this), callbackID] (bool access) {
- send(Messages::WebPage::DidCompleteShareSheet(access, callbackID));
- };
-
pageClient().showShareSheet(shareData, WTFMove(completionHandler));
}
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (260651 => 260652)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-04-24 17:25:31 UTC (rev 260652)
@@ -45,7 +45,6 @@
#include "ProcessTerminationReason.h"
#include "ProcessThrottler.h"
#include "SandboxExtension.h"
-#include "ShareSheetCallbackID.h"
#include "ShareableBitmap.h"
#include "ShareableResource.h"
#include "SuspendedPageProxy.h"
@@ -1894,7 +1893,7 @@
void didChangeViewportProperties(const WebCore::ViewportAttributes&);
void pageDidScroll();
void runOpenPanel(WebCore::FrameIdentifier, FrameInfoData&&, const WebCore::FileChooserSettings&);
- void showShareSheet(const WebCore::ShareDataWithParsedURL&, ShareSheetCallbackID);
+ void showShareSheet(const WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&);
void printFrame(WebCore::FrameIdentifier, CompletionHandler<void()>&&);
void exceededDatabaseQuota(WebCore::FrameIdentifier, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, Messages::WebPageProxy::ExceededDatabaseQuotaDelayedReply&&);
void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, Messages::WebPageProxy::ReachedApplicationCacheOriginQuotaDelayedReply&&);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (260651 => 260652)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-04-24 17:25:31 UTC (rev 260652)
@@ -69,7 +69,7 @@
RunBeforeUnloadConfirmPanel(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, String message) -> (bool shouldClose) Synchronous
PageDidScroll()
RunOpenPanel(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, struct WebCore::FileChooserSettings parameters)
- ShowShareSheet(struct WebCore::ShareDataWithParsedURL shareData, uint64_t callbackID)
+ ShowShareSheet(struct WebCore::ShareDataWithParsedURL shareData) -> (bool granted) Async
PrintFrame(WebCore::FrameIdentifier frameID) -> () Synchronous
RunModal()
NotifyScrollerThumbIsVisibleInRect(WebCore::IntRect scrollerThumb)
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (260651 => 260652)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-04-24 17:25:31 UTC (rev 260652)
@@ -420,7 +420,6 @@
1D4D737023A9E54700717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D4D736B23A9DF5500717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp */; };
1D4D737123A9E56200717A25 /* RemoteMediaResourceManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D4D736C23A9DF6000717A25 /* RemoteMediaResourceManagerMessages.h */; };
1D4D737623A9ED1800717A25 /* RemoteMediaResourceManagerMessagesReplies.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D4D737523A9EB6800717A25 /* RemoteMediaResourceManagerMessagesReplies.h */; };
- 1D67B339212E1F6100FAA786 /* ShareSheetCallbackID.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D67B338212E1F6100FAA786 /* ShareSheetCallbackID.h */; };
1DB01943211CF002009FB3E8 /* WKShareSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DE0D095211CC21300439B5F /* WKShareSheet.h */; };
1DB01944211CF005009FB3E8 /* WKShareSheet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1DBBB061211CC3CB00502ECC /* WKShareSheet.mm */; };
1F335BC0185B84F0001A201A /* WKWebProcessPlugInLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F335BBF185B84D8001A201A /* WKWebProcessPlugInLoadDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2751,7 +2750,6 @@
1D4D736B23A9DF5500717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = RemoteMediaResourceManagerMessageReceiver.cpp; path = DerivedSources/WebKit2/RemoteMediaResourceManagerMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
1D4D736C23A9DF6000717A25 /* RemoteMediaResourceManagerMessages.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; name = RemoteMediaResourceManagerMessages.h; path = DerivedSources/WebKit2/RemoteMediaResourceManagerMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
1D4D737523A9EB6800717A25 /* RemoteMediaResourceManagerMessagesReplies.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; name = RemoteMediaResourceManagerMessagesReplies.h; path = DerivedSources/WebKit2/RemoteMediaResourceManagerMessagesReplies.h; sourceTree = BUILT_PRODUCTS_DIR; };
- 1D67B338212E1F6100FAA786 /* ShareSheetCallbackID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareSheetCallbackID.h; sourceTree = "<group>"; };
1D97EC7D240898D200466FFA /* MediaPlayerPrivateRemoteCocoa.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = MediaPlayerPrivateRemoteCocoa.mm; sourceTree = "<group>"; };
1DA4089423A80A3E0058C950 /* RemoteMediaResourceManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteMediaResourceManager.h; sourceTree = "<group>"; };
1DA4089E23A827780058C950 /* RemoteMediaResourceManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteMediaResourceManager.cpp; sourceTree = "<group>"; };
@@ -6082,7 +6080,6 @@
8313F7E71F7DAE0300B944EB /* SharedStringHashTable.h */,
83F9644B1FA0F76200C47750 /* SharedStringHashTableReadOnly.cpp */,
83F9644C1FA0F76300C47750 /* SharedStringHashTableReadOnly.h */,
- 1D67B338212E1F6100FAA786 /* ShareSheetCallbackID.h */,
1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */,
2FD43B921FA006A30083F51C /* TouchBarMenuData.cpp */,
2FD43B911FA006A10083F51C /* TouchBarMenuData.h */,
@@ -11098,7 +11095,6 @@
8313F7EC1F7DAE0800B944EB /* SharedStringHashStore.h in Headers */,
8313F7EE1F7DAE0800B944EB /* SharedStringHashTable.h in Headers */,
83F9644E1FA0F76E00C47750 /* SharedStringHashTableReadOnly.h in Headers */,
- 1D67B339212E1F6100FAA786 /* ShareSheetCallbackID.h in Headers */,
7A41E9FB21F81DAD00B88CDB /* ShouldGrandfatherStatistics.h in Headers */,
995226D6207D184600F78420 /* SimulatedInputDispatcher.h in Headers */,
2DAF06D618BD1A470081CEB1 /* SmartMagnificationController.h in Headers */,
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (260651 => 260652)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-04-24 17:25:31 UTC (rev 260652)
@@ -60,7 +60,6 @@
#include "RemoteWebInspectorUIMessages.h"
#include "SessionState.h"
#include "SessionStateConversion.h"
-#include "ShareSheetCallbackID.h"
#include "ShareableBitmap.h"
#include "SharedBufferDataReference.h"
#include "UserMediaPermissionRequestManager.h"
@@ -6744,29 +6743,11 @@
}
#endif
-static ShareSheetCallbackID nextShareSheetCallbackID()
-{
- static ShareSheetCallbackID nextCallbackID = 0;
- return ++nextCallbackID;
-}
-
void WebPage::showShareSheet(ShareDataWithParsedURL& shareData, WTF::CompletionHandler<void(bool)>&& callback)
{
- ShareSheetCallbackID callbackID = nextShareSheetCallbackID();
- auto addResult = m_shareSheetResponseCallbackMap.add(callbackID, WTFMove(callback));
- ASSERT(addResult.isNewEntry);
- if (addResult.iterator->value)
- send(Messages::WebPageProxy::ShowShareSheet(WTFMove(shareData), callbackID));
- else
- callback(false);
+ sendWithAsyncReply(Messages::WebPageProxy::ShowShareSheet(WTFMove(shareData)), WTFMove(callback));
}
-void WebPage::didCompleteShareSheet(bool wasGranted, ShareSheetCallbackID callbackID)
-{
- auto callback = m_shareSheetResponseCallbackMap.take(callbackID);
- callback(wasGranted);
-}
-
WebCore::DOMPasteAccessResponse WebPage::requestDOMPasteAccess(const String& originIdentifier)
{
auto response = WebCore::DOMPasteAccessResponse::DeniedForGesture;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (260651 => 260652)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-04-24 17:25:31 UTC (rev 260652)
@@ -48,7 +48,6 @@
#include "Plugin.h"
#include "PolicyDecision.h"
#include "SandboxExtension.h"
-#include "ShareSheetCallbackID.h"
#include "ShareableBitmap.h"
#include "SharedMemory.h"
#include "StorageNamespaceIdentifier.h"
@@ -1215,7 +1214,6 @@
#endif
void showShareSheet(WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&& callback);
- void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
#if ENABLE(ATTACHMENT_ELEMENT)
void insertAttachment(const String& identifier, Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
@@ -2071,7 +2069,6 @@
HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
HashMap<uint64_t, Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
- HashMap<ShareSheetCallbackID, Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
#if ENABLE(APPLICATION_MANIFEST)
HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (260651 => 260652)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-04-24 17:20:03 UTC (rev 260651)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-04-24 17:25:31 UTC (rev 260652)
@@ -342,7 +342,6 @@
#endif
DidChooseFilesForOpenPanel(Vector<String> fileURLs)
DidCancelForOpenPanel()
- DidCompleteShareSheet(bool wasGranted, uint64_t callbackID)
#if ENABLE(SANDBOX_EXTENSIONS)
ExtendSandboxForFilesFromOpenPanel(WebKit::SandboxExtension::HandleArray sandboxExtensions)
#endif