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 17712 - 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: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Silvia Pfeiffer
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-07 15:47 UTC by Boris Zbarsky
Modified: 2012-09-21 10:29 UTC (History)
5 users (show)

See Also:


Attachments

Description Boris Zbarsky 2012-07-07 15:47:46 UTC
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.
Comment 1 Ian 'Hixie' Hickson 2012-07-07 23:53:32 UTC
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 2 contributor 2012-07-18 07:12:45 UTC
This bug was cloned to create bug 17888 as part of operation convergence.
Comment 3 Silvia Pfeiffer 2012-09-21 10:29:01 UTC
EDITOR'S RESPONSE: This is an Editor'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: Patch applied
https://github.com/w3c/html/commit/e17fea4b70a2ffc15c15784eaf8c68a36f2c432e
   Rationale: adopted from WHATWG