Title: [270931] trunk/Source/WebCore
Revision
270931
Author
[email protected]
Date
2020-12-17 03:13:58 -0800 (Thu, 17 Dec 2020)

Log Message

Make MixedContentChecker stateless
https://bugs.webkit.org/show_bug.cgi?id=219771

Patch by Rob Buis <[email protected]> on 2020-12-17
Reviewed by Alex Christensen.

Make MixedContentChecker stateless, it only needs the frame
in a few cased which we can just pass as a parameter. Making
MixedContentChecker stateless means that FrameLoader does
not have to know it.

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
* Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
(WebCore::WorkerThreadableWebSocketChannel::Bridge::connect):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::parseAttribute):
* html/parser/XSSAuditor.cpp:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::loadRequest):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::FrameLoader):
* loader/FrameLoader.h:
* loader/MixedContentChecker.cpp:
(WebCore::logWarning):
(WebCore::MixedContentChecker::canDisplayInsecureContent):
(WebCore::MixedContentChecker::canRunInsecureContent):
(WebCore::MixedContentChecker::checkFormForMixedContent):
(WebCore::MixedContentChecker::checkForMixedContentInFrameTree):
(WebCore::MixedContentChecker::MixedContentChecker): Deleted.
(WebCore::MixedContentChecker::client const): Deleted.
(WebCore::MixedContentChecker::canDisplayInsecureContent const): Deleted.
(WebCore::MixedContentChecker::canRunInsecureContent const): Deleted.
(WebCore::MixedContentChecker::checkFormForMixedContent const): Deleted.
(WebCore::MixedContentChecker::logWarning const): Deleted.
* loader/MixedContentChecker.h:
* loader/SubframeLoader.cpp:
(WebCore::FrameLoader::SubframeLoader::pluginIsLoadable):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::checkInsecureContent const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270930 => 270931)


--- trunk/Source/WebCore/ChangeLog	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/ChangeLog	2020-12-17 11:13:58 UTC (rev 270931)
@@ -1,3 +1,47 @@
+2020-12-17  Rob Buis  <[email protected]>
+
+        Make MixedContentChecker stateless
+        https://bugs.webkit.org/show_bug.cgi?id=219771
+
+        Reviewed by Alex Christensen.
+
+        Make MixedContentChecker stateless, it only needs the frame
+        in a few cased which we can just pass as a parameter. Making
+        MixedContentChecker stateless means that FrameLoader does
+        not have to know it.
+
+        * Modules/websockets/WebSocket.cpp:
+        (WebCore::WebSocket::connect):
+        * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
+        (WebCore::WorkerThreadableWebSocketChannel::Bridge::connect):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::parseAttribute):
+        * html/parser/XSSAuditor.cpp:
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::willSendRequest):
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::loadRequest):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::FrameLoader):
+        * loader/FrameLoader.h:
+        * loader/MixedContentChecker.cpp:
+        (WebCore::logWarning):
+        (WebCore::MixedContentChecker::canDisplayInsecureContent):
+        (WebCore::MixedContentChecker::canRunInsecureContent):
+        (WebCore::MixedContentChecker::checkFormForMixedContent):
+        (WebCore::MixedContentChecker::checkForMixedContentInFrameTree):
+        (WebCore::MixedContentChecker::MixedContentChecker): Deleted.
+        (WebCore::MixedContentChecker::client const): Deleted.
+        (WebCore::MixedContentChecker::canDisplayInsecureContent const): Deleted.
+        (WebCore::MixedContentChecker::canRunInsecureContent const): Deleted.
+        (WebCore::MixedContentChecker::checkFormForMixedContent const): Deleted.
+        (WebCore::MixedContentChecker::logWarning const): Deleted.
+        * loader/MixedContentChecker.h:
+        * loader/SubframeLoader.cpp:
+        (WebCore::FrameLoader::SubframeLoader::pluginIsLoadable):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::checkInsecureContent const):
+
 2020-12-16  Chris Dumez  <[email protected]>
 
         Flaky crash under AudioBuffer::channelData() when running layout tests

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.cpp (270930 => 270931)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -45,6 +45,7 @@
 #include "FrameLoaderClient.h"
 #include "Logging.h"
 #include "MessageEvent.h"
