Ticket #3551 (closed bug: fixed)
Dimensions functions fail exceptionally on parent-frame scope
| Reported by: | nphase | Owned by: | brandon |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.4 |
| Component: | dimensions | Version: | 1.2.6 |
| Keywords: | Cc: | nphase, flesler | |
| Blocking: | Blocked by: |
Description
Forgive me for adding to your pile of work. I'd suggest my own fix but I'm not quite skilled enough with the codebase to do such.
The Dimensions set of functions do not properly handle the parent scope (frames).
parent.$("#overlay,#alert").hide().fadeIn("slow");
all of that will run perfectly, yet something like
parent.$(window).height()
will fail and throw an exeception "NS_ERROR_XPC_BAD_CONVERT_JS" in FF.
parent.window.innerHeight is verified to work properly.
If you need any help testing or replication, feel free to ask
Change History
comment:2 Changed 5 years ago by nphase
Surprisingly, I got this to work when I tried:
window.parent.$().height(); window.parent.$(document).height() does not work (seems like it should) window.parent.$(window).height() does not work (seems like it shouldn't).
Hopefully this will help someone!
(formatting)
comment:3 Changed 5 years ago by flesler
- Cc flesler added
I think this is quite expected, here why (I think):
parent.$(window) is calling the jQuery function of the parent window, but passing the window from the frame.
That means... The jQuery object from another window, touching a foreign window.
Maybe this could be indeed patched. That would require to never assume that window is the only window. So replace every foo == window for !!foo.setInterval or something like that.
Still, could fail in many cases. This is not a very common use and I'm not sure it's worthy to patch such a thing.
I will keep this open, assigned to Brandon.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Surprisingly, I got this to work when I tried:
window.parent.$().height(); window.parent.$(document).height() does not work (seems like it should) window.parent.$(window).height() does not work (seems like it shouldn't).
Hopefully this will help someone!