<?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>179673</bug_id>
          
          <creation_ts>2017-11-14 10:38:02 -0800</creation_ts>
          <short_desc>Mark WebChromeClient::requestStorageAccess() as final</short_desc>
          <delta_ts>2017-11-21 17:06:03 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>WebKit Local Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Daniel Bates">dbates</reporter>
          <assigned_to name="Daniel Bates">dbates</assigned_to>
          <cc>buildbot</cc>
    
    <cc>darin</cc>
    
    <cc>sam</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wilander</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1371432</commentid>
    <comment_count>0</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-11-14 10:38:02 -0800</bug_when>
    <thetext>Mark WebChromeClient::requestStorageAccess() as final so that we actually call it through a ChromeClient pointer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1371436</commentid>
    <comment_count>1</comment_count>
      <attachid>326888</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-11-14 10:41:05 -0800</bug_when>
    <thetext>Created attachment 326888
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1371437</commentid>
    <comment_count>2</comment_count>
    <who name="Build Bot">buildbot</who>
    <bug_when>2017-11-14 10:42:28 -0800</bug_when>
    <thetext>Attachment 326888 did not pass style-queue:


ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:345:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1371525</commentid>
    <comment_count>3</comment_count>
      <attachid>326888</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-11-14 12:48:53 -0800</bug_when>
    <thetext>Comment on attachment 326888
Patch

Clearing flags on attachment: 326888

Committed r224835: &lt;https://trac.webkit.org/changeset/224835&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1371526</commentid>
    <comment_count>4</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-11-14 12:48:55 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1371856</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-11-15 09:30:52 -0800</bug_when>
    <thetext>&lt;rdar://problem/35561841&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1374053</commentid>
    <comment_count>6</comment_count>
      <attachid>326888</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2017-11-21 09:18:53 -0800</bug_when>
    <thetext>Comment on attachment 326888
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=326888&amp;action=review

&gt; Source/WebKit/ChangeLog:9
&gt; +        Mark WebChromeClient::requestStorageAccess() as final so that it overrides the virtual function
&gt; +        in ChromeClient with the same name and hence we actually call it through a ChromeClient pointer.

This comment doesn’t make sense to me. If a function signature matches, then it will override the virtual function. It doesn’t need to be marked &quot;final&quot; or &quot;override&quot; to do that.

It’s OK to mark this final so that we’d get an error if the function signature didn’t match, and so that if it’s called directly it can use a non-polymorphic function call.

On the other hand, I would have expected to get a warning if this is overriding and not marked final in a class that uses override and final. Maybe I don’t understand how the clang warning works. Maybe it works better if you use just override and not final?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1374116</commentid>
    <comment_count>7</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-11-21 17:02:41 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #6)
&gt; Comment on attachment 326888 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=326888&amp;action=review
&gt; 
&gt; &gt; Source/WebKit/ChangeLog:9
&gt; &gt; +        Mark WebChromeClient::requestStorageAccess() as final so that it overrides the virtual function
&gt; &gt; +        in ChromeClient with the same name and hence we actually call it through a ChromeClient pointer.
&gt; 
&gt; This comment doesn’t make sense to me. 

You’re right! This is nonsensical. I was trying to convey that this function could hide the virtual function of the same name if it is not marked final (or override) and its signature changes from that of the base class virtual function. And that this bug could be concealed if all callers of this function called through a derived class pointer. You expressed this more succinctly in the first sentence of your third paragraph.

&gt; If a function signature matches, then
&gt; it will override the virtual function. It doesn’t need to be marked &quot;final&quot;
&gt; or &quot;override&quot; to do that.
&gt; 
&gt; It’s OK to mark this final so that we’d get an error if the function
&gt; signature didn’t match, and so that if it’s called directly it can use a
&gt; non-polymorphic function call.
&gt; 
&gt; On the other hand, I would have expected to get a warning if this is
&gt; overriding and not marked final in a class that uses override and final.

I expected this too. I did not see any bot failures on build WebKit.org at the time I posted this patch. However my version of clang did emit a warning about this function. Therefore I posted this patch. I was building with Apple internal software so maybe the calling code is guarded by some kind of macro guard that is enabled for me or maybe there is a bug in the clang version we are using on build.webkit.org/EWS. I did not check. I am not near a computer to check at the moment.

&gt; Maybe I don’t understand how the clang warning works. Maybe it works better
&gt; if you use just override and not final?

It should work the same. With regards to using override vs final, I like using final to convey that we do not expect further overrides (at the time of writing) and to allow the compiler to replace the call with a non-polymorphic function call as you pointed out above.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1374118</commentid>
    <comment_count>8</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-11-21 17:06:03 -0800</bug_when>
    <thetext>(In reply to Daniel Bates from comment #7)
&gt; (In reply to Darin Adler from comment #6)
&gt; &gt; Comment on attachment 326888 [details]
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; https://bugs.webkit.org/attachment.cgi?id=326888&amp;action=review
&gt; &gt; 
&gt; &gt; &gt; Source/WebKit/ChangeLog:9
&gt; &gt; &gt; +        Mark WebChromeClient::requestStorageAccess() as final so that it overrides the virtual function
&gt; &gt; &gt; +        in ChromeClient with the same name and hence we actually call it through a ChromeClient pointer.
&gt; &gt; 
&gt; &gt; This comment doesn’t make sense to me. 
&gt; 
&gt; [...]
&gt; You expressed this more succinctly in the first sentence of your third paragraph.
&gt; 

*more succinctly and correctly phrased</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>326888</attachid>
            <date>2017-11-14 10:41:05 -0800</date>
            <delta_ts>2017-11-14 12:48:53 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-179673-20171114104104.patch</filename>
            <type>text/plain</type>
            <size>1628</size>
            <attacher name="Daniel Bates">dbates</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjI0ODE2CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCmluZGV4IDllMjM2Mzg4MDAyODE1NGVl
ZmE4ZTNhN2U2NGViMmZhY2Y2MWI0YTUuLjQyZTc1MmM1NzIyMzI1NGU2OTZmNDJjODU2NTQ4MzBi
MzkxOTk1YzAgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJLaXQvQ2hhbmdl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