<?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>46777</bug_id>
          
          <creation_ts>2010-09-28 19:28:02 -0700</creation_ts>
          <short_desc>CRASH at WebCore::HTMLSourceElement::scheduleErrorEvent</short_desc>
          <delta_ts>2011-01-24 13:07:56 -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>Media</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>51249</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>ademar</cc>
    
    <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>eric</cc>
    
    <cc>joepeck</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>286707</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-09-28 19:28:02 -0700</bug_when>
    <thetext>Non-reproducible crash seen at:

Thread 2 Crashed:
0   WebCore                       	0x31c958ec WebCore::HTMLSourceElement::scheduleErrorEvent() (HTMLSourceElement.cpp:94)
1   WebCore                       	0x31a710ac WebCore::HTMLMediaElement::setNetworkState(WebCore::MediaPlayer::NetworkState) (HTMLMediaElement.cpp:852)
2   WebCore                       	0x31c8bfac non-virtual thunk to WebCore::HTMLMediaElement::mediaPlayerNetworkStateChanged(WebCore::MediaPlayer*) + 36
3   WebCore                       	0x31a71010 WebCore::MediaPlayer::networkStateChanged() (MediaPlayer.cpp:607)
4   WebCore                       	0x31a70fac WebCore::MediaPlayerPrivateX::deliverNotification(MediaPlayerProxyNotificationType) (MediaPlayerPrivateX.mm:713)
5   WebCore                       	0x31a70cf4 WebCore::MediaPlayer::deliverNotification(MediaPlayerProxyNotificationType) (MediaPlayer.cpp:556)
6   WebCore                       	0x31a70cbc WebCore::HTMLMediaElement::deliverNotification(MediaPlayerProxyNotificationType) (HTMLMediaElement.cpp:2097)
7   WebKit                        	0x305849ac -[WebPluginController _webPluginContainerPostMediaPlayerNotification:forElement:] (WebPluginController.mm:651)
...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>286709</commentid>
    <comment_count>1</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-09-28 19:35:29 -0700</bug_when>
    <thetext>I believe this could happen if:

  - The markup has a &lt;video&gt; with &lt;source src=&quot;unsupported-video.video&quot;&gt;
  - ENABLE(PLUGIN_PROXY_FOR_VIDEO) is enabled

