Closed Bug 723519 Opened 13 years ago Closed 13 years ago

javascript window.frames access by name is inconsistent

Categories

(Core :: DOM: Core & HTML, defect)

9 Branch
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 170799

People

(Reporter: kevintap, Unassigned)

Details

Attachments

(1 file)

Attached file test.html
User Agent: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Build ID: 20120117091749

Steps to reproduce:

Javascript calls to window.frames["frame_name"] return inconsistent results.  This only appears to be a problem when parts of the page are being loaded/reloaded dynamically.  Please see the attached sample.


Actual results:

if a named iframe tag is loaded on the page, then discarded, then reloaded, a call to  window.frames["frame_name"] will return inconsistent results.  The object returned will be the wrong window.  And attempting to access its name property will cause a permission error: "Permission denied to access property 'name'"


Expected results:

I would expect consistent behavior of window.frames.  This was tested on other browsers and it appears Firefox is the only browser with this issue.
Attachment #593835 - Attachment mime type: text/plain → text/html
What is the expected and the actual result with your testcase ?
I get basically only this :

Error: Permission denied to access property 'name'
Source File: https://bug723519.bugzilla.mozilla.org/attachment.cgi?id=593835
Line: 34
Component: Untriaged → DOM
Product: Firefox → Core
QA Contact: untriaged → general
New DOM bindings for the window will fix this.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Perhaps some instructions with the testcase will help.
1) load the page
2) click the "load frame 1" button - this loads an iframe into the page with a name "frame1"
3) you should see javascript console output that looks correct
4) click the "load frame 2" button - this replaces the iframe "frame1" with a new iframe "frame2"
5) you should see javascript console output that looks correct
6) click the "load frame 1" button again - the will replace the "frame2" iframe with a new iframe "frame1"
7) you should see errors in the javascript console output

The error here is that after unloading iframe "frame1" and reloading another iframe using the same name "frame1", the window.frames object no longer behaves properly.

On the initial load, window.frames["frame1"] returns the correct window object.
After unloading the iframe "frame1" and loading a new iframe "frame1", calling window.frames["frame1"] will no longer return the correct window object.

The code in the test case using a for loop to examine the window.frames collection shows that window.frames["frame1"] no longer returns a window object that is actually a member of the window.frames collection.

The expected result is that calling window.frames["frame1"] will return a window object that is a member of the window.frames collection and is == to window.frames[0] (assuming there is only 1 frame on the page).
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: