<?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>119477</bug_id>
          
          <creation_ts>2013-08-04 02:10:13 -0700</creation_ts>
          <short_desc>[GStreamer] Store preloaded media in webkit&apos;s cache</short_desc>
          <delta_ts>2018-01-09 07:06:39 -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>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=755280</see_also>
    
    <see_also>https://bugzilla.gnome.org/show_bug.cgi?id=761035</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=156369</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Philippe Normand">pnormand</reporter>
          <assigned_to name="Enrique Ocaña">eocanha</assigned_to>
          <cc>aperez</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>calvaris</cc>
    
    <cc>cgarcia</cc>
    
    <cc>clopez</cc>
    
    <cc>commit-queue</cc>
    
    <cc>cristian.ciupitu</cc>
    
    <cc>csaavedra</cc>
    
    <cc>eocanha</cc>
    
    <cc>ht990332</cc>
    
    <cc>magomez</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>slomo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>914435</commentid>
    <comment_count>0</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2013-08-04 02:10:13 -0700</bug_when>
    <thetext>Right now preloaded videos go to ~/.cache but they should be stored in the webkit&apos;s cache folder instead.

The cache location can be configured using queue2::temp-location property but I&apos;m not sure yet how to access the right queue2 element at runtime. Some investigation is needed :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>917044</commentid>
    <comment_count>1</comment_count>
    <who name="Sebastian Dröge (slomo)">slomo</who>
    <bug_when>2013-08-14 02:07:23 -0700</bug_when>
    <thetext>It currently is impossible to do that properly, best solution would probably be to expose that queue2 property on uridecodebin and playbin.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1127621</commentid>
    <comment_count>2</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2015-09-21 06:16:07 -0700</bug_when>
    <thetext>Is that cache permanent? I mean, can it be reused among sessions? Otherwise I don&apos;t think it should be stored in the home dir at all, but in /tmp</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1127622</commentid>
    <comment_count>3</comment_count>
    <who name="Claudio Saavedra">csaavedra</who>
    <bug_when>2015-09-21 06:17:49 -0700</bug_when>
    <thetext>Carlos nailed it. If it cannot be reused between sessions then it doesn&apos;t belong in .cache.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1127624</commentid>
    <comment_count>4</comment_count>
    <who name="Sebastian Dröge (slomo)">slomo</who>
    <bug_when>2015-09-21 06:38:58 -0700</bug_when>
    <thetext>It can be used between sessions if webkit gives an appropriate name to the files IIRC. But yes, it should probably go into g_get_tmp_dir(). Main problem with that is that some people put /tmp on a tmpfs... so if you want to watch a long enough movie, your memory runs full.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1127625</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2015-09-21 06:46:26 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; It can be used between sessions if webkit gives an appropriate name to the
&gt; files IIRC. But yes, it should probably go into g_get_tmp_dir(). Main
&gt; problem with that is that some people put /tmp on a tmpfs... so if you want
&gt; to watch a long enough movie, your memory runs full.

/tmp on tmpfs has been default in Fedora for several years now... I was amazed quite recently to learn that other distros are still not doing this. Anyway, the videos would have to go in /var/tmp since they are big. But /var/tmp is not cleaned automatically, so there needs to be some measure to clean up leaked videos in the event of a web process crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1127646</commentid>
    <comment_count>6</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2015-09-21 08:58:22 -0700</bug_when>
    <thetext>The UIProcess is notified when the WebProcess crashes, so perhaps we could do the clean-up at that moment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1127965</commentid>
    <comment_count>7</comment_count>
    <who name="Sebastian Dröge (slomo)">slomo</who>
    <bug_when>2015-09-22 02:13:58 -0700</bug_when>
    <thetext>Or you could make the videos actually cacheable so they can be reused in future sessions until cleared from the cache ;)


Cleaning up from the webprocess crashes would mean that you need to have a way to identify which files belong to the pid of the crashed process</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1158108</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-01-24 06:59:41 -0800</bug_when>
    <thetext>Note that we&apos;ve gotten multiple reports of ~/.cache rising to excessive size; apparently there is no way to clean up cached video files if there is a web process crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1260725</commentid>
    <comment_count>9</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-12-16 13:23:47 -0800</bug_when>
    <thetext>CCing some media folks... how do we want to go about solving this?

Anything cached should go under WebKitWebsiteDataManager&apos;s base-cache-dir if it&apos;s persistent, or /var/tmp otherwise.