Sequence of events:

  - HTMLMediaElement::loadNextSourceChild triggers a load
    - m_loadState = LoadingFromSourceElement
  - Somehow documentWillBecomeInactive or userCancelledLoad is triggered
    - m_currentSourceNode = 0
    - m_readyState = HAVE_NOTHING
  - A web plugin post media player notification comes in and triggers setNetworkState calling:

        if (m_readyState &lt; HAVE_METADATA &amp;&amp; m_loadState == LoadingFromSourceElement) {
            m_currentSourceNode-&gt;scheduleErrorEvent(); // &lt;-- with a null pointer

I haven&apos;t been able to create a test case for this. However, it looks like m_loadState shouldn&apos;t
have LoadingFromSourceElement if the current source node is null. In numerous other places
when the currentSourceNode is set to 0 the load state is also changed to WaitingForSource.
I think the case in userCancelledLoad is missing this change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>286711</commentid>
    <comment_count>2</comment_count>
      <attachid>69155</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-09-28 19:45:33 -0700</bug_when>
    <thetext>Created attachment 69155
[PATCH] Clear Load State in userCancelledLoad

See comment #1 above for details on how this might have happened and why I think this fix is correct.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>287108</commentid>
    <comment_count>3</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-09-29 14:00:03 -0700</bug_when>
    <thetext>Thanks!

Committed r68682
	M	WebCore/ChangeLog
	M	WebCore/html/HTMLMediaElement.cpp
r68682 = 717390534b65d85cd07cc3df4992c84918a38e9f
http://trac.webkit.org/changeset/68682</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>287750</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-09-30 12:52:57 -0700</bug_when>
    <thetext>Hmm, this is the stack trace I saw on test case from bug 46763 in debug mode.

&gt; Thread 2 Crashed:

?!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>287796</commentid>
    <comment_count>5</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-09-30 13:56:28 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; Hmm, this is the stack trace I saw on test case from bug 46763 in debug mode.

Really? Thats good to know, because I created that test case on that bug
specifically to try and reproduce _this_ crash. However I never reproduced
it, just always hit that crash. So if that is the case, than although I don&apos;t
have a reduction, it reaffirms that this was the correct fix.

If you test with a debug nightly past r68682 can you reproduce the crash?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>287806</commentid>
    <comment_count>6</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-09-30 14:08:16 -0700</bug_when>
    <thetext>Its possible the same fix would need to be applied to:
HTMLMediaElement::prepareForLoad

Setting the m_loadState = WaitingForSource whenever
we set m_currentSourceNode to 0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>287963</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-09-30 17:41:05 -0700</bug_when>
    <thetext>I&apos;m still seeing this stack trace on the test from bug 46763. These two bugs are in confusing state - something was fixed without a test case, but the one with test case still shows a similar problem to the one that should have been fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>292563</commentid>
    <comment_count>8</comment_count>
      <attachid>70455</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-10-11 11:10:01 -0700</bug_when>
    <thetext>Created attachment 70455
[PATCH] Another State and ASSERT / Early Return to stop Crashes

This is another patch, to catch a similar unbalanced state. It also adds an ASSERT and early
return to prevent crashes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>292565</commentid>
    <comment_count>9</comment_count>
      <attachid>70455</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-10-11 11:12:10 -0700</bug_when>
    <thetext>Comment on attachment 70455
[PATCH] Another State and ASSERT / Early Return to stop Crashes

The bug fix looks fine, but I don’t see a test case. Can we create a test case for this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>292569</commentid>
    <comment_count>10</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-10-11 11:17:35 -0700</bug_when>
    <thetext>(In reply to comment #9)
&gt; (From update of attachment 70455 [details])
&gt; The bug fix looks fine, but I don’t see a test case. Can we create a test case for this?

I haven&apos;t been able to reproduce the crash myself. Alexey was able to reproduce it
(with a test case that I created to try to reproduce this) using MallocScribble and a
debug build. I tried to use the same settings and still was not able to reproduce it.
It may be based on timers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>292599</commentid>
    <comment_count>11</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-10-11 12:03:43 -0700</bug_when>
    <thetext>Committed r69514
	M	WebCore/ChangeLog
	M	WebCore/html/HTMLMediaElement.cpp
r69514 = 41102af89bdf6311aed9cf2d153ab8bc422caea5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>292601</commentid>
    <comment_count>12</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-10-11 12:07:28 -0700</bug_when>
    <thetext>http://trac.webkit.org/changeset/69514</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>292654</commentid>
    <comment_count>13</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2010-10-11 14:29:21 -0700</bug_when>
    <thetext>http://trac.webkit.org/changeset/69514 might have broken GTK Linux 32-bit Release
The following tests are not passing:
fast/js/basic-strict-mode.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>339008</commentid>
    <comment_count>14</comment_count>
    <who name="Ademar Reis">ademar</who>
    <bug_when>2011-01-24 07:45:26 -0800</bug_when>
    <thetext>Revision r68682 cherry-picked into qtwebkit-2.2 with commit 9211999 &lt;http://gitorious.org/webkit/qtwebkit/commit/9211999&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>339175</commentid>
    <comment_count>15</comment_count>
    <who name="Ademar Reis">ademar</who>
    <bug_when>2011-01-24 12:16:57 -0800</bug_when>
    <thetext>Revision r68682 cherry-picked into qtwebkit-2.2 with commit 9211999 &lt;http://gitorious.org/webkit/qtwebkit/commit/9211999&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>339210</commentid>
    <comment_count>16</comment_count>
    <who name="Ademar Reis">ademar</who>
    <bug_when>2011-01-24 13:07:56 -0800</bug_when>
    <thetext>Revision r69514 cherry-picked into qtwebkit-2.2 with commit 3a5ef1b &lt;http://gitorious.org/webkit/qtwebkit/commit/3a5ef1b&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>69155</attachid>
            <date>2010-09-28 19:45:33 -0700</date>
            <delta_ts>2010-09-29 13:36:44 -0700</delta_ts>
            <desc>[PATCH] Clear Load State in userCancelledLoad</desc>
            <filename>video.patch</filename>
            <type>text/plain</type>
            <size>1477</size>
            <attacher name="Joseph Pecoraro">joepeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
N2EzMDQ5Yy4uYmViYmFhZCAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cKKysrIGIvV2Vi
Q29yZS9DaGFuZ2VMb2cKQEAgLTEsMyArMSwxOCBAQAorMjAxMC0wOS0yOCAgSm9zZXBoIFBlY29y
YXJvICA8am9lcGVja0B3ZWJraXQub3JnPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAo
T09QUyEpLgorCisgICAgICAgIENSQVNIIGF0IFdlYkNvcmU6OkhUTUxTb3VyY2VFbGVtZW50Ojpz
Y2hlZHVsZUVycm9yRXZlbnQKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19i
dWcuY2dpP2lkPTQ2Nzc3CisKKyAgICAgICAgSXQgc2hvdWxkIG5vdCBiZSBwb3NzaWJsZSB0byBn
ZXQgdG8gYmUgaW4gdGhlIExvYWRpbmdGcm9tU291cmNlRWxlbWVudAorICAgICAgICBzdGF0ZSB3
aXRoIGEgbnVsbCBjdXJyZW50IHNvdXJjZSBub2RlLiBUaGlzIHdhcyBhIHBvc3NpYmxlIHNjZW5h
cmlvCisgICAgICAgIHdoZXJlIHRoZSBjdXJyZW50IHNvdXJjZSBub2RlIHdhcyBjbGVhcmVkIGJ1
dCB0aGUgbG9hZCBzdGF0ZSB3YXMgbm90CisgICAgICAgIGNsZWFyZWQgYXMgd2VsbC4gVHJpZWQg
YW5kIGNvdWxkIG5vdCBjcmVhdGUgYSB0ZXN0IGNhc2UgZm9yIHRoaXMuCisKKyAgICAgICAgK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fQUJPUlRFRCk7Cg==
</data>
<flag name="review"
          id="58796"
          type_id="1"
          status="+"
          setter="simon.fraser"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>70455</attachid>
            <date>2010-10-11 11:10:01 -0700</date>
            <delta_ts>2010-10-11 11:41:45 -0700</delta_ts>
            <desc>[PATCH] Another State and ASSERT / Early Return to stop Crashes</desc>
            <filename>loading-state.patch</filename>
            <type>text/plain</type>
            <size>1975</size>
            <attacher name="Joseph Pecoraro">joepeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
NTliOGQ0MC4uNmM2ZDc4NiAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cKKysrIGIvV2Vi
Q29yZS9DaGFuZ2VMb2cKQEAgLTEsMyArMSwxNyBAQAorMjAxMC0xMC0xMSAgSm9zZXBoIFBlY29y
YXJvICA8am9lcGVja0B3ZWJraXQub3JnPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAo
T09QUyEpLgorCisgICAgICAgIENSQVNIIGF0IFdlYkNvcmU6OkhUTUxTb3VyY2VFbGVtZW50Ojpz
Y2hlZHVsZUVycm9yRXZlbnQKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19i
dWcuY2dpP2lkPTQ2Nzc3CisKKyAgICAgICAgQW5vdGhlciBjYXNlIHRoYXQgY291bGQgbGVhZCB0
byBhbiBpbXByb3BlciBzZXQgb2Ygc3RhdGVzIGJldHdlZW4KKyAgICAgICAgbV9jdXJyZW50Tm9k
ZSBhbmQgbV9sb2FkaW5nU3RhdGUuIEFsc28gYWRkZWQgYW4gQVNTRVJUIGFuZCBlYXJseQorICAg
ICAgICByZXR1cm4gdG8gcHJldmVudCBjcmFzaGVzIGlmIHRoaXMgY2FzZSBjYW4gc3R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VE1MTWVkaWFFbGVtZW50
OjpzZXROZXR3b3JrU3RhdGUoTWVkaWFQbGF5ZXI6Ok5ldHdvcmtTdGF0ZSBzdGF0ZSkKICAgICAg
ICAgLy8gSWYgd2UgZmFpbGVkIHdoaWxlIHRyeWluZyB0byBsb2FkIGEgPHNvdXJjZT4gZWxlbWVu
dCwgdGhlIG1vdmllIHdhcyBuZXZlciBwYXJzZWQsIGFuZCB0aGVyZSBhcmUgbW9yZQogICAgICAg
ICAvLyA8c291cmNlPiBjaGlsZHJlbiwgc2NoZWR1bGUgdGhlIG5leHQgb25lCiAgICAgICAgIGlm
IChtX3JlYWR5U3RhdGUgPCBIQVZFX01FVEFEQVRBICYmIG1fbG9hZFN0YXRlID09IExvYWRpbmdG
cm9tU291cmNlRWxlbWVudCkgeworICAgICAgICAgICAgQVNTRVJUKG1fY3VycmVudFNvdXJjZU5v
ZGUpOworICAgICAgICAgICAgaWYgKCFtX2N1cnJlbnRTb3VyY2VOb2RlKQorICAgICAgICAgICAg
ICAgIHJldHVybjsKKwogICAgICAgICAgICAgbV9jdXJyZW50U291cmNlTm9kZS0+c2NoZWR1bGVF
cnJvckV2ZW50KCk7CiAgICAgICAgICAgICBpZiAoaGF2ZVBvdGVudGlhbFNvdXJjZUNoaWxkKCkp
IHsKICAgICAgICAgICAgICAgICBMT0coTWVkaWEsICJIVE1MTWVkaWFFbGVtZW50OjpzZXROZXR3
b3JrU3RhdGUgc2NoZWR1bGluZyBuZXh0IDxzb3VyY2U+Iik7Cg==
</data>
<flag name="review"
          id="60304"
          type_id="1"
          status="+"
          setter="eric.carlson"
    />
          </attachment>
      

    </bug>

</bugzilla>