This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17888 - Window name lookup algorithm is wrong for named subwindows
Summary: Window name lookup algorithm is wrong for named subwindows
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on: 18688
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-18 07:12 UTC by contributor
Modified: 2012-08-25 08:46 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2012-07-18 07:12:42 UTC
This was was cloned from bug 17712 as part of operation convergence.
Originally filed: 2012-07-07 15:47:00 +0000
Original reporter: Boris Zbarsky <bzbarsky@mit.edu>

================================================================================
 #0   Boris Zbarsky                                   2012-07-07 15:47:46 +0000 
--------------------------------------------------------------------------------
Consider this testcase:

  <iframe name="bar" 
          src="data:text/html,<script>window.name='foo'</script>"></iframe>
  <script>
    window.onload = function() { 
      alert(window.foo); 
      alert(window.bar); 
    }
  </script>

This interoperably alerts a Window object and then "undefined" in Chrome, Safari, Opera, Firefox.  IE9 seems to go the other way around: undefined and then a window object (have to test with a second real document, afaict, because data: doesn't work in IE9 there).

The Chrome, Safari, Opera, Firefox behavior is wrong as the spec is currently written, since the spec only looks at name attributes on <iframe>, not at window names.  But it sure looks pretty interoperable except for IE.

Note also that the spec as currently written would completely break child window lookup by name in framesets, as far as I can tell, since it only considers <iframe> and not <frame> in step 2 of "determine the value of a named property name when the Window object is indexed for property retrieval".  I'm 100% sure this is not web-compatible.
================================================================================
 #1   Ian 'Hixie' Hickson                             2012-07-07 23:53:32 +0000 
--------------------------------------------------------------------------------
The lack of checking for <frame> is totally an oversight on my part.

The other part was because I was testing IE when speccing this, I believe. I can definitely change the "named elements" algorithm to refer to the browsing context name for <iframe> and <frame> elements instead of their name="" attributes, if that's better for compat. What would be ideal is to see if there are any pages that depend on this one way or the other.
================================================================================
Comment 1 contributor 2012-08-24 22:44:41 UTC
Checked in as WHATWG revision r7272.
Check-in comment: Make window[name] lookup match more browsers.
http://html5.org/tools/web-apps-tracker?from=7271&to=7272