Diff
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog (221347 => 221348)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog 2017-08-30 07:58:49 UTC (rev 221347)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/ChangeLog 2017-08-30 08:22:54 UTC (rev 221348)
@@ -1,3 +1,31 @@
+2017-08-23 Alex Christensen <achristen...@webkit.org>
+
+ Stop using PolicyChecker for ContentPolicy
+ https://bugs.webkit.org/show_bug.cgi?id=175904
+
+ Reviewed by Tim Horton.
+
+ PolicyChecker is an artifact from the days before C++11. Now we have lambdas which
+ have a cleaner flow than one class that exists to be effectively one of three lambda types.
+ Let's remove them one at a time, starting with ContentPolicy checks.
+
+ No change in behaviour.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::responseReceived):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::checkContentPolicy):
+ * loader/FrameLoader.h:
+ * loader/PolicyCallback.cpp:
+ (WebCore::PolicyCallback::set):
+ (WebCore::PolicyCallback::call):
+ (WebCore::PolicyCallback::cancel):
+ * loader/PolicyCallback.h:
+ * loader/PolicyChecker.cpp:
+ (WebCore::PolicyChecker::checkContentPolicy): Deleted.
+ (WebCore::PolicyChecker::continueAfterContentPolicy): Deleted.
+ * loader/PolicyChecker.h:
+
2017-08-22 Zan Dobersek <zdober...@igalia.com>
GLContext: zero-initialize the GLContext pointer in ThreadGlobalGLContext
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/DocumentLoader.cpp (221347 => 221348)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/DocumentLoader.cpp 2017-08-30 07:58:49 UTC (rev 221347)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/DocumentLoader.cpp 2017-08-30 08:22:54 UTC (rev 221348)
@@ -704,7 +704,7 @@
}
#endif
- frameLoader()->policyChecker().checkContentPolicy(m_response, [this](PolicyAction policy) {
+ frameLoader()->checkContentPolicy(m_response, [this](PolicyAction policy) {
continueAfterContentPolicy(policy);
});
}
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.cpp (221347 => 221348)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.cpp 2017-08-30 07:58:49 UTC (rev 221347)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.cpp 2017-08-30 08:22:54 UTC (rev 221348)
@@ -355,6 +355,11 @@
}
}
+void FrameLoader::checkContentPolicy(const ResourceResponse& response, ContentPolicyDecisionFunction&& function)
+{
+ client().dispatchDecidePolicyForResponse(response, activeDocumentLoader()->request(), WTFMove(function));
+}
+
void FrameLoader::changeLocation(FrameLoadRequest&& request)
{
urlSelected(WTFMove(request), nullptr);
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.h (221347 => 221348)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.h 2017-08-30 07:58:49 UTC (rev 221347)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/FrameLoader.h 2017-08-30 08:22:54 UTC (rev 221348)
@@ -83,6 +83,8 @@
WEBCORE_EXPORT bool isBackForwardLoadType(FrameLoadType);
WEBCORE_EXPORT bool isReload(FrameLoadType);
+using ContentPolicyDecisionFunction = WTF::Function<void(PolicyAction)>;
+
class FrameLoader {
WTF_MAKE_NONCOPYABLE(FrameLoader);
public:
@@ -207,6 +209,8 @@
void setDefersLoading(bool);
+ void checkContentPolicy(const ResourceResponse&, ContentPolicyDecisionFunction&&);
+
void didExplicitOpen();
// Callbacks from DocumentWriter
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyCallback.cpp (221347 => 221348)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyCallback.cpp 2017-08-30 07:58:49 UTC (rev 221347)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyCallback.cpp 2017-08-30 08:22:54 UTC (rev 221348)
@@ -46,7 +46,6 @@
m_navigationFunction = WTFMove(function);
m_newWindowFunction = nullptr;
- m_contentFunction = nullptr;
}
void PolicyCallback::set(const ResourceRequest& request, FormState* formState, const String& frameName, const NavigationAction& navigationAction, NewWindowPolicyDecisionFunction&& function)
@@ -58,20 +57,8 @@
m_navigationFunction = nullptr;
m_newWindowFunction = WTFMove(function);
- m_contentFunction = nullptr;
}
-void PolicyCallback::set(ContentPolicyDecisionFunction&& function)
-{
- m_request = ResourceRequest();
- m_formState = nullptr;
- m_frameName = String();
-
- m_navigationFunction = nullptr;
- m_newWindowFunction = nullptr;
- m_contentFunction = WTFMove(function);
-}
-
void PolicyCallback::call(bool shouldContinue)
{
if (m_navigationFunction)
@@ -78,17 +65,8 @@
m_navigationFunction(m_request, m_formState.get(), shouldContinue);
if (m_newWindowFunction)
m_newWindowFunction(m_request, m_formState.get(), m_frameName, m_navigationAction, shouldContinue);
- ASSERT(!m_contentFunction);
}
-void PolicyCallback::call(PolicyAction action)
-{
- ASSERT(!m_navigationFunction);
- ASSERT(!m_newWindowFunction);
- ASSERT(m_contentFunction);
- m_contentFunction(action);
-}
-
void PolicyCallback::clearRequest()
{
m_request = ResourceRequest();
@@ -103,8 +81,6 @@
m_navigationFunction(m_request, m_formState.get(), false);
if (m_newWindowFunction)
m_newWindowFunction(m_request, m_formState.get(), m_frameName, m_navigationAction, false);
- if (m_contentFunction)
- m_contentFunction(PolicyIgnore);
}
} // namespace WebCore
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyCallback.h (221347 => 221348)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyCallback.h 2017-08-30 07:58:49 UTC (rev 221347)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyCallback.h 2017-08-30 08:22:54 UTC (rev 221348)
@@ -41,7 +41,6 @@
class FormState;
-using ContentPolicyDecisionFunction = Function<void(PolicyAction)>;
using NavigationPolicyDecisionFunction = Function<void(const ResourceRequest&, FormState*, bool shouldContinue)>;
using NewWindowPolicyDecisionFunction = Function<void(const ResourceRequest&, FormState*, const String& frameName, const NavigationAction&, bool shouldContinue)>;
@@ -49,13 +48,11 @@
public:
void set(const ResourceRequest&, FormState*, NavigationPolicyDecisionFunction&&);
void set(const ResourceRequest&, FormState*, const String& frameName, const NavigationAction&, NewWindowPolicyDecisionFunction&&);
- void set(ContentPolicyDecisionFunction&&);
const ResourceRequest& request() const { return m_request; }
void clearRequest();
void call(bool shouldContinue);
- void call(PolicyAction);
void cancel();
private:
@@ -66,7 +63,6 @@
NavigationPolicyDecisionFunction m_navigationFunction;
NewWindowPolicyDecisionFunction m_newWindowFunction;
- ContentPolicyDecisionFunction m_contentFunction;
};
} // namespace WebCore
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.cpp (221347 => 221348)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.cpp 2017-08-30 07:58:49 UTC (rev 221347)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.cpp 2017-08-30 08:22:54 UTC (rev 221348)
@@ -167,14 +167,6 @@
});
}
-void PolicyChecker::checkContentPolicy(const ResourceResponse& response, ContentPolicyDecisionFunction function)
-{
- m_callback.set(WTFMove(function));
- m_frame.loader().client().dispatchDecidePolicyForResponse(response, m_frame.loader().activeDocumentLoader()->request(), [this](PolicyAction action) {
- continueAfterContentPolicy(action);
- });
-}
-
void PolicyChecker::cancelCheck()
{
m_frame.loader().client().cancelPolicyCheck();
@@ -251,12 +243,6 @@
callback.call(policy == PolicyUse);
}
-void PolicyChecker::continueAfterContentPolicy(PolicyAction policy)
-{
- PolicyCallback callback = WTFMove(m_callback);
- callback.call(policy);
-}
-
void PolicyChecker::handleUnimplementablePolicy(const ResourceError& error)
{
m_delegateIsHandlingUnimplementablePolicy = true;
Modified: releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.h (221347 => 221348)
--- releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.h 2017-08-30 07:58:49 UTC (rev 221347)
+++ releases/WebKitGTK/webkit-2.18/Source/WebCore/loader/PolicyChecker.h 2017-08-30 08:22:54 UTC (rev 221348)
@@ -56,7 +56,6 @@
void checkNavigationPolicy(const ResourceRequest&, bool didReceiveRedirectResponse, DocumentLoader*, FormState*, NavigationPolicyDecisionFunction);
void checkNavigationPolicy(const ResourceRequest&, bool didReceiveRedirectResponse, NavigationPolicyDecisionFunction);
void checkNewWindowPolicy(const NavigationAction&, const ResourceRequest&, FormState*, const String& frameName, NewWindowPolicyDecisionFunction);
- void checkContentPolicy(const ResourceResponse&, ContentPolicyDecisionFunction);
// FIXME: These are different. They could use better names.
void cancelCheck();
@@ -86,7 +85,6 @@
private:
void continueAfterNavigationPolicy(PolicyAction);
void continueAfterNewWindowPolicy(PolicyAction);
- void continueAfterContentPolicy(PolicyAction);
void handleUnimplementablePolicy(const ResourceError&);