<?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>82421</bug_id>
          
          <creation_ts>2012-03-27 20:30:40 -0700</creation_ts>
          <short_desc>REGRESSION(r110064): audio elements can keep the DOM alive after the user has navigated away</short_desc>
          <delta_ts>2012-03-28 18:03:50 -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>Media</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</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>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Stephanie Lewis">slewis</reporter>
          <assigned_to name="Stephanie Lewis">slewis</assigned_to>
          <cc>ap</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>ggaren</cc>
    
    <cc>jer.noble</cc>
    
    <cc>jonlee</cc>
    
    <cc>mrobinson</cc>
    
    <cc>pnormand</cc>
    
    <cc>slewis</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>xan.lopez</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>589630</commentid>
    <comment_count>0</comment_count>
    <who name="Stephanie Lewis">slewis</who>
    <bug_when>2012-03-27 20:30:40 -0700</bug_when>
    <thetext>Testing on Lion.  Regression occurred http://trac.webkit.org/projects/webkit/changeset/110064.  

I believe this change has a typo.  I think the ! needs to be eliminated.

-            if (!static_cast&lt;HTMLAudioElement*&gt;(node)-&gt;paused())
+            if (!static_cast&lt;HTMLAudioElement*&gt;(node)-&gt;hasPendingActivity())


As it stands an HTMLAudioElement is observable when it is not waiting for any events.  This means that the DOM can never be cleaned up when a user navigates away from the page.  Observed on http://twitter.com.

&lt;rdar://problem/11135186&gt; REGRESSION: audio elements with pending activity progressively slow down the PLT3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>589631</commentid>
    <comment_count>1</comment_count>
      <attachid>134210</attachid>
    <who name="Stephanie Lewis">slewis</who>
    <bug_when>2012-03-27 20:40:00 -0700</bug_when>
    <thetext>Created attachment 134210
patch

Uploaded a patch to fix the if statement, but I&apos;m not sure if it is possible to write a test to show the bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>589691</commentid>
    <comment_count>2</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2012-03-27 23:58:35 -0700</bug_when>
    <thetext>*** Bug 81781 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>589693</commentid>
    <comment_count>3</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2012-03-28 00:02:34 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; Created an attachment (id=134210) [details]
&gt; patch
&gt; 
&gt; Uploaded a patch to fix the if statement, but I&apos;m not sure if it is possible to write a test to show the bug.

A nice list of media tests are flaky on GTK because of this issue, thanks for looking into it and sorry, I&apos;m a bit embarassed :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>589704</commentid>
    <comment_count>4</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2012-03-28 00:19:42 -0700</bug_when>
    <thetext>I&apos;ve just checked that with your patch those media tests are no longer flaky on GTK:

media/W3C/audio/networkState/networkState_during_loadstart.html
media/audio-delete-while-step-button-clicked.html
media/audio-mpeg-supported.html
media/audio-repaint.html
media/media-controls-clone-crash.html
media/audio-repaint.html


If you could unskip them as part of your patch it&apos;d be great.

media/audio-garbage-collect.html is now failing though. I&apos;ll have a look at this one again soon.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>590219</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-03-28 11:56:45 -0700</bug_when>
    <thetext>I don&apos;t think that this kind of change requires a regression test. Please upload an updated patch and mark it for review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>590311</commentid>
    <comment_count>6</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2012-03-28 12:55:19 -0700</bug_when>
    <thetext>I think it would be even better just to revert http://trac.webkit.org/projects/webkit/changeset/110064 and consult Eric and Jer about what the best fix is. It&apos;s not clear that HTMLAudioElement::hasPendingActivity is the right test for GC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>590478</commentid>
    <comment_count>7</comment_count>
    <who name="Stephanie Lewis">slewis</who>
    <bug_when>2012-03-28 14:59:14 -0700</bug_when>
    <thetext>Jer wasn&apos;t convinced that the original fix was correct, but said I should talk to Eric.  Since it is such a bad performance bug I&apos;m rolling out until I can catch up with Eric and find the right fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>590526</commentid>
    <comment_count>8</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2012-03-28 15:33:41 -0700</bug_when>
    <thetext>In the end, what we need is a DOM API that is true when the audio node is waiting for an event to fire, for a load to complete, or for playing to end, and is *guaranteed* to become false if the node is removed from the document or the window is closed or navigated away from.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>590665</commentid>
    <comment_count>9</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2012-03-28 17:41:24 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; I think it would be even better just to revert http://trac.webkit.org/projects/webkit/changeset/110064 and consult Eric and Jer about what the best fix is. It&apos;s not clear that HTMLAudioElement::hasPendingActivity is the right test for GC.

HTMLAudioElement::hasPendingActivity is definitely NOT the correct test. The reason that we care about this is that the spec says when a media element can be collected:

    Media elements that are potentially playing while not in a Document 
    must not play any video, but should play any audio component. Media 
    elements must not stop playing just because all references to them 
    have been removed; only once a media element is in a state where 
    no further audio could ever be played by that element may the 
    element be garbage collected.

and &quot;potentially playing&quot; is defined as:

    A media element is said to be potentially playing when its paused 
    attribute is false, the element has not ended playback, playback has 
    not stopped due to errors, the element either has no current media 
    controller or has a current media controller but is not blocked on its 
    media controller, and the element is not a blocked media element.

As it happens, we have HTMLMediaElement::potentiallyPlaying because &quot;potentially playing&quot; is used in other parts of the media element spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>590680</commentid>
    <comment_count>10</comment_count>
    <who name="Stephanie Lewis">slewis</who>
    <bug_when>2012-03-28 18:03:50 -0700</bug_when>
    <thetext>Rolled out in http://trac.webkit.org/projects/webkit/changeset/112483

I reopened the original bug for doing the correct fix. (https://bugs.webkit.org/show_bug.cgi?id=72698)</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>134210</attachid>
            <date>2012-03-27 20:40:00 -0700</date>
            <delta_ts>2012-03-27 20:40:00 -0700</delta_ts>
            <desc>patch</desc>
            <filename>0001-REGRESSION-audio-elements-can-keep-the-DOM-alive-aft.patch</filename>
            <type>text/plain</type>
            <size>2169</size>
            <attacher name="Stephanie Lewis">slewis</attacher>
            
              <data encoding="base64">RnJvbSAxOGE2YzE5NmJmMGU3NmM1MzA1YTI1MGIzNzYzNjY0ZDFkNmRkOGQ3IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBTdGVwaGFuaWUgTGV3aXMgPHNsZXdpc0BhcHBsZS5jb20+CkRh
dGU6IFR1ZSwgMjcgTWFyIDIwMTIgMjA6Mzc6MjQgLTA3MDAKU3ViamVjdDogW1BBVENIXSBSRUdS
RVNTSU9OOiBhdWRpbyBlbGVtZW50cyBjYW4ga2VlcCB0aGUgRE9NIGFsaXZlIGFmdGVyI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