Changeset 252301 in webkit


Ignore:
Timestamp:
Nov 8, 2019 7:29:14 PM (4 years ago)
Author:
Chris Dumez
Message:

Add back/forward cache quirk for Vimeo.com
https://bugs.webkit.org/show_bug.cgi?id=204025
<rdar://problem/56996057>

Reviewed by Antti Koivisto.

Vimeo.com used to bypass the back/forward cache by serving "Cache-Control: no-store" over HTTPS.
We started caching such content in r250437 but the vimeo.com content unfortunately is not currently compatible
because it changes the opacity of its body to 0 when navigating away and fails to restore the original opacity
when coming back from the back/forward cache (e.g. in 'pageshow' event handler).

To address the issue, this patch introduces a quirk to restore pre-r250437 on Vimeo.com, until they get
a chance to fix their content.

  • history/BackForwardCache.cpp:

(WebCore::canCacheFrame):

  • page/DiagnosticLoggingKeys.cpp:

(WebCore::DiagnosticLoggingKeys::siteSpecificQuirkKey):

  • page/DiagnosticLoggingKeys.h:
  • page/Quirks.cpp:

(WebCore::Quirks::shouldBypassBackForwardCache const):

  • page/Quirks.h:
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252300 r252301  
     12019-11-08  Chris Dumez  <cdumez@apple.com>
     2
     3        Add back/forward cache quirk for Vimeo.com
     4        https://bugs.webkit.org/show_bug.cgi?id=204025
     5        <rdar://problem/56996057>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Vimeo.com used to bypass the back/forward cache by serving "Cache-Control: no-store" over HTTPS.
     10        We started caching such content in r250437 but the vimeo.com content unfortunately is not currently compatible
     11        because it changes the opacity of its body to 0 when navigating away and fails to restore the original opacity
     12        when coming back from the back/forward cache (e.g. in 'pageshow' event handler).
     13
     14        To address the issue, this patch introduces a quirk to restore pre-r250437 on Vimeo.com, until they get
     15        a chance to fix their content.
     16
     17        * history/BackForwardCache.cpp:
     18        (WebCore::canCacheFrame):
     19        * page/DiagnosticLoggingKeys.cpp:
     20        (WebCore::DiagnosticLoggingKeys::siteSpecificQuirkKey):
     21        * page/DiagnosticLoggingKeys.h:
     22        * page/Quirks.cpp:
     23        (WebCore::Quirks::shouldBypassBackForwardCache const):
     24        * page/Quirks.h:
     25
    1262019-11-08  Youenn Fablet  <youenn@apple.com>
    227
  • trunk/Source/WebCore/history/BackForwardCache.cpp

    r251357 r252301  
    4646#include "Logging.h"
    4747#include "Page.h"
     48#include "Quirks.h"
    4849#include "ScriptDisallowedScope.h"
    4950#include "Settings.h"
     
    117118
    118119    bool isCacheable = true;
     120
     121    if (frame.isMainFrame() && frame.document()->quirks().shouldBypassBackForwardCache()) {
     122        PCLOG("   -Disabled by site-specific quirk");
     123        logBackForwardCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::siteSpecificQuirkKey());
     124        isCacheable = false;
     125    }
     126
    119127    // Do not cache error pages (these can be recognized as pages with substitute data or unreachable URLs).
    120128    if (documentLoader->substituteData().isValid() && !documentLoader->substituteData().failingURL().isEmpty()) {
  • trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp

    r251275 r252301  
    536536}
    537537
     538String DiagnosticLoggingKeys::siteSpecificQuirkKey()
     539{
     540    return "siteSpecificQuirk"_s;
     541}
     542
    538543String DiagnosticLoggingKeys::streamingMedia()
    539544{
  • trunk/Source/WebCore/page/DiagnosticLoggingKeys.h

    r251275 r252301  
    150150    static String scriptKey();
    151151    static String serviceWorkerKey();
     152    static String siteSpecificQuirkKey();
    152153    WEBCORE_EXPORT static String streamingMedia();
    153154    static String styleSheetKey();
  • trunk/Source/WebCore/page/Quirks.cpp

    r251827 r252301  
    610610}
    611611
    612 }
     612bool Quirks::shouldBypassBackForwardCache() const
     613{
     614    if (!needsQuirks())
     615        return false;
     616
     617    auto topURL = m_document->topDocument().url();
     618    auto host = topURL.host();
     619
     620    // Vimeo.com used to bypass the back/forward cache by serving "Cache-Control: no-store" over HTTPS.
     621    // We started caching such content in r250437 but the vimeo.com content unfortunately is not currently compatible
     622    // because it changes the opacity of its body to 0 when navigating away and fails to restore the original opacity
     623    // when coming back from the back/forward cache (e.g. in 'pageshow' event handler). See <rdar://problem/56996057>.
     624    if (topURL.protocolIs("https") && equalLettersIgnoringASCIICase(host, "vimeo.com")) {
     625        if (auto* documentLoader = m_document->frame() ? m_document->frame()->loader().documentLoader() : nullptr)
     626            return documentLoader->response().cacheControlContainsNoStore();
     627    }
     628
     629    return false;
     630}
     631
     632}
  • trunk/Source/WebCore/page/Quirks.h

    r251827 r252301  
    8383    bool needsFullWidthHeightFullscreenStyleQuirk() const;
    8484
     85    bool shouldBypassBackForwardCache() const;
     86
    8587private:
    8688    bool needsQuirks() const;
Note: See TracChangeset for help on using the changeset viewer.