Diff
Modified: trunk/Source/WebCore/ChangeLog (251764 => 251765)
--- trunk/Source/WebCore/ChangeLog 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebCore/ChangeLog 2019-10-30 04:14:39 UTC (rev 251765)
@@ -1,3 +1,16 @@
+2019-10-29 Andy Estes <[email protected]>
+
+ [Quick Look] Clean up LegacyPreviewLoaderClients
+ https://bugs.webkit.org/show_bug.cgi?id=203472
+
+ Reviewed by Brady Eidson.
+
+ * loader/ios/LegacyPreviewLoader.mm:
+ (WebCore::LegacyPreviewLoader::didReceiveBuffer):
+ * platform/network/ios/LegacyPreviewLoaderClient.h:
+ (WebCore::LegacyPreviewLoaderClient::didReceiveBuffer):
+ (WebCore::LegacyPreviewLoaderClient::didReceiveDataArray): Deleted.
+
2019-10-29 Said Abou-Hallawa <[email protected]>
[SVG2] SVGSymbolElement should inherits SVGGraphicsElement
Modified: trunk/Source/WebCore/loader/ios/LegacyPreviewLoader.mm (251764 => 251765)
--- trunk/Source/WebCore/loader/ios/LegacyPreviewLoader.mm 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebCore/loader/ios/LegacyPreviewLoader.mm 2019-10-30 04:14:39 UTC (rev 251765)
@@ -71,7 +71,7 @@
LOG(Network, "LegacyPreviewLoader appending buffer with size %ld.", buffer.size());
m_originalData->append(buffer);
m_converter->updateMainResource();
- m_client->didReceiveDataArray((__bridge CFArrayRef)buffer.createNSDataArray().get());
+ m_client->didReceiveBuffer(buffer);
return true;
}
Modified: trunk/Source/WebCore/platform/network/ios/LegacyPreviewLoaderClient.h (251764 => 251765)
--- trunk/Source/WebCore/platform/network/ios/LegacyPreviewLoaderClient.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebCore/platform/network/ios/LegacyPreviewLoaderClient.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -31,10 +31,12 @@
namespace WebCore {
+class SharedBuffer;
+
class LegacyPreviewLoaderClient : public RefCounted<LegacyPreviewLoaderClient> {
public:
virtual ~LegacyPreviewLoaderClient() = default;
- virtual void didReceiveDataArray(CFArrayRef) { }
+ virtual void didReceiveBuffer(const SharedBuffer&) { }
virtual void didFinishLoading() { }
virtual void didFail() { }
virtual bool supportsPasswordEntry() const { return false; }
Modified: trunk/Source/WebKit/ChangeLog (251764 => 251765)
--- trunk/Source/WebKit/ChangeLog 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/ChangeLog 2019-10-30 04:14:39 UTC (rev 251765)
@@ -1,3 +1,58 @@
+2019-10-29 Andy Estes <[email protected]>
+
+ [Quick Look] Clean up LegacyPreviewLoaderClients
+ https://bugs.webkit.org/show_bug.cgi?id=203472
+
+ Reviewed by Brady Eidson.
+
+ Replaced QuickLookDocumentData with ShareableResource.
+
+ Removed messages WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame and
+ WebPage::DidReceivePasswordForQuickLookDocument, replacing them with async message
+ WebPageProxy::RequestPasswordForQuickLookDocumentInMainFrame.
+
+ * Shared/ios/QuickLookDocumentData.cpp: Removed.
+ * Shared/ios/QuickLookDocumentData.h: Removed.
+ * SourcesCocoa.txt:
+ * UIProcess/API/APILoaderClient.h:
+ * UIProcess/API/APINavigationClient.h:
+ (API::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame):
+ * UIProcess/Cocoa/NavigationState.h:
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame):
+ * UIProcess/ProvisionalPageProxy.cpp:
+ (WebKit::ProvisionalPageProxy::requestPasswordForQuickLookDocumentInMainFrame):
+ (WebKit::ProvisionalPageProxy::didReceiveMessage):
+ (WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Deleted.
+ * UIProcess/ProvisionalPageProxy.h:
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::didFinishLoadForQuickLookDocumentInMainFrame):
+ (WebKit::WebPageProxy::requestPasswordForQuickLookDocumentInMainFrame):
+ (WebKit::WebPageProxy::requestPasswordForQuickLookDocumentInMainFrameShared):
+ (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame): Deleted.
+ (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared): Deleted.
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
+ (WebKit::WebPreviewLoaderClient::WebPreviewLoaderClient):
+ (WebKit::WebPreviewLoaderClient::didReceiveBuffer):
+ (WebKit::WebPreviewLoaderClient::didFinishLoading):
+ (WebKit::WebPreviewLoaderClient::didFail):
+ (WebKit::WebPreviewLoaderClient::didRequestPassword):
+ (WebKit::passwordCallbacks): Deleted.
+ (WebKit::WebPreviewLoaderClient::~WebPreviewLoaderClient): Deleted.
+ (WebKit::WebPreviewLoaderClient::didReceiveDataArray): Deleted.
+ (WebKit::WebPreviewLoaderClient::didReceivePassword): Deleted.
+ * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h:
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::didStartLoadForQuickLookDocumentInMainFrame):
+ (WebKit::WebPage::didFinishLoadForQuickLookDocumentInMainFrame):
+ (WebKit::WebPage::requestPasswordForQuickLookDocumentInMainFrame):
+ (WebKit::WebPage::didReceivePasswordForQuickLookDocument): Deleted.
+
2019-10-29 Jiewen Tan <[email protected]>
[WebAuthn] Add more information to _WKWebAuthenticationPanel
Copied: trunk/Source/WebKit/Platform/SharedMemory.cpp (from rev 251764, trunk/Source/WebKit/Shared/ios/QuickLookDocumentData.h) (0 => 251765)
--- trunk/Source/WebKit/Platform/SharedMemory.cpp (rev 0)
+++ trunk/Source/WebKit/Platform/SharedMemory.cpp 2019-10-30 04:14:39 UTC (rev 251765)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2019 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 "SharedMemory.h"
+
+#include <WebCore/SharedBuffer.h>
+
+namespace WebKit {
+
+using namespace WebCore;
+
+RefPtr<SharedMemory> SharedMemory::copyBuffer(const SharedBuffer& buffer)
+{
+ if (buffer.isEmpty())
+ return nullptr;
+
+ auto sharedMemory = allocate(buffer.size());
+ if (!sharedMemory)
+ return nullptr;
+
+ char* const sharedMemoryPtr = reinterpret_cast<char*>(sharedMemory->data());
+ size_t position = 0;
+ while (buffer.size() > position) {
+ auto data = ""
+ auto result = memcpy(sharedMemoryPtr + position, data.data(), data.size());
+ ASSERT_UNUSED(result, result == sharedMemoryPtr + position);
+ position += data.size();
+ }
+
+ return sharedMemory;
+}
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/Platform/SharedMemory.h (251764 => 251765)
--- trunk/Source/WebKit/Platform/SharedMemory.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/Platform/SharedMemory.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -44,6 +44,10 @@
class Encoder;
}
+namespace WebCore {
+class SharedBuffer;
+}
+
#if OS(DARWIN)
namespace WTF {
class MachSendRight;
@@ -97,6 +101,7 @@
static RefPtr<SharedMemory> allocate(size_t);
static RefPtr<SharedMemory> create(void*, size_t, Protection);
+ static RefPtr<SharedMemory> copyBuffer(const WebCore::SharedBuffer&);
static RefPtr<SharedMemory> map(const Handle&, Protection);
#if USE(UNIX_DOMAIN_SOCKETS)
static RefPtr<SharedMemory> wrapMap(void*, size_t, int fileDescriptor);
Deleted: trunk/Source/WebKit/Shared/ios/QuickLookDocumentData.cpp (251764 => 251765)
--- trunk/Source/WebKit/Shared/ios/QuickLookDocumentData.cpp 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/Shared/ios/QuickLookDocumentData.cpp 2019-10-30 04:14:39 UTC (rev 251765)
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2014 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 "QuickLookDocumentData.h"
-
-#if USE(QUICK_LOOK)
-
-#include "Decoder.h"
-#include "Encoder.h"
-
-namespace WebKit {
-
-void QuickLookDocumentData::append(CFDataRef data)
-{
- m_data.append(data);
-}
-
-CFDataRef QuickLookDocumentData::decodedData() const
-{
- ASSERT(m_data.size() <= 1);
- if (m_data.isEmpty())
- return nullptr;
- return m_data[0].get();
-}
-
-bool QuickLookDocumentData::isEmpty() const
-{
- return m_data.isEmpty();
-}
-
-void QuickLookDocumentData::clear()
-{
- m_data.clear();
-}
-
-void QuickLookDocumentData::encode(IPC::Encoder& encoder) const
-{
- uint64_t size = 0;
- for (const auto& data : m_data)
- size += CFDataGetLength(data.get());
- encoder << size;
-
- for (const auto& data : m_data)
- encoder.encodeFixedLengthData(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()), 1);
-}
-
-bool QuickLookDocumentData::decode(IPC::Decoder& decoder, QuickLookDocumentData& documentData)
-{
- uint64_t size;
- if (!decoder.decode(size))
- return false;
-
- if (!size)
- return true;
-
- uint8_t* const buffer = static_cast<uint8_t*>(CFAllocatorAllocate(kCFAllocatorDefault, size, 0));
- ASSERT(buffer);
-
- if (!decoder.decodeFixedLengthData(buffer, size, 1)) {
- CFAllocatorDeallocate(kCFAllocatorDefault, buffer);
- return false;
- }
-
- documentData.clear();
- documentData.m_data.append(adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, buffer, size, kCFAllocatorDefault)));
- return true;
-}
-
-} // namespace WebKit
-
-#endif // USE(QUICK_LOOK)
Deleted: trunk/Source/WebKit/Shared/ios/QuickLookDocumentData.h (251764 => 251765)
--- trunk/Source/WebKit/Shared/ios/QuickLookDocumentData.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/Shared/ios/QuickLookDocumentData.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2014 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 QuickLookDocumentData_h
-#define QuickLookDocumentData_h
-
-#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
-
-namespace IPC {
-class Decoder;
-class Encoder;
-}
-
-namespace WebKit {
-
-class QuickLookDocumentData {
-public:
- void append(CFDataRef);
- CFDataRef decodedData() const;
- bool isEmpty() const;
- void clear();
- void encode(IPC::Encoder&) const;
- static bool decode(IPC::Decoder&, QuickLookDocumentData&);
-
-private:
- Vector<RetainPtr<CFDataRef>, 1> m_data;
-};
-} // namespace WebKit
-
-#endif // QuickLookDocumentData_h
Modified: trunk/Source/WebKit/Sources.txt (251764 => 251765)
--- trunk/Source/WebKit/Sources.txt 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/Sources.txt 2019-10-30 04:14:39 UTC (rev 251765)
@@ -96,6 +96,7 @@
// TODO: We should unify these files once GTK's PluginProcess2 is removed.
Platform/Logging.cpp @no-unify
Platform/Module.cpp @no-unify
+Platform/SharedMemory.cpp @no-unify
// TODO: We should unify these files once GTK's PluginProcess2 is removed.
Platform/IPC/ArgumentCoders.cpp @no-unify
Modified: trunk/Source/WebKit/SourcesCocoa.txt (251764 => 251765)
--- trunk/Source/WebKit/SourcesCocoa.txt 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2019-10-30 04:14:39 UTC (rev 251765)
@@ -173,7 +173,6 @@
Shared/ios/NativeWebKeyboardEventIOS.mm
Shared/ios/NativeWebMouseEventIOS.mm
Shared/ios/NativeWebTouchEventIOS.mm
-Shared/ios/QuickLookDocumentData.cpp
Shared/ios/WebAutocorrectionData.mm
Shared/ios/WebIconUtilities.mm
Shared/ios/WebIOSEventFactory.mm
Modified: trunk/Source/WebKit/UIProcess/API/APILoaderClient.h (251764 => 251765)
--- trunk/Source/WebKit/UIProcess/API/APILoaderClient.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/UIProcess/API/APILoaderClient.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -38,7 +38,6 @@
namespace WebKit {
class AuthenticationChallengeProxy;
-class QuickLookDocumentData;
class WebBackForwardListItem;
class WebFrameProxy;
class WebPageProxy;
Modified: trunk/Source/WebKit/UIProcess/API/APINavigationClient.h (251764 => 251765)
--- trunk/Source/WebKit/UIProcess/API/APINavigationClient.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/UIProcess/API/APINavigationClient.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -49,12 +49,12 @@
class ResourceError;
class ResourceRequest;
class ResourceResponse;
+class SharedBuffer;
struct SecurityOriginData;
}
namespace WebKit {
class AuthenticationChallengeProxy;
-class QuickLookDocumentData;
class WebBackForwardListItem;
class WebFramePolicyListenerProxy;
class WebFrameProxy;
@@ -109,7 +109,7 @@
#if USE(QUICK_LOOK)
virtual void didStartLoadForQuickLookDocumentInMainFrame(const WTF::String& fileName, const WTF::String& uti) { }
- virtual void didFinishLoadForQuickLookDocumentInMainFrame(const WebKit::QuickLookDocumentData&) { }
+ virtual void didFinishLoadForQuickLookDocumentInMainFrame(const WebCore::SharedBuffer&) { }
#endif
virtual void decidePolicyForNavigationAction(WebKit::WebPageProxy&, Ref<NavigationAction>&&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, Object*)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h (251764 => 251765)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -122,7 +122,7 @@
#if USE(QUICK_LOOK)
void didStartLoadForQuickLookDocumentInMainFrame(const WTF::String& fileName, const WTF::String& uti) override;
- void didFinishLoadForQuickLookDocumentInMainFrame(const QuickLookDocumentData&) override;
+ void didFinishLoadForQuickLookDocumentInMainFrame(const WebCore::SharedBuffer&) override;
#endif
#if PLATFORM(MAC)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (251764 => 251765)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2019-10-30 04:14:39 UTC (rev 251765)
@@ -83,10 +83,6 @@
#import <pal/spi/cocoa/LaunchServicesSPI.h>
#endif
-#if USE(QUICK_LOOK)
-#import "QuickLookDocumentData.h"
-#endif
-
namespace WebKit {
using namespace WebCore;
@@ -1083,7 +1079,7 @@
[static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView didStartLoadForQuickLookDocumentInMainFrameWithFileName:fileName uti:uti];
}
-void NavigationState::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame(const QuickLookDocumentData& data)
+void NavigationState::NavigationClient::didFinishLoadForQuickLookDocumentInMainFrame(const SharedBuffer& buffer)
{
if (!m_navigationState.m_navigationDelegateMethods.webViewDidFinishLoadForQuickLookDocumentInMainFrame)
return;
@@ -1092,7 +1088,7 @@
if (!navigationDelegate)
return;
- [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView didFinishLoadForQuickLookDocumentInMainFrame:(NSData *)data.decodedData()];
+ [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView didFinishLoadForQuickLookDocumentInMainFrame:buffer.createNSData().get()];
}
#endif
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (251764 => 251765)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2019-10-30 04:14:39 UTC (rev 251765)
@@ -354,9 +354,9 @@
}
#if USE(QUICK_LOOK)
-void ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName)
+void ProvisionalPageProxy::requestPasswordForQuickLookDocumentInMainFrame(const String& fileName, CompletionHandler<void(const String&)>&& completionHandler)
{
- m_page.didRequestPasswordForQuickLookDocumentInMainFrameShared(m_process.copyRef(), fileName);
+ m_page.requestPasswordForQuickLookDocumentInMainFrameShared(fileName, WTFMove(completionHandler));
}
#endif
@@ -469,8 +469,8 @@
}
#if USE(QUICK_LOOK)
- if (decoder.messageName() == Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame::name()) {
- IPC::handleMessage<Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame>(decoder, this, &ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame);
+ if (decoder.messageName() == Messages::WebPageProxy::RequestPasswordForQuickLookDocumentInMainFrame::name()) {
+ IPC::handleMessageAsync<Messages::WebPageProxy::RequestPasswordForQuickLookDocumentInMainFrame>(connection, decoder, this, &ProvisionalPageProxy::requestPasswordForQuickLookDocumentInMainFrame);
return;
}
#endif
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h (251764 => 251765)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -115,7 +115,7 @@
FrameInfoData&&, Optional<WebPageProxyIdentifier> originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody,
WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSyncDelayedReply&&);
#if USE(QUICK_LOOK)
- void didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName);
+ void requestPasswordForQuickLookDocumentInMainFrame(const String& fileName, CompletionHandler<void(const String&)>&&);
#endif
#if PLATFORM(COCOA)
void registerWebProcessAccessibilityToken(const IPC::DataReference&);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (251764 => 251765)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -44,6 +44,7 @@
#include "SandboxExtension.h"
#include "ShareSheetCallbackID.h"
#include "ShareableBitmap.h"
+#include "ShareableResource.h"
#include "SuspendedPageProxy.h"
#include "SyntheticEditingCommandType.h"
#include "SystemPreviewController.h"
@@ -329,10 +330,6 @@
enum class UndoOrRedo : bool;
enum class WebContentMode : uint8_t;
-#if USE(QUICK_LOOK)
-class QuickLookDocumentData;
-#endif
-
typedef GenericCallback<API::Data*> DataCallback;
typedef GenericCallback<uint64_t> UnsignedCallback;
typedef GenericCallback<EditingRange> EditingRangeCallback;
@@ -1560,7 +1557,7 @@
FrameInfoData&&, Optional<WebPageProxyIdentifier> originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody,
WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSyncDelayedReply&&);
#if USE(QUICK_LOOK)
- void didRequestPasswordForQuickLookDocumentInMainFrameShared(Ref<WebProcessProxy>&&, const String& fileName);
+ void requestPasswordForQuickLookDocumentInMainFrameShared(const String& fileName, CompletionHandler<void(const String&)>&&);
#endif
#if ENABLE(CONTENT_FILTERING)
void contentFilterDidBlockLoadForFrameShared(Ref<WebProcessProxy>&&, const WebCore::ContentFilterUnblockHandler&, WebCore::FrameIdentifier);
@@ -2052,8 +2049,8 @@
#if USE(QUICK_LOOK)
void didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti);
- void didFinishLoadForQuickLookDocumentInMainFrame(const QuickLookDocumentData&);
- void didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName);
+ void didFinishLoadForQuickLookDocumentInMainFrame(const ShareableResource::Handle&);
+ void requestPasswordForQuickLookDocumentInMainFrame(const String& fileName, CompletionHandler<void(const String&)>&&);
#endif
#if ENABLE(CONTENT_FILTERING)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (251764 => 251765)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-10-30 04:14:39 UTC (rev 251765)
@@ -467,8 +467,8 @@
#if USE(QUICK_LOOK)
DidStartLoadForQuickLookDocumentInMainFrame(String fileName, String uti)
- DidFinishLoadForQuickLookDocumentInMainFrame(WebKit::QuickLookDocumentData data)
- DidRequestPasswordForQuickLookDocumentInMainFrame(String fileName)
+ DidFinishLoadForQuickLookDocumentInMainFrame(WebKit::ShareableResource::Handle resource)
+ RequestPasswordForQuickLookDocumentInMainFrame(String fileName) -> (String password) Async
#endif
#if ENABLE(CONTENT_FILTERING)
Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (251764 => 251765)
--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-10-30 04:14:39 UTC (rev 251765)
@@ -47,6 +47,7 @@
#import "RemoteLayerTreeDrawingAreaProxyMessages.h"
#import "RemoteLayerTreeTransaction.h"
#import "RemoteScrollingCoordinatorProxy.h"
+#import "ShareableResource.h"
#import "UIKitSPI.h"
#import "UserData.h"
#import "VersionChecks.h"
@@ -1249,7 +1250,7 @@
#endif
#if USE(QUICK_LOOK)
-
+
void WebPageProxy::didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti)
{
// Ensure that fileName isn't really a path name
@@ -1257,21 +1258,23 @@
m_navigationClient->didStartLoadForQuickLookDocumentInMainFrame(fileName.substring(fileName.reverseFind('/') + 1), uti);
}
-void WebPageProxy::didFinishLoadForQuickLookDocumentInMainFrame(const QuickLookDocumentData& data)
+void WebPageProxy::didFinishLoadForQuickLookDocumentInMainFrame(const ShareableResource::Handle& handle)
{
- m_navigationClient->didFinishLoadForQuickLookDocumentInMainFrame(data);
+ auto buffer = handle.tryWrapInSharedBuffer();
+ if (!buffer)
+ return;
+
+ m_navigationClient->didFinishLoadForQuickLookDocumentInMainFrame(*buffer);
}
-void WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName)
+void WebPageProxy::requestPasswordForQuickLookDocumentInMainFrame(const String& fileName, CompletionHandler<void(const String&)>&& completionHandler)
{
- didRequestPasswordForQuickLookDocumentInMainFrameShared(m_process.copyRef(), fileName);
+ requestPasswordForQuickLookDocumentInMainFrameShared(fileName, WTFMove(completionHandler));
}
-void WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared(Ref<WebProcessProxy>&& process, const String& fileName)
+void WebPageProxy::requestPasswordForQuickLookDocumentInMainFrameShared(const String& fileName, CompletionHandler<void(const String&)>&& completionHandler)
{
- pageClient().requestPasswordForQuickLookDocument(fileName, [process = WTFMove(process), webPageID = m_webPageID](const String& password) {
- process->send(Messages::WebPage::DidReceivePasswordForQuickLookDocument(password), webPageID);
- });
+ pageClient().requestPasswordForQuickLookDocument(fileName, WTFMove(completionHandler));
}
#endif
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (251764 => 251765)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-10-30 04:14:39 UTC (rev 251765)
@@ -1343,7 +1343,6 @@
A102A7081EC0EEE900D81D82 /* com.macromedia.Flash Player ESR.plugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7A5E39491D5BD8A700B4B7CE /* com.macromedia.Flash Player ESR.plugin.sb */; };
A1046EA12079263100F0C5D8 /* WKPDFView.h in Headers */ = {isa = PBXBuildFile; fileRef = A1046E9F2079263100F0C5D8 /* WKPDFView.h */; };
A115DC72191D82DA00DA8072 /* _WKWebViewPrintFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = A115DC6E191D82AB00DA8072 /* _WKWebViewPrintFormatter.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A118A9EF1907AD6F00F7C92B /* QuickLookDocumentData.h in Headers */ = {isa = PBXBuildFile; fileRef = A118A9ED1907AD6F00F7C92B /* QuickLookDocumentData.h */; };
A118A9F31908B8EA00F7C92B /* _WKNSFileManagerExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A118A9F11908B8EA00F7C92B /* _WKNSFileManagerExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
A13B3DA2207F39DE0090C58D /* MobileWiFiSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A13B3DA1207F39DE0090C58D /* MobileWiFiSPI.h */; };
A13DC682207AA6B20066EF72 /* WKApplicationStateTrackingView.h in Headers */ = {isa = PBXBuildFile; fileRef = A13DC680207AA6B20066EF72 /* WKApplicationStateTrackingView.h */; };
@@ -1360,6 +1359,7 @@
A1A4FE5A18DCE9FA00B5EA8A /* _WKDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE5718DCE9FA00B5EA8A /* _WKDownload.h */; settings = {ATTRIBUTES = (Private, ); }; };
A1A4FE5C18DCE9FA00B5EA8A /* _WKDownloadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE5918DCE9FA00B5EA8A /* _WKDownloadInternal.h */; };
A1A4FE6118DD54A400B5EA8A /* _WKDownloadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE6018DD54A400B5EA8A /* _WKDownloadDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A1ADAFB62368E6A8009CB776 /* SharedMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1ADAFB52368E4B8009CB776 /* SharedMemory.cpp */; };
A1C512C9190656E500448914 /* WebPreviewLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A1C512C7190656E500448914 /* WebPreviewLoaderClient.h */; };
A1DF631318E0B7C8003A3E2A /* DownloadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A1DF631118E0B7C8003A3E2A /* DownloadClient.h */; };
A1E688701F6E2BAB007006A6 /* QuarantineSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A1E6886F1F6E2BAB007006A6 /* QuarantineSPI.h */; };
@@ -1734,6 +1734,8 @@
compilerSpec = com.apple.compilers.proxy.script;
filePatterns = "*.h";
fileType = pattern.proxy;
+ inputFiles = (
+ );
isEditable = 1;
outputFiles = (
"$(HEADER_OUTPUT_DIR)/$(INPUT_FILE_NAME)",
@@ -4073,8 +4075,6 @@
A1046EA02079263100F0C5D8 /* WKPDFView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKPDFView.mm; path = ios/WKPDFView.mm; sourceTree = "<group>"; };
A115DC6D191D82AB00DA8072 /* _WKWebViewPrintFormatter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKWebViewPrintFormatter.mm; sourceTree = "<group>"; };
A115DC6E191D82AB00DA8072 /* _WKWebViewPrintFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebViewPrintFormatter.h; sourceTree = "<group>"; };
- A118A9EC1907AD6F00F7C92B /* QuickLookDocumentData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = QuickLookDocumentData.cpp; path = ios/QuickLookDocumentData.cpp; sourceTree = "<group>"; };
- A118A9ED1907AD6F00F7C92B /* QuickLookDocumentData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuickLookDocumentData.h; path = ios/QuickLookDocumentData.h; sourceTree = "<group>"; };
A118A9F01908B8EA00F7C92B /* _WKNSFileManagerExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKNSFileManagerExtras.mm; sourceTree = "<group>"; };
A118A9F11908B8EA00F7C92B /* _WKNSFileManagerExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKNSFileManagerExtras.h; sourceTree = "<group>"; };
A13B3DA1207F39DE0090C58D /* MobileWiFiSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MobileWiFiSPI.h; sourceTree = "<group>"; };
@@ -4102,6 +4102,7 @@
A1A4FE5818DCE9FA00B5EA8A /* _WKDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKDownload.mm; sourceTree = "<group>"; };
A1A4FE5918DCE9FA00B5EA8A /* _WKDownloadInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKDownloadInternal.h; sourceTree = "<group>"; };
A1A4FE6018DD54A400B5EA8A /* _WKDownloadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKDownloadDelegate.h; sourceTree = "<group>"; };
+ A1ADAFB52368E4B8009CB776 /* SharedMemory.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SharedMemory.cpp; sourceTree = "<group>"; };
A1B89B92221E023300EB4CEA /* SDKVariant.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = SDKVariant.xcconfig; sourceTree = "<group>"; };
A1B9CA382246E54A003D6DCA /* WebPaymentCoordinatorCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPaymentCoordinatorCocoa.mm; sourceTree = "<group>"; };
A1C512C6190656E500448914 /* WebPreviewLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPreviewLoaderClient.cpp; path = ios/WebPreviewLoaderClient.cpp; sourceTree = "<group>"; };
@@ -6072,8 +6073,6 @@
2DA944971884E4F000ED86DB /* NativeWebKeyboardEventIOS.mm */,
1C9EBA5B2087E74E00054429 /* NativeWebMouseEventIOS.mm */,
2DA944981884E4F000ED86DB /* NativeWebTouchEventIOS.mm */,
- A118A9EC1907AD6F00F7C92B /* QuickLookDocumentData.cpp */,
- A118A9ED1907AD6F00F7C92B /* QuickLookDocumentData.h */,
4459984122833E6000E61373 /* SyntheticEditingCommandType.h */,
F40D1B68220BDC0F00B49A01 /* WebAutocorrectionContext.h */,
F42D633F22A0EFD300D2FB3A /* WebAutocorrectionData.h */,
@@ -8429,6 +8428,7 @@
0FDCD7F61D47E92A009F08BC /* LogInitialization.h */,
C0E3AA451209E2BA00A49D01 /* Module.cpp */,
C0E3AA441209E2BA00A49D01 /* Module.h */,
+ A1ADAFB52368E4B8009CB776 /* SharedMemory.cpp */,
1A24BED3120894D100FBB059 /* SharedMemory.h */,
);
path = Platform;
@@ -9753,7 +9753,6 @@
86E67A251910B9D100004AB7 /* ProcessThrottler.h in Headers */,
83048AE61ACA45DC0082C832 /* ProcessThrottlerClient.h in Headers */,
A1E688701F6E2BAB007006A6 /* QuarantineSPI.h in Headers */,
- A118A9EF1907AD6F00F7C92B /* QuickLookDocumentData.h in Headers */,
57FD318222B3515E008D0E8B /* RedirectSOAuthorizationSession.h in Headers */,
2D47B56D1810714E003A3AEE /* RemoteLayerBackingStore.h in Headers */,
2DDF731518E95060004F5A66 /* RemoteLayerBackingStoreCollection.h in Headers */,
@@ -11355,6 +11354,7 @@
E18E6917169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp in Sources */,
41DE7C6C22278F1E00532B65 /* ServiceWorkerFetchTask.cpp in Sources */,
2D92A787212B6AB100F493FD /* ShareableBitmap.cpp in Sources */,
+ A1ADAFB62368E6A8009CB776 /* SharedMemory.cpp in Sources */,
2DE6943D18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp in Sources */,
1A334DED16DE8F88006A8E38 /* StorageAreaMapMessageReceiver.cpp in Sources */,
9368EEDE2303A90200BDB11A /* StorageManagerSetMessageReceiver.cpp in Sources */,
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp (251764 => 251765)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp 2019-10-30 04:14:39 UTC (rev 251765)
@@ -31,7 +31,7 @@
#include "Logging.h"
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
-#include <WebCore/QuickLook.h>
+#include <WebCore/SharedBuffer.h>
#include <wtf/Function.h>
#include <wtf/HashMap.h>
#include <wtf/NeverDestroyed.h>
@@ -38,61 +38,54 @@
namespace WebKit {
-using PasswordCallbackMap = HashMap<WebCore::PageIdentifier, Function<void(const String&)>>;
-static PasswordCallbackMap& passwordCallbacks()
-{
- static NeverDestroyed<PasswordCallbackMap> callbackMap;
- return callbackMap.get();
-}
+using namespace WebCore;
-WebPreviewLoaderClient::WebPreviewLoaderClient(const String& fileName, const String& uti, WebCore::PageIdentifier pageID)
+WebPreviewLoaderClient::WebPreviewLoaderClient(const String& fileName, const String& uti, PageIdentifier pageID)
: m_fileName { fileName }
, m_uti { uti }
, m_pageID { pageID }
+ , m_buffer { SharedBuffer::create() }
{
}
-WebPreviewLoaderClient::~WebPreviewLoaderClient()
-{
- passwordCallbacks().remove(m_pageID);
-}
+WebPreviewLoaderClient::~WebPreviewLoaderClient() = default;
-void WebPreviewLoaderClient::didReceiveDataArray(CFArrayRef dataArray)
+void WebPreviewLoaderClient::didReceiveBuffer(const SharedBuffer& buffer)
{
- if (m_data.isEmpty())
- WebProcess::singleton().send(Messages::WebPageProxy::DidStartLoadForQuickLookDocumentInMainFrame(m_fileName, m_uti), m_pageID);
+ auto webPage = WebProcess::singleton().webPage(m_pageID);
+ if (!webPage)
+ return;
- CFArrayApplyFunction(dataArray, CFRangeMake(0, CFArrayGetCount(dataArray)), [](const void* value, void* context) {
- ASSERT(CFGetTypeID(value) == CFDataGetTypeID());
- static_cast<QuickLookDocumentData*>(context)->append((CFDataRef)value);
- }, &m_data);
+ if (m_buffer->isEmpty())
+ webPage->didStartLoadForQuickLookDocumentInMainFrame(m_fileName, m_uti);
+
+ m_buffer->append(buffer);
}
void WebPreviewLoaderClient::didFinishLoading()
{
- WebProcess::singleton().send(Messages::WebPageProxy::DidFinishLoadForQuickLookDocumentInMainFrame(m_data), m_pageID);
- m_data.clear();
+ auto webPage = WebProcess::singleton().webPage(m_pageID);
+ if (!webPage)
+ return;
+
+ webPage->didFinishLoadForQuickLookDocumentInMainFrame(m_buffer.get());
+ m_buffer->clear();
}
void WebPreviewLoaderClient::didFail()
{
- m_data.clear();
+ m_buffer->clear();
}
void WebPreviewLoaderClient::didRequestPassword(Function<void(const String&)>&& completionHandler)
{
- ASSERT(!passwordCallbacks().contains(m_pageID));
- passwordCallbacks().add(m_pageID, WTFMove(completionHandler));
- WebProcess::singleton().send(Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame(m_fileName), m_pageID);
-}
+ auto webPage = WebProcess::singleton().webPage(m_pageID);
+ if (!webPage) {
+ completionHandler({ });
+ return;
+ }
-void WebPreviewLoaderClient::didReceivePassword(const String& password, WebCore::PageIdentifier pageID)
-{
- ASSERT(passwordCallbacks().contains(pageID));
- if (auto completionHandler = passwordCallbacks().take(pageID))
- completionHandler(password);
- else
- RELEASE_LOG_ERROR(Loading, "Discarding a password for a page that did not request one in this process");
+ webPage->requestPasswordForQuickLookDocumentInMainFrame(m_fileName, WTFMove(completionHandler));
}
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h (251764 => 251765)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -27,7 +27,6 @@
#if USE(QUICK_LOOK)
-#include "QuickLookDocumentData.h"
#include <WebCore/LegacyPreviewLoaderClient.h>
#include <WebCore/PageIdentifier.h>
#include <wtf/text/WTFString.h>
@@ -44,11 +43,9 @@
}
~WebPreviewLoaderClient();
- static void didReceivePassword(const String&, WebCore::PageIdentifier);
-
private:
WebPreviewLoaderClient(const String& fileName, const String& uti, WebCore::PageIdentifier);
- void didReceiveDataArray(CFArrayRef) override;
+ void didReceiveBuffer(const WebCore::SharedBuffer&) override;
void didFinishLoading() override;
void didFail() override;
bool supportsPasswordEntry() const override { return true; }
@@ -57,7 +54,7 @@
const String m_fileName;
const String m_uti;
const WebCore::PageIdentifier m_pageID;
- QuickLookDocumentData m_data;
+ Ref<WebCore::SharedBuffer> m_buffer;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (251764 => 251765)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-10-30 04:14:39 UTC (rev 251765)
@@ -1234,6 +1234,12 @@
static WebCore::IntRect rootViewInteractionBoundsForElement(const WebCore::Element&);
#endif // PLATFORM(IOS_FAMILY)
+#if USE(QUICK_LOOK)
+ void didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti);
+ void didFinishLoadForQuickLookDocumentInMainFrame(const WebCore::SharedBuffer&);
+ void requestPasswordForQuickLookDocumentInMainFrame(const String& fileName, CompletionHandler<void(const String&)>&&);
+#endif
+
private:
WebPage(WebCore::PageIdentifier, WebPageCreationParameters&&);
@@ -1595,10 +1601,6 @@
bool canPluginHandleResponse(const WebCore::ResourceResponse&);
-#if USE(QUICK_LOOK)
- void didReceivePasswordForQuickLookDocument(const String&);
-#endif
-
void simulateDeviceOrientationChange(double alpha, double beta, double gamma);
#if USE(SYSTEM_PREVIEW)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (251764 => 251765)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-10-30 04:14:39 UTC (rev 251765)
@@ -532,10 +532,6 @@
GamepadActivity(Vector<WebKit::GamepadData> gamepadDatas, bool shouldMakeGamepadsVisible)
#endif
-#if USE(QUICK_LOOK)
- DidReceivePasswordForQuickLookDocument(String password)
-#endif
-
FrameBecameRemote(WebCore::FrameIdentifier frameID, struct WebCore::GlobalFrameIdentifier remoteFrameIdentifier, struct WebCore::GlobalWindowIdentifier remoteWindowIdentifier)
RegisterURLSchemeHandler(uint64_t identifier, String scheme)
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (251764 => 251765)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-10-30 04:14:39 UTC (rev 251765)
@@ -42,6 +42,7 @@
#import "PrintInfo.h"
#import "RemoteLayerTreeDrawingArea.h"
#import "SandboxUtilities.h"
+#import "SharedMemory.h"
#import "SyntheticEditingCommandType.h"
#import "TextCheckingControllerProxy.h"
#import "UIKitSPI.h"
@@ -3843,13 +3844,6 @@
send(Messages::WebPageProxy::UpdateStringForFind(findString));
}
-#if USE(QUICK_LOOK)
-void WebPage::didReceivePasswordForQuickLookDocument(const String& password)
-{
- WebPreviewLoaderClient::didReceivePassword(password, m_identifier);
-}
-#endif
-
bool WebPage::platformPrefersTextLegibilityBasedZoomScaling() const
{
#if PLATFORM(WATCHOS)
@@ -4078,6 +4072,40 @@
completionHandler(context);
}
+#if USE(QUICK_LOOK)
+
+void WebPage::didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti)
+{
+ send(Messages::WebPageProxy::DidStartLoadForQuickLookDocumentInMainFrame(fileName, uti));
+}
+
+void WebPage::didFinishLoadForQuickLookDocumentInMainFrame(const SharedBuffer& buffer)
+{
+ ASSERT(!buffer.isEmpty());
+
+ // FIXME: In some cases, buffer conains a single segment that wraps an existing ShareableResource.
+ // If we could create a handle from that existing resource then we could avoid this extra
+ // allocation and copy.
+
+ auto sharedMemory = SharedMemory::copyBuffer(buffer);
+ if (!sharedMemory)
+ return;
+
+ ShareableResource::Handle handle;
+ auto shareableResource = ShareableResource::create(sharedMemory.releaseNonNull(), 0, buffer.size());
+ if (!shareableResource->createHandle(handle))
+ return;
+
+ send(Messages::WebPageProxy::DidFinishLoadForQuickLookDocumentInMainFrame(handle));
+}
+
+void WebPage::requestPasswordForQuickLookDocumentInMainFrame(const String& fileName, CompletionHandler<void(const String&)>&& completionHandler)
+{
+ sendWithAsyncReply(Messages::WebPageProxy::RequestPasswordForQuickLookDocumentInMainFrame(fileName), WTFMove(completionHandler));
+}
+
+#endif
+
} // namespace WebKit
#undef RELEASE_LOG_IF_ALLOWED
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (251764 => 251765)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-10-30 04:14:39 UTC (rev 251765)
@@ -1,3 +1,13 @@
+2019-10-29 Andy Estes <[email protected]>
+
+ [Quick Look] Clean up LegacyPreviewLoaderClients
+ https://bugs.webkit.org/show_bug.cgi?id=203472
+
+ Reviewed by Brady Eidson.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::createPreviewLoaderClient):
+
2019-10-26 Chris Lord <[email protected]>
Put OffscreenCanvas behind a build flag
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (251764 => 251765)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2019-10-30 04:14:39 UTC (rev 251765)
@@ -2206,9 +2206,10 @@
RetainPtr<NSString> m_filePath;
RetainPtr<NSFileHandle> m_fileHandle;
- void didReceiveDataArray(CFArrayRef dataArray) override
+ void didReceiveBuffer(const WebCore::SharedBuffer& buffer) override
{
- for (NSData *data in (NSArray *)dataArray)
+ auto dataArray = buffer.createNSDataArray();
+ for (NSData *data in dataArray.get())
[m_fileHandle writeData:data];
}
Modified: trunk/Tools/ChangeLog (251764 => 251765)
--- trunk/Tools/ChangeLog 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Tools/ChangeLog 2019-10-30 04:14:39 UTC (rev 251765)
@@ -1,3 +1,20 @@
+2019-10-29 Andy Estes <[email protected]>
+
+ [Quick Look] Clean up LegacyPreviewLoaderClients
+ https://bugs.webkit.org/show_bug.cgi?id=203472
+
+ Reviewed by Brady Eidson.
+
+ Updated API tests to compare data received in
+ -_webView:didFinishLoadForQuickLookDocumentInMainFrame: with expected data.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/QuickLook.mm:
+ (readFile):
+ (-[QuickLookDelegate initWithExpectedFileURL:responsePolicy:]):
+ (-[QuickLookDelegate _webView:didFinishLoadForQuickLookDocumentInMainFrame:]):
+ (-[QuickLookDelegate verifyDownload]):
+ (TEST):
+
2019-10-29 Jonathan Bedard <[email protected]>
results.webkit.org: Fix tooltip with drawer
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/QuickLook.mm (251764 => 251765)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/QuickLook.mm 2019-10-30 03:14:51 UTC (rev 251764)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/QuickLook.mm 2019-10-30 04:14:39 UTC (rev 251765)
@@ -70,6 +70,7 @@
@protected
NSUInteger _downloadFileSize;
NSUInteger _expectedFileSize;
+ RetainPtr<NSData> _expectedFileData;
RetainPtr<NSString> _expectedFileName;
RetainPtr<NSString> _expectedFileType;
RetainPtr<NSString> _expectedMIMEType;
@@ -77,7 +78,7 @@
WKNavigationResponsePolicy _responsePolicy;
}
-static void readFile(NSURL *fileURL, NSUInteger& fileSize, RetainPtr<NSString>& fileName, RetainPtr<NSString>& fileType, RetainPtr<NSString>& mimeType)
+static void readFile(NSURL *fileURL, NSUInteger& fileSize, RetainPtr<NSString>& fileName, RetainPtr<NSString>& fileType, RetainPtr<NSString>& mimeType, RetainPtr<NSData>& fileData)
{
if (NSDictionary *attributes = [NSFileManager.defaultManager attributesOfItemAtPath:fileURL.path error:nil])
fileSize = [attributes[NSFileSize] unsignedIntegerValue];
@@ -89,6 +90,7 @@
fileType = typeIdentifier;
mimeType = adoptCF(UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)typeIdentifier, kUTTagClassMIMEType));
+ fileData = [NSData dataWithContentsOfURL:fileURL];
}
- (instancetype)initWithExpectedFileURL:(NSURL *)fileURL responsePolicy:(WKNavigationResponsePolicy)responsePolicy
@@ -96,7 +98,7 @@
if (!(self = [super init]))
return nil;
- readFile(fileURL, _expectedFileSize, _expectedFileName, _expectedFileType, _expectedMIMEType);
+ readFile(fileURL, _expectedFileSize, _expectedFileName, _expectedFileType, _expectedMIMEType, _expectedFileData);
_responsePolicy = responsePolicy;
return self;
@@ -139,6 +141,7 @@
- (void)_webView:(WKWebView *)webView didFinishLoadForQuickLookDocumentInMainFrame:(NSData *)documentData
{
EXPECT_EQ(_expectedFileSize, documentData.length);
+ EXPECT_TRUE([_expectedFileData isEqualToData:documentData]);
EXPECT_FALSE(_didFinishQuickLookLoad);
EXPECT_TRUE(_didStartQuickLookLoad);
_didFinishQuickLookLoad = YES;
@@ -219,12 +222,14 @@
EXPECT_TRUE([NSFileManager.defaultManager fileExistsAtPath:[_downloadDestinationURL path]]);
NSUInteger downloadFileSize;
+ RetainPtr<NSData> downloadFileData;
RetainPtr<NSString> downloadFileName;
RetainPtr<NSString> downloadFileType;
RetainPtr<NSString> downloadMIMEType;
- readFile(_downloadDestinationURL.get(), downloadFileSize, downloadFileName, downloadFileType, downloadMIMEType);
+ readFile(_downloadDestinationURL.get(), downloadFileSize, downloadFileName, downloadFileType, downloadMIMEType, downloadFileData);
EXPECT_EQ(_expectedFileSize, downloadFileSize);
+ EXPECT_TRUE([_expectedFileData isEqualToData:downloadFileData.get()]);
EXPECT_WK_STREQ(_expectedFileName.get(), downloadFileName.get());
EXPECT_WK_STREQ(_expectedFileType.get(), downloadFileType.get());
EXPECT_WK_STREQ(_expectedMIMEType.get(), downloadMIMEType.get());
@@ -465,10 +470,11 @@
WebThreadLock();
NSUInteger expectedFileSize;
+ RetainPtr<NSData> expectedFileData;
RetainPtr<NSString> expectedFileName;
RetainPtr<NSString> expectedFileType;
RetainPtr<NSString> expectedMIMEType;
- readFile(pagesDocumentURL, expectedFileSize, expectedFileName, expectedFileType, expectedMIMEType);
+ readFile(pagesDocumentURL, expectedFileSize, expectedFileName, expectedFileType, expectedMIMEType, expectedFileData);
NSDictionary *quickLookContent = mainFrame.dataSource._quickLookContent;
NSString *filePath = quickLookContent[WebQuickLookFileNameKey];
@@ -478,6 +484,8 @@
NSDictionary *fileAttributes = [NSFileManager.defaultManager attributesOfItemAtPath:filePath error:nil];
EXPECT_EQ(expectedFileSize, [fileAttributes[NSFileSize] unsignedIntegerValue]);
+
+ EXPECT_TRUE([expectedFileData isEqualToData:[NSData dataWithContentsOfFile:filePath]]);
isDone = false;
[mainFrame loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];