Closed Bug 151300 Opened 22 years ago Closed 21 years ago

Attempting to call the pageYOffset property of the contentWindow of an iframe element fails.

Categories

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

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: pipian, Unassigned)

References

()

Details

(Keywords: testcase)

Attachments

(2 files)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530
BuildID:    2002053012

I am uncertain as to whether I am coding the DOM/JavaScript for this test page
correctly (at http://www.pipian.com/bugzilla/pageOffset/navbar.js), but I
essentially was attempting to control the scrolling of the iframe through links
while allowing the code to work in MSIE 4+ as well.

Most comments on the bug can be found in the .js file itself, but essentially,
it is summed up thusly:

The iframe.contentWindow.pageYOffset property (and presumably the pageXOffset
property as well, though this is untested) does not exist as it should.

This is either a bug that should be fixed, or an enhancement, depending on the
intent of the original coder.  I believe it is a bug, and have marked it as such
(Normal severity).  I have not tried to reproduce this problem with alternate
iframe element examples, but it reproduces itself every time on the supplied
test page.

Reproducible: Didn't try
Steps to Reproduce:
1. Create any iframe element in a file with a transitional doctype
2. Attempt to call (using calls to the DOM) the property of the iframe:
iframe.contentWindow.pageYOffset.
3. The call should return false.

Actual Results:  When the mouse hovers over one of the links (either the up or
down link in the sc2k.htm) the browser does not scroll the iframe (as the
property iframe.contentWindow.pageYOffset is non-existant, so it's value is false).

Expected Results:  When the mouse hovers over one of the links (either the up or
down link in the sc2k.htm) the browser should execute code that will continue to
increase or decrease the Y offset of the page within the iframe, through the use
and manipulation of the hypothetical property iframe.contentWindow.pageYOffset.
Summary: Attempting to call the pageXOffset property of the contentWindow of an iframe element fails. → Attempting to call the pageYOffset property of the contentWindow of an iframe element fails.
Browser, not engine ---> DOM Level 0
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → desale
I get URL not found when I try to access the provided URL...
The URL is fine, though my server has been rather unreliable of late.  It is
unix though, so the capitalization of pageOffset will make a difference.
Upon further investigation to make another testcase to apply to the bug, I find
that it is possible to get the attribute, but only once.  Attempts to get any
times more that once create an error in the JavaScript Console as follows:

"Error: uncaught exception: Permission denied to get property
Window.pageYOffset"

In addition, it is impossible to set this attribute as would be hoped, with the
error:

"Error: setting a property that has only a getter"

Both of these errors are given in the attached test case.

If the property has become read-once-only, then feel free to disregard the bug.
 If they are meant to be multi-read/multi-write, then the bug remains.
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Just need some confirmation that this still happens. Seems like a perfectly
valid bug.
At least window.pageYOffset still appears to be readonly. The raised error 
is "setting a property that has only a getter". I personally consider this a 
bug, since I see no reason to not allow the user to change the value 
programmatically from JavaScript.
pageYOffset is readonly because it was implemented this way in the original NS
js implementation 
(http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1203046)
There are other properties to scroll an iframe.
I do get the permission denied to get window.pageYOffset error, no idea why, tho.
109   readonly attribute long                        pageXOffset;
110   readonly attribute long                        pageYOffset;
http://lxr.mozilla.org/seamonkey/source/dom/public/idl/base/nsIDOMWindowInternal.idl#107

There are proper methods to scroll a window or frame or iframe: scrollTo(),
scrollBy(), scroll(), scrollByLines(), scrollByPages().

mozilla.org and bugzilla.mozilla.org are apparently not the same domain.
Javascript can not access nor modify a document which do not share the same
domain name.
"The same origin policy works as follows: when loading a document from one
origin, a script loaded from a different origin cannot get or set specific
properties of specific browser and HTML objects in a window or frame"
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/guide/sec.html#1015705

I recommend to RESOLVE this bug as INVALID
The document in the blue bordered iframe is an attachment/testcase to bug
189308.
contentWindow is not that useful as there are other ways to access the document
of an iframe and those other ways are better supported than contentWindow in
other browsers (like Opera 7.50)
I forgot to mention that the complete testcase has been tested in MSIE 6 SP1 for
windows, Opera 7.50 PR1 and Firebird 0.8+ rv:1.7a build 20040120 and Mozilla 1.6
final.

Not tested in the testcase was
RefIframe.contentWindow.document.getElementById("idElement").scrollIntoView(true);
the scroll event occurs but the values are not updated accordingly in the form
input controls.

I recommend to resolve as INVALID since one can never set directly
window.pageX/YOffset property values.
Keywords: testcase
"You should resolve a bug as INVALID, if the issue described in the bug is
clearly not a Mozilla bug or if the issue is intended behaviour."
http://mozilla.org/quality/help/bugzilla-privilege-guide.html#resolving

Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: