Diff
Modified: trunk/Source/WebCore/ChangeLog (258342 => 258343)
--- trunk/Source/WebCore/ChangeLog 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Source/WebCore/ChangeLog 2020-03-12 18:28:40 UTC (rev 258343)
@@ -1,3 +1,28 @@
+2020-03-12 Alex Christensen <[email protected]>
+
+ WKWebView.hasOnlySecureContent should be correct after back/forward navigations
+ https://bugs.webkit.org/show_bug.cgi?id=207609
+ <rdar://problem/59371252>
+
+ Reviewed by Ryosuke Niwa.
+
+ The web process informs the UI process of insecure content loads when http resources are requested from https pages.
+ The web process also remembers that this happened.
+ Rather than ask the UI process during a navigation, which can sometimes get information about the wrong navigation,
+ just use the remembered values. We will need to do something for legacy TLS loads too, but I left that code as it is
+ for this patch. Another is coming soon.
+
+ Covered by API tests.
+
+ * history/CachedFrame.cpp:
+ (WebCore::CachedFrame::setUsedLegacyTLS):
+ (WebCore::CachedFrame::hasInsecureContent const):
+ (WebCore::CachedFrame::setHasInsecureContent): Deleted.
+ * history/CachedFrame.h:
+ (WebCore::CachedFrame::hasInsecureContent const): Deleted.
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::commitProvisionalLoad):
+
2020-03-12 Simon Fraser <[email protected]>
REGRESSION (r257938): Some pointerevents/ios/touch-action-region tests started to fail
Modified: trunk/Source/WebCore/history/CachedFrame.cpp (258342 => 258343)
--- trunk/Source/WebCore/history/CachedFrame.cpp 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Source/WebCore/history/CachedFrame.cpp 2020-03-12 18:28:40 UTC (rev 258343)
@@ -302,9 +302,8 @@
return m_cachedFramePlatformData.get();
}
-void CachedFrame::setHasInsecureContent(HasInsecureContent hasInsecureContent, UsedLegacyTLS usedLegacyTLS)
+void CachedFrame::setUsedLegacyTLS(UsedLegacyTLS usedLegacyTLS)
{
- m_hasInsecureContent = hasInsecureContent;
m_usedLegacyTLS = usedLegacyTLS;
}
@@ -317,4 +316,19 @@
return count;
}
+HasInsecureContent CachedFrame::hasInsecureContent() const
+{
+ if (auto* document = this->document()) {
+ if (!document->isSecureContext() || !document->foundMixedContent().isEmpty())
+ return HasInsecureContent::Yes;
+ }
+
+ for (const auto& cachedFrame : m_childFrames) {
+ if (cachedFrame && cachedFrame->hasInsecureContent() == HasInsecureContent::Yes)
+ return HasInsecureContent::Yes;
+ }
+
+ return HasInsecureContent::No;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/history/CachedFrame.h (258342 => 258343)
--- trunk/Source/WebCore/history/CachedFrame.h 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Source/WebCore/history/CachedFrame.h 2020-03-12 18:28:40 UTC (rev 258343)
@@ -63,7 +63,6 @@
std::unique_ptr<ScriptCachedFrameData> m_cachedFrameScriptData;
std::unique_ptr<CachedFramePlatformData> m_cachedFramePlatformData;
bool m_isMainFrame;
- Optional<HasInsecureContent> m_hasInsecureContent;
Optional<UsedLegacyTLS> m_usedLegacyTLS;
Vector<std::unique_ptr<CachedFrame>> m_childFrames;
@@ -81,8 +80,8 @@
WEBCORE_EXPORT void setCachedFramePlatformData(std::unique_ptr<CachedFramePlatformData>);
WEBCORE_EXPORT CachedFramePlatformData* cachedFramePlatformData();
- WEBCORE_EXPORT void setHasInsecureContent(HasInsecureContent, UsedLegacyTLS);
- Optional<HasInsecureContent> hasInsecureContent() const { return m_hasInsecureContent; }
+ WEBCORE_EXPORT void setUsedLegacyTLS(UsedLegacyTLS);
+ HasInsecureContent hasInsecureContent() const;
Optional<UsedLegacyTLS> usedLegacyTLS() const { return m_usedLegacyTLS; }
using CachedFrameBase::document;
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (258342 => 258343)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2020-03-12 18:28:40 UTC (rev 258343)
@@ -2075,7 +2075,7 @@
requestFromDelegate(mainResourceRequest, mainResourceIdentifier, mainResouceError);
notifier().dispatchDidReceiveResponse(cachedPage->documentLoader(), mainResourceIdentifier, cachedPage->documentLoader()->response());
- Optional<HasInsecureContent> hasInsecureContent = cachedPage->cachedMainFrame()->hasInsecureContent();
+ auto hasInsecureContent = cachedPage->cachedMainFrame()->hasInsecureContent();
Optional<UsedLegacyTLS> usedLegacyTLS = cachedPage->cachedMainFrame()->usedLegacyTLS();
dispatchDidCommitLoad(hasInsecureContent, usedLegacyTLS);
Modified: trunk/Source/WebKit/ChangeLog (258342 => 258343)
--- trunk/Source/WebKit/ChangeLog 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Source/WebKit/ChangeLog 2020-03-12 18:28:40 UTC (rev 258343)
@@ -1,3 +1,18 @@
+2020-03-12 Alex Christensen <[email protected]>
+
+ WKWebView.hasOnlySecureContent should be correct after back/forward navigations
+ https://bugs.webkit.org/show_bug.cgi?id=207609
+
+ Reviewed by Ryosuke Niwa.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::usedLegacyTLS):
+ (WebKit::WebPageProxy::hasInsecureContent): Deleted.
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
+
2020-03-12 Chris Dumez <[email protected]>
Drop unused WebProcess::UpdateActivePages IPC
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (258342 => 258343)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-03-12 18:28:40 UTC (rev 258343)
@@ -4293,12 +4293,9 @@
networkProcess->preconnectTo(sessionID(), url, userAgent(), WebCore::StoredCredentialsPolicy::Use);
}
-void WebPageProxy::hasInsecureContent(CompletionHandler<void(WebCore::HasInsecureContent, WebCore::UsedLegacyTLS)>&& completionHandler)
+void WebPageProxy::usedLegacyTLS(CompletionHandler<void(WebCore::UsedLegacyTLS)>&& completionHandler)
{
- completionHandler(
- m_pageLoadState.committedHasInsecureContent() ? HasInsecureContent::Yes : HasInsecureContent::No,
- m_pageLoadState.hasNegotiatedLegacyTLS() ? UsedLegacyTLS::Yes : UsedLegacyTLS::No
- );
+ completionHandler(m_pageLoadState.hasNegotiatedLegacyTLS() ? UsedLegacyTLS::Yes : UsedLegacyTLS::No);
}
void WebPageProxy::didDestroyNavigation(uint64_t navigationID)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (258342 => 258343)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-03-12 18:28:40 UTC (rev 258343)
@@ -1791,7 +1791,7 @@
void preconnectTo(const URL&);
- void hasInsecureContent(CompletionHandler<void(WebCore::HasInsecureContent, WebCore::UsedLegacyTLS)>&&);
+ void usedLegacyTLS(CompletionHandler<void(WebCore::UsedLegacyTLS)>&&);
void didDestroyNavigation(uint64_t navigationID);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (258342 => 258343)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-03-12 18:28:40 UTC (rev 258343)
@@ -142,7 +142,7 @@
DidExplicitOpenForFrame(WebCore::FrameIdentifier frameID, URL url, String mimeType)
DidDestroyNavigation(uint64_t navigationID)
- HasInsecureContent() -> (enum:bool WebCore::HasInsecureContent hasInsecureContent, enum:bool WebCore::UsedLegacyTLS usedLegacyTLS) Synchronous
+ UsedLegacyTLS() -> (enum:bool WebCore::UsedLegacyTLS usedLegacyTLS) Synchronous
MainFramePluginHandlesPageScaleGestureDidChange(bool mainFramePluginHandlesPageScaleGesture)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (258342 => 258343)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-03-12 18:28:40 UTC (rev 258343)
@@ -1470,10 +1470,10 @@
if (!webPage)
return;
- HasInsecureContent hasInsecureContent;
+ // FIXME: Remember in the web process rather than send this sync message.
UsedLegacyTLS usedLegacyTLS;
- if (webPage->sendSync(Messages::WebPageProxy::HasInsecureContent(), Messages::WebPageProxy::HasInsecureContent::Reply(hasInsecureContent, usedLegacyTLS)))
- cachedFrame->setHasInsecureContent(hasInsecureContent, usedLegacyTLS);
+ if (webPage->sendSync(Messages::WebPageProxy::UsedLegacyTLS(), Messages::WebPageProxy::UsedLegacyTLS::Reply(usedLegacyTLS)))
+ cachedFrame->setUsedLegacyTLS(usedLegacyTLS);
}
void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*)
Modified: trunk/Tools/ChangeLog (258342 => 258343)
--- trunk/Tools/ChangeLog 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Tools/ChangeLog 2020-03-12 18:28:40 UTC (rev 258343)
@@ -1,3 +1,13 @@
+2020-03-12 Alex Christensen <[email protected]>
+
+ WKWebView.hasOnlySecureContent should be correct after back/forward navigations
+ https://bugs.webkit.org/show_bug.cgi?id=207609
+
+ Reviewed by Ryosuke Niwa.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:
+ (TestWebKitAPI::TEST):
+
2020-03-12 Daniel Bates <[email protected]>
FocusController::setFocusedElement() should tell client of refocused element
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm (258342 => 258343)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm 2020-03-12 18:18:10 UTC (rev 258342)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm 2020-03-12 18:28:40 UTC (rev 258343)
@@ -333,10 +333,44 @@
[webView removeObserver:observer.get() forKeyPath:@"_negotiatedLegacyTLS"];
}
-#endif // HAVE(NETWORK_FRAMEWORK) && HAVE(TLS_PROTOCOL_VERSION_T)
+TEST(TLSVersion, BackForwardHasOnlySecureContent)
+{
+ HTTPServer secureServer({
+ { "/", { "hello" }}
+ }, HTTPServer::Protocol::Https);
+ HTTPServer insecureServer({
+ { "/", { "hello" } }
+ });
+ HTTPServer mixedContentServer({
+ { "/", { {{ "Content-Type", "text/html" }}, makeString("<img src=''></img>") } },
+ }, HTTPServer::Protocol::Https);
-// FIXME: Add some tests for WKWebView.hasOnlySecureContent
+ auto [webView, delegate] = webViewWithNavigationDelegate();
+ EXPECT_FALSE([webView hasOnlySecureContent]);
+ [webView loadRequest:secureServer.request()];
+ [delegate waitForDidFinishNavigation];
+ EXPECT_TRUE([webView hasOnlySecureContent]);
+
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://localhost:%d/", mixedContentServer.port()]]]];
+ [delegate waitForDidFinishNavigation];
+ while ([webView hasOnlySecureContent])
+ TestWebKitAPI::Util::spinRunLoop();
+ EXPECT_FALSE([webView hasOnlySecureContent]);
+
+ [webView goBack];
+ [delegate waitForDidFinishNavigation];
+ EXPECT_TRUE([webView hasOnlySecureContent]);
+
+ [webView goForward];
+ [delegate waitForDidFinishNavigation];
+ while ([webView hasOnlySecureContent])
+ TestWebKitAPI::Util::spinRunLoop();
+ EXPECT_FALSE([webView hasOnlySecureContent]);
}
+#endif // HAVE(NETWORK_FRAMEWORK) && HAVE(TLS_PROTOCOL_VERSION_T)
+
+}
+
#endif // HAVE(SSL)