Title: [206006] trunk/Source
Revision
206006
Author
[email protected]
Date
2016-09-15 17:27:11 -0700 (Thu, 15 Sep 2016)

Log Message

WKWebView.hasOnlySecureContent always returns "YES" after going back to a CachedPage (even if it has http resources).
<rdar://problem/27681261> and https://bugs.webkit.org/show_bug.cgi?id=162043

Reviewed by Brent Fulgham.

Source/WebCore:

No new tests (Not possible with current testing infrastructure).

This adds the infrastructure for WebCore to track whether or not a CachedFrame had insecure content at the time
it was cached, and then to report that back to the client when a CachedPage is restored.

Since "has insecure content" is currently only tracked in the WK2 UI process, that is the only client of this code.

* history/CachedFrame.cpp:
(WebCore::CachedFrame::setHasInsecureContent):
* history/CachedFrame.h:
(WebCore::CachedFrame::hasInsecureContent):

* loader/EmptyClients.h:

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::receivedFirstData):
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::dispatchDidCommitLoad):
* loader/FrameLoader.h:

* loader/FrameLoaderClient.h:

* loader/FrameLoaderTypes.h:

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidCommitLoad):

Source/WebKit/win:

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchDidCommitLoad):
* WebCoreSupport/WebFrameLoaderClient.h:

Source/WebKit2:

* Scripts/webkit/messages.py:
(headers_for_type): Add a custom header, and alphabetize existing ones.

* Shared/WebCoreArgumentCoders.h: Add EnumTraits for HasInsecureContent.

* UIProcess/PageLoadState.h:
(WebKit::PageLoadState::committedHasInsecureContent):

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::hasInsecureContent):
(WebKit::WebPageProxy::didCommitLoadForFrame): If the WebProcess included an existing "HasInsecureContent" value, use it.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
(WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame): Save the "HasInsecureContent" value to the CachedFrame in
  case we restore it in the future.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206005 => 206006)


--- trunk/Source/WebCore/ChangeLog	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebCore/ChangeLog	2016-09-16 00:27:11 UTC (rev 206006)
@@ -1,3 +1,34 @@
+2016-09-15  Brady Eidson  <[email protected]>
+
+        WKWebView.hasOnlySecureContent always returns "YES" after going back to a CachedPage (even if it has http resources).
+        <rdar://problem/27681261> and https://bugs.webkit.org/show_bug.cgi?id=162043
+
+        Reviewed by Brent Fulgham. 
+
+        No new tests (Not possible with current testing infrastructure).
+
+        This adds the infrastructure for WebCore to track whether or not a CachedFrame had insecure content at the time
+        it was cached, and then to report that back to the client when a CachedPage is restored.
+
+        Since "has insecure content" is currently only tracked in the WK2 UI process, that is the only client of this code.
+
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrame::setHasInsecureContent):
+        * history/CachedFrame.h:
+        (WebCore::CachedFrame::hasInsecureContent):
+
+        * loader/EmptyClients.h:
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::receivedFirstData):
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        (WebCore::FrameLoader::dispatchDidCommitLoad):
+        * loader/FrameLoader.h:
+
+        * loader/FrameLoaderClient.h:
+
+        * loader/FrameLoaderTypes.h:
+
 2016-09-13  Jer Noble  <[email protected]>
 
         [media-source] web-platform-test/media-source/mediasource-remove.html test failing

Modified: trunk/Source/WebCore/history/CachedFrame.cpp (206005 => 206006)


--- trunk/Source/WebCore/history/CachedFrame.cpp	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebCore/history/CachedFrame.cpp	2016-09-16 00:27:11 UTC (rev 206006)
@@ -280,6 +280,11 @@
     return m_cachedFramePlatformData.get();
 }
 
+void CachedFrame::setHasInsecureContent(HasInsecureContent hasInsecureContent)
+{
+    m_hasInsecureContent = hasInsecureContent;
+}
+
 int CachedFrame::descendantFrameCount() const
 {
     int count = m_childFrames.size();

Modified: trunk/Source/WebCore/history/CachedFrame.h (206005 => 206006)


--- trunk/Source/WebCore/history/CachedFrame.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebCore/history/CachedFrame.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -39,6 +39,7 @@
 class DocumentLoader;
 class FrameView;
 class Node;
+enum class HasInsecureContent;
 
 class CachedFrameBase {
 public:
@@ -61,7 +62,8 @@
     std::unique_ptr<CachedFramePlatformData> m_cachedFramePlatformData;
     bool m_isMainFrame;
     bool m_isComposited;
-    
+    Optional<HasInsecureContent> m_hasInsecureContent;
+
     Vector<std::unique_ptr<CachedFrame>> m_childFrames;
 };
 
@@ -77,6 +79,9 @@
     WEBCORE_EXPORT void setCachedFramePlatformData(std::unique_ptr<CachedFramePlatformData>);
     WEBCORE_EXPORT CachedFramePlatformData* cachedFramePlatformData();
 
+    WEBCORE_EXPORT void setHasInsecureContent(HasInsecureContent);
+    Optional<HasInsecureContent> hasInsecureContent() const { return m_hasInsecureContent; }
+
     using CachedFrameBase::document;
     using CachedFrameBase::view;
     using CachedFrameBase::url;

Modified: trunk/Source/WebCore/loader/EmptyClients.h (206005 => 206006)


--- trunk/Source/WebCore/loader/EmptyClients.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -296,7 +296,7 @@
     void dispatchDidReceiveIcon() override { }
     void dispatchDidStartProvisionalLoad() override { }
     void dispatchDidReceiveTitle(const StringWithDirection&) override { }
-    void dispatchDidCommitLoad() override { }
+    void dispatchDidCommitLoad(Optional<HasInsecureContent>) override { }
     void dispatchDidFailProvisionalLoad(const ResourceError&) override { }
     void dispatchDidFailLoad(const ResourceError&) override { }
     void dispatchDidFinishDocumentLoad() override { }

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (206005 => 206006)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2016-09-16 00:27:11 UTC (rev 206006)
@@ -638,7 +638,7 @@
 
 void FrameLoader::receivedFirstData()
 {
-    dispatchDidCommitLoad();
+    dispatchDidCommitLoad(Nullopt);
     dispatchDidClearWindowObjectsInAllWorlds();
     dispatchGlobalObjectAvailableInAllWorlds();
 
@@ -1826,10 +1826,12 @@
         requestFromDelegate(mainResourceRequest, mainResourceIdentifier, mainResouceError);
         notifier().dispatchDidReceiveResponse(cachedPage->documentLoader(), mainResourceIdentifier, cachedPage->documentLoader()->response());
 
+        Optional<HasInsecureContent> hasInsecureContent = cachedPage->cachedMainFrame()->hasInsecureContent();
+
         // FIXME: This API should be turned around so that we ground CachedPage into the Page.
         cachedPage->restore(*m_frame.page());
 
-        dispatchDidCommitLoad();
+        dispatchDidCommitLoad(hasInsecureContent);
 #if PLATFORM(IOS)
         m_frame.page()->chrome().setDispatchViewportDataDidChangeSuppressed(false);
         m_frame.page()->chrome().dispatchViewportPropertiesDidChange(m_frame.page()->viewportArguments());
@@ -3532,12 +3534,12 @@
 #endif
 }
 
-void FrameLoader::dispatchDidCommitLoad()
+void FrameLoader::dispatchDidCommitLoad(Optional<HasInsecureContent> initialHasInsecureContent)
 {
     if (m_stateMachine.creatingInitialEmptyDocument())
         return;
 
-    m_client.dispatchDidCommitLoad();
+    m_client.dispatchDidCommitLoad(initialHasInsecureContent);
 
     if (m_frame.isMainFrame()) {
         m_frame.page()->resetSeenPlugins();

Modified: trunk/Source/WebCore/loader/FrameLoader.h (206005 => 206006)


--- trunk/Source/WebCore/loader/FrameLoader.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -50,6 +50,7 @@
 namespace WebCore {
 
 class Archive;
+class CachedFrame;
 class CachedFrameBase;
 class CachedPage;
 class CachedResource;
@@ -350,7 +351,7 @@
 
     bool shouldReloadToHandleUnreachableURL(DocumentLoader*);
 
-    void dispatchDidCommitLoad();
+    void dispatchDidCommitLoad(Optional<HasInsecureContent> initialHasInsecureContent);
 
     void urlSelected(const FrameLoadRequest&, Event*);
 

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (206005 => 206006)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -164,7 +164,7 @@
         virtual void dispatchDidReceiveIcon() = 0;
         virtual void dispatchDidStartProvisionalLoad() = 0;
         virtual void dispatchDidReceiveTitle(const StringWithDirection&) = 0;
-        virtual void dispatchDidCommitLoad() = 0;
+        virtual void dispatchDidCommitLoad(Optional<HasInsecureContent>) = 0;
         virtual void dispatchDidFailProvisionalLoad(const ResourceError&) = 0;
         virtual void dispatchDidFailLoad(const ResourceError&) = 0;
         virtual void dispatchDidFinishDocumentLoad() = 0;

Modified: trunk/Source/WebCore/loader/FrameLoaderTypes.h (206005 => 206006)


--- trunk/Source/WebCore/loader/FrameLoaderTypes.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebCore/loader/FrameLoaderTypes.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -129,4 +129,9 @@
     No
 };
 
+enum class HasInsecureContent {
+    Yes,
+    No,
+};
+
 } // namespace WebCore

Modified: trunk/Source/WebKit/mac/ChangeLog (206005 => 206006)


--- trunk/Source/WebKit/mac/ChangeLog	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-09-16 00:27:11 UTC (rev 206006)
@@ -1,3 +1,14 @@
+2016-09-15  Brady Eidson  <[email protected]>
+
+        WKWebView.hasOnlySecureContent always returns "YES" after going back to a CachedPage (even if it has http resources).
+        <rdar://problem/27681261> and https://bugs.webkit.org/show_bug.cgi?id=162043
+
+        Reviewed by Brent Fulgham. 
+
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::dispatchDidCommitLoad):
+
 2016-09-15  Anders Carlsson  <[email protected]>
 
         This was supposed to be committed with the previous patch!

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h (206005 => 206006)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -111,7 +111,7 @@
     void dispatchDidReceiveIcon() override;
     void dispatchDidStartProvisionalLoad() override;
     void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) override;
-    void dispatchDidCommitLoad() override;
+    void dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>) override;
     void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) override;
     void dispatchDidFailLoad(const WebCore::ResourceError&) override;
     void dispatchDidFinishDocumentLoad() override;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (206005 => 206006)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2016-09-16 00:27:11 UTC (rev 206006)
@@ -690,7 +690,7 @@
         CallFrameLoadDelegate(implementations->didReceiveTitleForFrameFunc, webView, @selector(webView:didReceiveTitle:forFrame:), (NSString *)title.string(), m_webFrame.get());
 }
 
-void WebFrameLoaderClient::dispatchDidCommitLoad()
+void WebFrameLoaderClient::dispatchDidCommitLoad(Optional<HasInsecureContent>)
 {
     // Tell the client we've committed this URL.
     ASSERT([m_webFrame->_private->webFrameView documentView] != nil);

Modified: trunk/Source/WebKit/win/ChangeLog (206005 => 206006)


--- trunk/Source/WebKit/win/ChangeLog	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit/win/ChangeLog	2016-09-16 00:27:11 UTC (rev 206006)
@@ -1,3 +1,14 @@
+2016-09-15  Brady Eidson  <[email protected]>
+
+        WKWebView.hasOnlySecureContent always returns "YES" after going back to a CachedPage (even if it has http resources).
+        <rdar://problem/27681261> and https://bugs.webkit.org/show_bug.cgi?id=162043
+
+        Reviewed by Brent Fulgham. 
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::dispatchDidCommitLoad):
+        * WebCoreSupport/WebFrameLoaderClient.h:
+
 2016-09-07  Mark Lam  <[email protected]>
 
         Add CatchScope and force all exception checks to be via ThrowScope or CatchScope.

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp (206005 => 206006)


--- trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp	2016-09-16 00:27:11 UTC (rev 206006)
@@ -423,7 +423,7 @@
         frameLoadDelegate->didReceiveTitle(webView, BString(title.string()), m_webFrame);
 }
 
-void WebFrameLoaderClient::dispatchDidCommitLoad()
+void WebFrameLoaderClient::dispatchDidCommitLoad(Optional<HasInsecureContent>)
 {
     WebView* webView = m_webFrame->webView();
     COMPtr<IWebFrameLoadDelegate> frameLoadDelegate;

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h (206005 => 206006)


--- trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -86,7 +86,7 @@
     void dispatchDidReceiveIcon() override;
     void dispatchDidStartProvisionalLoad() override;
     void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) override;
-    void dispatchDidCommitLoad() override;
+    void dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>) override;
     void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) override;
     void dispatchDidFailLoad(const WebCore::ResourceError&) override;
     void dispatchDidFinishDocumentLoad() override;

Modified: trunk/Source/WebKit2/ChangeLog (206005 => 206006)


--- trunk/Source/WebKit2/ChangeLog	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit2/ChangeLog	2016-09-16 00:27:11 UTC (rev 206006)
@@ -1,3 +1,30 @@
+2016-09-15  Brady Eidson  <[email protected]>
+
+        WKWebView.hasOnlySecureContent always returns "YES" after going back to a CachedPage (even if it has http resources).
+        <rdar://problem/27681261> and https://bugs.webkit.org/show_bug.cgi?id=162043
+
+        Reviewed by Brent Fulgham. 
+
+        * Scripts/webkit/messages.py:
+        (headers_for_type): Add a custom header, and alphabetize existing ones.
+
+        * Shared/WebCoreArgumentCoders.h: Add EnumTraits for HasInsecureContent.
+
+        * UIProcess/PageLoadState.h:
+        (WebKit::PageLoadState::committedHasInsecureContent):
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::hasInsecureContent):
+        (WebKit::WebPageProxy::didCommitLoadForFrame): If the WebProcess included an existing "HasInsecureContent" value, use it.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad): 
+        (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame): Save the "HasInsecureContent" value to the CachedFrame in
+          case we restore it in the future.
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+
 2016-09-15  Anders Carlsson  <[email protected]>
 
         Actually assign the decoded enum value to the output value

Modified: trunk/Source/WebKit2/Scripts/webkit/messages.py (206005 => 206006)


--- trunk/Source/WebKit2/Scripts/webkit/messages.py	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit2/Scripts/webkit/messages.py	2016-09-16 00:27:11 UTC (rev 206006)
@@ -349,21 +349,23 @@
         'String': ['<wtf/text/WTFString.h>'],
         'WebCore::CompositionUnderline': ['<WebCore/Editor.h>'],
         'WebCore::ExceptionDetails': ['<WebCore/JSDOMBinding.h>'],
+        'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'],
         'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'],
-        'WebCore::TextureMapperAnimations': ['<WebCore/TextureMapperAnimation.h>'],
+        'WebCore::HasInsecureContent': ['<WebCore/FrameLoaderTypes.h>'],
+        'WebCore::Highlight': ['<WebCore/InspectorOverlay.h>'],
         'WebCore::KeyframeValueList': ['<WebCore/GraphicsLayer.h>'],
         'WebCore::KeypressCommand': ['<WebCore/KeyboardEvent.h>'],
-        'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'],
-        'WebCore::Highlight': ['<WebCore/InspectorOverlay.h>'],
-        'WebCore::PluginInfo': ['<WebCore/PluginData.h>'],
         'WebCore::PasteboardImage': ['<WebCore/Pasteboard.h>'],
         'WebCore::PasteboardWebContent': ['<WebCore/Pasteboard.h>'],
+        'WebCore::PluginInfo': ['<WebCore/PluginData.h>'],
         'WebCore::RecentSearch': ['<WebCore/SearchPopupMenu.h>'],
         'WebCore::TextCheckingRequestData': ['<WebCore/TextChecking.h>'],
         'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'],
         'WebCore::TextIndicatorData': ['<WebCore/TextIndicator.h>'],
+        'WebCore::TextureMapperAnimations': ['<WebCore/TextureMapperAnimation.h>'],
         'WebCore::ViewportAttributes': ['<WebCore/ViewportArguments.h>'],
         'WebKit::BackForwardListItemState': ['"SessionState.h"'],
+        'WebKit::LayerHostingMode': ['"LayerTreeContext.h"'],
         'WebKit::PageState': ['"SessionState.h"'],
         'WebKit::WebGestureEvent': ['"WebEvent.h"'],
         'WebKit::WebKeyboardEvent': ['"WebEvent.h"'],

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (206005 => 206006)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -23,10 +23,10 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebCoreArgumentCoders_h
-#define WebCoreArgumentCoders_h
+#pragma once
 
 #include "ArgumentCoders.h"
+#include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/PaymentHeaders.h>
 
 namespace WebCore {
@@ -530,4 +530,14 @@
 
 } // namespace IPC
 
-#endif // WebCoreArgumentCoders_h
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::HasInsecureContent> {
+    using values = EnumValues<
+        WebCore::HasInsecureContent,
+        WebCore::HasInsecureContent::No,
+        WebCore::HasInsecureContent::Yes
+    >;
+};
+
+} // namespace WTF

Modified: trunk/Source/WebKit2/UIProcess/PageLoadState.h (206005 => 206006)


--- trunk/Source/WebKit2/UIProcess/PageLoadState.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit2/UIProcess/PageLoadState.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -165,6 +165,8 @@
     void didFinishProgress(const Transaction::Token&);
     void setNetworkRequestsInProgress(const Transaction::Token&, bool);
 
+    bool committedHasInsecureContent() const { return m_committedState.hasInsecureContent; }
+
     // FIXME: We piggy-back off PageLoadState::Observer so that both WKWebView and WKObservablePageState
     // can listen for changes. Once we get rid of WKObservablePageState these could just be part of API::NavigationClient.
     void willChangeProcessIsResponsive();

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (206005 => 206006)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-09-16 00:27:11 UTC (rev 206006)
@@ -3106,6 +3106,11 @@
     m_pageLoadState.setNetworkRequestsInProgress(transaction, networkRequestsInProgress);
 }
 
+void WebPageProxy::hasInsecureContent(HasInsecureContent& hasInsecureContent)
+{
+    hasInsecureContent = m_pageLoadState.committedHasInsecureContent() ? HasInsecureContent::Yes : HasInsecureContent::No;
+}
+
 void WebPageProxy::didDestroyNavigation(uint64_t navigationID)
 {
     PageClientProtector protector(m_pageClient);
@@ -3242,7 +3247,7 @@
     }
 }
 
-void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool containsPluginDocument, const UserData& userData)
+void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool containsPluginDocument, Optional<HasInsecureContent> hasInsecureContent, const UserData& userData)
 {
     PageClientProtector protector(m_pageClient);
 
@@ -3262,8 +3267,9 @@
 #endif
 
     auto transaction = m_pageLoadState.transaction();
-    bool markPageInsecure = m_treatsSHA1CertificatesAsInsecure && certificateInfo.containsNonRootSHA1SignedCertificate();
     Ref<WebCertificateInfo> webCertificateInfo = WebCertificateInfo::create(certificateInfo);
+    bool markPageInsecure = hasInsecureContent ? hasInsecureContent.value() == HasInsecureContent::Yes : m_treatsSHA1CertificatesAsInsecure && certificateInfo.containsNonRootSHA1SignedCertificate();
+
     if (frame->isMainFrame()) {
         m_pageLoadState.didCommitLoad(transaction, webCertificateInfo, markPageInsecure);
         m_suppressNavigationSnapshotting = false;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (206005 => 206006)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -153,6 +153,7 @@
 class RunLoopObserver;
 class SharedBuffer;
 class TextIndicator;
+enum class HasInsecureContent;
 struct DictionaryPopupInfo;
 struct ExceptionDetails;
 struct FileChooserSettings;
@@ -1172,7 +1173,7 @@
     void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&, const UserData&);
     void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, const String& url);
     void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);
-    void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool containsPluginDocument, const UserData&);
+    void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
     void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
     void didFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
     void didFailLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
