Changeset 251678 in webkit


Ignore:
Timestamp:
Oct 28, 2019 3:10:19 PM (4 years ago)
Author:
Chris Dumez
Message:

Drop code for X-Temp-Tablet HTTP header experiment
https://bugs.webkit.org/show_bug.cgi?id=203524
<rdar://problem/55791195>

Reviewed by Ryosuke Niwa.

  • loader/cache/CachedResourceLoader.cpp:

(WebCore::CachedResourceLoader::CachedResourceLoader):
(WebCore::CachedResourceLoader::requestResource):

  • loader/cache/CachedResourceLoader.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r251668 r251678  
     12019-10-28  Chris Dumez  <cdumez@apple.com>
     2
     3        Drop code for X-Temp-Tablet HTTP header experiment
     4        https://bugs.webkit.org/show_bug.cgi?id=203524
     5        <rdar://problem/55791195>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        * loader/cache/CachedResourceLoader.cpp:
     10        (WebCore::CachedResourceLoader::CachedResourceLoader):
     11        (WebCore::CachedResourceLoader::requestResource):
     12        * loader/cache/CachedResourceLoader.h:
     13
    1142019-10-28  Simon Fraser  <simon.fraser@apple.com>
    215
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r251637 r251678  
    154154}
    155155
    156 #if PLATFORM(IOS) && !PLATFORM(IOSMAC)
    157 static bool isXTempTabletHeaderExperimentOver()
    158 {
    159     DateComponents date;
    160     date.setMillisecondsSinceEpochForMonth(WallTime::now().secondsSinceEpoch().milliseconds());
    161     // End of experiment is 02-01-2020.
    162     return date.fullYear() > 2020 || (date.fullYear() == 2020 && date.month() >= 1);
    163 }
    164 #endif
    165 
    166156CachedResourceLoader::CachedResourceLoader(DocumentLoader* documentLoader)
    167157    : m_document(nullptr)
     
    173163    , m_imagesEnabled(true)
    174164    , m_allowStaleResources(false)
    175 #if PLATFORM(IOS) && !PLATFORM(IOSMAC)
    176     , m_isXTempTabletHeaderExperimentOver(isXTempTabletHeaderExperimentOver())
    177 #endif
    178165{
    179166}
     
    795782    return FetchOptions::Destination::EmptyString;
    796783}
    797 
    798 #if PLATFORM(IOS) && !PLATFORM(IOSMAC)
    799 static bool isGoogleSearch(const URL& url)
    800 {
    801     if (!url.protocolIs("https"))
    802         return false;
    803 
    804     RegistrableDomain registrableDomain(url);
    805     if (!registrableDomain.string().startsWith("google."))
    806         return false;
    807 
    808     auto host = url.host();
    809     return host.startsWithIgnoringASCIICase("google.") || host.startsWithIgnoringASCIICase("www.google.") || host.startsWithIgnoringASCIICase("images.google.");
    810 }
    811 
    812 bool CachedResourceLoader::shouldSendXTempTabletHeader(CachedResource::Type type, Frame& frame, const URL& url) const
    813 {
    814     if (m_isXTempTabletHeaderExperimentOver || !IOSApplication::isMobileSafari())
    815         return false;
    816 
    817     if (!isGoogleSearch(url))
    818         return false;
    819 
    820     if (type == CachedResource::Type::MainResource && frame.isMainFrame())
    821         return true;
    822 
    823     auto* topDocument = frame.mainFrame().document();
    824     return topDocument && isGoogleSearch(topDocument->url());
    825 }
    826 #endif
    827784
    828785ResourceErrorOr<CachedResourceHandle<CachedResource>> CachedResourceLoader::requestResource(CachedResource::Type type, CachedResourceRequest&& request, ForPreload forPreload, ImageLoading imageLoading)
     
    918875    }
    919876
    920     // FIXME: This is temporary for <rdar://problem/55790994>.
    921 #if PLATFORM(IOS) && !PLATFORM(IOSMAC)
    922     if (deviceHasIPadCapability() && shouldSendXTempTabletHeader(type, frame, request.resourceRequest().url()))
    923         request.resourceRequest().setHTTPHeaderField(HTTPHeaderName::XTempTablet, "1"_s);
    924 #endif
    925 
    926877    LoadTiming loadTiming;
    927878    loadTiming.markStartTimeAndFetchStart();
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.h

    r251637 r251678  
    193193    bool canRequestInContentDispositionAttachmentSandbox(CachedResource::Type, const URL&) const;
    194194
    195 #if PLATFORM(IOS) && !PLATFORM(IOSMAC)
    196     bool shouldSendXTempTabletHeader(CachedResource::Type, Frame&, const URL&) const;
    197 #endif
    198 
    199195    HashSet<String> m_validatedURLs;
    200196    mutable DocumentResourceMap m_documentResources;
     
    216212    bool m_imagesEnabled : 1;
    217213    bool m_allowStaleResources : 1;
    218 #if PLATFORM(IOS) && !PLATFORM(IOSMAC)
    219     bool m_isXTempTabletHeaderExperimentOver : 1;
    220 #endif
    221214};
    222215
Note: See TracChangeset for help on using the changeset viewer.