Closed Bug 178773 Opened 22 years ago Closed 21 years ago

Invisible forms not accessible via JavaScript

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 178258

People

(Reporter: bugzilla, Assigned: harishd)

Details

Attachments

(1 file)

A form which has no visible elements cannot be accessed via JavaScript.  When
attempting to address the form in JS, an error appears on the JS console
"document.formname has no properties".  Adding a single visible element makes
the form available in JavaScript.

I'm not sure if this is a bug or a "security feature".  If it's a feature, it
does a poor job of preventing invisible forms from being submitted, as a small
visible item can be added which will not draw attention.  Also it should be
possible to turn this "feature" off for specific sites as a lot of sites use
invisible forms to pass data to JavaScript.
Attached file testcase (deleted) —
The testcase works fine for me (linux build 2002-11-01-21).  Marking bug invalid
because it does not provide any of the information requested in
http://www.mozilla.org/quality/bug-writing-guidelines.html

Feel free to reopen if you list your build id and a url or testcase that shows
the problem.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Boris: thanks! Marking Verified. Here is the source of Boris' testcase:

<html>
<body>
<form name="aaa">
<input type="button" value="click me" onclick="alert(document.bbb)">
</form>
<form name="bbb"></form>
</body>
</html>


When I try this with Mozilla trunk binary 20021104xx on WinNT,
I also find that |document.bbb| is accessible, even though it
doesn't contain any visible element (or any element at all).

Greg: if you have a reduced testcase that exhibits the bug,
please attach it here via the "Create a New Attachment" link 
above, and reopen this. In that case, please be sure to report
the build ID of Mozilla you are using, as with any bug; thanks -
Status: RESOLVED → VERIFIED
Turns out it only happens when the screen is completley blank.  Example at:
http://66.54.199.11/~netchess/bug.html

Adding a single period to the file causes the problem to go away.

I'm not sure how to get the build number, but Help->About shows:
Mozilla 1.1 
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.1) Gecko/20020826
Status: VERIFIED → UNCONFIRMED
Resolution: INVALID → ---
how interesting.... if you check after onload, the document.myform works fine. 
but during load the invalid HTML seems to be confusing the content sink or
something....  Seeing this on Linux build 2002-11-01-21 as well.
Assignee: rogerl → harishd
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → Parser
Ever confirmed: true
OS: Windows 98 → All
QA Contact: pschwartau → moied
Hardware: PC → All
http://66.54.199.11/~netchess/bug.html is as follows:

<form name=myform action="whatever.cgi">
<input type=hidden name=test value="Testing">
</form>

<script>
alert(document.myform.test.value);
</script>

No problem if the page had <body>.

*** This bug has been marked as a duplicate of 178258 ***
Status: NEW → RESOLVED
Closed: 22 years ago21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: