- Revision
- 260985
- Author
- commit-qu...@webkit.org
- Date
- 2020-04-30 23:50:54 -0700 (Thu, 30 Apr 2020)
Log Message
Inline reportBlockedPortFailed and reportAuthenticationChallengeBlocked
https://bugs.webkit.org/show_bug.cgi?id=211250
Patch by Rob Buis <rb...@igalia.com> on 2020-04-30
Reviewed by Alex Christensen.
These two static methods have only one caller each, so we can just
inline them at the call site since there is nothing tying them to FrameLoader.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::reportBlockedPortFailed): Deleted.
(WebCore::FrameLoader::reportAuthenticationChallengeBlocked): Deleted.
* loader/FrameLoader.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didBlockAuthenticationChallenge):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (260984 => 260985)
--- trunk/Source/WebCore/ChangeLog 2020-05-01 05:38:06 UTC (rev 260984)
+++ trunk/Source/WebCore/ChangeLog 2020-05-01 06:50:54 UTC (rev 260985)
@@ -1,3 +1,22 @@
+2020-04-30 Rob Buis <rb...@igalia.com>
+
+ Inline reportBlockedPortFailed and reportAuthenticationChallengeBlocked
+ https://bugs.webkit.org/show_bug.cgi?id=211250
+
+ Reviewed by Alex Christensen.
+
+ These two static methods have only one caller each, so we can just
+ inline them at the call site since there is nothing tying them to FrameLoader.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::willSendRequest):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::reportBlockedPortFailed): Deleted.
+ (WebCore::FrameLoader::reportAuthenticationChallengeBlocked): Deleted.
+ * loader/FrameLoader.h:
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::didBlockAuthenticationChallenge):
+
2020-04-30 Ross Kirsling <ross.kirsl...@sony.com>
TriState should be an enum class and use "Indeterminate" instead of "Mixed"
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (260984 => 260985)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2020-05-01 05:38:06 UTC (rev 260984)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2020-05-01 06:50:54 UTC (rev 260985)
@@ -610,7 +610,8 @@
}
if (!portAllowed(newRequest.url())) {
RELEASE_LOG_IF_ALLOWED("willSendRequest: canceling - port not allowed");
- FrameLoader::reportBlockedPortFailed(m_frame, newRequest.url().string());
+ if (m_frame)
+ m_frame->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Not allowed to use restricted network port: " + newRequest.url().string());
cancelMainResourceLoad(frameLoader()->blockedError(newRequest));
return completionHandler(WTFMove(newRequest));
}
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (260984 => 260985)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2020-05-01 05:38:06 UTC (rev 260984)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2020-05-01 06:50:54 UTC (rev 260985)
@@ -1668,23 +1668,6 @@
frame->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Not allowed to load local resource: " + url);
}
-void FrameLoader::reportBlockedPortFailed(Frame* frame, const String& url)
-{
- ASSERT(!url.isEmpty());
- if (!frame)
- return;
-
- frame->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Not allowed to use restricted network port: " + url);
-}
-
-void FrameLoader::reportAuthenticationChallengeBlocked(Frame* frame, const URL& url, const String& reason)
-{
- if (!frame)
- return;
-
- frame->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, makeString("Blocked ", url.stringCenterEllipsizedToLength(), " from asking for credentials because ", reason, '.'));
-}
-
const ResourceRequest& FrameLoader::initialRequest() const
{
return activeDocumentLoader()->originalRequest();
Modified: trunk/Source/WebCore/loader/FrameLoader.h (260984 => 260985)
--- trunk/Source/WebCore/loader/FrameLoader.h 2020-05-01 05:38:06 UTC (rev 260984)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2020-05-01 06:50:54 UTC (rev 260985)
@@ -143,8 +143,6 @@
void retryAfterFailedCacheOnlyMainResourceLoad();
static void reportLocalLoadFailed(Frame*, const String& url);
- static void reportBlockedPortFailed(Frame*, const String& url);
- static void reportAuthenticationChallengeBlocked(Frame*, const URL&, const String& reason);
// FIXME: These are all functions which stop loads. We have too many.
void stopAllLoadersAndCheckCompleteness();
Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (260984 => 260985)
--- trunk/Source/WebCore/loader/ResourceLoader.cpp 2020-05-01 05:38:06 UTC (rev 260984)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp 2020-05-01 06:50:54 UTC (rev 260985)
@@ -489,7 +489,9 @@
if (m_options.clientCredentialPolicy == ClientCredentialPolicy::CannotAskClientForCredentials)
return;
ASSERT(!shouldAllowResourceToAskForCredentials());
- FrameLoader::reportAuthenticationChallengeBlocked(m_frame.get(), m_request.url(), "it is a cross-origin request"_s);
+ if (!m_frame)
+ return;
+ m_frame->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, makeString("Blocked ", m_request.url().stringCenterEllipsizedToLength(), " from asking for credentials because it is a cross-origin request."));
}
void ResourceLoader::didReceiveResponse(const ResourceResponse& r, CompletionHandler<void()>&& policyCompletionHandler)