<?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>39891</bug_id>
          
          <creation_ts>2010-05-28 11:37:15 -0700</creation_ts>
          <short_desc>HTML5ScriptRunner can re-enter from event dispatch</short_desc>
          <delta_ts>2010-06-22 01:45:29 -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>WebCore Misc.</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>39259</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Seidel (no email)">eric</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>tonyg</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>231827</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-05-28 11:37:15 -0700</bug_when>
    <thetext>HTML5ScriptRunner can re-enter from event dispatch

HTML5ScriptRunner tries to only enter scripting when calling &quot;executeScript&quot; on the HTML5SriptRunnerHost, but I realize after writing it that it will also re-enter from events which will cause us to hit m_scriptNestingLevel ASSERTs and do the wrong thing. :)

I tried to write a test for this, but it doesn&apos;t quite work yet, and I have more important bugs to fix in the code before I get back to this one so recording it for posterity:

1
&lt;script&gt;
function doubleWrite(number)
{
    document.write(&quot;&lt;script&gt;document.write(&quot; + number &quot;)&lt;/scr&quot; + &quot;ipt&gt;&lt;script&gt;document.write(&quot; + (number+1) &quot;)&lt;/scr&quot; + &quot;ipt&gt;&quot;)
}
&lt;/script&gt;
2
&lt;script
onbeforeload=&quot;doubleWrite(3)&quot;
onload=&quot;doubleWrite(5)&quot;
src=&quot;data:text/plain,doubleWrite(7)&quot;
&gt;&lt;/script&gt;
9</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>240032</commentid>
    <comment_count>1</comment_count>
      <attachid>59134</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-06-18 10:53:39 -0700</bug_when>
    <thetext>Created attachment 59134
Cleaned up test case which reveals at least one ASSERT in ToT

The fix for the first assert:

ASSERTION FAILED: !haveParsingBlockingScript()
(/Projects/WebKit/WebCore/html/HTML5ScriptRunner.cpp:262 void WebCore::HTML5ScriptRunner::runScript(WebCore::Element*, int))

is to just re-order the setting of m_parsingBlockingScript until after the beforeLoad check, since the before load might cancel the script anyway!

The next assertions you hit, of close m_source, relate to the insertion point never getting set for some of these calls.  Those need a bit more thought.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>240886</commentid>
    <comment_count>2</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-06-21 14:17:50 -0700</bug_when>
    <thetext>http://code.google.com/p/chromium/issues/detail?id=47080
is probably caused by this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>241188</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-06-22 01:44:49 -0700</bug_when>
    <thetext>As of http://trac.webkit.org/changeset/61610 we believe this issue to be completely resolved.  Adam is also mailing the W3c about Minefield&apos;s behavior discrepancy.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>241189</commentid>
    <comment_count>4</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-06-22 01:45:29 -0700</bug_when>
    <thetext>http://trac.webkit.org/changeset/61606
http://trac.webkit.org/changeset/61607
http://trac.webkit.org/changeset/61608
were all related to this fix, btw.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>59134</attachid>
            <date>2010-06-18 10:53:39 -0700</date>
            <delta_ts>2010-06-18 10:53:39 -0700</delta_ts>
            <desc>Cleaned up test case which reveals at least one ASSERT in ToT</desc>
            <filename>docwrite.html</filename>
            <type>text/html</type>
            <size>300</size>
            <attacher name="Eric Seidel (no email)">eric</attacher>
            
              <data encoding="base64">MQo8c2NyaXB0PgpmdW5jdGlvbiBkb3VibGVXcml0ZShudW1iZXIpCnsKICAgIGRvY3VtZW50Lndy
aXRlKCI8c2NyaXB0PmRvY3VtZW50LndyaXRlKCIgKyBudW1iZXIgKyAiKTwvc2NyIiArICJpcHQ+
PHNjcmlwdD5kb2N1bWVudC53cml0ZSgiICsgKG51bWJlcisxKSArICIpPC9zY3IiICsgImlwdD4i
KTsKfQo8L3NjcmlwdD4KMgo8c2NyaXB0Cm9uYmVmb3JlbG9hZD0iZG91YmxlV3JpdGUoMykiCm9u
bG9hZD0iZG91YmxlV3JpdGUoNSkiCnNyYz0iZGF0YTp0ZXh0L3BsYWluLGRvdWJsZVdyaXRlKDcp
Igo+PC9zY3JpcHQ+CjkK
</data>

          </attachment>
      

    </bug>

</bugzilla>