Note that we have to be robust to UI process crashes as well. That happens. We are already careful to never leak in the normal disk cache.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1262364</commentid>
    <comment_count>10</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-12-22 12:52:54 -0800</bug_when>
    <thetext>Probably bug #156369 needs to be fixed at the same time as this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1262365</commentid>
    <comment_count>11</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-12-22 12:53:29 -0800</bug_when>
    <thetext>(Changing component just so that we can find this bug again.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1262560</commentid>
    <comment_count>12</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2016-12-23 09:42:47 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; It can be used between sessions if webkit gives an appropriate name to the
&gt; &gt; files IIRC. But yes, it should probably go into g_get_tmp_dir(). Main
&gt; &gt; problem with that is that some people put /tmp on a tmpfs... so if you want
&gt; &gt; to watch a long enough movie, your memory runs full.
&gt; 
&gt; /tmp on tmpfs has been default in Fedora for several years now... I was
&gt; amazed quite recently to learn that other distros are still not doing this.
&gt; Anyway, the videos would have to go in /var/tmp since they are big. But
&gt; /var/tmp is not cleaned automatically, so there needs to be some measure to
&gt; clean up leaked videos in the event of a web process crash.

I suggest removing the file just after opening it for write.

That way you can continue to use the file for reading or writing to it, by passing the file descriptor id.

The kernel will automatically remove the file once the descriptor id is closed or the process holding the file descriptor id dies (crashes or exits)

So you not longer have to take care of cleaning the files. The file will be automatically cleaned when you not longer use it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1262565</commentid>
    <comment_count>13</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2016-12-23 09:59:15 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; It can be used between sessions if webkit gives an appropriate name to the
&gt; &gt; files IIRC. But yes, it should probably go into g_get_tmp_dir(). Main
&gt; &gt; problem with that is that some people put /tmp on a tmpfs... so if you want
&gt; &gt; to watch a long enough movie, your memory runs full.
&gt; 
&gt; /tmp on tmpfs has been default in Fedora for several years now... 

Personally, I don&apos;t think /tmp on tmpfs is a good idea.

In the worst case (you have configured your system without swap) you end wasting precious memory space for tmp files. Which is nuts.

In the best case, you end wasting swap space and risking incurring in more swappiness related freezes than otherwise you would have.

/tmp on tmpfs supporters main argument was they were worried about incrementing their SSD wearing level more than needed. This has been exaggerated a lot. I still have to find anyone that has nuked their SSD because of not having /tmp on tmpfs.

Related:
https://lists.debian.org/debian-devel/2012/05/msg01092.html
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666096</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1262736</commentid>
    <comment_count>14</comment_count>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2016-12-26 04:08:13 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; It can be used between sessions if webkit gives an appropriate name to the
&gt; &gt; files IIRC. But yes, it should probably go into g_get_tmp_dir(). Main
&gt; &gt; problem with that is that some people put /tmp on a tmpfs... so if you want
&gt; &gt; to watch a long enough movie, your memory runs full.
&gt; 
&gt; /tmp on tmpfs has been default in Fedora for several years now... I was
&gt; amazed quite recently to learn that other distros are still not doing this.
&gt; Anyway, the videos would have to go in /var/tmp since they are big. But
&gt; /var/tmp is not cleaned automatically, so there needs to be some measure to
&gt; clean up leaked videos in the event of a web process crash.

A naive suggestion would be to treat /var/tmp as system storing /tmp on disk treat it. Those systems clean /tmp on boot. My suggestion is to use /var/tmp/${USER}/WebKit-media (or some better name) as &quot;tmp&quot;, and not cleaning it at webprocess&apos; death (which can be uncontrolled in the very worst case), but at WebKit start. Each time WebKit starts, it cleans the previous &quot;tmp&quot;.

More efficient approaches can be implemented on top of that, but I think this one could be fine as a baseline.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1263287</commentid>
    <comment_count>15</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2017-01-02 04:49:36 -0800</bug_when>
    <thetext>(In reply to comment #12)
&gt; (In reply to comment #5)
&gt; &gt; (In reply to comment #4)
&gt; &gt; &gt; It can be used between sessions if webkit gives an appropriate name to the
&gt; &gt; &gt; files IIRC. But yes, it should probably go into g_get_tmp_dir(). Main
&gt; &gt; &gt; problem with that is that some people put /tmp on a tmpfs... so if you want
&gt; &gt; &gt; to watch a long enough movie, your memory runs full.
&gt; &gt; 
&gt; &gt; /tmp on tmpfs has been default in Fedora for several years now... I was
&gt; &gt; amazed quite recently to learn that other distros are still not doing this.
&gt; &gt; Anyway, the videos would have to go in /var/tmp since they are big. But
&gt; &gt; /var/tmp is not cleaned automatically, so there needs to be some measure to
&gt; &gt; clean up leaked videos in the event of a web process crash.

This is not necessarily true, many (most?) GNU/Linux distributions clean
“/var/tmp”:

  % grep &apos;/var/tmp &apos; /usr/lib/tmpfiles.d/tmp.conf
  q /var/tmp 1777 root root 30d
  %

Still, using “/var/tmp” is not a good option because many systems are known
*not to* clean it by default ({Free,Open,Net}BSD), and applications are
expected to clean up after themselves when creating files under ”/var/tmp”.

&gt; I suggest removing the file just after opening it for write.

+1

If we can make GStreamer happy without having named files, passing the FD
around is the absolute best option.

&gt; That way you can continue to use the file for reading or writing to it, by
&gt; passing the file descriptor id.
&gt; 
&gt; The kernel will automatically remove the file once the descriptor id is
&gt; closed or the process holding the file descriptor id dies (crashes or exits)
&gt; 
&gt; So you not longer have to take care of cleaning the files. The file will be
&gt; automatically cleaned when you not longer use it.

As an additional small side bonus unlinking the file after opening causes less name space pollution in the directory used for temporary files. Which reduces
contention for creating new temporary files — anyway this is most likely 
irrelevant for web browsing, but still nice :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1263311</commentid>
    <comment_count>16</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-01-02 08:12:52 -0800</bug_when>
    <thetext>(In reply to comment #15)
&gt; This is not necessarily true, many (most?) GNU/Linux distributions clean
&gt; “/var/tmp”:

You&apos;re right, systemd does this, even when the GNOME option to clean temporary files is disabled....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1271822</commentid>
    <comment_count>17</comment_count>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2017-01-31 11:59:38 -0800</bug_when>
    <thetext>Today I tried to solve this by setting the temp-remove[1] property of GstDownloadBuffer to true, only to find that it&apos;s already true by default and that the &quot;delete on READY&quot; statement in the documentation doesnt refer to the NULL -&gt; READY -&gt; PAUSED -&gt; PLAYING transition (ie: delete after creation), but to the PLAYING -&gt; PAUSED -&gt; READY -&gt; NULL one (ie: delete on destruction, the current behaviour).

I guess I&apos;ll have to try a different approach and delete the file by myself.


[1] https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-downloadbuffer.html#GstDownloadBuffer--temp-remove</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272165</commentid>
    <comment_count>18</comment_count>
      <attachid>300331</attachid>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2017-02-01 09:41:20 -0800</bug_when>
    <thetext>Created attachment 300331
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272181</commentid>
    <comment_count>19</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-02-01 10:04:23 -0800</bug_when>
    <thetext>LGTM. Would be good for a GStreamer reviewer to review it. Please add it to https://trac.webkit.org/wiki/WebKitGTK/2.14.x after committing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272191</commentid>
    <comment_count>20</comment_count>
      <attachid>300331</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2017-02-01 10:29:48 -0800</bug_when>
    <thetext>Comment on attachment 300331
Patch

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

&gt; Source/WebCore/ChangeLog:13
&gt; +        Files cached on disk by MediaPlayerPrivateGStreamer are deleted only when the player is closed. If the
&gt; +        WebProcess crashed, they&apos;re just left there in the cache directory. This patch changes the location
&gt; +        of those temporary files to a proper temporary directory (/var/tmp, as those files aren&apos;t actually
&gt; +        reusable, so they don&apos;t belong to a cache directory, and /tmp is a bad place because it&apos;s RAM-based on
&gt; +        some distros), unlinks (deletes) them right after creation and also deletes any other stalled temporary
&gt; +        file on the old legacy cache directory.

Wouldn&apos;t it be a problem if /var is in a different partition? I&apos;m not sure if the solution to leaked files is placing them in /tmp to be honest. If we can decide the folder, then we can use a specific one in the user cache dir, and clean it up at startup, for example.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1348
&gt; +    if (!g_strcmp0(className, &quot;GstDownloadBuffer&quot;)) {

Early return here instead.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1350
&gt; +        g_signal_handlers_disconnect_by_func(bin, gpointer(uriDecodeBinElementAddedCallback), player);

Use C++ style casts

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1358
&gt; +            processName = &quot;GStreamer&quot;;

shouldn&apos;t it be WebKitWebProcess by default?

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1360
&gt; +        GUniquePtr&lt;gchar&gt; newDownloadTemplate(g_strdup_printf(&quot;/var/tmp/%s-XXXXXX&quot;, processName));

Use g_build_filename

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1364
&gt; +        player-&gt;purgeOldDownloadFiles(oldDownloadTemplate.get());

So, if we purge the old files, then we don&apos;t really need to use /var/tmp, no?

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1372
&gt; +    g_signal_handlers_disconnect_by_func(player-&gt;m_downloadBuffer.get(), gpointer(downloadBufferFileCreatedCallback), player);

Use C++ style cast

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1379
&gt; +    GUniqueOutPtr&lt;gchar&gt; downloadFile;
&gt; +    g_object_get(player-&gt;m_downloadBuffer.get(), &quot;temp-location&quot;, &amp;downloadFile.outPtr(), nullptr);
&gt; +    if (g_unlink(downloadFile.get()) == -1)
&gt; +        GST_WARNING(&quot;Couldn&apos;t unlink media temporary file %s after creation&quot;, downloadFile.get());
&gt; +    else
&gt; +        GST_TRACE(&quot;Unlinked media temporary file %s after creation&quot;, downloadFile.get());

Do we need a signal for this? Doesn&apos;t gst changes it when g_object_set(element, &quot;temp-template&quot;, synchronously?

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1411
&gt; +    GDir* directory = g_dir_open(templatePath.get(), 0, nullptr);
&gt; +
&gt; +    if (!directory)
&gt; +        return;
&gt; +
&gt; +    for (const gchar* fileName = g_dir_read_name(directory); fileName; fileName = g_dir_read_name(directory)) {
&gt; +        if (g_str_has_prefix(fileName, templateFile.get())) {
&gt; +            GUniquePtr&lt;gchar&gt; filePath(g_build_filename(templatePath.get(), fileName, nullptr));
&gt; +            if (g_unlink(filePath.get()) == -1)
&gt; +                GST_WARNING(&quot;Couldn&apos;t unlink legacy media temporary file: %s&quot;, filePath.get());
&gt; +            else
&gt; +                GST_TRACE(&quot;Unlinked legacy media temporary file: %s&quot;, filePath.get());
&gt; +        }
&gt; +    }

You can simplify this by using FileSystem::listDirectory(), you can pass a regexp to mathc the files directly

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1418
&gt;      m_source.clear();

You should disconnect previous signals here and in the destructor I guess, since you are disconnecting only if the signals was emitted.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:249
&gt; +    GRefPtr&lt;GstElement&gt; m_downloadBuffer;

Do we really want to keepo this buffer object alive for the whole life of the media platyer? Or can we release it at some point?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272197</commentid>
    <comment_count>21</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-02-01 10:48:34 -0800</bug_when>
    <thetext>(In reply to comment #20)
&gt; Wouldn&apos;t it be a problem if /var is in a different partition?

Why would that be a problem?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272231</commentid>
    <comment_count>22</comment_count>
      <attachid>300331</attachid>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2017-02-01 12:25:37 -0800</bug_when>
    <thetext>Comment on attachment 300331
Patch

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

Thanks for the rest of the comments I&apos;m not replying, they&apos;re really useful.

&gt;&gt; Source/WebCore/ChangeLog:13
&gt;&gt; +        file on the old legacy cache directory.
&gt; 
&gt; Wouldn&apos;t it be a problem if /var is in a different partition? I&apos;m not sure if the solution to leaked files is placing them in /tmp to be honest. If we can decide the folder, then we can use a specific one in the user cache dir, and clean it up at startup, for example.

I don&apos;t think GstDownloadBuffer is ready to reuse the media files between sessions with its current design, so as per https://bugs.webkit.org/show_bug.cgi?id=119477#c2 and https://bugs.webkit.org/show_bug.cgi?id=119477#c3 the files shouldn&apos;t be considered &quot;cache&quot; but temporary files. They can be huge (eg: 2GB or similar movie sizes), so they aren&apos;t appropriate for /tmp (because of some distros using tmpfs) but they&apos;re appropriate for /var/tmp as per https://bugs.webkit.org/show_bug.cgi?id=119477#c5

I considered /var/tmp as the consensus solution for storing this kind of files. If it&apos;s not the consensus solution, then discuss it first among yourselves before requesting an implementation.

Having /var in a different partition is as problematic as having /home or /tmp in a different partition too. If the former hasn&apos;t been a problem until now, using /var shouldn&apos;t be a problem too.

&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1358
&gt;&gt; +            processName = &quot;GStreamer&quot;;
&gt; 
&gt; shouldn&apos;t it be WebKitWebProcess by default?

That&apos;s what g_get_prgname() should return, yes. In the very unlikely case that it returns NULL, I&apos;m just defaulting to the same value that GstUriDecodeBin would:

https://github.com/GStreamer/gst-plugins-base/blob/1.8.0/gst/playback/gsturidecodebin.c#L1951

&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1364
&gt;&gt; +        player-&gt;purgeOldDownloadFiles(oldDownloadTemplate.get());
&gt; 
&gt; So, if we purge the old files, then we don&apos;t really need to use /var/tmp, no?

The &quot;$HOME/.cache&quot; vs. &quot;/var/tmp&quot; discussion was about if the files were considered as &quot;cache&quot; or as &quot;temporary&quot;. It&apos;s the second, so they belong to a temporary directory.

This purging is here just for legacy files generated by WebKit prior to this patch. Michael told me that leaking those legacy files wasn&apos;t unacceptable. That&apos;s why I added the purge method.

Ideally, when all the users have migrated to a WebKit version having this patch, the purge shouldn&apos;t be needed anymore and might be removed.

&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1379
&gt;&gt; +        GST_TRACE(&quot;Unlinked media temporary file %s after creation&quot;, downloadFile.get());
&gt; 
&gt; Do we need a signal for this? Doesn&apos;t gst changes it when g_object_set(element, &quot;temp-template&quot;, synchronously?

I don&apos;t understand this comment. GstDownloadBuffer was already removing the file when the element was destroyed (when destroying the player). That&apos;s not enough for us. We want to delete the file immediately after it&apos;s created.

The only way I found to get notified of the file creation is listening to changes on the temp-location property, because it&apos;s updated with the final (random) filename right after the file is created. &quot;temp-template&quot; is just a template. The file isn&apos;t created when you set it, but when GstDownloadBuffer decides that it&apos;s time to create the file.

&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:249
&gt;&gt; +    GRefPtr&lt;GstElement&gt; m_downloadBuffer;
&gt; 
&gt; Do we really want to keepo this buffer object alive for the whole life of the media platyer? Or can we release it at some point?

Right, I should have set it to null in downloadBufferFileCreatedCallback(), when it&apos;s not needed anymore.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272389</commentid>
    <comment_count>23</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2017-02-01 22:32:12 -0800</bug_when>
    <thetext>(In reply to comment #21)
&gt; (In reply to comment #20)
&gt; &gt; Wouldn&apos;t it be a problem if /var is in a different partition?
&gt; 
&gt; Why would that be a problem?

I don&apos;t know that&apos;s why I&apos;m asking :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272390</commentid>
    <comment_count>24</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2017-02-01 22:46:55 -0800</bug_when>
    <thetext>(In reply to comment #22)
&gt; Comment on attachment 300331 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=300331&amp;action=review
&gt; 
&gt; Thanks for the rest of the comments I&apos;m not replying, they&apos;re really useful.
&gt; 
&gt; &gt;&gt; Source/WebCore/ChangeLog:13
&gt; &gt;&gt; +        file on the old legacy cache directory.
&gt; &gt; 
&gt; &gt; Wouldn&apos;t it be a problem if /var is in a different partition? I&apos;m not sure if the solution to leaked files is placing them in /tmp to be honest. If we can decide the folder, then we can use a specific one in the user cache dir, and clean it up at startup, for example.
&gt; 
&gt; I don&apos;t think GstDownloadBuffer is ready to reuse the media files between
&gt; sessions with its current design, so as per
&gt; https://bugs.webkit.org/show_bug.cgi?id=119477#c2 and
&gt; https://bugs.webkit.org/show_bug.cgi?id=119477#c3 the files shouldn&apos;t be
&gt; considered &quot;cache&quot; but temporary files. They can be huge (eg: 2GB or similar
&gt; movie sizes), so they aren&apos;t appropriate for /tmp (because of some distros
&gt; using tmpfs) but they&apos;re appropriate for /var/tmp as per
&gt; https://bugs.webkit.org/show_bug.cgi?id=119477#c5
&gt; 
&gt; I considered /var/tmp as the consensus solution for storing this kind of
&gt; files. If it&apos;s not the consensus solution, then discuss it first among
&gt; yourselves before requesting an implementation.

Ok, my fault, I tried to help reviewing this, but I didn&apos;t read the discussion first, there&apos;s even a comment by me suggesting not to use home cache dir :-P

&gt; Having /var in a different partition is as problematic as having /home or
&gt; /tmp in a different partition too. If the former hasn&apos;t been a problem until
&gt; now, using /var shouldn&apos;t be a problem too.

Yes, sure, but it&apos;s more unlikely. Anyway, I only asked. I know, for example, that we write the partial download files in the same download directory instead of /tmp to avoid copies between partitions.

&gt; &gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1358
&gt; &gt;&gt; +            processName = &quot;GStreamer&quot;;
&gt; &gt; 
&gt; &gt; shouldn&apos;t it be WebKitWebProcess by default?
&gt; 
&gt; That&apos;s what g_get_prgname() should return, yes. In the very unlikely case
&gt; that it returns NULL, I&apos;m just defaulting to the same value that
&gt; GstUriDecodeBin would:
&gt; 
&gt; https://github.com/GStreamer/gst-plugins-base/blob/1.8.0/gst/playback/
&gt; gsturidecodebin.c#L1951

Because gst can&apos;t know in which process is running, but we know it.

&gt; &gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1364
&gt; &gt;&gt; +        player-&gt;purgeOldDownloadFiles(oldDownloadTemplate.get());
&gt; &gt; 
&gt; &gt; So, if we purge the old files, then we don&apos;t really need to use /var/tmp, no?
&gt; 
&gt; The &quot;$HOME/.cache&quot; vs. &quot;/var/tmp&quot; discussion was about if the files were
&gt; considered as &quot;cache&quot; or as &quot;temporary&quot;. It&apos;s the second, so they belong to
&gt; a temporary directory.

Right, ok.

&gt; This purging is here just for legacy files generated by WebKit prior to this
&gt; patch. Michael told me that leaking those legacy files wasn&apos;t unacceptable.
&gt; That&apos;s why I added the purge method.

Ah, I see, I wonder if we should purge also leaked files from previous sessions too. That would solve the problem for systems where /var/tmp is not cleaned, or people who hardly ever reboot. Btw, I have old files in my /var/tmp so I&apos;m not sure systemd is cleaning it up, and I reboot every day. All of them are actually empty dirs though.

&gt; Ideally, when all the users have migrated to a WebKit version having this
&gt; patch, the purge shouldn&apos;t be needed anymore and might be removed.
&gt; 
&gt; &gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1379
&gt; &gt;&gt; +        GST_TRACE(&quot;Unlinked media temporary file %s after creation&quot;, downloadFile.get());
&gt; &gt; 
&gt; &gt; Do we need a signal for this? Doesn&apos;t gst changes it when g_object_set(element, &quot;temp-template&quot;, synchronously?
&gt; 
&gt; I don&apos;t understand this comment. GstDownloadBuffer was already removing the
&gt; file when the element was destroyed (when destroying the player). That&apos;s not
&gt; enough for us. We want to delete the file immediately after it&apos;s created.
&gt; 
&gt; The only way I found to get notified of the file creation is listening to
&gt; changes on the temp-location property, because it&apos;s updated with the final
&gt; (random) filename right after the file is created. &quot;temp-template&quot; is just a
&gt; template. The file isn&apos;t created when you set it, but when GstDownloadBuffer
&gt; decides that it&apos;s time to create the file.

Ok, understood. I was wondering if setting the template would set the location too, but it doesn&apos;t.

&gt; &gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:249
&gt; &gt;&gt; +    GRefPtr&lt;GstElement&gt; m_downloadBuffer;
&gt; &gt; 
&gt; &gt; Do we really want to keepo this buffer object alive for the whole life of the media platyer? Or can we release it at some point?
&gt; 
&gt; Right, I should have set it to null in downloadBufferFileCreatedCallback(),
&gt; when it&apos;s not needed anymore.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272427</commentid>
    <comment_count>25</comment_count>
      <attachid>300331</attachid>
    <who name="Xabier Rodríguez Calvar">calvaris</who>
    <bug_when>2017-02-02 03:44:44 -0800</bug_when>
    <thetext>Comment on attachment 300331
Patch

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

Lots of comments and suggestions, let&apos;s see this patch again.

&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1348
&gt;&gt; +    const gchar* className = G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(G_OBJECT(element)));
&gt;&gt; +    if (!g_strcmp0(className, &quot;GstDownloadBuffer&quot;)) {
&gt; 
&gt; Early return here instead.

Remove the variable because it is only used at the if. Besides, type should have been const char*.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1353
&gt; +        GUniqueOutPtr&lt;gchar&gt; oldDownloadTemplate;

char

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1356
&gt; +        const gchar* processName = g_get_prgname();

char

&gt;&gt;&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1358
&gt;&gt;&gt;&gt; +            processName = &quot;GStreamer&quot;;
&gt;&gt;&gt; 
&gt;&gt;&gt; shouldn&apos;t it be WebKitWebProcess by default?
&gt;&gt; 
&gt;&gt; That&apos;s what g_get_prgname() should return, yes. In the very unlikely case that it returns NULL, I&apos;m just defaulting to the same value that GstUriDecodeBin would:
&gt;&gt; 
&gt;&gt; https://github.com/GStreamer/gst-plugins-base/blob/1.8.0/gst/playback/gsturidecodebin.c#L1951
&gt; 
&gt; Because gst can&apos;t know in which process is running, but we know it.

I am with Carlos here. We don&apos;t need the process name actually to name the temp file. I&apos;d go for something like WebKit-Media-xxxxxx. This would be positive for not having to rename in case in the future we can do these downloads thru the network process.

&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1360
&gt;&gt; +        GUniquePtr&lt;gchar&gt; newDownloadTemplate(g_strdup_printf(&quot;/var/tmp/%s-XXXXXX&quot;, processName));
&gt; 
&gt; Use g_build_filename

char.

Another thing is that I think we should ensure the files are created in a different directory for each user and ensure that directory has the proper permissions so that it cannot be access by anyone else other than the user. I think media people watch online can vary a lot from cats to other things. I&apos;d write a function to return the template and ensure it is placed in the proper directory.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1362
&gt; +        GST_TRACE(&quot;Reconfiguring file download template from &apos;%s&apos; to &apos;%s&apos;\n&quot;, oldDownloadTemplate.get(), newDownloadTemplate.get());

The \n is not advisable.

&gt;&gt;&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1364
&gt;&gt;&gt;&gt; +        player-&gt;purgeOldDownloadFiles(oldDownloadTemplate.get());
&gt;&gt;&gt; 
&gt;&gt;&gt; So, if we purge the old files, then we don&apos;t really need to use /var/tmp, no?
&gt;&gt; 
&gt;&gt; The &quot;$HOME/.cache&quot; vs. &quot;/var/tmp&quot; discussion was about if the files were considered as &quot;cache&quot; or as &quot;temporary&quot;. It&apos;s the second, so they belong to a temporary directory.
&gt;&gt; 
&gt;&gt; This purging is here just for legacy files generated by WebKit prior to this patch. Michael told me that leaking those legacy files wasn&apos;t unacceptable. That&apos;s why I added the purge method.
&gt;&gt; 
&gt;&gt; Ideally, when all the users have migrated to a WebKit version having this patch, the purge shouldn&apos;t be needed anymore and might be removed.
&gt; 
&gt; Right, ok.

Yep, this will purge the old files. I have a concern though for the files that fall under the GST_WARNING of line 1377 of not being able to unlink. Should we assume that is is very unlikely and forget (and trust distros to purge this from time to time)? Btw, if it is so unlikely, we can tag the decission as UNLIKELY().

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1374
&gt; +    GUniqueOutPtr&lt;gchar&gt; downloadFile;

char

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1382
&gt; +void MediaPlayerPrivateGStreamer::purgeOldDownloadFiles(const gchar* downloadFileTemplate)

char

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1388
&gt; +    GUniquePtr&lt;gchar&gt; templatePath(g_path_get_dirname(downloadFileTemplate));
&gt; +    GUniquePtr&lt;gchar&gt; templateFile(g_path_get_basename(downloadFileTemplate));

char

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1391
&gt; +    gchar* found = g_strrstr(templateFile.get(), &quot;-XX&quot;);

char

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1393
&gt; +    if (!found)

This might be UNLIKELY too.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1405
&gt; +    for (const gchar* fileName = g_dir_read_name(directory); fileName; fileName = g_dir_read_name(directory)) {
&gt; +        if (g_str_has_prefix(fileName, templateFile.get())) {
&gt; +            GUniquePtr&lt;gchar&gt; filePath(g_build_filename(templatePath.get(), fileName, nullptr));

If you use FileSystem::listDirectory you won&apos;t probably use this, but char.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:171
&gt; +    void purgeOldDownloadFiles(const gchar* downloadFileTemplate);

char, remove parameter name</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272428</commentid>
    <comment_count>26</comment_count>
      <attachid>300331</attachid>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2017-02-02 04:37:59 -0800</bug_when>
    <thetext>Comment on attachment 300331
Patch

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

&gt;&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1360
&gt;&gt;&gt; +        GUniquePtr&lt;gchar&gt; newDownloadTemplate(g_strdup_printf(&quot;/var/tmp/%s-XXXXXX&quot;, processName));
&gt;&gt; 
&gt;&gt; Use g_build_filename
&gt; 
&gt; char.
&gt; 
&gt; Another thing is that I think we should ensure the files are created in a different directory for each user and ensure that directory has the proper permissions so that it cannot be access by anyone else other than the user. I think media people watch online can vary a lot from cats to other things. I&apos;d write a function to return the template and ensure it is placed in the proper directory.

This is tricky and, IMHO, not needed.

Having and extra directory under /var/tmp means that we would have to maintain (delete) that directory by ourselves. This is problematic because we can&apos;t use the elegant trick of deleting the file right after its creation to delete the directory. If several videos are being played at once by different WebProcesses a race condition can happen:

- Process A creates /var/tmp/$USER
- Process A creates WebKit-Media-123456 there
- Process B tries to create /var/tmp/$USER (but it&apos;s already created, no problem)
- Process A deletes WebKit-Media-123456 there and /var/tmp/$USER
- Process B creates WebKit-Media-ABCDEF there but... the directory doesn&apos;t exist anymore. ERROR!

Anyway, the directory itself isn&apos;t needed because the new temporary files are now deleted right after their creation. This means that no other processes can open them anymore, so there shouldn&apos;t be any concern regarding privacy. I&apos;ve checked it by myself with a &quot;while true; do ls /var/tmp; done&quot; script.

&gt;&gt;&gt;&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1364
&gt;&gt;&gt;&gt;&gt; +        player-&gt;purgeOldDownloadFiles(oldDownloadTemplate.get());
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; So, if we purge the old files, then we don&apos;t really need to use /var/tmp, no?
&gt;&gt;&gt; 
&gt;&gt;&gt; The &quot;$HOME/.cache&quot; vs. &quot;/var/tmp&quot; discussion was about if the files were considered as &quot;cache&quot; or as &quot;temporary&quot;. It&apos;s the second, so they belong to a temporary directory.
&gt;&gt;&gt; 
&gt;&gt;&gt; This purging is here just for legacy files generated by WebKit prior to this patch. Michael told me that leaking those legacy files wasn&apos;t unacceptable. That&apos;s why I added the purge method.
&gt;&gt;&gt; 
&gt;&gt;&gt; Ideally, when all the users have migrated to a WebKit version having this patch, the purge shouldn&apos;t be needed anymore and might be removed.
&gt;&gt; 
&gt;&gt; Right, ok.
&gt; 
&gt; Yep, this will purge the old files. I have a concern though for the files that fall under the GST_WARNING of line 1377 of not being able to unlink. Should we assume that is is very unlikely and forget (and trust distros to purge this from time to time)? Btw, if it is so unlikely, we can tag the decission as UNLIKELY().

Michael would say that WebKit should try hard to clean its own files. I don&apos;t think distros are going to mess with the contents of the user home dir, even for the .cache dir. Thanks for the UNLIKELY() suggestion, btw.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272429</commentid>
    <comment_count>27</comment_count>
      <attachid>300398</attachid>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2017-02-02 04:49:20 -0800</bug_when>
    <thetext>Created attachment 300398
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272449</commentid>
    <comment_count>28</comment_count>
      <attachid>300398</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2017-02-02 06:50:13 -0800</bug_when>
    <thetext>Comment on attachment 300398
Patch

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

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:40
&gt; +#include &lt;WebCore/FileSystem.h&gt;

Don&apos;t use &lt;&gt; since you are in WebCore.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:203
&gt; +    if (m_source &amp;&amp; WEBKIT_IS_WEB_SRC(m_source.get()))

G_TYPE_CHECK_INSTANCE_TYPE already null checks the pointer.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:204
&gt; +        g_signal_handlers_disconnect_by_func(GST_ELEMENT_PARENT(m_source.get()), reinterpret_cast&lt;gpointer&gt;(uriDecodeBinElementAddedCallback), this);

What if it has been disconnected before? I think it would be better to save the handler id and use g_signal_handler_disconnect() and invalidate the id.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1350
&gt; +    if (g_strcmp0(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(G_OBJECT(element))), &quot;GstDownloadBuffer&quot;))

GST_IS_DOWNLOAD_BUFFER?

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1395
&gt; +    // Transform &quot;-XXXXXX&quot; into &quot;-??????&quot; to get a file wildcard expression from the template.
&gt; +    for (char* p = &amp;templateFile.get()[strlen(templateFile.get()) - 1]; p &gt;= templateFile.get() &amp;&amp; *p == &apos;X&apos;; --p)
&gt; +        *p = &apos;?&apos;;

I&apos;m not sure I understand this, maybe you can simply do g_strdelimit (templateFile.get(), &quot;X&quot;, &apos;?&apos;);

Can&apos;t you pass something like &quot;*-XXXXXX*&quot; as pattern to listDirectory?

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1397
&gt; +    for (auto filePath : listDirectory(templatePath.get(), templateFile.get())) {

auto&amp;

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1409
&gt; +    if (m_source &amp;&amp; WEBKIT_IS_WEB_SRC(m_source.get()))

G_TYPE_CHECK_INSTANCE_TYPE already null checks the pointer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272455</commentid>
    <comment_count>29</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-02-02 07:04:32 -0800</bug_when>
    <thetext>(In reply to comment #25)
&gt; Another thing is that I think we should ensure the files are created in a
&gt; different directory for each user and ensure that directory has the proper
&gt; permissions so that it cannot be access by anyone else other than the user.
&gt; I think media people watch online can vary a lot from cats to other things.
&gt; I&apos;d write a function to return the template and ensure it is placed in the
&gt; proper directory.

It should be sufficient to just create the files with 600 permission, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272457</commentid>
    <comment_count>30</comment_count>
      <attachid>300398</attachid>
    <who name="Xabier Rodríguez Calvar">calvaris</who>
    <bug_when>2017-02-02 07:05:50 -0800</bug_when>
    <thetext>Comment on attachment 300398
Patch

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

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:203
&gt; +    if (m_source &amp;&amp; WEBKIT_IS_WEB_SRC(m_source.get()))

You don&apos;t need the m_source &amp;&amp; as WEBKIT_IS_WEB_SRC checks for nulls as expected.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1362
&gt; +    GUniqueOutPtr&lt;char&gt; oldDownloadTemplate;
&gt; +    g_object_get(element, &quot;temp-template&quot;, &amp;oldDownloadTemplate.outPtr(), nullptr);
&gt; +
&gt; +    GUniquePtr&lt;char&gt; newDownloadTemplate(g_build_filename(G_DIR_SEPARATOR_S, &quot;var&quot;, &quot;tmp&quot;, &quot;WebKit-Media-XXXXXX&quot;, nullptr));
&gt; +    g_object_set(element, &quot;temp-template&quot;, newDownloadTemplate.get(), nullptr);
&gt; +    GST_TRACE(&quot;Reconfiguring file download template from &apos;%s&apos; to &apos;%s&apos;&quot;, oldDownloadTemplate.get(), newDownloadTemplate.get());

Nit: you can move getting oldDownloadTemplate after setting newDownloadTemplate (it is going to be actually used before the GST_TRACE and specially relevant for the purge).

Another nit: &quot;Reconfigured&quot; is better because the relevant action already happened.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1395
&gt; +    // Transform &quot;-XXXXXX&quot; into &quot;-??????&quot; to get a file wildcard expression from the template.
&gt; +    for (char* p = &amp;templateFile.get()[strlen(templateFile.get()) - 1]; p &gt;= templateFile.get() &amp;&amp; *p == &apos;X&apos;; --p)
&gt; +        *p = &apos;?&apos;;

Maybe you can use String::replace instead of doing this (it can take position and length.

&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1409
&gt; +    if (m_source &amp;&amp; WEBKIT_IS_WEB_SRC(m_source.get()))

You don&apos;t need the m_source &amp;&amp; as WEBKIT_IS_WEB_SRC checks for nulls as expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272519</commentid>
    <comment_count>31</comment_count>
    <who name="Xabier Rodríguez Calvar">calvaris</who>
    <bug_when>2017-02-02 10:35:15 -0800</bug_when>
    <thetext>(In reply to comment #26)
&gt; &gt; Another thing is that I think we should ensure the files are created in a different directory for each user and ensure that directory has the proper permissions so that it cannot be access by anyone else other than the user. I think media people watch online can vary a lot from cats to other things. I&apos;d write a function to return the template and ensure it is placed in the proper directory.
&gt; 
&gt; This is tricky and, IMHO, not needed.
&gt; 
&gt; Having and extra directory under /var/tmp means that we would have to
&gt; maintain (delete) that directory by ourselves. This is problematic because
&gt; we can&apos;t use the elegant trick of deleting the file right after its creation
&gt; to delete the directory. If several videos are being played at once by
&gt; different WebProcesses a race condition can happen:
&gt; 
&gt; - Process A creates /var/tmp/$USER
&gt; - Process A creates WebKit-Media-123456 there
&gt; - Process B tries to create /var/tmp/$USER (but it&apos;s already created, no
&gt; problem)
&gt; - Process A deletes WebKit-Media-123456 there and /var/tmp/$USER
&gt; - Process B creates WebKit-Media-ABCDEF there but... the directory doesn&apos;t
&gt; exist anymore. ERROR!
&gt; 
&gt; Anyway, the directory itself isn&apos;t needed because the new temporary files
&gt; are now deleted right after their creation. This means that no other
&gt; processes can open them anymore, so there shouldn&apos;t be any concern regarding
&gt; privacy. I&apos;ve checked it by myself with a &quot;while true; do ls /var/tmp; done&quot;
&gt; script.

Well, I don&apos;t think deleting the directory is needed, it is just 4k on disk.

&gt; &gt; Yep, this will purge the old files. I have a concern though for the files that fall under the GST_WARNING of line 1377 of not being able to unlink. Should we assume that is is very unlikely and forget (and trust distros to purge this from time to time)? Btw, if it is so unlikely, we can tag the decission as UNLIKELY().
&gt; 
&gt; Michael would say that WebKit should try hard to clean its own files. I
&gt; don&apos;t think distros are going to mess with the contents of the user home
&gt; dir, even for the .cache dir. Thanks for the UNLIKELY() suggestion, btw.

I think I wasn&apos;t clear here. Line 1377, if the regular unlink fails (not the purge one, the regular) we are leaking them (under /var/tmp/).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272523</commentid>
    <comment_count>32</comment_count>
      <attachid>300398</attachid>
    <who name="Xabier Rodríguez Calvar">calvaris</who>
    <bug_when>2017-02-02 10:40:23 -0800</bug_when>
    <thetext>Comment on attachment 300398
Patch

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

&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1362
&gt;&gt; +    GST_TRACE(&quot;Reconfiguring file download template from &apos;%s&apos; to &apos;%s&apos;&quot;, oldDownloadTemplate.get(), newDownloadTemplate.get());
&gt; 
&gt; Nit: you can move getting oldDownloadTemplate after setting newDownloadTemplate (it is going to be actually used before the GST_TRACE and specially relevant for the purge).
&gt; 
&gt; Another nit: &quot;Reconfigured&quot; is better because the relevant action already happened.

Forget this, it is wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272539</commentid>
    <comment_count>33</comment_count>
      <attachid>300398</attachid>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2017-02-02 11:04:20 -0800</bug_when>
    <thetext>Comment on attachment 300398
Patch

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

&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:204
&gt;&gt; +        g_signal_handlers_disconnect_by_func(GST_ELEMENT_PARENT(m_source.get()), reinterpret_cast&lt;gpointer&gt;(uriDecodeBinElementAddedCallback), this);
&gt; 
&gt; What if it has been disconnected before? I think it would be better to save the handler id and use g_signal_handler_disconnect() and invalidate the id.

If the callback has been disconnected before, then g_signal_handlers_disconnect_matched() (the actual function called by the macro) just returns &quot;0&quot; matches and nothing happens.

&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1350
&gt;&gt; +    if (g_strcmp0(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(G_OBJECT(element))), &quot;GstDownloadBuffer&quot;))
&gt; 
&gt; GST_IS_DOWNLOAD_BUFFER?

Sorry, that&apos;s not possible. GstDownloadBuffer is an element, and as such, comes from a dynamically loaded plugin. It seems that the gstdownloadbuffer.h header isn&apos;t distributed for usage from third party applications. If I can&apos;t find it in WebKit/WebKitBuild/DependenciesGTK/Root/include/gstreamer-1.0/gst when using jhbuild, I doubt it&apos;s going to be available on regular distros.

&gt;&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1395
&gt;&gt;&gt; +        *p = &apos;?&apos;;
&gt;&gt; 
&gt;&gt; I&apos;m not sure I understand this, maybe you can simply do g_strdelimit (templateFile.get(), &quot;X&quot;, &apos;?&apos;);
&gt;&gt; 
&gt;&gt; Can&apos;t you pass something like &quot;*-XXXXXX*&quot; as pattern to listDirectory?
&gt; 
&gt; Maybe you can use String::replace instead of doing this (it can take position and length.

Carlos: It doesn&apos;t work like that. &quot;X&quot; isn&apos;t an actual letter X, but the character g_mkstemp()[1] uses as wildcard to construct actual random filenames. That character is equivalent to &quot;?&quot; in shell glob syntax.

Now that I think about it, if we&apos;re comfident about what the legacy base name was (&quot;WebKitWebProcess-XXXXXX&quot;) and are sure that it doesn&apos;t have &quot;X&quot; in any other place than in the pattern, we can do a simple character replacement in the base name without fear to screw legitimate &quot;X&quot; letters up.

[1] https://developer.gnome.org/glib/stable/glib-File-Utilities.html#g-mkstemp</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272543</commentid>
    <comment_count>34</comment_count>
    <who name="Xabier Rodríguez Calvar">calvaris</who>
    <bug_when>2017-02-02 11:10:54 -0800</bug_when>
    <thetext>After discussing in private I think the best solution because of permissions is sticking to ~/.cache/ but ensuring deleting and purge of old files. I guess a new patch would be needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272545</commentid>
    <comment_count>35</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-02-02 11:14:04 -0800</bug_when>
    <thetext>(In reply to comment #34)
&gt; After discussing in private I think the best solution because of permissions
&gt; is sticking to ~/.cache/ but ensuring deleting and purge of old files. I
&gt; guess a new patch would be needed.

Why you can&apos;t you apply there the same approach of unlinking the file just after its created? Its simpler to implement and more robust.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272558</commentid>
    <comment_count>36</comment_count>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2017-02-02 11:39:53 -0800</bug_when>
    <thetext>(In reply to comment #34)
&gt; After discussing in private I think the best solution because of permissions
&gt; is sticking to ~/.cache/ but ensuring deleting and purge of old files. I
&gt; guess a new patch would be needed.

I&apos;ve checked it (after adding a hack to avoid removing the file, normally external processes can&apos;t see it), and the file permissions are &quot;600&quot;:

1605111 81156 -rw-------  1 enrique enrique 83103373 Feb  2 19:33 WebKit-Media-VPHGVY

Having this into account, there&apos;s no reason why plain /var/tmp is a bad idea, and there are several reasons why it&apos;s a good idea (as per the &quot;cache&quot; vs. &quot;temporary&quot; file discussion in previous comments).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272829</commentid>
    <comment_count>37</comment_count>
    <who name="Xabier Rodríguez Calvar">calvaris</who>
    <bug_when>2017-02-02 23:59:13 -0800</bug_when>
    <thetext>(In reply to comment #35)
&gt; Why you can&apos;t you apply there the same approach of unlinking the file just
&gt; after its created? Its simpler to implement and more robust.

Probably I wasn&apos;t clear enough but my proposal implied this inside WebKit code the problem was a possible permissions race condition between creation and deletion.(In reply to comment #36)

&gt; (In reply to comment #34)
&gt; I&apos;ve checked it (after adding a hack to avoid removing the file, normally
&gt; external processes can&apos;t see it), and the file permissions are &quot;600&quot;:
&gt; 
&gt; 1605111 81156 -rw-------  1 enrique enrique 83103373 Feb  2 19:33
&gt; WebKit-Media-VPHGVY
&gt; 
&gt; Having this into account, there&apos;s no reason why plain /var/tmp is a bad
&gt; idea, and there are several reasons why it&apos;s a good idea (as per the &quot;cache&quot;
&gt; vs. &quot;temporary&quot; file discussion in previous comments).

Then I think we would be good to go once you fix the less serious comments such as extra null checks, chars replacing, etc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272858</commentid>
    <comment_count>38</comment_count>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2017-02-03 03:04:39 -0800</bug_when>
    <thetext>(In reply to comment #31)
&gt; (In reply to comment #26)
&gt; &gt; &gt; Yep, this will purge the old files. I have a concern though for the files that fall under the GST_WARNING of line 1377 of not being able to unlink. Should we assume that is is very unlikely and forget (and trust distros to purge this from time to time)? Btw, if it is so unlikely, we can tag the decission as UNLIKELY().
&gt; &gt; 
&gt; &gt; Michael would say that WebKit should try hard to clean its own files. I
&gt; &gt; don&apos;t think distros are going to mess with the contents of the user home
&gt; &gt; dir, even for the .cache dir. Thanks for the UNLIKELY() suggestion, btw.
&gt; 
&gt; I think I wasn&apos;t clear here. Line 1377, if the regular unlink fails (not the
&gt; purge one, the regular) we are leaking them (under /var/tmp/).

Trying to purge leaked files in the new /var/tmp location doesn&apos;t make sense. If the files couldn&apos;t be deleted right after creation in the first place (because of a race condition with permissions, where some malicious (root?) process changes the permissions in the milisecond that the file is visible), then ther&apos;s no point on trying to delete the file later: the deletion will also fail for the same reasons it failed initially.

Purging files in the old location still makes sense, because with the old implementation more time passed from file creation to file deletion (eg: 2h until the movie finishes being played) and the probability of a crash or kill (the only reason why the file would have been leaked) was higher.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272861</commentid>
    <comment_count>39</comment_count>
      <attachid>300517</attachid>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2017-02-03 03:19:04 -0800</bug_when>
    <thetext>Created attachment 300517
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272865</commentid>
    <comment_count>40</comment_count>
      <attachid>300517</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-02-03 04:04:37 -0800</bug_when>
    <thetext>Comment on attachment 300517
Patch

Clearing flags on attachment: 300517

Committed r211627: &lt;http://trac.webkit.org/changeset/211627&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272866</commentid>
    <comment_count>41</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-02-03 04:04:44 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1272872</commentid>
    <comment_count>42</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-02-03 04:26:54 -0800</bug_when>
    <thetext>\o/

Kinda a shame that this went in with a misleading commit name, since the media is most definitely not being stored in WebKit&apos;s cache, but oh well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1273022</commentid>
    <comment_count>43</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2017-02-03 12:37:27 -0800</bug_when>
    <thetext>Storing this big media files on the homedir is a potentially performance problem on systems where the home-dir is mounted over a shared network file-system (like happens on many shared computers at places like universities)

I think /var/tmp is the right place for this. This directory will be served from local storage, and never from a network file-system.

Also, the possibility of an attacker opening the file in the millisecond that happens between the file is created and the file is unlinked are pretty low.

Adding that to the fact that videos you watch on your browser is not something that I would consider critical information (like a password).

If you are that kind of person, is better you ensure that you are not sharing your computer with anyone when you watch the videos, rating than expecting WebKitGTK+ to do magic tricks to protect your privacy from the other users of your own computer.

So... I&apos;m happy that in the end the simplest approach of storing the file on /var/tmp and unlink it was committed, and we didn&apos;t end creating an over-engineered solution to something I don&apos;t think is a real problem

Just my 2 cents.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1387248</commentid>
    <comment_count>44</comment_count>
      <attachid>300517</attachid>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2018-01-09 07:06:39 -0800</bug_when>
    <thetext>Comment on attachment 300517
Patch

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

&gt; Source/WebCore/ChangeLog:13
&gt; +        some distros), unlinks (deletes) them right after creation and also deletes any other stalled temporary
&gt; +        file on the old legacy cache directory.

The problem with this approach is that if a page contains 2 video element for instance, one player will indirectly hijack the other and we could end-up with some hard-to-debug fallout issues.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>300331</attachid>
            <date>2017-02-01 09:41:20 -0800</date>
            <delta_ts>2017-02-02 04:49:10 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-119477-20170201173907.patch</filename>
            <type>text/plain</type>
            <size>7733</size>
            <attacher name="Enrique Ocaña">eocanha</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjExMDM4CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggOTAwNzcyNDU1MzIzNzcw
MThlZTVlMTZjOGM1ZWQ3MzUxNTE3N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lhUGxh
eWVyUHJpdmF0ZUdTdHJlYW1lciopOworCiBwcm90ZWN0ZWQ6CiAgICAgdm9pZCBjYWNoZUR1cmF0
aW9uKCk7CiAKQEAgLTI0Miw2ICsyNDYsNyBAQCBwcml2YXRlOgogICAgIHN0ZDo6dW5pcXVlX3B0
cjxBdWRpb1NvdXJjZVByb3ZpZGVyR1N0cmVhbWVyPiBtX2F1ZGlvU291cmNlUHJvdmlkZXI7CiAj
ZW5kaWYKICAgICBHUmVmUHRyPEdzdEVsZW1lbnQ+IG1fYXV0b0F1ZGlvU2luazsKKyAgICBHUmVm
UHRyPEdzdEVsZW1lbnQ+IG1fZG93bmxvYWRCdWZmZXI7CiAgICAgUmVmUHRyPE1lZGlhUGxheWVy
UmVxdWVzdEluc3RhbGxNaXNzaW5nUGx1Z2luc0NhbGxiYWNrPiBtX21pc3NpbmdQbHVnaW5zQ2Fs
bGJhY2s7CiAjaWYgRU5BQkxFKFZJREVPX1RSQUNLKQogICAgIFZlY3RvcjxSZWZQdHI8QXVkaW9U
cmFja1ByaXZhdGVHU3RyZWFtZXI+PiBtX2F1ZGlvVHJhY2tzOwo=
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>300398</attachid>
            <date>2017-02-02 04:49:20 -0800</date>
            <delta_ts>2017-02-03 03:18:53 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-119477-20170202124705.patch</filename>
            <type>text/plain</type>
            <size>8210</size>
            <attacher name="Enrique Ocaña">eocanha</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjExMDM4CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggOTAwNzcyNDU1MzIzNzcw
MThlZTVlMTZjOGM1ZWQ3MzUxNTE3NTY4My4uZTUzMTA2NjE1MGE3NDgwMGZmYzA4MWQ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bGxiYWNr
PiBtX21pc3NpbmdQbHVnaW5zQ2FsbGJhY2s7CiAjaWYgRU5BQkxFKFZJREVPX1RSQUNLKQogICAg
IFZlY3RvcjxSZWZQdHI8QXVkaW9UcmFja1ByaXZhdGVHU3RyZWFtZXI+PiBtX2F1ZGlvVHJhY2tz
Owo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>300517</attachid>
            <date>2017-02-03 03:19:04 -0800</date>
            <delta_ts>2017-02-03 04:04:37 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-119477-20170203111647.patch</filename>
            <type>text/plain</type>
            <size>8168</size>
            <attacher name="Enrique Ocaña">eocanha</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjExMDM4CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggOTAwNzcyNDU1MzIzNzcw
MThlZTVlMTZjOGM1ZWQ3MzUxNTE3NTY4My4uZDVkOTIwYWJiOTQ0NGFhNzZmZTE1YzkyNjVlZmNl
NzhmMzIxMDYxYSAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDI5IEBACisyMDE3LTAyLTAzICBFbnJp
cXVlIE9jYcOxYSBHb256w6FsZXogIDxlb2NhbmhhQGlnYWxpYS5jb20+CisKKyAgICAgICAgW0dT
dHJlYW1lcl0gU3RvcmUgcHJlbG9hZGVkIG1lZGlhIGluIHdlYmtpdCdzIGNhY2hlCisgICAgICAg
IGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0xMTk0NzcKKworICAgICAg
ICBSZXZpZXdlZCBieSBYYWJpZXIgUm9kcmlndWV6LUNhbHZhci4KK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