<?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>188843</bug_id>
          
          <creation_ts>2018-08-22 07:29:03 -0700</creation_ts>
          <short_desc>NetworkCache::Storage::lastStableVersion should be a developer-only feature</short_desc>
          <delta_ts>2018-08-23 00:00:17 -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>Page Loading</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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="Antti Koivisto">koivisto</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>beidson</cc>
    
    <cc>cdumez</cc>
    
    <cc>cgarcia</cc>
    
    <cc>commit-queue</cc>
    
    <cc>dbates</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>ggaren</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>mitz</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1452613</commentid>
    <comment_count>0</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2018-08-22 07:29:03 -0700</bug_when>
    <thetext>System WebKit should always delete old cache versions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452614</commentid>
    <comment_count>1</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2018-08-22 07:29:14 -0700</bug_when>
    <thetext>&lt;rdar://problem/43574100&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452625</commentid>
    <comment_count>2</comment_count>
      <attachid>347792</attachid>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2018-08-22 08:10:09 -0700</bug_when>
    <thetext>Created attachment 347792
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452650</commentid>
    <comment_count>3</comment_count>
      <attachid>347792</attachid>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-08-22 09:08:30 -0700</bug_when>
    <thetext>Comment on attachment 347792
patch

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

&gt; Source/WebKit/Shared/mac/ChildProcessMac.mm:743
&gt; +#if PLATFORM(MAC)
&gt; +bool ChildProcess::isSystemWebKit()
&gt; +{
&gt; +    static bool isSystemWebKit = [] {
&gt; +        return [[webKit2Bundle() bundlePath] hasPrefix:@&quot;/System/&quot;];
&gt; +    }();
&gt; +    return isSystemWebKit;
&gt; +}
&gt; +#endif

You can implement this now for all platforms. On non-Cocoa ports, it&apos;s system WebKit #if !ENABLE(DEVELOPER_MODE).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452652</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-08-22 09:09:28 -0700</bug_when>
    <thetext>BTW it would be convenient if ENABLE(DEVELOPER_MODE) was defined on Cocoa ports as well. Currently that only works for CMake ports (so all non-Cocoa ports).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452782</commentid>
    <comment_count>5</comment_count>
      <attachid>347792</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2018-08-22 13:34:11 -0700</bug_when>
    <thetext>Comment on attachment 347792
patch

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

&gt; Source/WebKit/Shared/mac/ChildProcessMac.mm:740
&gt; +    static bool isSystemWebKit = [] {
&gt; +        return [[webKit2Bundle() bundlePath] hasPrefix:@&quot;/System/&quot;];
&gt; +    }();

This will treat an installed development WebKit root or Xcode installed development WebKit as a system install. Is this OK? Otherwise, we should make use of the codesign framework API/SPI to actually check that the process is &quot;restricted&quot; and/or signed by Apple.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452815</commentid>
    <comment_count>6</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2018-08-22 14:50:10 -0700</bug_when>
    <thetext>I think it&apos;s OK to treat installing roots as an &quot;upgrade&quot; event that clears old caches just like a real upgrade would.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452819</commentid>
    <comment_count>7</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2018-08-22 14:55:14 -0700</bug_when>
    <thetext>&gt; BTW it would be convenient if ENABLE(DEVELOPER_MODE) was defined on Cocoa
&gt; ports as well. Currently that only works for CMake ports (so all non-Cocoa
&gt; ports).

I read some of the DEVELOPER_MODE code and I&apos;m not sure I fully understand the concept -- or perhaps I disagree with it. In general, we want the code we test to be the same as the code customers will run. That way, we know that our testing is accurate. But DEVELOPER_MODE seems to be a step away from that.

Maybe you should send email to webkit-dev explaining the thesis of DEVELOPER_MODE and some examples of when to use or not use it. Then we can discuss.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452820</commentid>
    <comment_count>8</comment_count>
      <attachid>347792</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2018-08-22 14:55:38 -0700</bug_when>
    <thetext>Comment on attachment 347792
patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452864</commentid>
    <comment_count>9</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-08-22 15:51:55 -0700</bug_when>
    <thetext>Well the thesis is straightforward: sometimes you really do need to do things differently for developers. For instance, the title of this changelog:

&quot;NetworkCache::Storage::lastStableVersion should be a developer-only feature&quot;

Normally we use it for loading content from the source directory rather than the install prefix. E.g. in developer mode, hyphenation dictionaries, secondary processes, and the InjectedBundle are all loaded from the source directory instead of the install prefix. It would not be very good for developers if the UI process were to try launching the system WebKitWebProcess, for example.

Anyway, you don&apos;t need to enable it for Cocoa here, but you should use it here for other ports, because this is exactly the sort of thing it&apos;s intended for. E.g.:

bool ChildProcess::isSystemWebKit()
{
#if ENABLE(DEVELOPER_MODE)
    return false;
#elif PLATFORM(MAC)
    static bool isSystemWebKit = [] {
        return [[webKit2Bundle() bundlePath] hasPrefix:@&quot;/System/&quot;];
    }();

    return isSystemWebKit;
#else
    return true;
#endif
}

and then you can remove the other PLATFORM(MAC) guards:

#if PLATFORM(MAC)
    /// Allow the last stable version of the cache to co-exist with the latest development one.
    static const unsigned lastStableVersion = 12;
#endif

#if PLATFORM(MAC)
            if (directoryVersion == lastStableVersion)
                return;
#endif

since clearly there&apos;s nothing really platform-specific there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1452995</commentid>
    <comment_count>10</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2018-08-22 23:42:22 -0700</bug_when>
    <thetext>&gt; since clearly there&apos;s nothing really platform-specific there.

The &apos;stable version&apos; here refers to the version a developer likely has installed as system WebKit. That is platform specific. 

(the idea is to prevent newer builds of WebKit unnecessarily wiping out the caches for the system WebKit)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1453005</commentid>
    <comment_count>11</comment_count>
      <attachid>347792</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-08-23 00:00:15 -0700</bug_when>
    <thetext>Comment on attachment 347792
patch

Clearing flags on attachment: 347792

Committed r235220: &lt;https://trac.webkit.org/changeset/235220&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1453006</commentid>
    <comment_count>12</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-08-23 00:00:17 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>347792</attachid>
            <date>2018-08-22 08:10:09 -0700</date>
            <delta_ts>2018-08-23 00:00:15 -0700</delta_ts>
            <desc>patch</desc>
            <filename>cache-old-version-system-3.patch</filename>
            <type>text/plain</type>
            <size>2941</size>
            <attacher name="Antti Koivisto">koivisto</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFNvdXJjZS9XZWJL
aXQvQ2hhbmdlTG9nCShyZXZpc2lvbiAyMzUxNzEpCisrKyBTb3VyY2UvV2ViS2l0L0NoYW5nZUxv
Zwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDIyIEBACisyMDE4LTA4LTIyICBBbnR0aSBLb2l2
aXN0byAgPGFudHRpQGFwcGxlLmNvbT4KKworICAgICAgICBOZXR3b3JrQ2FjaGU6OlN0b3JhZ2U6
Omxhc3RTdGFibGVWZXJzaW9uIHNob3VsZCBiZSBhIGRldmVsb3Blci1vbmx5IGZlYXR1cmUKKyAg
ICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTE4ODg0MworICAg
ICAgICA8cmRhcjovL3Byb2JsZW0vNDM1NzQxMDA+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9C
T0RZIChPT1BTISkuCisKKyAgICAgICAgKiBOZXR3b3JrUHJvY2Vzcy9jYWNoZS9OZXR3b3JrQ2Fj
aGVTdG9yYWdlLmNwcDoKKyAgICAgICAgKFdlYktpdDo6TmV0d29ya0NhY2hlOjpTdG9yYWdlOjpk
ZWxldGVPbGRWZXJzaW9ucyk6CisKKyAgICAgICAgRGVsZXRlIG9sZCBjYWNoZSB2ZXJzaW9ucyB1
bmNvbmRpdGlvbmFsb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