WebKit Bugzilla
Attachment 347401 Details for
Bug 188709
: Add some plumbing for safe browsing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188709-20180817155221.patch (text/plain), 62.02 KB, created by
Alex Christensen
on 2018-08-17 15:52:22 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2018-08-17 15:52:22 PDT
Size:
62.02 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 234967) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,41 @@ >+2018-08-17 Alex Christensen <achristensen@webkit.org> >+ >+ Add some plumbing for safe browsing >+ https://bugs.webkit.org/show_bug.cgi?id=188709 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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 Alex Christensen <achristensen@webkit.org> > > Remove unused allowScriptsToCloseWindows setting >Index: Source/WebCore/WebCore.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebCore/WebCore.xcodeproj/project.pbxproj (revision 234932) >+++ Source/WebCore/WebCore.xcodeproj/project.pbxproj (working copy) >@@ -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 */, >Index: Source/WebCore/loader/EmptyClients.cpp >=================================================================== >--- Source/WebCore/loader/EmptyClients.cpp (revision 234932) >+++ Source/WebCore/loader/EmptyClients.cpp (working copy) >@@ -446,7 +446,7 @@ void EmptyFrameLoaderClient::dispatchDec > { > } > >-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&&) > { > } > >Index: Source/WebCore/loader/EmptyFrameLoaderClient.h >=================================================================== >--- Source/WebCore/loader/EmptyFrameLoaderClient.h (revision 234932) >+++ Source/WebCore/loader/EmptyFrameLoaderClient.h (working copy) >@@ -95,7 +95,7 @@ class WEBCORE_EXPORT EmptyFrameLoaderCli > > 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 { } >Index: Source/WebCore/loader/FrameLoadRequest.h >=================================================================== >--- Source/WebCore/loader/FrameLoadRequest.h (revision 234932) >+++ Source/WebCore/loader/FrameLoadRequest.h (working copy) >@@ -27,6 +27,7 @@ > > #include "FrameLoaderTypes.h" > #include "ResourceRequest.h" >+#include "ShouldSkipSafeBrowsingCheck.h" > #include "SubstituteData.h" > #include <wtf/Forward.h> > >@@ -63,6 +64,9 @@ public: > 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 @@ private: > InitiatedByMainFrame m_initiatedByMainFrame { InitiatedByMainFrame::Unknown }; > bool m_isCrossOriginWindowOpenNavigation { false }; > SystemPreviewInfo m_systemPreviewInfo; >+ ShouldSkipSafeBrowsingCheck m_shouldSkipSafeBrowsingCheck { ShouldSkipSafeBrowsingCheck::No }; > }; > > } // namespace WebCore >Index: Source/WebCore/loader/FrameLoader.cpp >=================================================================== >--- Source/WebCore/loader/FrameLoader.cpp (revision 234932) >+++ Source/WebCore/loader/FrameLoader.cpp (working copy) >@@ -1003,7 +1003,7 @@ void FrameLoader::loadArchive(Ref<Archiv > > 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 @@ void FrameLoader::loadURL(FrameLoadReque > 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 @@ void FrameLoader::load(FrameLoadRequest& > 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 @@ void FrameLoader::loadWithNavigationActi > 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 @@ void FrameLoader::load(DocumentLoader* n > // 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 @@ void FrameLoader::load(DocumentLoader* n > 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 @@ void FrameLoader::loadWithDocumentLoader > 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 @@ bool FrameLoader::willLoadMediaElementUR > 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 @@ void FrameLoader::reloadWithOverrideEnco > > 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 @@ void FrameLoader::reload(OptionSet<Reloa > 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 @@ void FrameLoader::loadPostRequest(FrameL > 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 @@ void FrameLoader::loadPostRequest(FrameL > > // 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 @@ void FrameLoader::continueLoadAfterNewWi > } > > 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 @@ void FrameLoader::loadDifferentDocumentI > documentLoader->setTriggeringAction(WTFMove(action)); > > documentLoader->setLastCheckedRequest(ResourceRequest()); >- loadWithDocumentLoader(documentLoader, loadType, { }, AllowNavigationToInvalidURL::Yes, shouldTreatAsContinuingLoad, [] { }); >+ loadWithDocumentLoader(documentLoader, loadType, { }, AllowNavigationToInvalidURL::Yes, shouldTreatAsContinuingLoad); > return; > } > >@@ -3677,7 +3677,7 @@ void FrameLoader::loadDifferentDocumentI > > 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 >Index: Source/WebCore/loader/FrameLoader.h >=================================================================== >--- Source/WebCore/loader/FrameLoader.h (revision 234932) >+++ Source/WebCore/loader/FrameLoader.h (working copy) >@@ -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 @@ private: > 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()>&&); >Index: Source/WebCore/loader/FrameLoaderClient.h >=================================================================== >--- Source/WebCore/loader/FrameLoaderClient.h (revision 234932) >+++ Source/WebCore/loader/FrameLoaderClient.h (working copy) >@@ -104,6 +104,8 @@ class URL; > class Widget; > > enum class PolicyDecisionMode; >+enum class ShouldSkipSafeBrowsingCheck; >+ > struct StringWithDirection; > > typedef WTF::Function<void (PolicyAction)> FramePolicyFunction; >@@ -191,7 +193,7 @@ public: > > 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; >Index: Source/WebCore/loader/PolicyChecker.cpp >=================================================================== >--- Source/WebCore/loader/PolicyChecker.cpp (revision 234932) >+++ Source/WebCore/loader/PolicyChecker.cpp (working copy) >@@ -98,7 +98,7 @@ CompletionHandlerCallingScope PolicyChec > }); > } > >-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 = loader->triggeringAction(); > if (action.isEmpty()) { >@@ -168,7 +168,7 @@ void PolicyChecker::checkNavigationPolic > > 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) { >Index: Source/WebCore/loader/PolicyChecker.h >=================================================================== >--- Source/WebCore/loader/PolicyChecker.h (revision 234932) >+++ Source/WebCore/loader/PolicyChecker.h (working copy) >@@ -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 @@ class PolicyChecker { > 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&&); > >Index: Source/WebCore/loader/ShouldSkipSafeBrowsingCheck.h >=================================================================== >--- Source/WebCore/loader/ShouldSkipSafeBrowsingCheck.h (nonexistent) >+++ Source/WebCore/loader/ShouldSkipSafeBrowsingCheck.h (working copy) >@@ -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 >+ >; >+}; >+ >+} >Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 234997) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,35 @@ >+2018-08-17 Alex Christensen <achristensen@webkit.org> >+ >+ Add some plumbing for safe browsing >+ https://bugs.webkit.org/show_bug.cgi?id=188709 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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 <rniwa@webkit.org> > > Replace canBubble and cancelable booleans in Event by enum classes >Index: Source/WebKit/Shared/LoadParameters.cpp >=================================================================== >--- Source/WebKit/Shared/LoadParameters.cpp (revision 234985) >+++ Source/WebKit/Shared/LoadParameters.cpp (working copy) >@@ -49,6 +49,7 @@ void LoadParameters::encode(IPC::Encoder > encoder << shouldOpenExternalURLsPolicy; > encoder << shouldTreatAsContinuingLoad; > encoder << userData; >+ encoder << forSafeBrowsing; > > platformEncode(encoder); > } >@@ -105,6 +106,9 @@ bool LoadParameters::decode(IPC::Decoder > if (!decoder.decode(data.userData)) > return false; > >+ if (!decoder.decode(data.forSafeBrowsing)) >+ return false; >+ > if (!platformDecode(decoder, data)) > return false; > >Index: Source/WebKit/Shared/LoadParameters.h >=================================================================== >--- Source/WebKit/Shared/LoadParameters.h (revision 234985) >+++ Source/WebKit/Shared/LoadParameters.h (working copy) >@@ -62,6 +62,7 @@ struct LoadParameters { > uint64_t shouldOpenExternalURLsPolicy; > bool shouldTreatAsContinuingLoad { false }; > UserData userData; >+ bool forSafeBrowsing { false }; > > #if PLATFORM(COCOA) > RetainPtr<NSDictionary> dataDetectionContext; >Index: Source/WebKit/UIProcess/SafeBrowsingResult.h >=================================================================== >--- Source/WebKit/UIProcess/SafeBrowsingResult.h (revision 234932) >+++ Source/WebKit/UIProcess/SafeBrowsingResult.h (working copy) >@@ -25,6 +25,7 @@ > > #pragma once > >+#include <WebCore/URL.h> > #include <wtf/text/WTFString.h> > > OBJC_CLASS SSBServiceLookupResult; >@@ -34,10 +35,11 @@ namespace WebKit { > 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 @@ public: > bool isKnownToBeUnsafe() const { return m_isKnownToBeUnsafe; } > > private: >+ WebCore::URL m_url; > String m_provider; > bool m_isPhishing { false }; > bool m_isMalware { false }; >Index: Source/WebKit/UIProcess/WebPageProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.cpp (revision 234985) >+++ Source/WebKit/UIProcess/WebPageProxy.cpp (working copy) >@@ -1079,7 +1079,7 @@ RefPtr<API::Navigation> WebPageProxy::lo > 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 +1110,7 @@ void WebPageProxy::loadAlternateHTML(con > 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 +3969,14 @@ void WebPageProxy::beginSafeBrowsingChec > } > #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 +4053,9 @@ void WebPageProxy::decidePolicyForNaviga > } > > 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 +4083,11 @@ void WebPageProxy::decidePolicyForNaviga > 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); >Index: Source/WebKit/UIProcess/WebPageProxy.h >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.h (revision 234985) >+++ Source/WebKit/UIProcess/WebPageProxy.h (working copy) >@@ -457,7 +457,7 @@ public: > 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 @@ private: > > 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&); >Index: Source/WebKit/UIProcess/WebPageProxy.messages.in >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.messages.in (revision 234932) >+++ Source/WebKit/UIProcess/WebPageProxy.messages.in (working copy) >@@ -106,8 +106,8 @@ messages -> WebPageProxy { > > # 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) > >Index: Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm (revision 234932) >+++ Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm (working copy) >@@ -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]) >Index: Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (revision 234932) >+++ Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (working copy) >@@ -77,8 +77,8 @@ void WebPageProxy::beginSafeBrowsingChec > 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 = url] (SSBLookupResult *result, NSError *error) mutable { >+ RunLoop::main().dispatch([listener = WTFMove(listener), result = retainPtr(result), error = retainPtr(error), url = WTFMove(url)] { > if (error) { > listener->didReceiveSafeBrowsingResults({ }); > return; >@@ -88,7 +88,7 @@ void WebPageProxy::beginSafeBrowsingChec > 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()]; >Index: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (revision 234932) >+++ Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (working copy) >@@ -813,7 +813,7 @@ void WebFrameLoaderClient::applyToDocume > 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 @@ void WebFrameLoaderClient::dispatchDecid > 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 @@ void WebFrameLoaderClient::dispatchDecid > } > > 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, { }, { }); > } > >Index: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h >=================================================================== >--- Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (revision 234932) >+++ Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (working copy) >@@ -125,7 +125,7 @@ private: > > 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; >Index: Source/WebKitLegacy/mac/ChangeLog >=================================================================== >--- Source/WebKitLegacy/mac/ChangeLog (revision 234932) >+++ Source/WebKitLegacy/mac/ChangeLog (working copy) >@@ -1,3 +1,14 @@ >+2018-08-17 Alex Christensen <achristensen@webkit.org> >+ >+ Add some plumbing for safe browsing >+ https://bugs.webkit.org/show_bug.cgi?id=188709 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebFrameLoaderClient.h: >+ * WebCoreSupport/WebFrameLoaderClient.mm: >+ (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): >+ > 2018-08-16 Aditya Keerthi <akeerthi@apple.com> > > Support drag-and-drop for input[type=color] >Index: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h >=================================================================== >--- Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h (revision 234932) >+++ Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h (working copy) >@@ -128,7 +128,7 @@ private: > > 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; >Index: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (revision 234932) >+++ Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (working copy) >@@ -901,7 +901,7 @@ void WebFrameLoaderClient::dispatchDecid > 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())); >Index: Source/WebKitLegacy/win/ChangeLog >=================================================================== >--- Source/WebKitLegacy/win/ChangeLog (revision 234932) >+++ Source/WebKitLegacy/win/ChangeLog (working copy) >@@ -1,3 +1,14 @@ >+2018-08-17 Alex Christensen <achristensen@webkit.org> >+ >+ Add some plumbing for safe browsing >+ https://bugs.webkit.org/show_bug.cgi?id=188709 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebFrameLoaderClient.cpp: >+ (WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): >+ * WebCoreSupport/WebFrameLoaderClient.h: >+ > 2018-08-02 David Fenton <david_fenton@apple.com> > > Unreviewed, rolling out r234489. >Index: Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp >=================================================================== >--- Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (revision 234932) >+++ Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp (working copy) >@@ -565,7 +565,7 @@ void WebFrameLoaderClient::dispatchDecid > 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); >Index: Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h >=================================================================== >--- Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h (revision 234932) >+++ Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h (working copy) >@@ -102,7 +102,7 @@ public: > > 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;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188709
:
347401
|
347408