Diff
Modified: trunk/Source/WebCore/ChangeLog (234997 => 234998)
--- trunk/Source/WebCore/ChangeLog 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/ChangeLog 2018-08-17 23:24:37 UTC (rev 234998)
@@ -1,3 +1,41 @@
+2018-08-17 Alex Christensen <[email protected]>
+
+ Add some plumbing for safe browsing
+ https://bugs.webkit.org/show_bug.cgi?id=188709
+
+ Reviewed by Tim Horton.
+
+ No change in behavior. Just passing around unused booleans.
+ We will need this for a way to load a page even though safe browsing says it's unsafe.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/EmptyClients.cpp:
+ (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+ * loader/EmptyFrameLoaderClient.h:
+ * loader/FrameLoadRequest.h:
+ (WebCore::FrameLoadRequest::setShouldSkipSafeBrowsingCheck):
+ (WebCore::FrameLoadRequest::shouldSkipSafeBrowsingCheck):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadArchive):
+ (WebCore::FrameLoader::loadURL):
+ (WebCore::FrameLoader::load):
+ (WebCore::FrameLoader::loadWithNavigationAction):
+ (WebCore::FrameLoader::loadWithDocumentLoader):
+ (WebCore::FrameLoader::shouldReloadToHandleUnreachableURL):
+ (WebCore::FrameLoader::reloadWithOverrideEncoding):
+ (WebCore::FrameLoader::reload):
+ (WebCore::FrameLoader::loadPostRequest):
+ (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
+ (WebCore::FrameLoader::loadDifferentDocumentItem):
+ * loader/FrameLoader.h:
+ (WebCore::FrameLoader::loadWithDocumentLoader):
+ (WebCore::FrameLoader::loadWithNavigationAction):
+ * loader/FrameLoaderClient.h:
+ * loader/PolicyChecker.cpp:
+ (WebCore::PolicyChecker::checkNavigationPolicy):
+ * loader/PolicyChecker.h:
+ * loader/ShouldSkipSafeBrowsingCheck.h: Added.
+
2018-08-16 Ryosuke Niwa <[email protected]>
Replace canBubble and cancelable booleans in Event by enum classes
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (234997 => 234998)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-08-17 23:24:37 UTC (rev 234998)
@@ -1839,6 +1839,7 @@
5C4304B6191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4304B4191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h */; };
5C6E65431D5CEFBF00F7862E /* URLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C6E65401D5CEDC900F7862E /* URLParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
5C7C88D81D0F1F4A009D2F6D /* SocketProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5C8C600921276B870082F88F /* ShouldSkipSafeBrowsingCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C8C600721276B0F0082F88F /* ShouldSkipSafeBrowsingCheck.h */; settings = {ATTRIBUTES = (Private, ); }; };
5CA1DEC61F71F1C700E71BD3 /* HTTPHeaderField.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CA1DEC41F71E68700E71BD3 /* HTTPHeaderField.h */; settings = {ATTRIBUTES = (Private, ); }; };
5CB37FFF1C62D2A100F20188 /* ScrollAnimatorMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB37FFD1C62D27800F20188 /* ScrollAnimatorMock.h */; };
5CBC8DAD1AAA302200E1C803 /* MediaAccessibilitySoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC8DAB1AAA302200E1C803 /* MediaAccessibilitySoftLink.h */; };
@@ -8673,6 +8674,7 @@
5C6E653F1D5CEDC900F7862E /* URLParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLParser.cpp; sourceTree = "<group>"; };
5C6E65401D5CEDC900F7862E /* URLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLParser.h; sourceTree = "<group>"; };
5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketProvider.h; sourceTree = "<group>"; };
+ 5C8C600721276B0F0082F88F /* ShouldSkipSafeBrowsingCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShouldSkipSafeBrowsingCheck.h; sourceTree = "<group>"; };
5C97A3361F5F7A6500105207 /* RectEdges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RectEdges.h; sourceTree = "<group>"; };
5C9B860B1C21E3C600110F36 /* NetworkLoadMetrics.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkLoadMetrics.mm; sourceTree = "<group>"; };
5C9EF16F1DFF719900A452E3 /* XPathGrammar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathGrammar.cpp; sourceTree = "<group>"; };
@@ -24402,6 +24404,7 @@
CBC2D22E1CE5B77D00D1880B /* ResourceTimingInformation.h */,
286E4DCB2021048800315238 /* ServerTiming.cpp */,
286E4DCC2021048800315238 /* ServerTiming.h */,
+ 5C8C600721276B0F0082F88F /* ShouldSkipSafeBrowsingCheck.h */,
8362E8BF20CEF9CB00245886 /* ShouldTreatAsContinuingLoad.h */,
51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */,
51327D5E11A33A2B004F9D65 /* SinkDocument.h */,
@@ -30298,6 +30301,7 @@
1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */,
834DFAD01F7DAE5D00C2725B /* SharedStringHash.h in Headers */,
93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */,
+ 5C8C600921276B870082F88F /* ShouldSkipSafeBrowsingCheck.h in Headers */,
8362E8C120CEF9CB00245886 /* ShouldTreatAsContinuingLoad.h in Headers */,
E48944A3180B57D800F165D8 /* SimpleLineLayout.h in Headers */,
11E067EE1E6246E500162D16 /* SimpleLineLayoutCoverage.h in Headers */,
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (234997 => 234998)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2018-08-17 23:24:37 UTC (rev 234998)
@@ -446,7 +446,7 @@
{
}
-void EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, const ResourceResponse&, FormState*, PolicyDecisionMode, FramePolicyFunction&&)
+void EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, const ResourceResponse&, FormState*, PolicyDecisionMode, ShouldSkipSafeBrowsingCheck, FramePolicyFunction&&)
{
}
Modified: trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h (234997 => 234998)
--- trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -95,7 +95,7 @@
void dispatchDecidePolicyForResponse(const ResourceResponse&, const ResourceRequest&, FramePolicyFunction&&) final { }
void dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, FramePolicyFunction&&) final;
- void dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, const ResourceResponse& redirectResponse, FormState*, PolicyDecisionMode, FramePolicyFunction&&) final;
+ void dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, const ResourceResponse& redirectResponse, FormState*, PolicyDecisionMode, ShouldSkipSafeBrowsingCheck, FramePolicyFunction&&) final;
void cancelPolicyCheck() final { }
void dispatchUnableToImplementPolicy(const ResourceError&) final { }
Modified: trunk/Source/WebCore/loader/FrameLoadRequest.h (234997 => 234998)
--- trunk/Source/WebCore/loader/FrameLoadRequest.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/loader/FrameLoadRequest.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -27,6 +27,7 @@
#include "FrameLoaderTypes.h"
#include "ResourceRequest.h"
+#include "ShouldSkipSafeBrowsingCheck.h"
#include "SubstituteData.h"
#include <wtf/Forward.h>
@@ -63,6 +64,9 @@
void setShouldTreatAsContinuingLoad(bool value) { m_shouldTreatAsContinuingLoad = value; }
bool shouldTreatAsContinuingLoad() const { return m_shouldTreatAsContinuingLoad; }
+ void setShouldSkipSafeBrowsingCheck(ShouldSkipSafeBrowsingCheck skip) { m_shouldSkipSafeBrowsingCheck = skip; }
+ ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck() { return m_shouldSkipSafeBrowsingCheck; }
+
const SubstituteData& substituteData() const { return m_substituteData; }
void setSubstituteData(const SubstituteData& data) { m_substituteData = data; }
bool hasSubstituteData() { return m_substituteData.isValid(); }
@@ -110,6 +114,7 @@
InitiatedByMainFrame m_initiatedByMainFrame { InitiatedByMainFrame::Unknown };
bool m_isCrossOriginWindowOpenNavigation { false };
SystemPreviewInfo m_systemPreviewInfo;
+ ShouldSkipSafeBrowsingCheck m_shouldSkipSafeBrowsingCheck { ShouldSkipSafeBrowsingCheck::No };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (234997 => 234998)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2018-08-17 23:24:37 UTC (rev 234998)
@@ -1003,7 +1003,7 @@
auto documentLoader = m_client.createDocumentLoader(request, substituteData);
documentLoader->setArchive(WTFMove(archive));
- load(documentLoader.ptr());
+ load(documentLoader.get(), ShouldSkipSafeBrowsingCheck::No);
}
#endif // ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
@@ -1407,7 +1407,7 @@
if (isSystemPreview)
request.setSystemPreviewRect(frameLoadRequest.systemPreviewRect());
#endif
- loadWithNavigationAction(request, action, lockHistory, newLoadType, WTFMove(formState), allowNavigationToInvalidURL, [this, isRedirect, sameURL, newLoadType, protectedFrame = makeRef(m_frame), completionHandler = completionHandlerCaller.release()] () mutable {
+ loadWithNavigationAction(request, action, lockHistory, newLoadType, WTFMove(formState), allowNavigationToInvalidURL, frameLoadRequest.shouldSkipSafeBrowsingCheck(), [this, isRedirect, sameURL, newLoadType, protectedFrame = makeRef(m_frame), completionHandler = completionHandlerCaller.release()] () mutable {
if (isRedirect) {
m_quickRedirectComing = false;
if (m_provisionalDocumentLoader)
@@ -1469,10 +1469,10 @@
applyShouldOpenExternalURLsPolicyToNewDocumentLoader(m_frame, loader, request);
SetForScope<bool> currentLoadShouldBeTreatedAsContinuingLoadGuard(m_currentLoadShouldBeTreatedAsContinuingLoad, request.shouldTreatAsContinuingLoad());
- load(loader.ptr());
+ load(loader.get(), request.shouldSkipSafeBrowsingCheck());
}
-void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const NavigationAction& action, LockHistory lockHistory, FrameLoadType type, RefPtr<FormState>&& formState, AllowNavigationToInvalidURL allowNavigationToInvalidURL, CompletionHandler<void()>&& completionHandler)
+void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const NavigationAction& action, LockHistory lockHistory, FrameLoadType type, RefPtr<FormState>&& formState, AllowNavigationToInvalidURL allowNavigationToInvalidURL, ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck, CompletionHandler<void()>&& completionHandler)
{
Ref<DocumentLoader> loader = m_client.createDocumentLoader(request, defaultSubstituteDataForURL(request.url()));
applyShouldOpenExternalURLsPolicyToNewDocumentLoader(m_frame, loader, action.initiatedByMainFrame(), action.shouldOpenExternalURLsPolicy());
@@ -1484,27 +1484,27 @@
if (m_documentLoader)
loader->setOverrideEncoding(m_documentLoader->overrideEncoding());
- loadWithDocumentLoader(loader.ptr(), type, WTFMove(formState), allowNavigationToInvalidURL, ShouldTreatAsContinuingLoad::No, WTFMove(completionHandler));
+ loadWithDocumentLoader(loader.ptr(), type, WTFMove(formState), allowNavigationToInvalidURL, ShouldTreatAsContinuingLoad::No, shouldSkipSafeBrowsingCheck, WTFMove(completionHandler));
}
-void FrameLoader::load(DocumentLoader* newDocumentLoader)
+void FrameLoader::load(DocumentLoader& newDocumentLoader, ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck)
{
- ResourceRequest& r = newDocumentLoader->request();
+ ResourceRequest& r = newDocumentLoader.request();
addExtraFieldsToMainResourceRequest(r);
FrameLoadType type;
- if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->originalRequest().url())) {
+ if (shouldTreatURLAsSameAsCurrent(newDocumentLoader.originalRequest().url())) {
r.setCachePolicy(ResourceRequestCachePolicy::ReloadIgnoringCacheData);
type = FrameLoadType::Same;
- } else if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->unreachableURL()) && isReload(m_loadType))
+ } else if (shouldTreatURLAsSameAsCurrent(newDocumentLoader.unreachableURL()) && isReload(m_loadType))
type = m_loadType;
- else if (m_loadType == FrameLoadType::RedirectWithLockedBackForwardList && !newDocumentLoader->unreachableURL().isEmpty() && newDocumentLoader->substituteData().isValid())
+ else if (m_loadType == FrameLoadType::RedirectWithLockedBackForwardList && !newDocumentLoader.unreachableURL().isEmpty() && newDocumentLoader.substituteData().isValid())
type = FrameLoadType::RedirectWithLockedBackForwardList;
else
type = FrameLoadType::Standard;
if (m_documentLoader)
- newDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEncoding());
+ newDocumentLoader.setOverrideEncoding(m_documentLoader->overrideEncoding());
// When we loading alternate content for an unreachable URL that we're
// visiting in the history list, we treat it as a reload so the history list
@@ -1514,7 +1514,7 @@
// shouldn't a more explicit type of reload be defined, that means roughly
// "load without affecting history" ?
if (shouldReloadToHandleUnreachableURL(newDocumentLoader)) {
- // shouldReloadToHandleUnreachableURL() returns true only when the original load type is back-forward.
+ // shouldReloadToHandleUnreachableURL returns true only when the original load type is back-forward.
// In this case we should save the document state now. Otherwise the state can be lost because load type is
// changed and updateForBackForwardNavigation() will not be called when loading is committed.
history().saveDocumentAndScrollState();
@@ -1523,10 +1523,10 @@
type = FrameLoadType::Reload;
}
- loadWithDocumentLoader(newDocumentLoader, type, { }, AllowNavigationToInvalidURL::Yes, ShouldTreatAsContinuingLoad::No, [] { });
+ loadWithDocumentLoader(&newDocumentLoader, type, nullptr, AllowNavigationToInvalidURL::Yes, ShouldTreatAsContinuingLoad::No, shouldSkipSafeBrowsingCheck);
}
-void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType type, RefPtr<FormState>&& formState, AllowNavigationToInvalidURL allowNavigationToInvalidURL, ShouldTreatAsContinuingLoad, CompletionHandler<void()>&& completionHandler)
+void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType type, RefPtr<FormState>&& formState, AllowNavigationToInvalidURL allowNavigationToInvalidURL, ShouldTreatAsContinuingLoad, ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck, CompletionHandler<void()>&& completionHandler)
{
// Retain because dispatchBeforeLoadEvent may release the last reference to it.
Ref<Frame> protect(m_frame);
@@ -1605,7 +1605,7 @@
policyChecker().checkNavigationPolicy(ResourceRequest(loader->request()), ResourceResponse { } /* redirectResponse */, loader, WTFMove(formState), [this, protectedFrame = makeRef(m_frame), allowNavigationToInvalidURL, completionHandler = completionHandlerCaller.release()] (const ResourceRequest& request, WeakPtr<FormState>&& formState, ShouldContinue shouldContinue) mutable {
continueLoadAfterNavigationPolicy(request, formState.get(), shouldContinue, allowNavigationToInvalidURL);
completionHandler();
- });
+ }, PolicyDecisionMode::Asynchronous, shouldSkipSafeBrowsingCheck);
}
void FrameLoader::clearProvisionalLoadForPolicyCheck()
@@ -1670,9 +1670,9 @@
return error.isNull();
}
-bool FrameLoader::shouldReloadToHandleUnreachableURL(DocumentLoader* docLoader)
+bool FrameLoader::shouldReloadToHandleUnreachableURL(DocumentLoader& docLoader)
{
- URL unreachableURL = docLoader->unreachableURL();
+ URL unreachableURL = docLoader.unreachableURL();
if (unreachableURL.isEmpty())
return false;
@@ -1712,7 +1712,7 @@
loader->setOverrideEncoding(encoding);
- loadWithDocumentLoader(loader.ptr(), FrameLoadType::Reload, { }, AllowNavigationToInvalidURL::Yes, ShouldTreatAsContinuingLoad::No, [] { });
+ loadWithDocumentLoader(loader.ptr(), FrameLoadType::Reload, { }, AllowNavigationToInvalidURL::Yes, ShouldTreatAsContinuingLoad::No);
}
void FrameLoader::reload(OptionSet<ReloadOption> options)
@@ -1759,7 +1759,7 @@
return FrameLoadType::Reload;
};
- loadWithDocumentLoader(loader.ptr(), frameLoadTypeForReloadOptions(options), { }, AllowNavigationToInvalidURL::Yes, ShouldTreatAsContinuingLoad::No, [] { });
+ loadWithDocumentLoader(loader.ptr(), frameLoadTypeForReloadOptions(options), { }, AllowNavigationToInvalidURL::Yes, ShouldTreatAsContinuingLoad::No);
}
void FrameLoader::stopAllLoaders(ClearProvisionalItemPolicy clearProvisionalItemPolicy)
@@ -2918,7 +2918,7 @@
if (!frameName.isEmpty()) {
// The search for a target frame is done earlier in the case of form submission.
if (auto* targetFrame = formState ? nullptr : findFrameForNavigation(frameName)) {
- targetFrame->loader().loadWithNavigationAction(workingResourceRequest, action, lockHistory, loadType, WTFMove(formState), allowNavigationToInvalidURL, WTFMove(completionHandler));
+ targetFrame->loader().loadWithNavigationAction(workingResourceRequest, action, lockHistory, loadType, WTFMove(formState), allowNavigationToInvalidURL, ShouldSkipSafeBrowsingCheck::No, WTFMove(completionHandler));
return;
}
@@ -2931,7 +2931,7 @@
// must grab this now, since this load may stop the previous load and clear this flag
bool isRedirect = m_quickRedirectComing;
- loadWithNavigationAction(workingResourceRequest, action, lockHistory, loadType, WTFMove(formState), allowNavigationToInvalidURL, [this, isRedirect, protectedFrame = makeRef(m_frame), completionHandler = WTFMove(completionHandler)] () mutable {
+ loadWithNavigationAction(workingResourceRequest, action, lockHistory, loadType, WTFMove(formState), allowNavigationToInvalidURL, request.shouldSkipSafeBrowsingCheck(), [this, isRedirect, protectedFrame = makeRef(m_frame), completionHandler = WTFMove(completionHandler)] () mutable {
if (isRedirect) {
m_quickRedirectComing = false;
if (m_provisionalDocumentLoader)
@@ -3393,7 +3393,7 @@
}
NavigationAction newAction { *frame->document(), request, InitiatedByMainFrame::Unknown, NavigationType::Other, action.shouldOpenExternalURLsPolicy() };
- mainFrame->loader().loadWithNavigationAction(request, newAction, LockHistory::No, FrameLoadType::Standard, formState, allowNavigationToInvalidURL, [] { });
+ mainFrame->loader().loadWithNavigationAction(request, newAction, LockHistory::No, FrameLoadType::Standard, formState, allowNavigationToInvalidURL);
}
void FrameLoader::requestFromDelegate(ResourceRequest& request, unsigned long& identifier, ResourceError& error)
@@ -3589,7 +3589,7 @@
documentLoader->setTriggeringAction(WTFMove(action));
documentLoader->setLastCheckedRequest(ResourceRequest());
- loadWithDocumentLoader(documentLoader, loadType, { }, AllowNavigationToInvalidURL::Yes, shouldTreatAsContinuingLoad, [] { });
+ loadWithDocumentLoader(documentLoader, loadType, { }, AllowNavigationToInvalidURL::Yes, shouldTreatAsContinuingLoad);
return;
}
@@ -3677,7 +3677,7 @@
action.setTargetBackForwardItem(item);
- loadWithNavigationAction(request, action, LockHistory::No, loadType, { }, AllowNavigationToInvalidURL::Yes, [] { });
+ loadWithNavigationAction(request, action, LockHistory::No, loadType, { }, AllowNavigationToInvalidURL::Yes);
}
// Loads content into this frame, as specified by history item
Modified: trunk/Source/WebCore/loader/FrameLoader.h (234997 => 234998)
--- trunk/Source/WebCore/loader/FrameLoader.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -41,8 +41,10 @@
#include "ResourceLoaderOptions.h"
#include "ResourceRequestBase.h"
#include "SecurityContext.h"
+#include "ShouldSkipSafeBrowsingCheck.h"
#include "StoredCredentialsPolicy.h"
#include "Timer.h"
+#include <wtf/CompletionHandler.h>
#include <wtf/Forward.h>
#include <wtf/HashSet.h>
#include <wtf/OptionSet.h>
@@ -361,16 +363,16 @@
void closeOldDataSources();
void willRestoreFromCachedPage();
- bool shouldReloadToHandleUnreachableURL(DocumentLoader*);
+ bool shouldReloadToHandleUnreachableURL(DocumentLoader&);
void dispatchDidCommitLoad(std::optional<HasInsecureContent> initialHasInsecureContent);
void urlSelected(FrameLoadRequest&&, Event*);
- void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, ShouldTreatAsContinuingLoad, CompletionHandler<void()>&&); // Calls continueLoadAfterNavigationPolicy
- void load(DocumentLoader*); // Calls loadWithDocumentLoader
+ void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, ShouldTreatAsContinuingLoad, ShouldSkipSafeBrowsingCheck = ShouldSkipSafeBrowsingCheck::No, CompletionHandler<void()>&& = [] { }); // Calls continueLoadAfterNavigationPolicy
+ void load(DocumentLoader&, ShouldSkipSafeBrowsingCheck); // Calls loadWithDocumentLoader
- void loadWithNavigationAction(const ResourceRequest&, const NavigationAction&, LockHistory, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, CompletionHandler<void()>&&); // Calls loadWithDocumentLoader
+ void loadWithNavigationAction(const ResourceRequest&, const NavigationAction&, LockHistory, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, ShouldSkipSafeBrowsingCheck = ShouldSkipSafeBrowsingCheck::No, CompletionHandler<void()>&& = [] { }); // Calls loadWithDocumentLoader
void loadPostRequest(FrameLoadRequest&&, const String& referrer, FrameLoadType, Event*, RefPtr<FormState>&&, CompletionHandler<void()>&&);
void loadURL(FrameLoadRequest&&, const String& referrer, FrameLoadType, Event*, RefPtr<FormState>&&, CompletionHandler<void()>&&);
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (234997 => 234998)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -104,6 +104,8 @@
class Widget;
enum class PolicyDecisionMode;
+enum class ShouldSkipSafeBrowsingCheck;
+
struct StringWithDirection;
typedef WTF::Function<void (PolicyAction)> FramePolicyFunction;
@@ -191,7 +193,7 @@
virtual void dispatchDecidePolicyForResponse(const ResourceResponse&, const ResourceRequest&, FramePolicyFunction&&) = 0;
virtual void dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String& frameName, FramePolicyFunction&&) = 0;
- virtual void dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, const ResourceResponse& redirectResponse, FormState*, PolicyDecisionMode, FramePolicyFunction&&) = 0;
+ virtual void dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, const ResourceResponse& redirectResponse, FormState*, PolicyDecisionMode, ShouldSkipSafeBrowsingCheck, FramePolicyFunction&&) = 0;
virtual void cancelPolicyCheck() = 0;
virtual void dispatchUnableToImplementPolicy(const ResourceError&) = 0;
Modified: trunk/Source/WebCore/loader/PolicyChecker.cpp (234997 => 234998)
--- trunk/Source/WebCore/loader/PolicyChecker.cpp 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/loader/PolicyChecker.cpp 2018-08-17 23:24:37 UTC (rev 234998)
@@ -98,7 +98,7 @@
});
}
-void PolicyChecker::checkNavigationPolicy(ResourceRequest&& request, const ResourceResponse& redirectResponse, DocumentLoader* loader, RefPtr<FormState>&& formState, NavigationPolicyDecisionFunction&& function, PolicyDecisionMode policyDecisionMode)
+void PolicyChecker::checkNavigationPolicy(ResourceRequest&& request, const ResourceResponse& redirectResponse, DocumentLoader* loader, RefPtr<FormState>&& formState, NavigationPolicyDecisionFunction&& function, PolicyDecisionMode policyDecisionMode, ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck)
{
NavigationAction action = ""
if (action.isEmpty()) {
@@ -168,7 +168,7 @@
m_delegateIsDecidingNavigationPolicy = true;
String suggestedFilename = action.downloadAttribute().isEmpty() ? nullAtom() : action.downloadAttribute();
- m_frame.loader().client().dispatchDecidePolicyForNavigationAction(action, request, redirectResponse, formState.get(), policyDecisionMode, [this, function = WTFMove(function), request = ResourceRequest(request), formState = WTFMove(formState), suggestedFilename = WTFMove(suggestedFilename), blobURLLifetimeExtension = WTFMove(blobURLLifetimeExtension)](PolicyAction policyAction) mutable {
+ m_frame.loader().client().dispatchDecidePolicyForNavigationAction(action, request, redirectResponse, formState.get(), policyDecisionMode, shouldSkipSafeBrowsingCheck, [this, function = WTFMove(function), request = ResourceRequest(request), formState = WTFMove(formState), suggestedFilename = WTFMove(suggestedFilename), blobURLLifetimeExtension = WTFMove(blobURLLifetimeExtension)](PolicyAction policyAction) mutable {
m_delegateIsDecidingNavigationPolicy = false;
switch (policyAction) {
Modified: trunk/Source/WebCore/loader/PolicyChecker.h (234997 => 234998)
--- trunk/Source/WebCore/loader/PolicyChecker.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebCore/loader/PolicyChecker.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -31,6 +31,7 @@
#include "FrameLoaderTypes.h"
#include "ResourceRequest.h"
+#include "ShouldSkipSafeBrowsingCheck.h"
#include <wtf/WeakPtr.h>
#include <wtf/text/WTFString.h>
@@ -69,7 +70,7 @@
public:
explicit PolicyChecker(Frame&);
- void checkNavigationPolicy(ResourceRequest&&, const ResourceResponse& redirectResponse, DocumentLoader*, RefPtr<FormState>&&, NavigationPolicyDecisionFunction&&, PolicyDecisionMode = PolicyDecisionMode::Asynchronous);
+ void checkNavigationPolicy(ResourceRequest&&, const ResourceResponse& redirectResponse, DocumentLoader*, RefPtr<FormState>&&, NavigationPolicyDecisionFunction&&, PolicyDecisionMode = PolicyDecisionMode::Asynchronous, ShouldSkipSafeBrowsingCheck = ShouldSkipSafeBrowsingCheck::No);
void checkNavigationPolicy(ResourceRequest&&, const ResourceResponse& redirectResponse, NavigationPolicyDecisionFunction&&);
void checkNewWindowPolicy(NavigationAction&&, ResourceRequest&&, RefPtr<FormState>&&, const String& frameName, NewWindowPolicyDecisionFunction&&);
Added: trunk/Source/WebCore/loader/ShouldSkipSafeBrowsingCheck.h (0 => 234998)
--- trunk/Source/WebCore/loader/ShouldSkipSafeBrowsingCheck.h (rev 0)
+++ trunk/Source/WebCore/loader/ShouldSkipSafeBrowsingCheck.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -0,0 +1,46 @@
+/*
+ * 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/EnumTraits.h>
+
+namespace WebCore {
+
+enum class ShouldSkipSafeBrowsingCheck { No, Yes };
+
+}
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::ShouldSkipSafeBrowsingCheck> {
+ using values = EnumValues<
+ WebCore::ShouldSkipSafeBrowsingCheck,
+ WebCore::ShouldSkipSafeBrowsingCheck::No,
+ WebCore::ShouldSkipSafeBrowsingCheck::Yes
+ >;
+};
+
+}
Modified: trunk/Source/WebKit/ChangeLog (234997 => 234998)
--- trunk/Source/WebKit/ChangeLog 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/ChangeLog 2018-08-17 23:24:37 UTC (rev 234998)
@@ -1,3 +1,35 @@
+2018-08-17 Alex Christensen <[email protected]>
+
+ Add some plumbing for safe browsing
+ https://bugs.webkit.org/show_bug.cgi?id=188709
+
+ Reviewed by Tim Horton.
+
+ Also adding a URL to SafeBrowsingResult because we'll need it.
+ Also adding a bool to LoadParameters because we will need to do special things
+ when loading the safe browsing warning, like adding a way to skip the safe browsing check.
+
+ * Shared/LoadParameters.cpp:
+ (WebKit::LoadParameters::encode const):
+ (WebKit::LoadParameters::decode):
+ * Shared/LoadParameters.h:
+ * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm:
+ (WebKit::SafeBrowsingResult::SafeBrowsingResult):
+ * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+ (WebKit::WebPageProxy::beginSafeBrowsingCheck):
+ * UIProcess/SafeBrowsingResult.h:
+ (WebKit::SafeBrowsingResult::url const):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::loadAlternateHTML):
+ (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
+ (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+ (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+
2018-08-16 Ryosuke Niwa <[email protected]>
Replace canBubble and cancelable booleans in Event by enum classes
Modified: trunk/Source/WebKit/Shared/LoadParameters.cpp (234997 => 234998)
--- trunk/Source/WebKit/Shared/LoadParameters.cpp 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/Shared/LoadParameters.cpp 2018-08-17 23:24:37 UTC (rev 234998)
@@ -49,6 +49,7 @@
encoder << shouldOpenExternalURLsPolicy;
encoder << shouldTreatAsContinuingLoad;
encoder << userData;
+ encoder << forSafeBrowsing;
platformEncode(encoder);
}
@@ -105,6 +106,9 @@
if (!decoder.decode(data.userData))
return false;
+ if (!decoder.decode(data.forSafeBrowsing))
+ return false;
+
if (!platformDecode(decoder, data))
return false;
Modified: trunk/Source/WebKit/Shared/LoadParameters.h (234997 => 234998)
--- trunk/Source/WebKit/Shared/LoadParameters.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/Shared/LoadParameters.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -62,6 +62,7 @@
uint64_t shouldOpenExternalURLsPolicy;
bool shouldTreatAsContinuingLoad { false };
UserData userData;
+ bool forSafeBrowsing { false };
#if PLATFORM(COCOA)
RetainPtr<NSDictionary> dataDetectionContext;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm (234997 => 234998)
--- trunk/Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm 2018-08-17 23:24:37 UTC (rev 234998)
@@ -31,8 +31,9 @@
namespace WebKit {
#if HAVE(SAFE_BROWSING)
-SafeBrowsingResult::SafeBrowsingResult(SSBServiceLookupResult *result)
- : m_provider([result provider])
+SafeBrowsingResult::SafeBrowsingResult(WebCore::URL&& url, SSBServiceLookupResult *result)
+ : m_url(WTFMove(url))
+ , m_provider([result provider])
, m_isPhishing([result isPhishing])
, m_isMalware([result isMalware])
, m_isUnwantedSoftware([result isUnwantedSoftware])
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (234997 => 234998)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2018-08-17 23:24:37 UTC (rev 234998)
@@ -77,8 +77,8 @@
SSBLookupContext *context = [SSBLookupContext sharedLookupContext];
if (!context)
return listener.didReceiveSafeBrowsingResults({ });
- [context 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)] {
+ [context lookUpURL:url completionHandler:BlockPtr<void(SSBLookupResult *, NSError *)>::fromCallable([listener = makeRef(listener), url = "" (SSBLookupResult *result, NSError *error) mutable {
+ RunLoop::main().dispatch([listener = WTFMove(listener), result = retainPtr(result), error = retainPtr(error), url = "" {
if (error) {
listener->didReceiveSafeBrowsingResults({ });
return;
@@ -88,7 +88,7 @@
Vector<SafeBrowsingResult> resultsVector;
resultsVector.reserveInitialCapacity([results count]);
for (SSBServiceLookupResult *result in results)
- resultsVector.uncheckedAppend({ result });
+ resultsVector.uncheckedAppend({ URL(url), result });
listener->didReceiveSafeBrowsingResults(WTFMove(resultsVector));
});
}).get()];
Modified: trunk/Source/WebKit/UIProcess/SafeBrowsingResult.h (234997 => 234998)
--- trunk/Source/WebKit/UIProcess/SafeBrowsingResult.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/UIProcess/SafeBrowsingResult.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -25,6 +25,7 @@
#pragma once
+#include <WebCore/URL.h>
#include <wtf/text/WTFString.h>
OBJC_CLASS SSBServiceLookupResult;
@@ -34,10 +35,11 @@
class SafeBrowsingResult {
public:
#if HAVE(SAFE_BROWSING)
- SafeBrowsingResult(SSBServiceLookupResult *);
+ SafeBrowsingResult(WebCore::URL&&, SSBServiceLookupResult *);
#endif
SafeBrowsingResult() = default;
+ const WebCore::URL& url() const { return m_url; }
const String& provider() const { return m_provider; }
bool isPhishing() const { return m_isPhishing; }
bool isMalware() const { return m_isMalware; }
@@ -45,6 +47,7 @@
bool isKnownToBeUnsafe() const { return m_isKnownToBeUnsafe; }
private:
+ WebCore::URL m_url;
String m_provider;
bool m_isPhishing { false };
bool m_isMalware { false };
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (234997 => 234998)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-08-17 23:24:37 UTC (rev 234998)
@@ -146,6 +146,7 @@
#include <WebCore/SSLKeyGenerator.h>
#include <WebCore/SerializedCryptoKeyWrap.h>
#include <WebCore/SharedBuffer.h>
+#include <WebCore/ShouldSkipSafeBrowsingCheck.h>
#include <WebCore/ShouldTreatAsContinuingLoad.h>
#include <WebCore/TextCheckerClient.h>
#include <WebCore/TextIndicator.h>
@@ -1079,7 +1080,7 @@
return WTFMove(navigation);
}
-void WebPageProxy::loadAlternateHTML(const IPC::DataReference& htmlData, const String& encoding, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData)
+void WebPageProxy::loadAlternateHTML(const IPC::DataReference& htmlData, const String& encoding, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData, bool forSafeBrowsing)
{
// When the UIProcess is in the process of handling a failing provisional load, do not attempt to
// start a second alternative HTML load as this will prevent the page load state from being
@@ -1110,6 +1111,7 @@
loadParameters.unreachableURLString = unreachableURL;
loadParameters.provisionalLoadErrorURLString = m_failingProvisionalLoadURL;
loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
+ loadParameters.forSafeBrowsing = forSafeBrowsing;
addPlatformLoadParameters(loadParameters);
m_process->assumeReadAccessToBaseURL(baseURL);
@@ -3968,14 +3970,14 @@
}
#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)
+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, WebCore::ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck, 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) {
+ decidePolicyForNavigationAction(frameID, frameSecurityOrigin, navigationID, WTFMove(navigationActionData), frameInfoData, originatingPageID, originalRequest, WTFMove(request), WTFMove(redirectResponse), userData, shouldSkipSafeBrowsingCheck, PolicyDecisionSender::create([this, protectedThis = makeRef(*this), frameID, listenerID] (auto... args) {
m_process->send(Messages::WebPage::DidReceivePolicyDecision(frameID, listenerID, args...), m_pageID);
}));
}
-void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&& navigationActionData, const FrameInfoData& originatingFrameInfoData, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&& request, WebCore::ResourceResponse&& redirectResponse, const UserData& userData, Ref<PolicyDecisionSender>&& sender)
+void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&& navigationActionData, const FrameInfoData& originatingFrameInfoData, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&& request, WebCore::ResourceResponse&& redirectResponse, const UserData& userData, WebCore::ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck, Ref<PolicyDecisionSender>&& sender)
{
LOG(Loading, "WebPageProxy::decidePolicyForNavigationAction - Original URL %s, current target URL %s", originalRequest.url().string().utf8().data(), request.url().string().utf8().data());
@@ -4052,8 +4054,9 @@
}
receivedPolicyDecision(policyAction, navigation.get(), WTFMove(data), WTFMove(sender));
- }, ShouldExpectSafeBrowsingResult::Yes));
- beginSafeBrowsingCheck(request.url(), listener);
+ }, shouldSkipSafeBrowsingCheck == ShouldSkipSafeBrowsingCheck::Yes ? ShouldExpectSafeBrowsingResult::No : ShouldExpectSafeBrowsingResult::Yes));
+ if (shouldSkipSafeBrowsingCheck == ShouldSkipSafeBrowsingCheck::No)
+ beginSafeBrowsingCheck(request.url(), listener);
API::Navigation* mainFrameNavigation = frame->isMainFrame() ? navigation.get() : nullptr;
WebFrameProxy* originatingFrame = m_process->webFrame(originatingFrameInfoData.frameID);
@@ -4081,11 +4084,11 @@
m_shouldSuppressAppLinksInNextNavigationPolicyDecision = false;
}
-void WebPageProxy::decidePolicyForNavigationActionSync(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, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&& reply)
+void WebPageProxy::decidePolicyForNavigationActionSync(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, WebCore::ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&& reply)
{
auto sender = PolicyDecisionSender::create(WTFMove(reply));
- decidePolicyForNavigationAction(frameID, frameSecurityOrigin, navigationID, WTFMove(navigationActionData), frameInfoData, originatingPageID, originalRequest, WTFMove(request), WTFMove(redirectResponse), userData, sender.copyRef());
+ decidePolicyForNavigationAction(frameID, frameSecurityOrigin, navigationID, WTFMove(navigationActionData), frameInfoData, originatingPageID, originalRequest, WTFMove(request), WTFMove(redirectResponse), userData, shouldSkipSafeBrowsingCheck, sender.copyRef());
// If the client did not respond synchronously, proceed with the load.
sender->send(PolicyAction::Use, navigationID, DownloadID(), std::nullopt);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (234997 => 234998)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -457,7 +457,7 @@
RefPtr<API::Navigation> loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr);
RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
RefPtr<API::Navigation> loadData(const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr);
- void loadAlternateHTML(const IPC::DataReference&, const String& encoding, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData = nullptr);
+ void loadAlternateHTML(const IPC::DataReference&, const String& encoding, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData = nullptr, bool forSafeBrowsing = false);
void loadWebArchiveData(API::Data*, API::Object* userData = nullptr);
void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
@@ -1425,9 +1425,9 @@
void didDestroyNavigation(uint64_t navigationID);
- void decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, WebCore::ResourceResponse&& redirectResponse, const UserData&, Ref<PolicyDecisionSender>&&);
- void decidePolicyForNavigationActionAsync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, WebCore::ResourceResponse&& redirectResponse, const UserData&, uint64_t listenerID);
- void decidePolicyForNavigationActionSync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&&);
+ void decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, WebCore::ResourceResponse&& redirectResponse, const UserData&, WebCore::ShouldSkipSafeBrowsingCheck, Ref<PolicyDecisionSender>&&);
+ void decidePolicyForNavigationActionAsync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, WebCore::ResourceResponse&& redirectResponse, const UserData&, WebCore::ShouldSkipSafeBrowsingCheck, uint64_t listenerID);
+ void decidePolicyForNavigationActionSync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, WebCore::ResourceResponse&& redirectResponse, const UserData&, WebCore::ShouldSkipSafeBrowsingCheck, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&&);
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&);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (234997 => 234998)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2018-08-17 23:24:37 UTC (rev 234998)
@@ -106,8 +106,8 @@
# Policy messages
DecidePolicyForResponse(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, WebCore::ResourceResponse response, WebCore::ResourceRequest request, bool canShowMIMEType, uint64_t listenerID, WebKit::UserData userData)
- DecidePolicyForNavigationActionAsync(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, uint64_t originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse, WebKit::UserData userData, uint64_t listenerID)
- DecidePolicyForNavigationActionSync(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, uint64_t originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse, WebKit::UserData userData) -> (enum WebCore::PolicyAction policyAction, uint64_t newNavigationID, WebKit::DownloadID downloadID, std::optional<WebKit::WebsitePoliciesData> websitePolicies) Delayed
+ DecidePolicyForNavigationActionAsync(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, uint64_t originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse, WebKit::UserData userData, enum WebCore::ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck, uint64_t listenerID)
+ DecidePolicyForNavigationActionSync(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, struct WebKit::FrameInfoData originatingFrameInfoData, uint64_t originatingPageID, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse, WebKit::UserData userData, enum WebCore::ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck) -> (enum WebCore::PolicyAction policyAction, uint64_t newNavigationID, WebKit::DownloadID downloadID, std::optional<WebKit::WebsitePoliciesData> websitePolicies) Delayed
DecidePolicyForNewWindowAction(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, struct WebKit::NavigationActionData navigationActionData, WebCore::ResourceRequest request, String frameName, uint64_t listenerID, WebKit::UserData userData)
UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::UserData userData)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (234997 => 234998)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2018-08-17 23:24:37 UTC (rev 234998)
@@ -813,7 +813,7 @@
WebsitePoliciesData::applyToDocumentLoader(WTFMove(websitePolicies), *documentLoader);
}
-void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& navigationAction, const ResourceRequest& request, const ResourceResponse& redirectResponse, FormState* formState, PolicyDecisionMode policyDecisionMode, FramePolicyFunction&& function)
+void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& navigationAction, const ResourceRequest& request, const ResourceResponse& redirectResponse, FormState* formState, PolicyDecisionMode policyDecisionMode, ShouldSkipSafeBrowsingCheck shouldSkipSafeBrowsingCheck, FramePolicyFunction&& function)
{
WebPage* webPage = m_frame ? m_frame->page() : nullptr;
if (!webPage) {
@@ -892,7 +892,7 @@
DownloadID downloadID;
std::optional<WebsitePoliciesData> websitePolicies;
- if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationActionSync(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), documentLoader->navigationID(), navigationActionData, originatingFrameInfoData, originatingPageID, navigationAction.resourceRequest(), request, redirectResponse, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForNavigationActionSync::Reply(policyAction, newNavigationID, downloadID, websitePolicies))) {
+ if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationActionSync(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), documentLoader->navigationID(), navigationActionData, originatingFrameInfoData, originatingPageID, navigationAction.resourceRequest(), request, redirectResponse, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()), shouldSkipSafeBrowsingCheck), Messages::WebPageProxy::DecidePolicyForNavigationActionSync::Reply(policyAction, newNavigationID, downloadID, websitePolicies))) {
m_frame->didReceivePolicyDecision(listenerID, PolicyAction::Ignore, 0, { }, { });
return;
}
@@ -902,7 +902,7 @@
}
ASSERT(policyDecisionMode == PolicyDecisionMode::Asynchronous);
- if (!webPage->send(Messages::WebPageProxy::DecidePolicyForNavigationActionAsync(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), documentLoader->navigationID(), navigationActionData, originatingFrameInfoData, originatingPageID, navigationAction.resourceRequest(), request, redirectResponse, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()), listenerID)))
+ if (!webPage->send(Messages::WebPageProxy::DecidePolicyForNavigationActionAsync(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), documentLoader->navigationID(), navigationActionData, originatingFrameInfoData, originatingPageID, navigationAction.resourceRequest(), request, redirectResponse, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()), shouldSkipSafeBrowsingCheck, listenerID)))
m_frame->didReceivePolicyDecision(listenerID, PolicyAction::Ignore, 0, { }, { });
}
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (234997 => 234998)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -125,7 +125,7 @@
void dispatchDecidePolicyForResponse(const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, WebCore::FramePolicyFunction&&) final;
void dispatchDecidePolicyForNewWindowAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WebCore::FormState*, const String& frameName, WebCore::FramePolicyFunction&&) final;
- void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse, WebCore::FormState*, WebCore::PolicyDecisionMode, WebCore::FramePolicyFunction&&) final;
+ void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse, WebCore::FormState*, WebCore::PolicyDecisionMode, WebCore::ShouldSkipSafeBrowsingCheck, WebCore::FramePolicyFunction&&) final;
void cancelPolicyCheck() final;
void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) final;
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (234997 => 234998)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2018-08-17 23:24:37 UTC (rev 234998)
@@ -1,3 +1,14 @@
+2018-08-17 Alex Christensen <[email protected]>
+
+ Add some plumbing for safe browsing
+ https://bugs.webkit.org/show_bug.cgi?id=188709
+
+ Reviewed by Tim Horton.
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+
2018-08-16 Ryosuke Niwa <[email protected]>
Replace canBubble and cancelable booleans in Event by enum classes
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h (234997 => 234998)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -128,7 +128,7 @@
void dispatchDecidePolicyForResponse(const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, WebCore::FramePolicyFunction&&) final;
void dispatchDecidePolicyForNewWindowAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WebCore::FormState*, const WTF::String& frameName, WebCore::FramePolicyFunction&&) final;
- void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse, WebCore::FormState*, WebCore::PolicyDecisionMode, WebCore::FramePolicyFunction&&) final;
+ void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse, WebCore::FormState*, WebCore::PolicyDecisionMode, WebCore::ShouldSkipSafeBrowsingCheck, WebCore::FramePolicyFunction&&) final;
void cancelPolicyCheck() final;
void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) final;
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (234997 => 234998)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2018-08-17 23:24:37 UTC (rev 234998)
@@ -901,7 +901,7 @@
decisionListener:setUpPolicyListener(WTFMove(function), PolicyAction::Ignore, tryAppLink ? (NSURL *)request.url() : nil).get()];
}
-void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& action, const ResourceRequest& request, const ResourceResponse&, FormState* formState, PolicyDecisionMode, FramePolicyFunction&& function)
+void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& action, const ResourceRequest& request, const ResourceResponse&, FormState* formState, PolicyDecisionMode, WebCore::ShouldSkipSafeBrowsingCheck, FramePolicyFunction&& function)
{
WebView *webView = getWebView(m_webFrame.get());
BOOL tryAppLink = shouldTryAppLink(webView, action, core(m_webFrame.get()));
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (234997 => 234998)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2018-08-17 23:24:37 UTC (rev 234998)
@@ -1,3 +1,14 @@
+2018-08-17 Alex Christensen <[email protected]>
+
+ Add some plumbing for safe browsing
+ https://bugs.webkit.org/show_bug.cgi?id=188709
+
+ Reviewed by Tim Horton.
+
+ * WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+ * WebCoreSupport/WebFrameLoaderClient.h:
+
2018-08-02 David Fenton <[email protected]>
Unreviewed, rolling out r234489.
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (234997 => 234998)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp 2018-08-17 23:24:37 UTC (rev 234998)
@@ -565,7 +565,7 @@
m_policyListenerPrivate->m_policyFunction(PolicyAction::Use);
}
-void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& action, const ResourceRequest& request, const ResourceResponse&, FormState* formState, WebCore::PolicyDecisionMode, FramePolicyFunction&& function)
+void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction& action, const ResourceRequest& request, const ResourceResponse&, FormState* formState, WebCore::PolicyDecisionMode, WebCore::ShouldSkipSafeBrowsingCheck, FramePolicyFunction&& function)
{
WebView* webView = m_webFrame->webView();
Frame* coreFrame = core(m_webFrame);
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h (234997 => 234998)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h 2018-08-17 21:43:31 UTC (rev 234997)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h 2018-08-17 23:24:37 UTC (rev 234998)
@@ -102,7 +102,7 @@
void dispatchDecidePolicyForResponse(const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, WebCore::FramePolicyFunction&&) override;
void dispatchDecidePolicyForNewWindowAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WebCore::FormState*, const WTF::String& frameName, WebCore::FramePolicyFunction&&) override;
- void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse, WebCore::FormState*, WebCore::PolicyDecisionMode, WebCore::FramePolicyFunction&&) override;
+ void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse, WebCore::FormState*, WebCore::PolicyDecisionMode, WebCore::ShouldSkipSafeBrowsingCheck, WebCore::FramePolicyFunction&&) override;
void cancelPolicyCheck() override;
void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) override;