Diff
Modified: trunk/LayoutTests/ChangeLog (234639 => 234640)
--- trunk/LayoutTests/ChangeLog 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/LayoutTests/ChangeLog 2018-08-07 01:13:37 UTC (rev 234640)
@@ -1,3 +1,21 @@
+2018-08-06 Alex Christensen <achristen...@webkit.org>
+
+ Check with SafeBrowsing during navigation in WKWebView
+ https://bugs.webkit.org/show_bug.cgi?id=188133
+
+ Reviewed by Andy Estes.
+
+ * platform/wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt: Copied from http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt.
+ This test verifies that keys cannot be entered during navigation, and the keys seen in WebKitTestRunner
+ are before the navigation. This is seen now because there is a brief moment in time between when
+ WebKitTestRunner calls decidePolicyForNavigationAction and when the WebContent receives it.
+ * svg/custom/anchor-on-use.svg:
+ This test verifies what the page looks like after navigation. It used to just call testRunner.notifyDone
+ when the link was clicked and because of the timing of messages sent with the UIProcess, WebKitTestRunner
+ would see the results after the page navigated. Because we are adding a delay during navigation, the
+ message order can no longer be relied on in this way. To fix this, we are just calling notifyDone in an
+ unload handler.
+
2018-08-06 Ryosuke Niwa <rn...@webkit.org>
fast/custom-elements/custom-element-registry-wrapper-should-stay-alive.html always timeouts on debug bots
Added: trunk/LayoutTests/platform/wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt (0 => 234640)
--- trunk/LayoutTests/platform/wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt 2018-08-07 01:13:37 UTC (rev 234640)
@@ -0,0 +1,48 @@
+CONSOLE MESSAGE: line 16: Provisional navigation started.
+CONSOLE MESSAGE: line 17: No trusted events should be logged and the input element should have the value "".
+CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
+CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
+CONSOLE MESSAGE: line 42: Pressing tab.
+CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
+CONSOLE MESSAGE: line 46: Pressing "a".
+CONSOLE MESSAGE: line 49: Setting marked text to "b".
+CONSOLE MESSAGE: line 52: Inserting text "c".
+CONSOLE MESSAGE: line 55: Pasting text "d".
+CONSOLE MESSAGE: line 58: Input element value after text input events: "".
+CONSOLE MESSAGE: line 20: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
+CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 6: Finished navigating to resources/keyboard-events-after-navigation.html.
+CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "acd".
+CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
+CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
+CONSOLE MESSAGE: line 42: Pressing tab.
+CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
+CONSOLE MESSAGE: line 46: Pressing "a".
+CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 49: Setting marked text to "b".
+CONSOLE MESSAGE: line 18: compositionstartevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: compositionupdateevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 52: Inserting text "c".
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: compositionendevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 55: Pasting text "d".
+CONSOLE MESSAGE: line 18: pasteevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 58: Input element value after text input events: "acd".
+
Modified: trunk/LayoutTests/svg/custom/anchor-on-use.svg (234639 => 234640)
--- trunk/LayoutTests/svg/custom/anchor-on-use.svg 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/LayoutTests/svg/custom/anchor-on-use.svg 2018-08-07 01:13:37 UTC (rev 234640)
@@ -3,13 +3,16 @@
if (window.testRunner)
window.testRunner.waitUntilDone();
+ window._onunload_ = ()=>{
+ if (window.testRunner)
+ testRunner.notifyDone();
+ };
+
function clickLinkNow() {
if (window.eventSender) {
eventSender.mouseMoveTo(20, 20);
eventSender.mouseDown();
eventSender.mouseUp();
- if (window.testRunner)
- testRunner.notifyDone();
}
}
</script>
Modified: trunk/Source/WebKit/ChangeLog (234639 => 234640)
--- trunk/Source/WebKit/ChangeLog 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/ChangeLog 2018-08-07 01:13:37 UTC (rev 234640)
@@ -1,3 +1,47 @@
+2018-08-06 Alex Christensen <achristen...@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-06 Chris Dumez <cdu...@apple.com>
Regression(NetworkLoadChecker): CORS preflights are no longer able to deal with client certificate authentication
Modified: trunk/Source/WebKit/Platform/spi/Cocoa/SafeBrowsingSPI.h (234639 => 234640)
--- trunk/Source/WebKit/Platform/spi/Cocoa/SafeBrowsingSPI.h 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/Platform/spi/Cocoa/SafeBrowsingSPI.h 2018-08-07 01:13:37 UTC (rev 234640)
@@ -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 @@
#endif
#endif
-
Copied: trunk/Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm (from rev 234638, trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h) (0 => 234640)
--- trunk/Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm 2018-08-07 01:13:37 UTC (rev 234640)
@@ -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
+
+}
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (234639 => 234640)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2018-08-07 01:13:37 UTC (rev 234640)
@@ -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 @@
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)
{
Copied: trunk/Source/WebKit/UIProcess/SafeBrowsingResult.h (from rev 234638, trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h) (0 => 234640)
--- trunk/Source/WebKit/UIProcess/SafeBrowsingResult.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/SafeBrowsingResult.h 2018-08-07 01:13:37 UTC (rev 234640)
@@ -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
Modified: trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp (234639 => 234640)
--- trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp 2018-08-07 01:13:37 UTC (rev 234640)
@@ -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,6 +29,7 @@
#include "APINavigation.h"
#include "APIWebsiteDataStore.h"
#include "APIWebsitePolicies.h"
+#include "SafeBrowsingResult.h"
#include "WebFrameProxy.h"
#include "WebsiteDataStore.h"
#include "WebsitePoliciesData.h"
@@ -35,27 +36,47 @@
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
Modified: trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h (234639 => 234640)
--- trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h 2018-08-07 01:13:37 UTC (rev 234640)
@@ -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 @@
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
Modified: trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp (234639 => 234640)
--- trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp 2018-08-07 01:13:37 UTC (rev 234640)
@@ -178,14 +178,14 @@
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;
}
Modified: trunk/Source/WebKit/UIProcess/WebFrameProxy.h (234639 => 234640)
--- trunk/Source/WebKit/UIProcess/WebFrameProxy.h 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/UIProcess/WebFrameProxy.h 2018-08-07 01:13:37 UTC (rev 234640)
@@ -48,10 +48,12 @@
}
namespace WebKit {
+class SafeBrowsingResult;
class WebCertificateInfo;
class WebFramePolicyListenerProxy;
class WebPageProxy;
class WebsiteDataStore;
+enum class ShouldExpectSafeBrowsingResult;
enum class ShouldProcessSwapIfPossible;
struct WebsitePoliciesData;
@@ -115,7 +117,7 @@
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); }
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (234639 => 234640)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-07 01:13:37 UTC (rev 234640)
@@ -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 @@
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 @@
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 = ""
@@ -4084,7 +4094,8 @@
}
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 @@
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 @@
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);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (234639 => 234640)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-08-07 01:13:37 UTC (rev 234640)
@@ -1435,6 +1435,7 @@
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&);
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (234639 => 234640)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-08-07 01:13:37 UTC (rev 234640)
@@ -1289,6 +1289,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 */; };
@@ -3854,6 +3856,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>"; };
@@ -5668,6 +5672,7 @@
CDA29A221CBEB61A00901CCF /* PlaybackSessionManagerProxy.messages.in */,
CDA29A1F1CBEB5FB00901CCF /* PlaybackSessionManagerProxy.mm */,
837A660020E2AD8400A9DBD8 /* ResourceLoadStatisticsMemoryStoreCocoa.mm */,
+ 5CA9854B210BEB730057EB6B /* SafeBrowsingResultCocoa.mm */,
1A002D47196B345D00B9AD44 /* SessionStateCoding.h */,
1A002D46196B345D00B9AD44 /* SessionStateCoding.mm */,
3157135C2040A9B20084F9CF /* SystemPreviewControllerCocoa.mm */,
@@ -7453,6 +7458,7 @@
51E6C1611F2935CD00FD3437 /* ResourceLoadStatisticsPersistentStorage.h */,
BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */,
1A30066C1110F4F70031937C /* ResponsivenessTimer.h */,
+ 5CA98549210BEB5A0057EB6B /* SafeBrowsingResult.h */,
414DEDD61F9EDDE00047C40D /* ServiceWorkerProcessProxy.cpp */,
414DEDD51F9EDDDF0047C40D /* ServiceWorkerProcessProxy.h */,
51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */,
@@ -9347,6 +9353,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 */,
@@ -11171,6 +11178,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 */,
Modified: trunk/Source/WebKit/config.h (234639 => 234640)
--- trunk/Source/WebKit/config.h 2018-08-07 00:58:54 UTC (rev 234639)
+++ trunk/Source/WebKit/config.h 2018-08-07 01:13:37 UTC (rev 234640)
@@ -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