Closed Bug 669884 Opened 13 years ago Closed 13 years ago

Add-on SDK -- window.frames[0] returns undefined from content script

Categories

(Add-on SDK Graveyard :: General, defect, P2)

All
Other
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tjmart1, Assigned: ochameau)

Details

Attachments

(3 files)

Attached file main.js
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0a1) Gecko/20110705 Firefox/7.0a1
Build ID: 20110705030811

Steps to reproduce:

Using page-mod to run a content script on a site with a frameset.



Actual results:

From the content script, window.frames.length returns the correct number of frames, but window.frames[0] returns undefined.

Using the web console on the same page, window.frames[0] returns the expected [object Window].


Expected results:

window.frames[0] should return the frame's window object.
Sample file that loads google in a frame.  Bug seemed present whether the frame src was same domain or not.
Huh, the "user friendly" bug report interface didn't indicate it was going to format everything like that!  If I could figure out how, I'd edit this into the first post.

Steps to reproduce:
* Create a minimal extension with cfx init.
* Replace main.js with the attached file
* Download the attached html file and rename it FrameTest.html.  (To match the pattern page-mod is looking for.)
* Examine the console output.
Assignee: nobody → poirot.alex
Priority: -- → P2
Target Milestone: --- → 1.1
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
For the record, window === window.frames.
I wasn't aware of this way of accessing frames:
  window[integer]/window.frames[integer]

Here is the related implementation,
Thanks Tim for the report!
Attachment #546560 - Flags: review?(rFobic)
Comment on attachment 546560 [details] [diff] [review]
Fix window.frame[integer]

Review of attachment 546560 [details] [diff] [review]:
-----------------------------------------------------------------

Looks ok, it would be nice if you could do `name in obj` tests though or otherwise annoying warnings get logged into console.
Attachment #546560 - Flags: review?(rFobic) → review+
I opened bug 672784 in order to fix these warning messages.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: