Title: [285361] trunk/Source/WebKit
Revision
285361
Author
cdu...@apple.com
Date
2021-11-05 20:02:57 -0700 (Fri, 05 Nov 2021)

Log Message

[iOS] IPC decoder for ResourceRequest loses systemPreviewInfo when there is platform data
https://bugs.webkit.org/show_bug.cgi?id=232769

Reviewed by Wenson Hsieh.

The IPC decoder for ResourceRequest decodes systemPreviewInfo and sets it on the ResourceRequest.
It then uses different code paths to decode the rest of the ResourceRequest based on whether or not
there is underlying platform data. If there is underlying platform data, we call decodePlatformData()
which creates a brand-new ResourceRequest, and thus loses the systemPreviewInfo we've just set.

To address the issue, we now decode extra data members *after* decoding platform data instead of
*before*.

This was causing the ProcessSwap.SameOriginSystemPreview API test to fail on iOS with the patch for
Bug 231727.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ResourceRequest>::encode):
(IPC::ArgumentCoder<ResourceRequest>::decode):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (285360 => 285361)


--- trunk/Source/WebKit/ChangeLog	2021-11-06 01:42:22 UTC (rev 285360)
+++ trunk/Source/WebKit/ChangeLog	2021-11-06 03:02:57 UTC (rev 285361)
@@ -1,3 +1,25 @@
+2021-11-05  Chris Dumez  <cdu...@apple.com>
+
+        [iOS] IPC decoder for ResourceRequest loses systemPreviewInfo when there is platform data
+        https://bugs.webkit.org/show_bug.cgi?id=232769
+
+        Reviewed by Wenson Hsieh.
+
+        The IPC decoder for ResourceRequest decodes systemPreviewInfo and sets it on the ResourceRequest.
+        It then uses different code paths to decode the rest of the ResourceRequest based on whether or not
+        there is underlying platform data. If there is underlying platform data, we call decodePlatformData()
+        which creates a brand-new ResourceRequest, and thus loses the systemPreviewInfo we've just set.
+
+        To address the issue, we now decode extra data members *after* decoding platform data instead of
+        *before*.
+
+        This was causing the ProcessSwap.SameOriginSystemPreview API test to fail on iOS with the patch for
+        Bug 231727.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<ResourceRequest>::encode):
+        (IPC::ArgumentCoder<ResourceRequest>::decode):
+
 2021-11-05  Nikolaos Mouchtaris  <nmouchta...@apple.com>
 
         Make scroll bar mode an enum class

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (285360 => 285361)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-11-06 01:42:22 UTC (rev 285360)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-11-06 03:02:57 UTC (rev 285361)
@@ -1188,6 +1188,14 @@
 
 void ArgumentCoder<ResourceRequest>::encode(Encoder& encoder, const ResourceRequest& resourceRequest)
 {
+    if (resourceRequest.encodingRequiresPlatformData()) {
+        encoder << true;
+        encodePlatformData(encoder, resourceRequest);
+    } else {
+        encoder << false;
+        resourceRequest.encodeWithoutPlatformData(encoder);
+    }
+
     encoder << resourceRequest.cachePartition();
     encoder << resourceRequest.hiddenFromInspector();
 
@@ -1198,18 +1206,18 @@
     } else
         encoder << false;
 #endif
-
-    if (resourceRequest.encodingRequiresPlatformData()) {
-        encoder << true;
-        encodePlatformData(encoder, resourceRequest);
-        return;
-    }
-    encoder << false;
-    resourceRequest.encodeWithoutPlatformData(encoder);
 }
 
 bool ArgumentCoder<ResourceRequest>::decode(Decoder& decoder, ResourceRequest& resourceRequest)
 {
+    bool hasPlatformData;
+    if (!decoder.decode(hasPlatformData))
+        return false;
+
+    bool decodeSuccess = hasPlatformData ? decodePlatformData(decoder, resourceRequest) : resourceRequest.decodeWithoutPlatformData(decoder);
+    if (!decodeSuccess)
+        return false;
+
     String cachePartition;
     if (!decoder.decode(cachePartition))
         return false;
@@ -1233,13 +1241,7 @@
     }
 #endif
 
-    bool hasPlatformData;
-    if (!decoder.decode(hasPlatformData))
-        return false;
-    if (hasPlatformData)
-        return decodePlatformData(decoder, resourceRequest);
-
-    return resourceRequest.decodeWithoutPlatformData(decoder);
+    return true;
 }
 
 void ArgumentCoder<ResourceError>::encode(Encoder& encoder, const ResourceError& resourceError)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to