+#include "MixedContentChecker.h"
 #include "ResourceLoadObserver.h"
 #include "ScriptController.h"
 #include "ScriptExecutionContext.h"
@@ -310,7 +311,7 @@
         Document& document = downcast<Document>(context);
         RefPtr<Frame> frame = document.frame();
         // FIXME: make the mixed content check equivalent to the non-document mixed content check currently in WorkerThreadableWebSocketChannel::Bridge::connect()
-        if (!frame || !frame->loader().mixedContentChecker().canRunInsecureContent(document.securityOrigin(), m_url)) {
+        if (!frame || !MixedContentChecker::canRunInsecureContent(*frame, document.securityOrigin(), m_url)) {
             failAsynchronously();
             return { };
         }

Modified: trunk/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp (270930 => 270931)


--- trunk/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -34,7 +34,7 @@
 #include "Blob.h"
 #include "Document.h"
 #include "Frame.h"
-#include "FrameLoader.h"
+#include "MixedContentChecker.h"
 #include "ScriptExecutionContext.h"
 #include "SocketProvider.h"
 #include "ThreadableWebSocketChannelClientWrapper.h"
@@ -410,8 +410,8 @@
         auto& document = downcast<Document>(context);
         
         // FIXME: make this mixed content check equivalent to the document mixed content check currently in WebSocket::connect()
-        if (document.frame()) {
-            Optional<String> errorString = document.frame()->loader().mixedContentChecker().checkForMixedContentInFrameTree(url);
+        if (auto* frame = document.frame()) {
+            Optional<String> errorString = MixedContentChecker::checkForMixedContentInFrameTree(*frame, url);
             if (errorString) {
                 peer->fail(errorString.value());
                 return;

Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (270930 => 270931)


--- trunk/Source/WebCore/html/HTMLFormElement.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -44,6 +44,7 @@
 #include "HTMLObjectElement.h"
 #include "HTMLParserIdioms.h"
 #include "HTMLTableElement.h"
+#include "MixedContentChecker.h"
 #include "NodeRareData.h"
 #include "Page.h"
 #include "RadioNodeList.h"
@@ -447,7 +448,7 @@
         if (!m_attributes.action().isEmpty()) {
             if (RefPtr<Frame> f = document().frame()) {
                 Frame& topFrame = f->tree().top();
-                topFrame.loader().mixedContentChecker().checkFormForMixedContent(topFrame.document()->securityOrigin(), document().completeURL(m_attributes.action()));
+                MixedContentChecker::checkFormForMixedContent(topFrame, topFrame.document()->securityOrigin(), document().completeURL(m_attributes.action()));
             }
         }
     } else if (name == targetAttr)

Modified: trunk/Source/WebCore/html/parser/XSSAuditor.cpp (270930 => 270931)


--- trunk/Source/WebCore/html/parser/XSSAuditor.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/html/parser/XSSAuditor.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -38,6 +38,7 @@
 #include "HTMLNames.h"
 #include "HTMLParamElement.h"
 #include "HTMLParserIdioms.h"
+#include "MixedContentChecker.h"
 #include "SVGNames.h"
 #include "Settings.h"
 #include "TextResourceDecoder.h"

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (270930 => 270931)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -67,6 +67,7 @@
 #include "LoaderStrategy.h"
 #include "Logging.h"
 #include "MemoryCache.h"
+#include "MixedContentChecker.h"
 #include "NavigationScheduler.h"
 #include "NetworkLoadMetrics.h"
 #include "NetworkStorageSession.h"
@@ -660,11 +661,11 @@
         newRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadIgnoringCacheData);
 
     if (&topFrame != m_frame) {
-        if (!m_frame->loader().mixedContentChecker().canDisplayInsecureContent(m_frame->document()->securityOrigin(), MixedContentChecker::ContentType::Active, newRequest.url(), MixedContentChecker::AlwaysDisplayInNonStrictMode::Yes)) {
+        if (!MixedContentChecker::canDisplayInsecureContent(*m_frame, m_frame->document()->securityOrigin(), MixedContentChecker::ContentType::Active, newRequest.url(), MixedContentChecker::AlwaysDisplayInNonStrictMode::Yes)) {
             cancelMainResourceLoad(frameLoader()->cancelledError(newRequest));
             return completionHandler(WTFMove(newRequest));
         }
-        if (!frameLoader()->mixedContentChecker().canDisplayInsecureContent(topFrame.document()->securityOrigin(), MixedContentChecker::ContentType::Active, newRequest.url())) {
+        if (!MixedContentChecker::canDisplayInsecureContent(*m_frame, topFrame.document()->securityOrigin(), MixedContentChecker::ContentType::Active, newRequest.url())) {
             cancelMainResourceLoad(frameLoader()->cancelledError(newRequest));
             return completionHandler(WTFMove(newRequest));
         }

Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (270930 => 270931)


--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -41,11 +41,11 @@
 #include "DOMWindow.h"
 #include "Document.h"
 #include "Frame.h"
-#include "FrameLoader.h"
 #include "InspectorInstrumentation.h"
 #include "LegacySchemeRegistry.h"
 #include "LoadTiming.h"
 #include "LoaderStrategy.h"
+#include "MixedContentChecker.h"
 #include "Performance.h"
 #include "PlatformStrategies.h"
 #include "ProgressTracker.h"
@@ -590,10 +590,10 @@
     ResourceError error;
     ResourceResponse response;
     unsigned long identifier = std::numeric_limits<unsigned long>::max();
-    if (m_document.frame()) {
-        auto& frameLoader = m_document.frame()->loader();
-        if (!frameLoader.mixedContentChecker().canRunInsecureContent(m_document.securityOrigin(), requestURL))
+    if (auto* frame = m_document.frame()) {
+        if (!MixedContentChecker::canRunInsecureContent(*frame, m_document.securityOrigin(), requestURL))
             return;
+        auto& frameLoader = frame->loader();
         identifier = frameLoader.loadResourceSynchronously(request, m_options.clientCredentialPolicy, m_options, *m_originalHeaders, error, response, data);
     }
 

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (270930 => 270931)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -297,7 +297,6 @@
     , m_history(makeUnique<HistoryController>(frame))
     , m_notifier(frame)
     , m_subframeLoader(makeUnique<SubframeLoader>(frame))
-    , m_mixedContentChecker(frame)
     , m_state(FrameStateProvisional)
     , m_loadType(FrameLoadType::Standard)
     , m_quickRedirectComing(false)

Modified: trunk/Source/WebCore/loader/FrameLoader.h (270930 => 270931)


--- trunk/Source/WebCore/loader/FrameLoader.h	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2020-12-17 11:13:58 UTC (rev 270931)
@@ -35,7 +35,6 @@
 #include "FrameLoaderStateMachine.h"
 #include "FrameLoaderTypes.h"
 #include "LayoutMilestone.h"
-#include "MixedContentChecker.h"
 #include "PageIdentifier.h"
 #include "PrivateClickMeasurement.h"
 #include "ReferrerPolicy.h"
@@ -117,7 +116,6 @@
     class SubframeLoader;
     SubframeLoader& subframeLoader() { return *m_subframeLoader; }
     const SubframeLoader& subframeLoader() const { return *m_subframeLoader; }
-    MixedContentChecker& mixedContentChecker() const { return m_mixedContentChecker; }
 
     void setupForReplace();
 
@@ -436,7 +434,6 @@
     mutable ResourceLoadNotifier m_notifier;
     const std::unique_ptr<SubframeLoader> m_subframeLoader;
     mutable FrameLoaderStateMachine m_stateMachine;
-    mutable MixedContentChecker m_mixedContentChecker;
 
     class FrameProgressTracker;
     std::unique_ptr<FrameProgressTracker> m_progressTracker;

Modified: trunk/Source/WebCore/loader/MixedContentChecker.cpp (270930 => 270931)


--- trunk/Source/WebCore/loader/MixedContentChecker.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/loader/MixedContentChecker.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -42,16 +42,6 @@
 
 namespace WebCore {
 
-MixedContentChecker::MixedContentChecker(Frame& frame)
-    : m_frame(frame)
-{
-}
-
-FrameLoaderClient& MixedContentChecker::client() const
-{
-    return m_frame.loader().client();
-}
-
 // static
 bool MixedContentChecker::isMixedContent(SecurityOrigin& securityOrigin, const URL& url)
 {
@@ -62,49 +52,56 @@
     return !SecurityOrigin::isSecure(url);
 }
 
-bool MixedContentChecker::canDisplayInsecureContent(SecurityOrigin& securityOrigin, ContentType type, const URL& url, AlwaysDisplayInNonStrictMode alwaysDisplayInNonStrictMode) const
+static void logWarning(const Frame& frame, bool allowed, const String& action, const URL& target)
 {
+    const char* errorString = allowed ? " was allowed to " : " was not allowed to ";
+    String message = makeString((allowed ? String() : "[blocked] "), "The page at ", frame.document()->url().stringCenterEllipsizedToLength(), errorString, action, " insecure content from ", target.stringCenterEllipsizedToLength(), ".\n");
+    frame.document()->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, message);
+}
+
+bool MixedContentChecker::canDisplayInsecureContent(Frame& frame, SecurityOrigin& securityOrigin, ContentType type, const URL& url, AlwaysDisplayInNonStrictMode alwaysDisplayInNonStrictMode)
+{
     if (!isMixedContent(securityOrigin, url))
         return true;
 
-    if (!m_frame.document()->contentSecurityPolicy()->allowRunningOrDisplayingInsecureContent(url))
+    if (!frame.document()->contentSecurityPolicy()->allowRunningOrDisplayingInsecureContent(url))
         return false;
 
-    bool isStrictMode = m_frame.document()->isStrictMixedContentMode();
+    bool isStrictMode = frame.document()->isStrictMixedContentMode();
     if (!isStrictMode && alwaysDisplayInNonStrictMode == AlwaysDisplayInNonStrictMode::Yes)
         return true;
 
-    bool allowed = !isStrictMode && (m_frame.settings().allowDisplayOfInsecureContent() || type == ContentType::ActiveCanWarn) && !m_frame.document()->geolocationAccessed();
-    logWarning(allowed, "display", url);
+    bool allowed = !isStrictMode && (frame.settings().allowDisplayOfInsecureContent() || type == ContentType::ActiveCanWarn) && !frame.document()->geolocationAccessed();
+    logWarning(frame, allowed, "display", url);
 
     if (allowed) {
-        m_frame.document()->setFoundMixedContent(SecurityContext::MixedContentType::Inactive);
-        client().didDisplayInsecureContent();
+        frame.document()->setFoundMixedContent(SecurityContext::MixedContentType::Inactive);
+        frame.loader().client().didDisplayInsecureContent();
     }
 
     return allowed;
 }
 
-bool MixedContentChecker::canRunInsecureContent(SecurityOrigin& securityOrigin, const URL& url) const
+bool MixedContentChecker::canRunInsecureContent(Frame& frame, SecurityOrigin& securityOrigin, const URL& url)
 {
     if (!isMixedContent(securityOrigin, url))
         return true;
 
-    if (!m_frame.document()->contentSecurityPolicy()->allowRunningOrDisplayingInsecureContent(url))
+    if (!frame.document()->contentSecurityPolicy()->allowRunningOrDisplayingInsecureContent(url))
         return false;
 
-    bool allowed = !m_frame.document()->isStrictMixedContentMode() && m_frame.settings().allowRunningOfInsecureContent() && !m_frame.document()->geolocationAccessed() && !m_frame.document()->secureCookiesAccessed();
-    logWarning(allowed, "run", url);
+    bool allowed = !frame.document()->isStrictMixedContentMode() && frame.settings().allowRunningOfInsecureContent() && !frame.document()->geolocationAccessed() && !frame.document()->secureCookiesAccessed();
+    logWarning(frame, allowed, "run", url);
 
     if (allowed) {
-        m_frame.document()->setFoundMixedContent(SecurityContext::MixedContentType::Active);
-        client().didRunInsecureContent(securityOrigin, url);
+        frame.document()->setFoundMixedContent(SecurityContext::MixedContentType::Active);
+        frame.loader().client().didRunInsecureContent(securityOrigin, url);
     }
 
     return allowed;
 }
 
-void MixedContentChecker::checkFormForMixedContent(SecurityOrigin& securityOrigin, const URL& url) const
+void MixedContentChecker::checkFormForMixedContent(Frame& frame, SecurityOrigin& securityOrigin, const URL& url)
 {
     // Unconditionally allow _javascript_: URLs as form actions as some pages do this and it does not introduce
     // a mixed content issue.
@@ -114,15 +111,15 @@
     if (!isMixedContent(securityOrigin, url))
         return;
 
-    String message = makeString("The page at ", m_frame.document()->url().stringCenterEllipsizedToLength(), " contains a form which targets an insecure URL ", url.stringCenterEllipsizedToLength(), ".\n");
-    m_frame.document()->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, message);
+    String message = makeString("The page at ", frame.document()->url().stringCenterEllipsizedToLength(), " contains a form which targets an insecure URL ", url.stringCenterEllipsizedToLength(), ".\n");
+    frame.document()->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, message);
 
-    client().didDisplayInsecureContent();
+    frame.loader().client().didDisplayInsecureContent();
 }
 
-Optional<String> MixedContentChecker::checkForMixedContentInFrameTree(const URL& url)
+Optional<String> MixedContentChecker::checkForMixedContentInFrameTree(const Frame& frame, const URL& url)
 {
-    auto* document = m_frame.document();
+    auto* document = frame.document();
 
     while (document) {
         RELEASE_ASSERT_WITH_MESSAGE(document->frame(), "An unparented document tried to connect to a websocket with url: %s", url.string().utf8().data());
@@ -142,11 +139,4 @@
     return WTF::nullopt;
 }
 
-void MixedContentChecker::logWarning(bool allowed, const String& action, const URL& target) const
-{
-    const char* errorString = allowed ? " was allowed to " : " was not allowed to ";
-    String message = makeString((allowed ? String() : "[blocked] "), "The page at ", m_frame.document()->url().stringCenterEllipsizedToLength(), errorString, action, " insecure content from ", target.stringCenterEllipsizedToLength(), ".\n");
-    m_frame.document()->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, message);
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/loader/MixedContentChecker.h (270930 => 270931)


--- trunk/Source/WebCore/loader/MixedContentChecker.h	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/loader/MixedContentChecker.h	2020-12-17 11:13:58 UTC (rev 270931)
@@ -47,26 +47,17 @@
         ActiveCanWarn,
     };
 
-    MixedContentChecker(Frame&);
-
     enum class AlwaysDisplayInNonStrictMode {
         No,
         Yes,
     };
 
-    bool canDisplayInsecureContent(SecurityOrigin&, ContentType, const URL&, AlwaysDisplayInNonStrictMode = AlwaysDisplayInNonStrictMode::No) const;
-    bool canRunInsecureContent(SecurityOrigin&, const URL&) const;
-    void checkFormForMixedContent(SecurityOrigin&, const URL&) const;
+    // FIXME: This should probably have a separate client from FrameLoader.
+    static bool canDisplayInsecureContent(Frame&, SecurityOrigin&, ContentType, const URL&, AlwaysDisplayInNonStrictMode = AlwaysDisplayInNonStrictMode::No);
+    static bool canRunInsecureContent(Frame&, SecurityOrigin&, const URL&);
+    static void checkFormForMixedContent(Frame&, SecurityOrigin&, const URL&);
     static bool isMixedContent(SecurityOrigin&, const URL&);
-    Optional<String> checkForMixedContentInFrameTree(const URL&);
-
-private:
-    // FIXME: This should probably have a separate client from FrameLoader.
-    FrameLoaderClient& client() const;
-
-    void logWarning(bool allowed, const String& action, const URL&) const;
-
-    Frame& m_frame;
+    static Optional<String> checkForMixedContentInFrameTree(const Frame&, const URL&);
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (270930 => 270931)


--- trunk/Source/WebCore/loader/SubframeLoader.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -38,7 +38,6 @@
 #include "DiagnosticLoggingKeys.h"
 #include "DocumentLoader.h"
 #include "Frame.h"
-#include "FrameLoader.h"
 #include "FrameLoaderClient.h"
 #include "HTMLFrameElement.h"
 #include "HTMLIFrameElement.h"
@@ -45,6 +44,7 @@
 #include "HTMLNames.h"
 #include "HTMLObjectElement.h"
 #include "MIMETypeRegistry.h"
+#include "MixedContentChecker.h"
 #include "NavigationScheduler.h"
 #include "Page.h"
 #include "PluginData.h"
@@ -140,7 +140,7 @@
             return false;
         }
 
-        if (!m_frame.loader().mixedContentChecker().canRunInsecureContent(document->securityOrigin(), url))
+        if (!MixedContentChecker::canRunInsecureContent(m_frame, document->securityOrigin(), url))
             return false;
     }
 

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (270930 => 270931)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2020-12-17 09:41:30 UTC (rev 270930)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2020-12-17 11:13:58 UTC (rev 270931)
@@ -63,6 +63,7 @@
 #include "LocalizedStrings.h"
 #include "Logging.h"
 #include "MemoryCache.h"
+#include "MixedContentChecker.h"
 #include "Page.h"
 #include "PingLoader.h"
 #include "PlatformStrategies.h"
@@ -420,10 +421,10 @@
         // These resource can inject script into the current document (Script,
         // XSL) or exfiltrate the content of the current document (CSS).
         if (Frame* frame = this->frame()) {
-            if (!frame->loader().mixedContentChecker().canRunInsecureContent(m_document->securityOrigin(), url))
+            if (!MixedContentChecker::canRunInsecureContent(*frame, m_document->securityOrigin(), url))
                 return false;
             Frame& top = frame->tree().top();
-            if (&top != frame && !top.loader().mixedContentChecker().canRunInsecureContent(top.document()->securityOrigin(), url))
+            if (&top != frame && !MixedContentChecker::canRunInsecureContent(top, top.document()->securityOrigin(), url))
                 return false;
         }
         break;
@@ -438,10 +439,10 @@
     case CachedResource::Type::FontResource: {
         // These resources can corrupt only the frame's pixels.
         if (Frame* frame = this->frame()) {
-            if (!frame->loader().mixedContentChecker().canDisplayInsecureContent(m_document->securityOrigin(), contentTypeFromResourceType(type), url, MixedContentChecker::AlwaysDisplayInNonStrictMode::Yes))
+            if (!MixedContentChecker::canDisplayInsecureContent(*frame, m_document->securityOrigin(), contentTypeFromResourceType(type), url, MixedContentChecker::AlwaysDisplayInNonStrictMode::Yes))
                 return false;
             Frame& topFrame = frame->tree().top();
-            if (!topFrame.loader().mixedContentChecker().canDisplayInsecureContent(topFrame.document()->securityOrigin(), contentTypeFromResourceType(type), url))
+            if (!MixedContentChecker::canDisplayInsecureContent(topFrame, topFrame.document()->securityOrigin(), contentTypeFromResourceType(type), url))
                 return false;
         }
         break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to