WebKit Bugzilla
Attachment 346398 Details for
Bug 188133
: Check with SafeBrowsing during navigation in WKWebView
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188133-20180802113633.patch (text/plain), 30.43 KB, created by
Alex Christensen
on 2018-08-02 11:36:34 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2018-08-02 11:36:34 PDT
Size:
30.43 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 234493) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,47 @@ >+2018-08-02 Alex Christensen <achristensen@webkit.org> >+ >+ Check with SafeBrowsing during navigation in WKWebView >+ https://bugs.webkit.org/show_bug.cgi?id=188133 >+ >+ Reviewed by Chris Dumez. >+ >+ This turns WebFramePolicyListenerProxy into an object that now listens for the results >+ of two processes happening in parallel: the API::NavigationClient's decidePolicyForNavigation{Action, Response} >+ (which it was already waiting for) and, on platforms that support it, the SafariSafeBrowsing framework's check. >+ The first result is stored as it waits for the second result unless the first result is the API::NavigationClient >+ saying to cancel or convert the navigation to a download, in which cases we don't care what the safe browsing >+ framework results are because we won't show the URL in the browser. >+ >+ Nothing is done with the safe browsing results yet. >+ >+ * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Added. >+ (WebKit::SafeBrowsingResult::SafeBrowsingResult): >+ * UIProcess/Cocoa/WebPageProxyCocoa.mm: >+ (WebKit::WebPageProxy::beginSafeBrowsingCheck): >+ * UIProcess/SafeBrowsingResult.h: Added. >+ (WebKit::SafeBrowsingResult::provider const): >+ (WebKit::SafeBrowsingResult::isPhishing const): >+ (WebKit::SafeBrowsingResult::isMalware const): >+ (WebKit::SafeBrowsingResult::isUnwantedSoftware const): >+ (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): >+ * UIProcess/WebFramePolicyListenerProxy.cpp: >+ (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy): >+ (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults): >+ (WebKit::WebFramePolicyListenerProxy::use): >+ (WebKit::WebFramePolicyListenerProxy::download): >+ (WebKit::WebFramePolicyListenerProxy::ignore): >+ * UIProcess/WebFramePolicyListenerProxy.h: >+ (WebKit::WebFramePolicyListenerProxy::create): >+ * UIProcess/WebFrameProxy.cpp: >+ (WebKit::WebFrameProxy::setUpPolicyListenerProxy): >+ * UIProcess/WebFrameProxy.h: >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::decidePolicyForNavigationAction): >+ (WebKit::WebPageProxy::decidePolicyForNewWindowAction): >+ (WebKit::WebPageProxy::decidePolicyForResponse): >+ * UIProcess/WebPageProxy.h: >+ * WebKit.xcodeproj/project.pbxproj: >+ > 2018-08-01 Tomas Popela <tpopela@redhat.com> > > [WTF] Rename String::format to String::deprecatedFormat >Index: Source/WebKit/config.h >=================================================================== >--- Source/WebKit/config.h (revision 234466) >+++ Source/WebKit/config.h (working copy) >@@ -126,3 +126,9 @@ > #define HAVE_MOBILE_WIFI 0 > #endif > #endif >+ >+#if ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)) && !defined(__i386__) >+#define HAVE_SAFE_BROWSING 1 >+#else >+#define HAVE_SAFE_BROWSING 0 >+#endif >Index: Source/WebKit/Platform/spi/Cocoa/SafeBrowsingSPI.h >=================================================================== >--- Source/WebKit/Platform/spi/Cocoa/SafeBrowsingSPI.h (revision 234466) >+++ Source/WebKit/Platform/spi/Cocoa/SafeBrowsingSPI.h (working copy) >@@ -25,7 +25,7 @@ > > #pragma once > >-#if WK_API_ENABLED && ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)) >+#if HAVE(SAFE_BROWSING) > > #import <Foundation/Foundation.h> > >@@ -73,4 +73,3 @@ WTF_EXTERN_C_END > #endif > > #endif >- >Index: Source/WebKit/UIProcess/SafeBrowsingResult.h >=================================================================== >--- Source/WebKit/UIProcess/SafeBrowsingResult.h (nonexistent) >+++ Source/WebKit/UIProcess/SafeBrowsingResult.h (working copy) >@@ -0,0 +1,55 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#pragma once >+ >+#include <wtf/text/WTFString.h> >+ >+OBJC_CLASS SSBServiceLookupResult; >+ >+namespace WebKit { >+ >+class SafeBrowsingResult { >+public: >+#if HAVE(SAFE_BROWSING) >+ SafeBrowsingResult(SSBServiceLookupResult *); >+#endif >+ SafeBrowsingResult() = default; >+ >+ const String& provider() const { return m_provider; } >+ bool isPhishing() const { return m_isPhishing; } >+ bool isMalware() const { return m_isMalware; } >+ bool isUnwantedSoftware() const { return m_isUnwantedSoftware; } >+ bool isKnownToBeUnsafe() const { return m_isKnownToBeUnsafe; } >+ >+private: >+ String m_provider; >+ bool m_isPhishing { false }; >+ bool m_isMalware { false }; >+ bool m_isUnwantedSoftware { false }; >+ bool m_isKnownToBeUnsafe { false }; >+}; >+ >+} // namespace WebKit >Index: Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp (revision 234466) >+++ Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp (working copy) >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -29,33 +29,54 @@ > #include "APINavigation.h" > #include "APIWebsiteDataStore.h" > #include "APIWebsitePolicies.h" >+#include "SafeBrowsingResult.h" > #include "WebFrameProxy.h" > #include "WebsiteDataStore.h" > #include "WebsitePoliciesData.h" > > namespace WebKit { > >-WebFramePolicyListenerProxy::WebFramePolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible)>&& completionHandler) >- : m_completionHandler(WTFMove(completionHandler)) >+WebFramePolicyListenerProxy::WebFramePolicyListenerProxy(Reply&& reply, ShouldExpectSafeBrowsingResult expect) >+ : m_reply(WTFMove(reply)) > { >+ if (expect == ShouldExpectSafeBrowsingResult::No) >+ didReceiveSafeBrowsingResults({ }); >+} >+ >+WebFramePolicyListenerProxy::~WebFramePolicyListenerProxy() = default; >+ >+void WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults(Vector<SafeBrowsingResult>&& safeBrowsingResults) >+{ >+ ASSERT(!m_safeBrowsingResults); >+ if (m_policyResult) { >+ if (m_reply) >+ m_reply(WebCore::PolicyAction::Use, m_policyResult->first.get(), m_policyResult->second, WTFMove(safeBrowsingResults)); >+ } else >+ m_safeBrowsingResults = WTFMove(safeBrowsingResults); > } > > void WebFramePolicyListenerProxy::use(API::WebsitePolicies* policies, ShouldProcessSwapIfPossible swap) > { >- if (m_completionHandler) >- m_completionHandler(WebCore::PolicyAction::Use, policies, swap); >+ ASSERT(!m_policyResult); >+ if (m_safeBrowsingResults) { >+ if (m_reply) >+ m_reply(WebCore::PolicyAction::Use, policies, swap, WTFMove(*m_safeBrowsingResults)); >+ } else >+ m_policyResult = {{ policies, swap }}; > } > > void WebFramePolicyListenerProxy::download() > { >- if (m_completionHandler) >- m_completionHandler(WebCore::PolicyAction::Download, nullptr, ShouldProcessSwapIfPossible::No); >+ ASSERT(!m_policyResult); >+ if (m_reply) >+ m_reply(WebCore::PolicyAction::Download, nullptr, ShouldProcessSwapIfPossible::No, { }); > } > > void WebFramePolicyListenerProxy::ignore() > { >- if (m_completionHandler) >- m_completionHandler(WebCore::PolicyAction::Ignore, nullptr, ShouldProcessSwapIfPossible::No); >+ ASSERT(!m_policyResult); >+ if (m_reply) >+ m_reply(WebCore::PolicyAction::Ignore, nullptr, ShouldProcessSwapIfPossible::No, { }); > } > > } // namespace WebKit >Index: Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h >=================================================================== >--- Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h (revision 234466) >+++ Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h (working copy) >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -27,6 +27,7 @@ > > #include "APIObject.h" > #include <wtf/CompletionHandler.h> >+#include <wtf/Vector.h> > > namespace API { > class WebsitePolicies; >@@ -38,24 +39,33 @@ enum class PolicyAction; > > namespace WebKit { > >+class SafeBrowsingResult; >+ > enum class ShouldProcessSwapIfPossible { No, Yes }; >+enum class ShouldExpectSafeBrowsingResult { No, Yes }; > > class WebFramePolicyListenerProxy : public API::ObjectImpl<API::Object::Type::FramePolicyListener> { > public: > >- static Ref<WebFramePolicyListenerProxy> create(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible)>&& completionHandler) >+ using Reply = CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)>; >+ static Ref<WebFramePolicyListenerProxy> create(Reply&& reply, ShouldExpectSafeBrowsingResult expect) > { >- return adoptRef(*new WebFramePolicyListenerProxy(WTFMove(completionHandler))); >+ return adoptRef(*new WebFramePolicyListenerProxy(WTFMove(reply), expect)); > } >+ ~WebFramePolicyListenerProxy(); > > void use(API::WebsitePolicies* = nullptr, ShouldProcessSwapIfPossible = ShouldProcessSwapIfPossible::No); > void download(); > void ignore(); >+ >+ void didReceiveSafeBrowsingResults(Vector<SafeBrowsingResult>&&); > > private: >- WebFramePolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible)>&&); >+ WebFramePolicyListenerProxy(Reply&&, ShouldExpectSafeBrowsingResult); > >- CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible)> m_completionHandler; >+ std::optional<std::pair<RefPtr<API::WebsitePolicies>, ShouldProcessSwapIfPossible>> m_policyResult; >+ std::optional<Vector<SafeBrowsingResult>> m_safeBrowsingResults; >+ Reply m_reply; > }; > > } // namespace WebKit >Index: Source/WebKit/UIProcess/WebFrameProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebFrameProxy.cpp (revision 234466) >+++ Source/WebKit/UIProcess/WebFrameProxy.cpp (working copy) >@@ -178,14 +178,14 @@ void WebFrameProxy::didChangeTitle(const > m_title = title; > } > >-WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible)>&& completionHandler) >+WebFramePolicyListenerProxy& WebFrameProxy::setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)>&& completionHandler, ShouldExpectSafeBrowsingResult expect) > { > if (m_activeListener) > m_activeListener->ignore(); >- m_activeListener = WebFramePolicyListenerProxy::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (WebCore::PolicyAction action, API::WebsitePolicies* policies, ShouldProcessSwapIfPossible swap) mutable { >- completionHandler(action, policies, swap); >+ m_activeListener = WebFramePolicyListenerProxy::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (WebCore::PolicyAction action, API::WebsitePolicies* policies, ShouldProcessSwapIfPossible swap, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable { >+ completionHandler(action, policies, swap, WTFMove(safeBrowsingResults)); > m_activeListener = nullptr; >- }); >+ }, expect); > return *m_activeListener; > } > >Index: Source/WebKit/UIProcess/WebFrameProxy.h >=================================================================== >--- Source/WebKit/UIProcess/WebFrameProxy.h (revision 234466) >+++ Source/WebKit/UIProcess/WebFrameProxy.h (working copy) >@@ -48,10 +48,12 @@ class Decoder; > } > > namespace WebKit { >+class SafeBrowsingResult; > class WebCertificateInfo; > class WebFramePolicyListenerProxy; > class WebPageProxy; > class WebsiteDataStore; >+enum class ShouldExpectSafeBrowsingResult; > enum class ShouldProcessSwapIfPossible; > struct WebsitePoliciesData; > >@@ -115,7 +117,7 @@ public: > void didSameDocumentNavigation(const WebCore::URL&); // eg. anchor navigation, session state change. > void didChangeTitle(const String&); > >- WebFramePolicyListenerProxy& setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible)>&&); >+ WebFramePolicyListenerProxy& setUpPolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)>&&, ShouldExpectSafeBrowsingResult); > > #if ENABLE(CONTENT_FILTERING) > void contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler contentFilterUnblockHandler) { m_contentFilterUnblockHandler = WTFMove(contentFilterUnblockHandler); } >Index: Source/WebKit/UIProcess/WebPageProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.cpp (revision 234466) >+++ Source/WebKit/UIProcess/WebPageProxy.cpp (working copy) >@@ -76,6 +76,7 @@ > #include "PluginInformation.h" > #include "PluginProcessManager.h" > #include "PrintInfo.h" >+#include "SafeBrowsingResult.h" > #include "TextChecker.h" > #include "TextCheckerState.h" > #include "UIMessagePortChannelProvider.h" >@@ -4002,6 +4003,13 @@ void WebPageProxy::frameDidBecomeFrameSe > m_frameSetLargestFrame = value ? m_mainFrame : 0; > } > >+#if !PLATFORM(COCOA) >+void WebPageProxy::beginSafeBrowsingCheck(const URL&, WebFramePolicyListenerProxy& listener) >+{ >+ listener.didReceiveSafeBrowsingResults({ }); >+} >+#endif >+ > void WebPageProxy::decidePolicyForNavigationActionAsync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&& navigationActionData, const FrameInfoData& frameInfoData, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&& request, WebCore::ResourceResponse&& redirectResponse, const UserData& userData, uint64_t listenerID) > { > decidePolicyForNavigationAction(frameID, frameSecurityOrigin, navigationID, WTFMove(navigationActionData), frameInfoData, originatingPageID, originalRequest, WTFMove(request), WTFMove(redirectResponse), userData, PolicyDecisionSender::create([this, protectedThis = makeRef(*this), frameID, listenerID] (auto... args) { >@@ -4063,7 +4071,9 @@ void WebPageProxy::decidePolicyForNaviga > UNUSED_PARAM(newNavigationID); > #endif > >- auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(*frame), sender = sender.copyRef(), navigation] (WebCore::PolicyAction policyAction, API::WebsitePolicies* policies, ShouldProcessSwapIfPossible swap) mutable { >+ auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(*frame), sender = sender.copyRef(), navigation] (WebCore::PolicyAction policyAction, API::WebsitePolicies* policies, ShouldProcessSwapIfPossible swap, Vector<SafeBrowsingResult>&&) mutable { >+ // FIXME: do something with the SafeBrowsingResults. >+ > std::optional<WebsitePoliciesData> data; > if (policies) { > data = policies->data(); >@@ -4084,7 +4094,8 @@ void WebPageProxy::decidePolicyForNaviga > } > > receivedPolicyDecision(policyAction, navigation.get(), WTFMove(data), WTFMove(sender)); >- })); >+ }, ShouldExpectSafeBrowsingResult::Yes)); >+ beginSafeBrowsingCheck(request.url(), listener); > > API::Navigation* mainFrameNavigation = frame->isMainFrame() ? navigation.get() : nullptr; > WebFrameProxy* originatingFrame = m_process->webFrame(originatingFrameInfoData.frameID); >@@ -4130,13 +4141,14 @@ void WebPageProxy::decidePolicyForNewWin > MESSAGE_CHECK(frame); > MESSAGE_CHECK_URL(request.url()); > >- auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), listenerID, frameID] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible swap) mutable { >+ auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), listenerID, frameID] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible swap, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable { > // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away. > RELEASE_ASSERT(swap == ShouldProcessSwapIfPossible::No); >+ ASSERT_UNUSED(safeBrowsingResults, safeBrowsingResults.isEmpty()); > receivedPolicyDecision(policyAction, nullptr, std::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (auto... args) { > m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID); > })); >- })); >+ }, ShouldExpectSafeBrowsingResult::No)); > > if (m_navigationClient) { > RefPtr<API::FrameInfo> sourceFrameInfo; >@@ -4165,13 +4177,14 @@ void WebPageProxy::decidePolicyForRespon > MESSAGE_CHECK_URL(response.url()); > > RefPtr<API::Navigation> navigation = navigationID ? &m_navigationState->navigation(navigationID) : nullptr; >- auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frameID, listenerID, navigation = WTFMove(navigation)] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible swap) mutable { >+ auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frameID, listenerID, navigation = WTFMove(navigation)] (WebCore::PolicyAction policyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible swap, Vector<SafeBrowsingResult>&& safeBrowsingResults) mutable { > // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away. > RELEASE_ASSERT(swap == ShouldProcessSwapIfPossible::No); >+ ASSERT_UNUSED(safeBrowsingResults, safeBrowsingResults.isEmpty()); > receivedPolicyDecision(policyAction, navigation.get(), std::nullopt, PolicyDecisionSender::create([this, protectedThis = WTFMove(protectedThis), frameID, listenerID] (auto... args) { > m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID); > })); >- })); >+ }, ShouldExpectSafeBrowsingResult::No)); > > if (m_navigationClient) { > auto navigationResponse = API::NavigationResponse::create(API::FrameInfo::create(*frame, frameSecurityOrigin.securityOrigin()).get(), request, response, canShowMIMEType); >Index: Source/WebKit/UIProcess/WebPageProxy.h >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.h (revision 234466) >+++ Source/WebKit/UIProcess/WebPageProxy.h (working copy) >@@ -1428,6 +1428,7 @@ private: > void decidePolicyForNewWindowAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, NavigationActionData&&, WebCore::ResourceRequest&&, const String& frameName, uint64_t listenerID, const UserData&); > void decidePolicyForResponse(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&); > void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, const UserData&); >+ void beginSafeBrowsingCheck(const WebCore::URL&, WebFramePolicyListenerProxy&); > > void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, const UserData&); > >Index: Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm (nonexistent) >+++ Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm (working copy) >@@ -0,0 +1,44 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#import "config.h" >+#import "SafeBrowsingResult.h" >+ >+#import "SafeBrowsingSPI.h" >+ >+namespace WebKit { >+ >+#if HAVE(SAFE_BROWSING) >+SafeBrowsingResult::SafeBrowsingResult(SSBServiceLookupResult *result) >+ : m_provider([result provider]) >+ , m_isPhishing([result isPhishing]) >+ , m_isMalware([result isMalware]) >+ , m_isUnwantedSoftware([result isUnwantedSoftware]) >+ , m_isKnownToBeUnsafe([result isKnownToBeUnsafe]) >+{ >+} >+#endif >+ >+} >Index: Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (revision 234466) >+++ Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (working copy) >@@ -30,11 +30,14 @@ > #import "DataDetectionResult.h" > #import "LoadParameters.h" > #import "PageClient.h" >+#import "SafeBrowsingResult.h" >+#import "SafeBrowsingSPI.h" > #import "WebProcessProxy.h" > #import <WebCore/DragItem.h> > #import <WebCore/NotImplemented.h> > #import <WebCore/SearchPopupMenuCocoa.h> > #import <WebCore/ValidationBubble.h> >+#import <wtf/BlockPtr.h> > #import <wtf/cf/TypeCastsCF.h> > > using namespace WebCore; >@@ -68,6 +71,29 @@ void WebPageProxy::loadRecentSearches(co > searchItems = WebCore::loadRecentSearches(name); > } > >+void WebPageProxy::beginSafeBrowsingCheck(const URL& url, WebFramePolicyListenerProxy& listener) >+{ >+#if HAVE(SAFE_BROWSING) >+ [[SSBLookupContext sharedLookupContext] lookUpURL:url completionHandler:BlockPtr<void(SSBLookupResult *, NSError *)>::fromCallable([listener = makeRef(listener)] (SSBLookupResult *result, NSError *error) mutable { >+ RunLoop::main().dispatch([listener = WTFMove(listener), result = retainPtr(result), error = retainPtr(error)] { >+ if (error) { >+ listener->didReceiveSafeBrowsingResults({ }); >+ return; >+ } >+ >+ NSArray<SSBServiceLookupResult *> *results = [result serviceLookupResults]; >+ Vector<SafeBrowsingResult> resultsVector; >+ resultsVector.reserveInitialCapacity([results count]); >+ for (SSBServiceLookupResult *result in results) >+ resultsVector.uncheckedAppend({ result }); >+ listener->didReceiveSafeBrowsingResults(WTFMove(resultsVector)); >+ }); >+ }).get()]; >+#else >+ listener.didReceiveSafeBrowsingResults({ }); >+#endif >+} >+ > #if ENABLE(CONTENT_FILTERING) > void WebPageProxy::contentFilterDidBlockLoadForFrame(const WebCore::ContentFilterUnblockHandler& unblockHandler, uint64_t frameID) > { >Index: Source/WebKit/WebKit.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebKit/WebKit.xcodeproj/project.pbxproj (revision 234466) >+++ Source/WebKit/WebKit.xcodeproj/project.pbxproj (working copy) >@@ -1287,6 +1287,8 @@ > 5C8DD3801FE4521600F2A556 /* WebsiteAutoplayPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C8DD37F1FE4519200F2A556 /* WebsiteAutoplayPolicy.h */; }; > 5C9E56821DF7F1AB00C9EE33 /* WKWebsitePolicies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9E56801DF7F05500C9EE33 /* WKWebsitePolicies.cpp */; }; > 5C9E56831DF7F1B300C9EE33 /* WKWebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9E56811DF7F05500C9EE33 /* WKWebsitePolicies.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 5CA9854A210BEB640057EB6B /* SafeBrowsingResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CA98549210BEB5A0057EB6B /* SafeBrowsingResult.h */; }; >+ 5CA9854C210BEB7D0057EB6B /* SafeBrowsingResultCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CA9854B210BEB730057EB6B /* SafeBrowsingResultCocoa.mm */; }; > 5CB2378B1DF0DE5300117AA3 /* _WKWebsitePolicies.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB2378A1DF0DD4300117AA3 /* _WKWebsitePolicies.mm */; }; > 5CB2378C1DF0DE6E00117AA3 /* _WKWebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB237891DF0DD4300117AA3 /* _WKWebsitePolicies.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5CB2378E1DF0E0D300117AA3 /* _WKWebsitePoliciesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */; }; >@@ -3850,6 +3852,8 @@ > 5C8DD3811FE455CA00F2A556 /* WebsiteAutoplayQuirk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteAutoplayQuirk.h; sourceTree = "<group>"; }; > 5C9E56801DF7F05500C9EE33 /* WKWebsitePolicies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKWebsitePolicies.cpp; sourceTree = "<group>"; }; > 5C9E56811DF7F05500C9EE33 /* WKWebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsitePolicies.h; sourceTree = "<group>"; }; >+ 5CA98549210BEB5A0057EB6B /* SafeBrowsingResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SafeBrowsingResult.h; sourceTree = "<group>"; }; >+ 5CA9854B210BEB730057EB6B /* SafeBrowsingResultCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SafeBrowsingResultCocoa.mm; sourceTree = "<group>"; }; > 5CB237891DF0DD4300117AA3 /* _WKWebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsitePolicies.h; sourceTree = "<group>"; }; > 5CB2378A1DF0DD4300117AA3 /* _WKWebsitePolicies.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKWebsitePolicies.mm; sourceTree = "<group>"; }; > 5CB2378D1DF0E0C200117AA3 /* _WKWebsitePoliciesInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKWebsitePoliciesInternal.h; sourceTree = "<group>"; }; >@@ -5664,6 +5668,7 @@ > CDA29A221CBEB61A00901CCF /* PlaybackSessionManagerProxy.messages.in */, > CDA29A1F1CBEB5FB00901CCF /* PlaybackSessionManagerProxy.mm */, > 837A660020E2AD8400A9DBD8 /* ResourceLoadStatisticsMemoryStoreCocoa.mm */, >+ 5CA9854B210BEB730057EB6B /* SafeBrowsingResultCocoa.mm */, > 1A002D47196B345D00B9AD44 /* SessionStateCoding.h */, > 1A002D46196B345D00B9AD44 /* SessionStateCoding.mm */, > 3157135C2040A9B20084F9CF /* SystemPreviewControllerCocoa.mm */, >@@ -7447,6 +7452,7 @@ > 51E6C1611F2935CD00FD3437 /* ResourceLoadStatisticsPersistentStorage.h */, > BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */, > 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */, >+ 5CA98549210BEB5A0057EB6B /* SafeBrowsingResult.h */, > 414DEDD61F9EDDE00047C40D /* ServiceWorkerProcessProxy.cpp */, > 414DEDD51F9EDDDF0047C40D /* ServiceWorkerProcessProxy.h */, > 51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */, >@@ -9341,6 +9347,7 @@ > 51E6C1641F2935DD00FD3437 /* ResourceLoadStatisticsPersistentStorage.h in Headers */, > 1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */, > 410482CE1DDD324F00F006D0 /* RTCNetwork.h in Headers */, >+ 5CA9854A210BEB640057EB6B /* SafeBrowsingResult.h in Headers */, > 0E97D74D200E900400BF6643 /* SafeBrowsingSPI.h in Headers */, > BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */, > 1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */, >@@ -11164,6 +11171,7 @@ > BC111B09112F5E3C00337BAB /* ResponsivenessTimer.cpp in Sources */, > 410482CD1DDD324C00F006D0 /* RTCNetwork.cpp in Sources */, > 41B28B0A1F83AD4200FB52AC /* RTCPacketOptions.cpp in Sources */, >+ 5CA9854C210BEB7D0057EB6B /* SafeBrowsingResultCocoa.mm in Sources */, > 1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */, > E1E552C416AE065F004ED653 /* SandboxInitialiationParametersMac.mm in Sources */, > E19BDA8B19368D4600B97F57 /* SandboxUtilities.mm in Sources */,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188133
:
345975
|
345976
|
346003
|
346297
|
346299
|
346301
|
346305
|
346309
|
346388
|
346398
|
346669