<?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>46012</bug_id>
          
          <creation_ts>2010-09-17 16:20:11 -0700</creation_ts>
          <short_desc>XMLHttpRequest: readystatechange event is not dispatched when open() is called.</short_desc>
          <delta_ts>2023-05-12 23:34:08 -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>XML</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jian Li">jianli</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>annevk</cc>
    
    <cc>ap</cc>
    
    <cc>deqing.huang</cc>
    
    <cc>dimich</cc>
    
    <cc>fishd</cc>
    
    <cc>jchaffraix</cc>
    
    <cc>jianli</cc>
    
    <cc>joethomas</cc>
    
    <cc>levin</cc>
    
    <cc>webkit</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>280967</commentid>
    <comment_count>0</comment_count>
    <who name="Jian Li">jianli</who>
    <bug_when>2010-09-17 16:20:11 -0700</bug_when>
    <thetext>XMLHttpRequest: readystatechange event is not dispatched when open() is called.

Per the XHR spec, readystatechange event should be dispatch when we finish processing open().

TESTS:
http://tc.labs.opera.com/apis/XMLHttpRequest/abort-after-send.htm
http://tc.labs.opera.com/apis/XMLHttpRequest/open-after-abort.htm
http://tc.labs.opera.com/apis/XMLHttpRequest/open-open-send.htm
http://tc.labs.opera.com/apis/XMLHttpRequest/open-open-sync-send.htm
http://tc.labs.opera.com/apis/XMLHttpRequest/open-send-open.htm
http://tc.labs.opera.com/apis/XMLHttpRequest/open-open-sync-send.htm</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>538690</commentid>
    <comment_count>1</comment_count>
    <who name="Joe Thomas">joethomas</who>
    <bug_when>2012-01-19 07:25:44 -0800</bug_when>
    <thetext>(In reply to comment #0)
&gt; XMLHttpRequest: readystatechange event is not dispatched when open() is called.
&gt; 
&gt; Per the XHR spec, readystatechange event should be dispatch when we finish processing open().
&gt; 
&gt; TESTS:
&gt; http://tc.labs.opera.com/apis/XMLHttpRequest/abort-after-send.htm
&gt; http://tc.labs.opera.com/apis/XMLHttpRequest/open-after-abort.htm
&gt; http://tc.labs.opera.com/apis/XMLHttpRequest/open-open-send.htm
&gt; http://tc.labs.opera.com/apis/XMLHttpRequest/open-open-sync-send.htm
&gt; http://tc.labs.opera.com/apis/XMLHttpRequest/open-send-open.htm
&gt; http://tc.labs.opera.com/apis/XMLHttpRequest/open-open-sync-send.htm


Currently webkit sends readystatechange event with state &quot;OPENED&quot; when Open() gets called. 

As per w3c spec http://www.w3.org/TR/XMLHttpRequest/#the-send-method, section 4.7.6(8), readystatechange event needs to be called with the same state for asynchronous XMLHTTPRequest once the Send() flag is set. Looks like this is not happening with webkit. Do we need a fix for this ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>547376</commentid>
    <comment_count>2</comment_count>
      <attachid>125016</attachid>
    <who name="Joe Thomas">joethomas</who>
    <bug_when>2012-02-01 14:35:48 -0800</bug_when>
    <thetext>Created attachment 125016
Simplified test case

Simplified test case showing the sequence of state when readystatechange event is fired.

Webkit browsers fires readystatechange event with [1,2,3,4] (OPENED, HEADERS_RECEIVED, LOADING, DONE) whereas Firefox and IE fires with states [1,1,2,3,4]. As per spec, readystatechange event is supposed to be fired when Send() is called for asynchronous request but webkit does not do that.

I will create a patch if we agree to add this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>830121</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2013-02-11 14:19:32 -0800</bug_when>
    <thetext>*** Bug 71985 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>830122</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2013-02-11 14:20:01 -0800</bug_when>
    <thetext>The duplicate has some relevant analysis.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955191</commentid>
    <comment_count>5</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2023-05-12 23:34:08 -0700</bug_when>
    <thetext>This has been addressed in the past decade.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>125016</attachid>
            <date>2012-02-01 14:35:48 -0800</date>
            <delta_ts>2012-02-01 14:35:48 -0800</delta_ts>
            <desc>Simplified test case</desc>
            <filename>test case.html</filename>
            <type>text/html</type>
            <size>441</size>
            <attacher name="Joe Thomas">joethomas</attacher>
            
              <data encoding="base64">PGh0bWw+Cjxib2R5Pgo8c2NyaXB0PgogICAgdmFyIHhociA9IG5ldyBYTUxIdHRwUmVxdWVzdCgp
OwogICAgdmFyIHJlc3VsdCA9IFtdOwogICAgeGhyLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0
aW9uKCkgewogICAgICAgIHJlc3VsdC5wdXNoKHhoci5yZWFkeVN0YXRlKTsKICAgICAgICBpZiAo
eGhyLnJlYWR5U3RhdGUgPT0gNCkgewogICAgICAgICAgICBhbGVydCgicmVhZHlzdGF0ZWNoYW5n
ZSAtIHN0YXRlIHNlcXVlbmNlIC0gIiArcmVzdWx0KTsKICAgICAgICB9CiAgICB9CiAgICB2YXIg
dXJsID0gImh0dHA6Ly9odG1sNWxhYnMuaW50ZXJvcGVyYWJpbGl0eWJyaWRnZXMuY29tL0NPUlMv
Q09SU1NlcnZlci5hc3B4P1Rlc3RJRD0xMiI7CiAgICB4aHIub3BlbigiR0VUIix1cmwpOwogICAg
eGhyLnNlbmQobnVsbCk7Cjwvc2NyaXB0Pgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>