<?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>146041</bug_id>
          
          <creation_ts>2015-06-16 19:12:19 -0700</creation_ts>
          <short_desc>[GTK] Reimplement webkit_web_context_clear_cache functionality.</short_desc>
          <delta_ts>2016-03-14 06:36:44 -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>WebKitGTK</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugzilla.gnome.org/show_bug.cgi?id=763456</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Carlos Alberto Lopez Perez">clopez</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>berto</cc>
    
    <cc>cgarcia</cc>
    
    <cc>commit-queue</cc>
    
    <cc>gustavo</cc>
    
    <cc>gyuyoung.kim</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>mrobinson</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1102444</commentid>
    <comment_count>0</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2015-06-16 19:12:19 -0700</bug_when>
    <thetext>r185615 &lt;http://trac.webkit.org/changeset/185615&gt; removed WebResourceCacheManager, which was used by the GTK port in webkit_web_context_clear_cache() at Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp

The functionality should be reimplemented (in terms of WebsiteDataStore).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1102497</commentid>
    <comment_count>1</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2015-06-16 23:45:33 -0700</bug_when>
    <thetext>Maybe it&apos;s time to deprecate this method. It&apos;s very confusing, and untested. It says clear cache, as if there were only one cache. Epiphany uses it to clear the disk cache, but as a side effect, the memory cache is cleared as well. We could probably expose the WebsiteDataStore in our API. It would allow to manage all caches and storage (memory cache, disk cache, local storage and indexedDB databases, etc.), and with some more control, like clearing only a cache for a particular security origin.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1102509</commentid>
    <comment_count>2</comment_count>
      <attachid>255006</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2015-06-17 01:28:36 -0700</bug_when>
    <thetext>Created attachment 255006
Patch

This should fix the regression</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1102510</commentid>
    <comment_count>3</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2015-06-17 01:30:09 -0700</bug_when>
    <thetext>Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1102520</commentid>
    <comment_count>4</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2015-06-17 03:04:15 -0700</bug_when>
    <thetext>I noticed we don&apos;t have a regression test for this. Should we add one?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1102521</commentid>
    <comment_count>5</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2015-06-17 03:41:19 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; I noticed we don&apos;t have a regression test for this. Should we add one?

I don&apos;t think it&apos;s worth it, we could check that the disk cache is cleared, but not that the memory cache is, at least I don&apos;t know how to do that. I think it&apos;s better to deprecate this, and expose WebsiteDataStore with proper unit tests.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1102545</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2015-06-17 08:13:08 -0700</bug_when>
    <thetext>We should do that anyway, so that we can fix the clear personal data dialog in Epiphany, that&apos;s currently only able to clear a subset of your personal data.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1105186</commentid>
    <comment_count>7</comment_count>
      <attachid>255006</attachid>
    <who name="Anders Carlsson">andersca</who>
    <bug_when>2015-06-27 10:46:21 -0700</bug_when>
    <thetext>Comment on attachment 255006
Patch

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

&gt; Source/WebKit2/WebProcess/WebProcess.cpp:1182
&gt; +#endif

Disk cache isn&apos;t the same as all resource caches.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1127501</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2015-09-20 09:00:33 -0700</bug_when>
    <thetext>I forgot that this API is broken.

Anders, the problem is that WebProcess::deleteWebsiteData thinks the web process is only responsible for clearing the memory cache, which is true on Macs, but on the Soup port it is also needs to clear the soup disk cache if the network process is enabled. (Our thinking is to eventually mandate running the network process and get rid of the soup cache entirely, but that hasn&apos;t happened yet.) platformClearResourceCaches will only ever clear the disk cache on the soup port, and the code is in an ifdef, so platformClearResourceCaches(AllResourceCaches) is the right thing to do; the only other flag would be ResourceCaches::InMemoryResourceCachesOnly, which would cause the function to do nothing.

Alternatives:

* We could add a new function with a more specific name, but then we are just going to need another #ifdef in the header file.

