Changeset 256073 in webkit


Ignore:
Timestamp:
Feb 7, 2020 3:30:29 PM (4 years ago)
Author:
achristensen@apple.com
Message:

Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content
https://bugs.webkit.org/show_bug.cgi?id=207409
rdar://problem/59275641

Patch by Alex Christensen <achristensen@apple.com> on 2020-02-07
Reviewed by Chris Dumez.

Source/WebCore:

Covered by an API test.

  • history/CachedFrame.cpp:

(WebCore::CachedFrame::setHasInsecureContent):

  • history/CachedFrame.h:

(WebCore::CachedFrame::usedLegacyTLS const):

  • loader/EmptyFrameLoaderClient.h:
  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::receivedFirstData):
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::dispatchDidCommitLoad):

  • loader/FrameLoader.h:
  • loader/FrameLoaderClient.h:

Source/WebKit:

  • Scripts/webkit/messages.py:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::hasInsecureContent):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
(WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.h:

Source/WebKitLegacy/mac:

  • WebCoreSupport/WebFrameLoaderClient.h:
  • WebCoreSupport/WebFrameLoaderClient.mm:

(WebFrameLoaderClient::dispatchDidCommitLoad):

Source/WebKitLegacy/win:

  • WebCoreSupport/WebFrameLoaderClient.cpp:

(WebFrameLoaderClient::dispatchDidCommitLoad):

  • WebCoreSupport/WebFrameLoaderClient.h:

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:

(TestWebKitAPI::TEST):

Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r256066 r256073  
     12020-02-07  Alex Christensen  <achristensen@apple.com>
     2
     3        Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content
     4        https://bugs.webkit.org/show_bug.cgi?id=207409
     5        rdar://problem/59275641
     6
     7        Reviewed by Chris Dumez.
     8
     9        Covered by an API test.
     10
     11        * history/CachedFrame.cpp:
     12        (WebCore::CachedFrame::setHasInsecureContent):
     13        * history/CachedFrame.h:
     14        (WebCore::CachedFrame::usedLegacyTLS const):
     15        * loader/EmptyFrameLoaderClient.h:
     16        * loader/FrameLoader.cpp:
     17        (WebCore::FrameLoader::receivedFirstData):
     18        (WebCore::FrameLoader::commitProvisionalLoad):
     19        (WebCore::FrameLoader::dispatchDidCommitLoad):
     20        * loader/FrameLoader.h:
     21        * loader/FrameLoaderClient.h:
     22
    1232020-02-07  Ryan Haddad  <ryanhaddad@apple.com>
    224
  • trunk/Source/WebCore/history/CachedFrame.cpp

    r251924 r256073  
    303303}
    304304
    305 void CachedFrame::setHasInsecureContent(HasInsecureContent hasInsecureContent)
     305void CachedFrame::setHasInsecureContent(HasInsecureContent hasInsecureContent, UsedLegacyTLS usedLegacyTLS)
    306306{
    307307    m_hasInsecureContent = hasInsecureContent;
     308    m_usedLegacyTLS = usedLegacyTLS;
    308309}
    309310
  • trunk/Source/WebCore/history/CachedFrame.h

    r239427 r256073  
    4040class Node;
    4141enum class HasInsecureContent : bool;
     42enum class UsedLegacyTLS : bool;
    4243
    4344class CachedFrameBase {
     
    6465    bool m_isMainFrame;
    6566    Optional<HasInsecureContent> m_hasInsecureContent;
     67    Optional<UsedLegacyTLS> m_usedLegacyTLS;
    6668
    6769    Vector<std::unique_ptr<CachedFrame>> m_childFrames;
     
    8082    WEBCORE_EXPORT CachedFramePlatformData* cachedFramePlatformData();
    8183
    82     WEBCORE_EXPORT void setHasInsecureContent(HasInsecureContent);
     84    WEBCORE_EXPORT void setHasInsecureContent(HasInsecureContent, UsedLegacyTLS);
    8385    Optional<HasInsecureContent> hasInsecureContent() const { return m_hasInsecureContent; }
     86    Optional<UsedLegacyTLS> usedLegacyTLS() const { return m_usedLegacyTLS; }
    8487
    8588    using CachedFrameBase::document;
  • trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h

    r251488 r256073  
    9090    void dispatchDidStartProvisionalLoad() final { }
    9191    void dispatchDidReceiveTitle(const StringWithDirection&) final { }
    92     void dispatchDidCommitLoad(Optional<HasInsecureContent>) final { }
     92    void dispatchDidCommitLoad(Optional<HasInsecureContent>, Optional<UsedLegacyTLS>) final { }
    9393    void dispatchDidFailProvisionalLoad(const ResourceError&, WillContinueLoading) final { }
    9494    void dispatchDidFailLoad(const ResourceError&) final { }
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r255961 r256073  
    706706void FrameLoader::receivedFirstData()
    707707{
    708     dispatchDidCommitLoad(WTF::nullopt);
     708    dispatchDidCommitLoad(WTF::nullopt, WTF::nullopt);
    709709    dispatchDidClearWindowObjectsInAllWorlds();
    710710    dispatchGlobalObjectAvailableInAllWorlds();
     
    20732073
    20742074        Optional<HasInsecureContent> hasInsecureContent = cachedPage->cachedMainFrame()->hasInsecureContent();
    2075 
    2076         dispatchDidCommitLoad(hasInsecureContent);
     2075        Optional<UsedLegacyTLS> usedLegacyTLS = cachedPage->cachedMainFrame()->usedLegacyTLS();
     2076
     2077        dispatchDidCommitLoad(hasInsecureContent, usedLegacyTLS);
    20772078
    20782079        // FIXME: This API should be turned around so that we ground CachedPage into the Page.
     
    40084009}
    40094010
    4010 void FrameLoader::dispatchDidCommitLoad(Optional<HasInsecureContent> initialHasInsecureContent)
     4011void FrameLoader::dispatchDidCommitLoad(Optional<HasInsecureContent> initialHasInsecureContent, Optional<UsedLegacyTLS> initialUsedLegacyTLS)
    40114012{
    40124013    if (m_stateMachine.creatingInitialEmptyDocument())
    40134014        return;
    40144015
    4015     m_client.dispatchDidCommitLoad(initialHasInsecureContent);
     4016    m_client.dispatchDidCommitLoad(initialHasInsecureContent, initialUsedLegacyTLS);
    40164017
    40174018    if (m_frame.isMainFrame()) {
  • trunk/Source/WebCore/loader/FrameLoader.h

    r253964 r256073  
    8888enum class NavigationPolicyDecision : uint8_t;
    8989enum class ShouldTreatAsContinuingLoad : bool;
     90enum class UsedLegacyTLS : bool;
    9091
    9192struct WindowFeatures;
     
    378379    bool shouldReloadToHandleUnreachableURL(DocumentLoader&);
    379380
    380     void dispatchDidCommitLoad(Optional<HasInsecureContent> initialHasInsecureContent);
     381    void dispatchDidCommitLoad(Optional<HasInsecureContent> initialHasInsecureContent, Optional<UsedLegacyTLS> initialUsedLegacyTLS);
    381382
    382383    void urlSelected(FrameLoadRequest&&, Event*, Optional<AdClickAttribution>&& = WTF::nullopt);
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r254064 r256073  
    103103enum class LockBackForwardList : bool;
    104104enum class PolicyDecisionMode;
     105enum class UsedLegacyTLS : bool;
    105106
    106107struct StringWithDirection;
     
    174175    virtual void dispatchDidStartProvisionalLoad() = 0;
    175176    virtual void dispatchDidReceiveTitle(const StringWithDirection&) = 0;
    176     virtual void dispatchDidCommitLoad(Optional<HasInsecureContent>) = 0;
     177    virtual void dispatchDidCommitLoad(Optional<HasInsecureContent>, Optional<UsedLegacyTLS>) = 0;
    177178    virtual void dispatchDidFailProvisionalLoad(const ResourceError&, WillContinueLoading) = 0;
    178179    virtual void dispatchDidFailLoad(const ResourceError&) = 0;
  • trunk/Source/WebKit/ChangeLog

    r256072 r256073  
     12020-02-07  Alex Christensen  <achristensen@apple.com>
     2
     3        Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content
     4        https://bugs.webkit.org/show_bug.cgi?id=207409
     5        rdar://problem/59275641
     6
     7        Reviewed by Chris Dumez.
     8
     9        * Scripts/webkit/messages.py:
     10        * UIProcess/WebPageProxy.cpp:
     11        (WebKit::WebPageProxy::hasInsecureContent):
     12        * UIProcess/WebPageProxy.h:
     13        * UIProcess/WebPageProxy.messages.in:
     14        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     15        (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
     16        (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
     17        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     18
    1192020-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
    220
  • trunk/Source/WebKit/Scripts/webkit/messages.py

    r255133 r256073  
    603603        'WebCore::ThirdPartyCookieBlockingMode': ['<WebCore/NetworkStorageSession.h>'],
    604604        'WebCore::FirstPartyWebsiteDataRemovalMode': ['<WebCore/NetworkStorageSession.h>'],
     605        'WebCore::UsedLegacyTLS': ['<WebCore/ResourceResponseBase.h>'],
    605606        'WebCore::ViewportAttributes': ['<WebCore/ViewportArguments.h>'],
    606607        'WebCore::WillContinueLoading': ['<WebCore/FrameLoaderTypes.h>'],
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r255992 r256073  
    42254225}
    42264226
    4227 void WebPageProxy::hasInsecureContent(CompletionHandler<void(WebCore::HasInsecureContent)>&& completionHandler)
    4228 {
    4229     completionHandler(m_pageLoadState.committedHasInsecureContent() ? HasInsecureContent::Yes : HasInsecureContent::No);
     4227void WebPageProxy::hasInsecureContent(CompletionHandler<void(WebCore::HasInsecureContent, WebCore::UsedLegacyTLS)>&& completionHandler)
     4228{
     4229    completionHandler(
     4230        m_pageLoadState.committedHasInsecureContent() ? HasInsecureContent::Yes : HasInsecureContent::No,
     4231        m_pageLoadState.hasNegotiatedLegacyTLS() ? UsedLegacyTLS::Yes : UsedLegacyTLS::No
     4232    );
    42304233}
    42314234
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r255992 r256073  
    17611761    void setNetworkRequestsInProgress(bool);
    17621762
    1763     void hasInsecureContent(CompletionHandler<void(WebCore::HasInsecureContent)>&&);
     1763    void hasInsecureContent(CompletionHandler<void(WebCore::HasInsecureContent, WebCore::UsedLegacyTLS)>&&);
    17641764
    17651765    void didDestroyNavigation(uint64_t navigationID);
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r255846 r256073  
    143143    DidDestroyNavigation(uint64_t navigationID)
    144144
    145     HasInsecureContent() -> (enum:bool WebCore::HasInsecureContent hasInsecureContent) Synchronous
     145    HasInsecureContent() -> (enum:bool WebCore::HasInsecureContent hasInsecureContent, enum:bool WebCore::UsedLegacyTLS usedLegacyTLS) Synchronous
    146146
    147147    MainFramePluginHandlesPageScaleGestureDidChange(bool mainFramePluginHandlesPageScaleGesture)
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r255846 r256073  
    546546}
    547547
    548 void WebFrameLoaderClient::dispatchDidCommitLoad(Optional<HasInsecureContent> hasInsecureContent)
     548void WebFrameLoaderClient::dispatchDidCommitLoad(Optional<HasInsecureContent> hasInsecureContent, Optional<UsedLegacyTLS> usedLegacyTLSFromPageCache)
    549549{
    550550    WebPage* webPage = m_frame->page();
     
    560560    webPage->sandboxExtensionTracker().didCommitProvisionalLoad(m_frame);
    561561
     562    bool usedLegacyTLS = documentLoader.response().usedLegacyTLS();
     563    if (!usedLegacyTLS && usedLegacyTLSFromPageCache)
     564        usedLegacyTLS = usedLegacyTLSFromPageCache == UsedLegacyTLS::Yes;
     565   
    562566    // Notify the UIProcess.
    563     webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), valueOrCompute(documentLoader.response().certificateInfo(), [] { return CertificateInfo(); }), documentLoader.response().usedLegacyTLS(), m_frame->coreFrame()->document()->isPluginDocument(), hasInsecureContent, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
     567    webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), valueOrCompute(documentLoader.response().certificateInfo(), [] { return CertificateInfo(); }), usedLegacyTLS, m_frame->coreFrame()->document()->isPluginDocument(), hasInsecureContent, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
    564568    webPage->didCommitLoad(m_frame);
    565569}
     
    14681472
    14691473    HasInsecureContent hasInsecureContent;
    1470     if (webPage->sendSync(Messages::WebPageProxy::HasInsecureContent(), Messages::WebPageProxy::HasInsecureContent::Reply(hasInsecureContent)))
    1471         cachedFrame->setHasInsecureContent(hasInsecureContent);
     1474    UsedLegacyTLS usedLegacyTLS;
     1475    if (webPage->sendSync(Messages::WebPageProxy::HasInsecureContent(), Messages::WebPageProxy::HasInsecureContent::Reply(hasInsecureContent, usedLegacyTLS)))
     1476        cachedFrame->setHasInsecureContent(hasInsecureContent, usedLegacyTLS);
    14721477}
    14731478
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

    r251787 r256073  
    115115    void dispatchDidStartProvisionalLoad() final;
    116116    void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) final;
    117     void dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>) final;
     117    void dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>, Optional<WebCore::UsedLegacyTLS>) final;
    118118    void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&, WebCore::WillContinueLoading) final;
    119119    void dispatchDidFailLoad(const WebCore::ResourceError&) final;
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r256066 r256073  
     12020-02-07  Alex Christensen  <achristensen@apple.com>
     2
     3        Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content
     4        https://bugs.webkit.org/show_bug.cgi?id=207409
     5        rdar://problem/59275641
     6
     7        Reviewed by Chris Dumez.
     8
     9        * WebCoreSupport/WebFrameLoaderClient.h:
     10        * WebCoreSupport/WebFrameLoaderClient.mm:
     11        (WebFrameLoaderClient::dispatchDidCommitLoad):
     12
    1132020-02-07  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h

    r251488 r256073  
    116116    void dispatchDidStartProvisionalLoad() final;
    117117    void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) final;
    118     void dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>) final;
     118    void dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>, Optional<WebCore::UsedLegacyTLS>) final;
    119119    void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&, WebCore::WillContinueLoading) final;
    120120    void dispatchDidFailLoad(const WebCore::ResourceError&) final;
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r255226 r256073  
    699699}
    700700
    701 void WebFrameLoaderClient::dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>)
     701void WebFrameLoaderClient::dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>, Optional<WebCore::UsedLegacyTLS>)
    702702{
    703703    // Tell the client we've committed this URL.
  • trunk/Source/WebKitLegacy/win/ChangeLog

    r255961 r256073  
     12020-02-07  Alex Christensen  <achristensen@apple.com>
     2
     3        Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content
     4        https://bugs.webkit.org/show_bug.cgi?id=207409
     5        rdar://problem/59275641
     6
     7        Reviewed by Chris Dumez.
     8
     9        * WebCoreSupport/WebFrameLoaderClient.cpp:
     10        (WebFrameLoaderClient::dispatchDidCommitLoad):
     11        * WebCoreSupport/WebFrameLoaderClient.h:
     12
    1132020-02-06  Brent Fulgham  <bfulgham@apple.com>
    214
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp

    r253135 r256073  
    439439}
    440440
    441 void WebFrameLoaderClient::dispatchDidCommitLoad(Optional<HasInsecureContent>)
     441void WebFrameLoaderClient::dispatchDidCommitLoad(Optional<HasInsecureContent>, Optional<UsedLegacyTLS>)
    442442{
    443443    WebView* webView = m_webFrame->webView();
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h

    r253135 r256073  
    9393    void dispatchDidStartProvisionalLoad() override;
    9494    void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) override;
    95     void dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>) override;
     95    void dispatchDidCommitLoad(Optional<WebCore::HasInsecureContent>, Optional<WebCore::UsedLegacyTLS>) override;
    9696    void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&, WebCore::WillContinueLoading) override;
    9797    void dispatchDidFailLoad(const WebCore::ResourceError&) override;
  • trunk/Tools/ChangeLog

    r256066 r256073  
     12020-02-07  Alex Christensen  <achristensen@apple.com>
     2
     3        Remember if we used legacy TLS in the back/forward cache like we remember if we have only secure content
     4        https://bugs.webkit.org/show_bug.cgi?id=207409
     5        rdar://problem/59275641
     6
     7        Reviewed by Chris Dumez.
     8
     9        * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:
     10        (TestWebKitAPI::TEST):
     11
    1122020-02-07  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm

    r255880 r256073  
    313313
    314314    HTTPServer modernTLSServer({
    315         { "/", { makeString("<script>fetch('https://127.0.0.1:", static_cast<unsigned>(legacyTLSServer.port()), "/',{mode:'no-cors'})</script>") } }
     315        { "/", { makeString("<script>fetch('https://127.0.0.1:", static_cast<unsigned>(legacyTLSServer.port()), "/',{mode:'no-cors'})</script>") } },
     316        { "/pageWithoutSubresource", { "hello" }}
    316317    }, HTTPServer::Protocol::Https);
    317318   
     
    324325    while (![webView _negotiatedLegacyTLS])
    325326        [observer waitUntilNegotiatedLegacyTLSChanged];
     327   
     328    EXPECT_TRUE([webView _negotiatedLegacyTLS]);
     329    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/pageWithoutSubresource", modernTLSServer.port()]]]];
     330    [delegate waitForDidFinishNavigation];
     331    EXPECT_FALSE([webView _negotiatedLegacyTLS]);
     332
     333    [webView goBack];
     334    [delegate waitForDidFinishNavigation];
     335    EXPECT_TRUE([webView _negotiatedLegacyTLS]);
    326336
    327337    [webView removeObserver:observer.get() forKeyPath:@"_negotiatedLegacyTLS"];
Note: See TracChangeset for help on using the changeset viewer.