<?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>67312</bug_id>
          
          <creation_ts>2011-08-31 13:30:59 -0700</creation_ts>
          <short_desc>[meta] EventTarget should be in the prototype chain</short_desc>
          <delta_ts>2023-05-12 23:40:28 -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>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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>
          <dependson>67329</dependson>
    
    <dependson>67516</dependson>
    
    <dependson>88120</dependson>
    
    <dependson>88232</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dominic Cooney">dominicc</reporter>
          <assigned_to name="Dominic Cooney">dominicc</assigned_to>
          <cc>annevk</cc>
    
    <cc>ap</cc>
    
    <cc>arv</cc>
    
    <cc>benjamin</cc>
    
    <cc>cdumez</cc>
    
    <cc>chrisguttandin</cc>
    
    <cc>laszlo.gombos</cc>
    
    <cc>mjs</cc>
    
    <cc>oren.me</cc>
    
    <cc>rniwa</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>459857</commentid>
    <comment_count>0</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2011-08-31 13:30:59 -0700</bug_when>
    <thetext>Per recent drafts of DOM Core, EventTarget should have an interface object (ie is no longer NoInterfaceObject) &lt;http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget&gt; and in every relevant spec, with the possible exception of FileReader, EventTarget is specified as a parent interface. For more context, see the thread on webkit-dev in June &lt;https://lists.webkit.org/pipermail/webkit-dev/2011-June/thread.html#17024&gt; and July &lt;https://lists.webkit.org/pipermail/webkit-dev/2011-August/017685.html&gt;.

This is a metabug to track introducing an EventTarget interface object and changing the JavaScript bindings to put EventTarget on the prototype chain instead of mixing it into every event target.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466147</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-09-12 22:56:46 -0700</bug_when>
    <thetext>For some context: this idea has gained lukewarm acceptance (at best) on webkit-dev, see &lt;https://lists.webkit.org/pipermail/webkit-dev/2011-June/017041.html&gt;.

Since making this change doesn&apos;t seem to benefit anyone, but comes with all early adopter costs and risks, it&apos;s not clear to me why WebKit should be the first engine to make and ship it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466376</commentid>
    <comment_count>2</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2011-09-13 10:33:24 -0700</bug_when>
    <thetext>So… I guess we should start rolling back features in WebKit that are not in IE and Firefox. This early adopter risk is killing us.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466396</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-09-13 10:56:51 -0700</bug_when>
    <thetext>This is not nearly what I said.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466404</commentid>
    <comment_count>4</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2011-09-13 11:10:54 -0700</bug_when>
    <thetext>By moving EventTarget to become the root class of XHR, Window, Node etc we get a better prototype chain, allowing monkey patching events:

if (DEBUG) {
  var ael = EventTarget.prototype.addEventListener;
  EventTarget.prototype.addEventListener = function(type, listener, capture) {
    // Ensure no typos
    assert(isValidEventType(type))
    return ael.call(this, type, listener, capture);
  };
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466426</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-09-13 11:41:58 -0700</bug_when>
    <thetext>Thanks, that&apos;s the rationale that I&apos;ve seen, too. I doubt that defining a function on all these completely unrelated objects is of any use in practice though - you&apos;ll need a switch inside of such function to do anything meaningful anyway (e.g. isValidEventType() should better return different results for XHRs, windows and nodes).

But this ship has sailed, and it&apos;s definitely not useful to discuss whether this change is good or not in this bug. My suggestion is to give a thought to what the best timing to make the change is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>606102</commentid>
    <comment_count>6</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2012-04-19 16:18:54 -0700</bug_when>
    <thetext>Gecko has moved EventTarget to being the superclass of XHR in FF14 and is moving other interfaces over piecemeal as part of their DOM bindings refactor.

The web compatibility and performance risks seem low here and most (all?) of the relevant specs have changed to put EventTarget on the prototype change.  I don&apos;t see a reason to hold back on this longer. Alexey, were there other concerns you had with being an early adopter? It seems really unlikely to me that this will break pages. Maybe you disagree on that point?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>606104</commentid>
    <comment_count>7</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2012-04-19 16:19:51 -0700</bug_when>
    <thetext>The last webkit-dev thread on this was https://lists.webkit.org/pipermail/webkit-dev/2011-August/017685.html, which got no responses. The thread was asking if there were any objections. Silence == no objections?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>907359</commentid>
    <comment_count>8</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2013-07-10 06:46:20 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; Thanks, that&apos;s the rationale that I&apos;ve seen, too. I doubt that defining a function on all these completely unrelated objects is of any use in practice though - you&apos;ll need a switch inside of such function to do anything meaningful anyway (e.g. isValidEventType() should better return different results for XHRs, windows and nodes).
&gt; 
&gt; But this ship has sailed, and it&apos;s definitely not useful to discuss whether this change is good or not in this bug. My suggestion is to give a thought to what the best timing to make the change is.

I have been working on this on Blink side:
http://code.google.com/p/chromium/issues/detail?id=257583

One good side-effect was that there is a lot less code duplication in the generated bindings as the EventTarget API is only implemented in one place. This resulted in a smaller binary size (~90k less in release and ~450k in debug).

Alexey, the previous discussion is a bit old and one of your issues seemed to be about the timing. How do you feel about this change nowadays? If this is fine with you, I would be happy making similar changes in WebKit.

Sorry to start this again, I&apos;m just wondering if it is worth for me porting my work over.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>907375</commentid>
    <comment_count>9</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2013-07-10 08:32:09 -0700</bug_when>
    <thetext>Has this change shipped in Chrome and Firefox? Did it break any sites? My objection was only about paying early adopter cost for something we don&apos;t care about.

On the other hand, Sam had an objection in principle (&quot;I don&apos;t think we should do this&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>907379</commentid>
    <comment_count>10</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2013-07-10 08:45:33 -0700</bug_when>
    <thetext>(In reply to comment #9)
&gt; Has this change shipped in Chrome and Firefox? Did it break any sites? My objection was only about paying early adopter cost for something we don&apos;t care about.

This has been shipping in IE since v9.

It has been in Firefox for a few stable releases (I don&apos;t know which exact version)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>907407</commentid>
    <comment_count>11</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2013-07-10 10:57:12 -0700</bug_when>
    <thetext>(In reply to comment #9)
&gt; Has this change shipped in Chrome and Firefox? Did it break any sites? My objection was only about paying early adopter cost for something we don&apos;t care about.
&gt; 
&gt; On the other hand, Sam had an objection in principle (&quot;I don&apos;t think we should do this&quot;).

I still think will be of limited utility, but the standards bodies and implementations have done it anyway. It is probably time to bow to tides of change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955194</commentid>
    <comment_count>12</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2023-05-12 23:40:28 -0700</bug_when>
    <thetext>In retrospect I think you all were right that this change was not worth it, but alas, it happened and WebKit has been changed.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>