<?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>10340</bug_id>
          
          <creation_ts>2010-08-10 14:33:30 +0000</creation_ts>
          <short_desc>The [OverrideBuiltins] annotation on the Window interface IDL block should be removed because it breaks sites</short_desc>
          <delta_ts>2010-10-04 14:47:41 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>pre-LC1 HTML5 spec (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://dev.w3.org/html5/spec/browsers.html#the-window-object</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adrian Bateman [MSFT]">adrianba</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>37334</commentid>
    <comment_count>0</comment_count>
    <who name="Adrian Bateman [MSFT]">adrianba</who>
    <bug_when>2010-08-10 14:33:30 +0000</bug_when>
    <thetext>Existing text:
[OverrideBuiltins, ReplaceableNamedProperties]
interface Window {
  ...

New text:
[ReplaceableNamedProperties]
interface Window {
  ...


In IE9, as in both Chrome and Firefoxs OverrideBuiltins implementation, OverrideBuiltins means check the custom named getter for the object, then check the prototype chain. This can be observed by looking at the behavior of OverrideBuiltins support on the HTMLFormElement in Firefox and Chrome (IE9 preview 4 gets it wrong but were fixing that):

&lt;form id=myForm&gt;
     &lt;input id=appendChild /&gt;
     &lt;img id=hasOwnProperty name=hasOwnProperty /&gt;
&lt;/form&gt;

document.getElementById(myForm).appendChild; // This is a reference to the &lt;input&gt; element, not the built-in appendChild DOM API.
document.getElementById(myForm).hasOwnProperty; // This is a reference to the &lt;img&gt; element, not the built-in Object.prototype.hasOwnProperty API.

So, in early IE9 builds, we applied this behavior to the Window interface just like the current spec says. However, this behavior breaks real websites because many, many websites use element ids that conflict with the built-in properties that they are expecting.

In IE9, all DOM operations and properties are represented by ES5 data properties and accessor properties respectively. These DOM built-ins are looked up in the prototype chain, just like everything else. The accessors of the window object (e.g., the document accessor) are defined on Window.prototype, which is the prototype of the global object. The HTML5 spec defines an element with id=document. At that point, any window-scoped requests for the document built-in return an HTMLElement instance, instead of the built-in Document object, such as:

document.getElementById; // Script error, because document is a reference to the specific HTMLElement type, which does not support the getElementById property.

In our testing, Chrome doesnt support OverrideBuiltins on window, nor does Firefox. Opera does something else which is a different behavior than what we found with the other browsers when applying the HTMLFormElements definition of OverrideBultins to the window.

Due to the browser interop matrix as well as the site-compat problem, we recommend removing the [OverrideBuiltins] annotation from the Window interface.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38867</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-09-10 23:07:02 +0000</bug_when>
    <thetext>Looks like it&apos;s more complicated than just removing OverrideBuiltins, because &lt;iframe name=document&gt; does override builtins in Chrome (not in Firefox). I wasn&apos;t able to test IE since I don&apos;t have access to a Windows install. Does IE [OverrideBuiltins] on Window for &lt;iframe name=document&gt;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38882</commentid>
    <comment_count>2</comment_count>
    <who name="Adrian Bateman [MSFT]">adrianba</who>
    <bug_when>2010-09-11 18:10:50 +0000</bug_when>
    <thetext>In our testing, even Chrome6 does not [OverrideBuiltins] in the iframe case. They appear to first lookup the real &quot;document&quot; before getting the window from the iframe. If Chrome supported [OverrideBuiltins] for iframes, then we would expect both &quot;doc&quot; and &quot;win&quot; below to alert the Window--but that is not the case. To answer your question, both IE8 and IE9 do not OverrideBuiltins for &lt;iframe name=&quot;document&quot;&gt;. Here&apos;s our interop report and test case for your verification:

&lt;!DOCTYPE html&gt;
&lt;html&gt;&lt;head&gt;&lt;title&gt;window [OverrideBuiltins] and iframes&lt;/title&gt;&lt;/head&gt; &lt;body&gt;
  &lt;iframe name=&quot;document2&quot; src=&quot;http://www.bing.com/&quot;&gt;&lt;/iframe&gt;
  &lt;iframe name=&quot;document&quot; src=&quot;http://www.google.com/&quot;&gt;&lt;/iframe&gt;
  &lt;div id=&quot;toString&quot;&gt;&lt;/div&gt;
  &lt;span id=&quot;testing&quot;&gt;&lt;/span&gt;
  &lt;script&gt;
      onload = function () {
          try {
              var spn = testing; // Confirm this functionality is supported
          } catch (ex) { }
          try {
              var doc = document;
          } catch (ex) { }
          try {
              var win = document2;
          } catch (ex) { }
          try {
              var func = toString;
          } catch (ex) { }

          // Results:     Chrome6         Firefox3.6      IE8             IE9
          alert(spn); //  HTMLElement     undefined       HTMLSpanElement HTMLSpanElement
          alert(doc); //  HTMLDocument    HTMLDocument    HTMLDocument    Document
          alert(win); //  DOMWindow       Window          Window          Window
          alert(func); // [native code]   [native code]   [native code]   [native code]   
      }
  &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39642</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-09-28 01:31:50 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Fair enough.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39643</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-09-28 01:37:30 +0000</bug_when>
    <thetext>http://html5.org/tools/web-apps-tracker?from=5522&amp;to=5523</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>40199</commentid>
    <comment_count>5</comment_count>
    <who name="Adrian Bateman [MSFT]">adrianba</who>
    <bug_when>2010-09-30 16:11:21 +0000</bug_when>
    <thetext>Looks good. Thanks!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>