<?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>27823</bug_id>
          
          <creation_ts>2015-01-13 20:16:42 +0000</creation_ts>
          <short_desc>We should consider dropping [NoInterfaceObject] from XMLHttpRequestEventTarget</short_desc>
          <delta_ts>2015-01-16 08:39:34 +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>All</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Boris Zbarsky">bzbarsky</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bugs</cc>
    
    <cc>d</cc>
    
    <cc>jonas</cc>
    
    <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>117095</commentid>
    <comment_count>0</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-01-13 20:16:42 +0000</bug_when>
    <thetext>Doesn&apos;t seem to be a good reason for it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117096</commentid>
    <comment_count>1</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2015-01-13 20:21:24 +0000</bug_when>
    <thetext>It seems like a mixin. I guess it&apos;d be less compatible, but what about changing `: XHRET` to `implements XHRET`?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117097</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-01-13 20:26:30 +0000</bug_when>
    <thetext>That would be possible.  It&apos;d mean that .upload and the XHR itself no longer share a prototype for their common set of event handlers, but apart from that would not be an issue in any way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117131</commentid>
    <comment_count>3</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2015-01-14 02:59:46 +0000</bug_when>
    <thetext>(In reply to Domenic Denicola from comment #1)
&gt; It seems like a mixin. I guess it&apos;d be less compatible, but what about
&gt; changing `: XHRET` to `implements XHRET`?

This was my first thought too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117136</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-01-14 07:11:18 +0000</bug_when>
    <thetext>At some point Olli argued for the common prototype I think. I don&apos;t really care either way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117152</commentid>
    <comment_count>5</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2015-01-14 12:34:06 +0000</bug_when>
    <thetext>Dealing with the same prototype chain can be handy - especially since the
prototype would be used only with XHR stuff.
EventTarget is then shared with random other stuff too.

Mixin is kind of a weaker abstraction - or how to say - and since
there really isn&apos;t reason to use that, I&apos;d just remove
[NoInterfaceObject].

But don&apos;t feel very strongly about this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117154</commentid>
    <comment_count>6</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-01-14 12:54:07 +0000</bug_when>
    <thetext>If I turn it into a mixin, would I have to change both XMLHttpRequest and XMLHttpRequestUpload to directly inherit from EventTarget?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117155</commentid>
    <comment_count>7</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-01-14 13:03:49 +0000</bug_when>
    <thetext>Yes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117156</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-01-14 13:15:16 +0000</bug_when>
    <thetext>https://github.com/whatwg/xhr/commit/2c56fdc97b65dfe4026fab8ceb78a7fb9bddeb87

I decided to not turn it into a mixin as the inheritance design seems more compatible with how we deal with EventTarget.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117158</commentid>
    <comment_count>9</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2015-01-14 15:59:44 +0000</bug_when>
    <thetext>I don&apos;t care strongly, but I&apos;d be curious to understand what you mean by &quot;the inheritance design seems more compatible with how we deal with EventTarget.&quot; Lots of things inherit directly from EventTarget and have corresponding properties for their `onxxx` methods.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117159</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-01-14 16:52:58 +0000</bug_when>
    <thetext>My rationale was that for the common functionality provided by EventTarget we wanted to inherit rather than create a mixin and that therefore we should inherit for the common functionality provided by XMLHttpRequestEventTarget as well.

If XMLHttpRequestEventTarget should be a mixin, why shouldn&apos;t EventTarget? (Ian argued it should.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117164</commentid>
    <comment_count>11</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2015-01-14 19:27:04 +0000</bug_when>
    <thetext>&gt; My rationale was that for the common functionality provided by EventTarget we wanted to inherit rather than create a mixin and that therefore we should inherit for the common functionality provided by XMLHttpRequestEventTarget as well.

I still don&apos;t get it. What common functionality is provided by XMLHttpRequestEventTarget that is not already provided by EventTarget? It seems more like it&apos;s just working around the awkard need to add onX for all the events.

Stated another way, most classes that fire events have a very simple hierarchy: they inherit from EventTarget, and have onX properties on their own prototype. However, XMLHttpRequestUpload and XMLHttpRequest are now exceptions to that rule.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117165</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-01-14 20:48:04 +0000</bug_when>
    <thetext>I don&apos;t think that&apos;s true, e.g. everything in DOM inherits from an abstract interface as well that in turn inherits from EventTarget:

  *SpecificNode* : Node : EventTarget</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117166</commentid>
    <comment_count>13</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2015-01-14 20:51:55 +0000</bug_when>
    <thetext>Right, but Node actually adds functionality.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117167</commentid>
    <comment_count>14</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2015-01-14 20:57:12 +0000</bug_when>
    <thetext>onfoo event handlers are functionality.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117168</commentid>
    <comment_count>15</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2015-01-14 21:01:43 +0000</bug_when>
    <thetext>I guess that&apos;s the divergence. They feel more like... syntax, almost. Something that, in a better world, would just automatically work for all EventTargets.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117190</commentid>
    <comment_count>16</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2015-01-15 06:32:00 +0000</bug_when>
    <thetext>I think the simplest solution is to simply get rid of XMLHttpRequestEventTarget and add the corresponding on* properties to the XMLHttpRequestUpload and XMLHttpRequest interfaces. That&apos;s essentially how the rest of the DOM works. The XMLHttpRequestEventTarget interface seems like a feature without use cases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117191</commentid>
    <comment_count>17</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2015-01-15 06:33:21 +0000</bug_when>
    <thetext>onfoo isn&apos;t really functionality. It&apos;s just syntax sugar.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117195</commentid>
    <comment_count>18</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-01-15 08:45:24 +0000</bug_when>
    <thetext>(In reply to Jonas Sicking from comment #16)
&gt; I think the simplest solution is to simply get rid of
&gt; XMLHttpRequestEventTarget and add the corresponding on* properties to the
&gt; XMLHttpRequestUpload and XMLHttpRequest interfaces. That&apos;s essentially how
&gt; the rest of the DOM works.

Not really. If we can&apos;t use inheritance we use mixins.


&gt; The XMLHttpRequestEventTarget interface seems
&gt; like a feature without use cases.

If you want to extend both XMLHttpRequest and XMLHttpRequestUpload it&apos;s the way to go.


If only Olli and I feel this way and you see us generating on* attributes &quot;automatically&quot; at some point, I guess I&apos;m willing to turn this into a mixin after all...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117206</commentid>
    <comment_count>19</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2015-01-15 11:05:47 +0000</bug_when>
    <thetext>(In reply to Jonas Sicking from comment #17)
&gt; onfoo isn&apos;t really functionality. It&apos;s just syntax sugar.

Unfortunately onfoo can be very much more than that, as in case of
MessagePort&apos;s onmessage.
(I consider it a bug that MessagePort.onmessage behaves differently to any other onfoo in the platform.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117262</commentid>
    <comment_count>20</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2015-01-16 01:42:48 +0000</bug_when>
    <thetext>(In reply to Anne from comment #18)
&gt; (In reply to Jonas Sicking from comment #16)
&gt; &gt; I think the simplest solution is to simply get rid of
&gt; &gt; XMLHttpRequestEventTarget and add the corresponding on* properties to the
&gt; &gt; XMLHttpRequestUpload and XMLHttpRequest interfaces. That&apos;s essentially how
&gt; &gt; the rest of the DOM works.
&gt; 
&gt; Not really. If we can&apos;t use inheritance we use mixins.

Lots of interfaces have onfoo&apos;s directly on them. Like Window and WebSocket. But yes, I&apos;d be fine with using mixin&apos;s too.

&gt; &gt; The XMLHttpRequestEventTarget interface seems
&gt; &gt; like a feature without use cases.
&gt; 
&gt; If you want to extend both XMLHttpRequest and XMLHttpRequestUpload it&apos;s the
&gt; way to go.

What&apos;s the use case?

(In reply to Olli Pettay from comment #19)
&gt; (In reply to Jonas Sicking from comment #17)
&gt; &gt; onfoo isn&apos;t really functionality. It&apos;s just syntax sugar.
&gt; 
&gt; Unfortunately onfoo can be very much more than that, as in case of
&gt; MessagePort&apos;s onmessage.

Sure, but that&apos;s not the case here, no?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117270</commentid>
    <comment_count>21</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-01-16 08:39:34 +0000</bug_when>
    <thetext>Window and WebSocket are completely orthogonal classes. They are not expected to share functionality. XMLHttpRequest and XMLHttpRequestUpload are both event targets and share a whole bunch of events. I don&apos;t see why that is so different from say Text and Comment sharing CharacterData.

Your argument is that on* is syntax, but that is not always the case as Olli points out, so it&apos;s unclear whether we could ever make it so.

As for common functionality, a library could support an additional event of sorts and want to expose an on* member on both classes.

If this should be a mixin, then lots of stuff in the DOM and especially EventTarget should have been made a mixin too.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>