* We could add a new platformClearDiskCache function, which would be a no-op on all other ports. This is my preference, since it avoids ifdefs in the cross-platform files.

* We could copypaste the contents of platformClearResourceCaches into the ifdef, but that rather defeats the purpose of having the platform functions.

* We could clear the disk cache in webkit_web_context_clear_cache, but that would leave WebProcess::deleteWebsiteData broken.

Regardless, we should change both WebProcess::deleteWebsiteData and WebProcess::deleteWebsiteDataForOrigins. Carlos, you fixed WebProcess::deleteWebsiteData, but it seems WebProcess::deleteWebsiteDataForOrigins is what the WebsiteDataManager uses.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1127502</commentid>
    <comment_count>9</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2015-09-20 09:07:00 -0700</bug_when>
    <thetext>I guess it would be odd for WebProcess::deleteWebsiteDataForOrigins to delete the entire disk cache, but it must, since there is no tracking of which resources correspond to which origin. This is fine since applications should be prepared for the entire cache to disappear at any time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1138306</commentid>
    <comment_count>10</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2015-11-01 06:37:26 -0800</bug_when>
    <thetext>Carlos, got time to deal with this? I think your original patch, which currently has r-, is the best approach, except:

(In reply to comment #8)
&gt; Regardless, we should change both WebProcess::deleteWebsiteData and
&gt; WebProcess::deleteWebsiteDataForOrigins. Carlos, you fixed
&gt; WebProcess::deleteWebsiteData, but it seems
&gt; WebProcess::deleteWebsiteDataForOrigins is what the WebsiteDataManager uses.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1143066</commentid>
    <comment_count>11</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2015-11-18 16:20:08 -0800</bug_when>
    <thetext>We agreed at the Contributors Meeting to make network process mandatory; that will unblock this, since we&apos;ll no longer need to worry about the soup cache.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1143226</commentid>
    <comment_count>12</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2015-11-19 00:20:42 -0800</bug_when>
    <thetext>we need to fix this in 2.10 branch in any case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1152167</commentid>
    <comment_count>13</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-01-03 15:41:36 -0800</bug_when>
    <thetext>(In reply to comment #12)
&gt; we need to fix this in 2.10 branch in any case.

My vote is to not bother. The GTK+ port does not use the soup cache anymore; only EFL does. I think EFL should switch to use the network cache (which will hopefully be painless) so that USE(SOUP) implies ENABLE(NETWORK_CACHE); then we can remove all our soup cache code. You already taught the network process to clear the soup cache on startup when the network cache is enabled, so we won&apos;t have to worry about it anymore.

In summary:

 * This patch&apos;s changes to WebKitWebContext.cpp are good as-is, r=me.
 * I do not particularly want the change to WebProcess.cpp in trunk.
    * That change is fine for the 2.10 branch, but you must be sure to change WebProcess::deleteWebsiteDataForOrigins as well; otherwise, the change is broken!
 * I am changing this to r+ on the basis that I have asked you to remove from this patch the change that Anders objected to when he gave this r-.

Sound good?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1174431</commentid>
    <comment_count>14</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2016-03-14 06:36:44 -0700</bug_when>
    <thetext>Committed r198124: &lt;http://trac.webkit.org/changeset/198124&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>255006</attachid>
            <date>2015-06-17 01:28:36 -0700</date>
            <delta_ts>2016-01-03 15:42:03 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>wk2-clear-cache.diff</filename>
            <type>text/plain</type>
            <size>2528</size>
            <attacher name="Carlos Garcia Campos">cgarcia</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJLaXQyL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQyL0No
YW5nZUxvZwppbmRleCAzM2FlYzVkLi45ZWZjZWM5IDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViS2l0
Mi9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYktpdDIvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTkg
QEAKKzIwMTUtMDYtMTcgIENhcmxvcyBHYXJ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          status="+"
          setter="mcatanzaro"
    />
          </attachment>
      

    </bug>

</bugzilla>