<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>22058</bug_id>
          
          <creation_ts>2013-05-16 09:42:00 +0000</creation_ts>
          <short_desc>&quot;error&quot; event should fire before final readystatechange event</short_desc>
          <delta_ts>2013-05-16 11:40:28 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>XHR</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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="Hallvord R. M. Steen">hsteen</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>87751</commentid>
    <comment_count>0</comment_count>
    <who name="Hallvord R. M. Steen">hsteen</who>
    <bug_when>2013-05-16 09:42:00 +0000</bug_when>
    <thetext>#request-error part of spec:

Step 6: Fire an event named readystatechange. 

.
.

Step 9: Fire a progress event named event. // this fires the actual &apos;error&apos; event

This seems to be an order of events that isn&apos;t really user-friendly. 

Given a typical XHR-using script has logic like this:

if readystatechange fires with readyState === 4
  report &quot;success&quot;, handle response data

if error event fires
  report failure

this typical XHR user would end up running the &quot;success&quot; code first, then the &quot;failure&quot; code. This seems less than ideal.. Is there any reason we can&apos;t move the &quot;fire error&quot; step to before the &quot;fire readystatechange&quot; step?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87753</commentid>
    <comment_count>1</comment_count>
    <who name="Hallvord R. M. Steen">hsteen</who>
    <bug_when>2013-05-16 09:51:02 +0000</bug_when>
    <thetext>(I guess the real answer is &quot;we want to push users to not rely on readystatechange but use load/error events instead&quot; :-p)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87757</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-05-16 11:40:28 +0000</bug_when>
    <thetext>Either fully use readystatechange or use the other set of events. If you start mixing, you&apos;re on your own.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>