WebKit Bugzilla
Attachment 345975 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-20180727165808.patch (text/plain), 26.61 KB, created by
Alex Christensen
on 2018-07-27 16:58:09 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2018-07-27 16:58:09 PDT
Size:
26.61 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 234337) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,38 @@ >+2018-07-27 Alex Christensen <achristensen@webkit.org> >+ >+ Implement safe browsing in WKWebView >+ https://bugs.webkit.org/show_bug.cgi?id=188133 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * 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-07-27 Chris Dumez <cdumez@apple.com> > > Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable() >Index: Source/WebKit/UIProcess/SafeBrowsingResult.h >=================================================================== >--- Source/WebKit/UIProcess/SafeBrowsingResult.h (nonexistent) >+++ Source/WebKit/UIProcess/SafeBrowsingResult.h (working copy) >@@ -0,0 +1,54 @@ >+/* >+ * 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 "WKFoundation.h" >+#include <wtf/text/WTFString.h> >+ >+OBJC_CLASS SSBServiceLookupResult; >+ >+namespace WebKit { >+ >+class SafeBrowsingResult { >+public: >+ SafeBrowsingResult(SSBServiceLookupResult *); >+ 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 234326) >+++ Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp (working copy) >@@ -29,30 +29,51 @@ > #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) >+WebFramePolicyListenerProxy::WebFramePolicyListenerProxy(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)>&& completionHandler) > : m_completionHandler(WTFMove(completionHandler)) > { > } > >+WebFramePolicyListenerProxy::~WebFramePolicyListenerProxy() = default; >+ >+void WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults(Vector<SafeBrowsingResult>&& safeBrowsingResults) >+{ >+ if (!m_completionHandler) >+ return; >+ >+ ASSERT(!m_safeBrowsingResults); >+ if (m_policyResult) >+ m_completionHandler(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) > { >- m_completionHandler(WebCore::PolicyAction::Use, policies, swap); >+ ASSERT(!m_policyResult); >+ if (m_safeBrowsingResults) >+ m_completionHandler(WebCore::PolicyAction::Use, policies, swap, WTFMove(*m_safeBrowsingResults)); >+ else >+ m_policyResult = {{ policies, swap }}; > } > > void WebFramePolicyListenerProxy::download() > { >- m_completionHandler(WebCore::PolicyAction::Download, nullptr, ShouldProcessSwapIfPossible::No); >+ ASSERT(!m_policyResult); >+ m_completionHandler(WebCore::PolicyAction::Download, nullptr, ShouldProcessSwapIfPossible::No, { }); > } > > void WebFramePolicyListenerProxy::ignore() > { >- m_completionHandler(WebCore::PolicyAction::Ignore, nullptr, ShouldProcessSwapIfPossible::No); >+ ASSERT(!m_policyResult); >+ m_completionHandler(WebCore::PolicyAction::Ignore, nullptr, ShouldProcessSwapIfPossible::No, { }); > } > > } // namespace WebKit >Index: Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h >=================================================================== >--- Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h (revision 234326) >+++ Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h (working copy) >@@ -27,6 +27,7 @@ > > #include "APIObject.h" > #include <wtf/CompletionHandler.h> >+#include <wtf/Vector.h> > > namespace API { > class WebsitePolicies; >@@ -38,24 +39,31 @@ enum class PolicyAction; > > namespace WebKit { > >+class SafeBrowsingResult; >+ > enum class ShouldProcessSwapIfPossible { No, Yes }; > > class WebFramePolicyListenerProxy : public API::ObjectImpl<API::Object::Type::FramePolicyListener> { > public: > >- static Ref<WebFramePolicyListenerProxy> create(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible)>&& completionHandler) >+ static Ref<WebFramePolicyListenerProxy> create(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)>&& completionHandler) > { > return adoptRef(*new WebFramePolicyListenerProxy(WTFMove(completionHandler))); > } >+ ~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(CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)>&&); > >- 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; >+ CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ShouldProcessSwapIfPossible, Vector<SafeBrowsingResult>&&)> m_completionHandler; > }; > > } // namespace WebKit >Index: Source/WebKit/UIProcess/WebFrameProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebFrameProxy.cpp (revision 234326) >+++ Source/WebKit/UIProcess/WebFrameProxy.cpp (working copy) >@@ -178,12 +178,12 @@ 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) > { > 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) { >- 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) { >+ completionHandler(action, policies, swap, WTFMove(safeBrowsingResults)); > m_activeListener = nullptr; > }); > return *m_activeListener; >Index: Source/WebKit/UIProcess/WebFrameProxy.h >=================================================================== >--- Source/WebKit/UIProcess/WebFrameProxy.h (revision 234326) >+++ Source/WebKit/UIProcess/WebFrameProxy.h (working copy) >@@ -48,6 +48,7 @@ class Decoder; > } > > namespace WebKit { >+class SafeBrowsingResult; > class WebCertificateInfo; > class WebFramePolicyListenerProxy; > class WebPageProxy; >@@ -115,7 +116,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>&&)>&&); > > #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 234327) >+++ 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" >@@ -4032,7 +4033,25 @@ 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>&& safeBrowsingResults) mutable { >+ >+ auto shouldShowWarning = [] (const auto results) { >+ for (auto& result : results) { >+ if (result.isPhishing() >+ || result.isMalware() >+ || result.isUnwantedSoftware() >+ || result.isKnownToBeUnsafe()) >+ return true; >+ } >+ return false; >+ }; >+ >+ if (shouldShowWarning(safeBrowsingResults)) { >+ receivedPolicyDecision(PolicyAction::Ignore, navigation.get(), std::nullopt, WTFMove(sender)); >+ loadHTMLString("<html><body>THIS IS SUSPICIOUS</body></html>", "about:blank", nullptr); >+ return; >+ } >+ > std::optional<WebsitePoliciesData> data; > if (policies) { > data = policies->data(); >@@ -4054,6 +4073,7 @@ void WebPageProxy::decidePolicyForNaviga > > receivedPolicyDecision(policyAction, navigation.get(), WTFMove(data), WTFMove(sender)); > })); >+ beginSafeBrowsingCheck(request.url(), listener); > > API::Navigation* mainFrameNavigation = frame->isMainFrame() ? navigation.get() : nullptr; > WebFrameProxy* originatingFrame = m_process->webFrame(originatingFrameInfoData.frameID); >@@ -4099,13 +4119,15 @@ 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); > })); > })); >+ listener->didReceiveSafeBrowsingResults({ }); > > if (m_navigationClient) { > RefPtr<API::FrameInfo> sourceFrameInfo; >@@ -4134,13 +4156,15 @@ 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); > })); > })); >+ listener->didReceiveSafeBrowsingResults({ }); > > 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 234327) >+++ 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,42 @@ >+/* >+ * 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 { >+ >+SafeBrowsingResult::SafeBrowsingResult(SSBServiceLookupResult *result) >+ : m_provider([result provider]) >+ , m_isPhishing([result isPhishing]) >+ , m_isMalware([result isMalware]) >+ , m_isUnwantedSoftware([result isUnwantedSoftware]) >+ , m_isKnownToBeUnsafe([result isKnownToBeUnsafe]) >+{ >+} >+ >+} >Index: Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (revision 234326) >+++ 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,25 @@ void WebPageProxy::loadRecentSearches(co > searchItems = WebCore::loadRecentSearches(name); > } > >+void WebPageProxy::beginSafeBrowsingCheck(const URL& url, WebFramePolicyListenerProxy& listener) >+{ >+ [[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()]; >+} >+ > #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 234326) >+++ Source/WebKit/WebKit.xcodeproj/project.pbxproj (working copy) >@@ -1278,6 +1278,7 @@ > 5C26958520043212005C439B /* WKOpenPanelParametersPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C26958420042F12005C439B /* WKOpenPanelParametersPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5C298DA01C3DF02100470AFE /* PendingDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C298D9E1C3DEF2900470AFE /* PendingDownload.h */; }; > 5C3AEA8F1FE1F21F002318D3 /* WebsitePoliciesData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C3AEA8E1FE1F1DF002318D3 /* WebsitePoliciesData.cpp */; }; >+ 5C4B9D88210A6188008F14D1 /* SafeBrowsingResultCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B9D87210954D9008F14D1 /* SafeBrowsingResultCocoa.mm */; }; > 5C62FDF91EFC271C00CE072E /* WKURLSchemeTaskPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5C6CE6D11F59BC7A0007C6CB /* PageClientImplCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C6CE6D01F59BC460007C6CB /* PageClientImplCocoa.mm */; }; > 5C7706741D1138380012700F /* WebSocketProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C7706731D111D8B0012700F /* WebSocketProvider.cpp */; }; >@@ -3835,6 +3836,8 @@ > 5C26958420042F12005C439B /* WKOpenPanelParametersPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOpenPanelParametersPrivate.h; sourceTree = "<group>"; }; > 5C298D9E1C3DEF2900470AFE /* PendingDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PendingDownload.h; path = NetworkProcess/Downloads/PendingDownload.h; sourceTree = "<group>"; }; > 5C3AEA8E1FE1F1DF002318D3 /* WebsitePoliciesData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebsitePoliciesData.cpp; sourceTree = "<group>"; }; >+ 5C4B9D86210954B7008F14D1 /* SafeBrowsingResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SafeBrowsingResult.h; sourceTree = "<group>"; }; >+ 5C4B9D87210954D9008F14D1 /* SafeBrowsingResultCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SafeBrowsingResultCocoa.mm; sourceTree = "<group>"; }; > 5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKURLSchemeTaskPrivate.h; sourceTree = "<group>"; }; > 5C6CE6D01F59BC460007C6CB /* PageClientImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageClientImplCocoa.mm; sourceTree = "<group>"; }; > 5C6CE6D31F59EA350007C6CB /* PageClientImplCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageClientImplCocoa.h; sourceTree = "<group>"; }; >@@ -5661,6 +5664,7 @@ > CDA29A221CBEB61A00901CCF /* PlaybackSessionManagerProxy.messages.in */, > CDA29A1F1CBEB5FB00901CCF /* PlaybackSessionManagerProxy.mm */, > 837A660020E2AD8400A9DBD8 /* ResourceLoadStatisticsMemoryStoreCocoa.mm */, >+ 5C4B9D87210954D9008F14D1 /* SafeBrowsingResultCocoa.mm */, > 1A002D47196B345D00B9AD44 /* SessionStateCoding.h */, > 1A002D46196B345D00B9AD44 /* SessionStateCoding.mm */, > 3157135C2040A9B20084F9CF /* SystemPreviewControllerCocoa.mm */, >@@ -7444,6 +7448,7 @@ > 51E6C1611F2935CD00FD3437 /* ResourceLoadStatisticsPersistentStorage.h */, > BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */, > 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */, >+ 5C4B9D86210954B7008F14D1 /* SafeBrowsingResult.h */, > 414DEDD61F9EDDE00047C40D /* ServiceWorkerProcessProxy.cpp */, > 414DEDD51F9EDDDF0047C40D /* ServiceWorkerProcessProxy.h */, > 51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */, >@@ -11160,6 +11165,7 @@ > BC111B09112F5E3C00337BAB /* ResponsivenessTimer.cpp in Sources */, > 410482CD1DDD324C00F006D0 /* RTCNetwork.cpp in Sources */, > 41B28B0A1F83AD4200FB52AC /* RTCPacketOptions.cpp in Sources */, >+ 5C4B9D88210A6188008F14D1 /* 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