@@ -1190,6 +1191,8 @@
     void didFinishProgress();
     void setNetworkRequestsInProgress(bool);
 
+    void hasInsecureContent(WebCore::HasInsecureContent&);
+
     void didDestroyNavigation(uint64_t navigationID);
 
     void decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const NavigationActionData&, uint64_t originatingFrameID, const WebCore::SecurityOriginData& originatingFrameSecurityOrigin, const WebCore::ResourceRequest& originalRequest, const WebCore::ResourceRequest&, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& newNavigationID, uint64_t& policyAction, DownloadID&);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (206005 => 206006)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-09-16 00:27:11 UTC (rev 206006)
@@ -126,7 +126,7 @@
     DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, WebKit::UserData userData)
     DidChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, String url)
     DidFailProvisionalLoadForFrame(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, WebKit::UserData userData)
-    DidCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, bool containsPluginDocument, WebKit::UserData userData)
+    DidCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebKit::UserData userData)
     DidFailLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceError error, WebKit::UserData userData)
     DidFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, WebKit::UserData userData)
     DidFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, WebKit::UserData userData)
@@ -140,6 +140,8 @@
     DidSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t type, String url, WebKit::UserData userData)
     DidDestroyNavigation(uint64_t navigationID)
 
+    HasInsecureContent() -> (enum WebCore::HasInsecureContent hasInsecureContent)
+
     MainFramePluginHandlesPageScaleGestureDidChange(bool mainFramePluginHandlesPageScaleGesture)
 
     FrameDidBecomeFrameSet(uint64_t frameID, bool value)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (206005 => 206006)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2016-09-16 00:27:11 UTC (rev 206006)
@@ -55,6 +55,7 @@
 #include "WebProcessPoolMessages.h"
 #include <_javascript_Core/APICast.h>
 #include <_javascript_Core/JSObject.h>
+#include <WebCore/CachedFrame.h>
 #include <WebCore/CertificateInfo.h>
 #include <WebCore/Chrome.h>
 #include <WebCore/DOMWrapperWorld.h>
@@ -438,7 +439,7 @@
     webPage->send(Messages::WebPageProxy::DidReceiveTitleForFrame(m_frame->frameID(), title.string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
-void WebFrameLoaderClient::dispatchDidCommitLoad()
+void WebFrameLoaderClient::dispatchDidCommitLoad(Optional<HasInsecureContent> hasInsecureContent)
 {
     WebPage* webPage = m_frame->page();
     if (!webPage)
@@ -453,8 +454,7 @@
     webPage->sandboxExtensionTracker().didCommitProvisionalLoad(m_frame);
 
     // Notify the UIProcess.
-
-    webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), documentLoader.response().certificateInfo().valueOrCompute([] { return CertificateInfo(); }), m_frame->coreFrame()->document()->isPluginDocument(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+    webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), documentLoader.response().certificateInfo().valueOrCompute([] { return CertificateInfo(); }), m_frame->coreFrame()->document()->isPluginDocument(), hasInsecureContent, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
     webPage->didCommitLoad(m_frame);
 }
 
@@ -1281,8 +1281,15 @@
     return webPage->userAgent(m_frame, url);
 }
 
-void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*)
+void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame* cachedFrame)
 {
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    HasInsecureContent hasInsecureContent;
+    if (webPage->sendSync(Messages::WebPageProxy::HasInsecureContent(), Messages::WebPageProxy::HasInsecureContent::Reply(hasInsecureContent)))
+        cachedFrame->setHasInsecureContent(hasInsecureContent);
 }
 
 void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (206005 => 206006)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2016-09-16 00:20:03 UTC (rev 206005)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2016-09-16 00:27:11 UTC (rev 206006)
@@ -96,7 +96,7 @@
     void dispatchDidReceiveIcon() override;
     void dispatchDidStartProvisionalLoad() override;
     void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) override;
-    void dispatchDidCommitLoad() override;
+    void dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>) override;
     void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) override;
     void dispatchDidFailLoad(const WebCore::ResourceError&) override;
     void dispatchDidFinishDocumentLoad() override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to