<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>258608</bug_id>
          
          <creation_ts>2023-06-27 23:44:12 -0700</creation_ts>
          <short_desc>Generated IPC serializers for MoveOnlyBaseClass&amp;&amp; are incorrect</short_desc>
          <delta_ts>2023-10-27 00:22:08 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=257581</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>257580</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Kimmo Kinnunen">kkinnunen</reporter>
          <assigned_to name="Matt Woodrow">mattwoodrow</assigned_to>
          <cc>g_squelart</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1963960</commentid>
    <comment_count>0</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2023-06-27 23:44:12 -0700</bug_when>
    <thetext>Generated IPC serializers forMoveOnlyBaseClass&amp;&amp; are incorrect

It appears that the code tries to implement move through base class rvalue reference. It is not possible in general case following c++ rvalue semantics, as rvalue constructors are not polymorphic.

Move makes no sense:

void ArgumentCoder&lt;WebCore::MoveOnlyBaseClass&gt;::encode(Encoder&amp; encoder, WebCore::MoveOnlyBaseClass&amp;&amp; instance)
{
    if (auto* subclass = dynamicDowncast&lt;WebCore::MoveOnlyDerivedClass&gt;(instance)) {
        encoder &lt;&lt; WebCore_MoveOnlyBaseClass_Subclass::MoveOnlyDerivedClass;
        encoder &lt;&lt; WTFMove(*subclass);
        return;
    }
    ASSERT_NOT_REACHED();
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1965059</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-07-04 23:45:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/111768907&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1987924</commentid>
    <comment_count>2</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2023-10-27 00:22:08 -0700</bug_when>
    <thetext>Maybe you&apos;re right that when using downcast, it is consistent with by-ref encoding.
I don&apos;t remember what was the idea why it&apos;s bad. The only thing I could re-comeup with is that MoveOnlyDerivedClass might not be the final class, so then moving parts of the class is not ok. Comparing to by-ref encoding, copying only part of the class is ok from the safety perspective. However, it&apos;s not probably intended so both would be equally buggy and as such rvalue ref code would be consistent with ref code.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>