Title: [250483] trunk/Source/WebCore
Revision
250483
Author
[email protected]
Date
2019-09-28 14:38:14 -0700 (Sat, 28 Sep 2019)

Log Message

[Experiment][iOS] Add temporary HTTP header to distinguish iPads for requests to Google
https://bugs.webkit.org/show_bug.cgi?id=202335
<rdar://problem/55790994>

Reviewed by Maciej Stachowiak.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* platform/network/HTTPHeaderNames.in:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (250482 => 250483)


--- trunk/Source/WebCore/ChangeLog	2019-09-28 14:30:40 UTC (rev 250482)
+++ trunk/Source/WebCore/ChangeLog	2019-09-28 21:38:14 UTC (rev 250483)
@@ -1,3 +1,15 @@
+2019-09-28  Chris Dumez  <[email protected]>
+
+        [Experiment][iOS] Add temporary HTTP header to distinguish iPads for requests to Google
+        https://bugs.webkit.org/show_bug.cgi?id=202335
+        <rdar://problem/55790994>
+
+        Reviewed by Maciej Stachowiak.
+
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestResource):
+        * platform/network/HTTPHeaderNames.in:
+
 2019-09-28  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Line::Box should have a const public interface

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (250482 => 250483)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2019-09-28 14:30:40 UTC (rev 250482)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2019-09-28 21:38:14 UTC (rev 250483)
@@ -88,6 +88,10 @@
 #include "CachedTextTrack.h"
 #endif
 
+#if PLATFORM(IOS_FAMILY)
+#include "Device.h"
+#endif
+
 #undef RELEASE_LOG_IF_ALLOWED
 #define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - CachedResourceLoader::" fmt, this, ##__VA_ARGS__)
 
@@ -867,6 +871,18 @@
         }
     }
 
+    // FIXME: This is temporary for <rdar://problem/55790994>.
+#if PLATFORM(IOS) && !PLATFORM(IOSMAC)
+    if (!page.sessionID().isEphemeral() && deviceHasIPadCapability() && request.resourceRequest().url().protocolIs("https")) {
+        RegistrableDomain registrableDomain(request.resourceRequest().url());
+        if (registrableDomain.string().startsWith("google.")) {
+            auto host = request.resourceRequest().url().host();
+            if (host.startsWithIgnoringASCIICase("google.") || host.startsWithIgnoringASCIICase("www.google.") || host.startsWithIgnoringASCIICase("images.google."))
+                request.resourceRequest().setHTTPHeaderField(HTTPHeaderName::XTempTablet, "1"_s);
+        }
+    }
+#endif
+
     LoadTiming loadTiming;
     loadTiming.markStartTimeAndFetchStart();
     InitiatorContext initiatorContext = request.options().initiatorContext;

Modified: trunk/Source/WebCore/platform/network/HTTPHeaderNames.in (250482 => 250483)


--- trunk/Source/WebCore/platform/network/HTTPHeaderNames.in	2019-09-28 14:30:40 UTC (rev 250482)
+++ trunk/Source/WebCore/platform/network/HTTPHeaderNames.in	2019-09-28 21:38:14 UTC (rev 250483)
@@ -104,6 +104,7 @@
 X-WebKit-CSP
 X-WebKit-CSP-Report-Only
 X-XSS-Protection
+X-Temp-Tablet
 
 // These headers are specific to GStreamer.
 Icy-MetaInt
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to