Closed
Bug 54845
Opened 26 years ago
Closed 26 years ago
Submit to javascript: url's doesn't work
Categories
(Core :: DOM: Core & HTML, defect, P3)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
People
(Reporter: dp, Assigned: harishd)
References
()
Details
(Whiteboard: [nsbeta3-][rtm-][Fix in hand])
Attachments
(7 files)
|
875 bytes,
text/plain
|
Details | |
|
660 bytes,
text/plain
|
Details | |
|
80.47 KB,
text/plain
|
Details | |
|
704 bytes,
text/html
|
Details | |
|
5.13 KB,
patch
|
Details | Diff | Splinter Review | |
|
4.74 KB,
patch
|
Details | Diff | Splinter Review | |
|
4.73 KB,
patch
|
Details | Diff | Splinter Review |
Select any product from the product listing and click on GO
Nothing happens.
| Reporter | ||
Comment 1•26 years ago
|
||
Ccing pollmann, Adding rtm and beta3 keywords
Comment 2•26 years ago
|
||
"Go" is an image input. Clicking this should try to go to/do the action the
form. The action of this form is:
action="javascript:changePage();"
...
function changePage(){
i = document.SelectMenu.pro.selectedIndex;
if (i == 0){alert("Please select a product and click go.");return;}
else{
window.location.href = 'http://www.' + pv[i];
}
}
...
So the post will not try to submit the values to a server, but instead execute a
javascript - this is not a vanilla form post page. My guess is that the
javascript is indeed executing and the problem lies in changePage(). I won't
be able to confirm until I download a nightly tonight. :S
CC'ing some random people who might be able to look at this.
Summary: Clicking on img GO doesn't do form submit → Clicking on img GO doesn't do form submit (javascript: url)
Comment 3•26 years ago
|
||
I think the problem here is invalid html. I'll have a simplified test case
shortly.
Summary: Clicking on img GO doesn't do form submit (javascript: url) → Clicking on img GO doesn't do form submit
Comment 4•26 years ago
|
||
The html on this page is real garbage. I'm attaching a stripped-down version
that shows the GO button and the tags around it. The tags are not balanced,
the <form> tag has been erroneously duplicated, etc. etc. I'm surprised it lays
out as well as it does in 4.x.
Comment 5•26 years ago
|
||
Comment 6•26 years ago
|
||
I should mention that in the stripped-down version, you should get an alert when
you click on the GO button. And that is what happens in 4.x. In seamonkey,
nothing happens.
Comment 7•26 years ago
|
||
Comment 8•26 years ago
|
||
I'm wrong, it's not a matter of the html being invalid syntax. I just attached
a syntactically-correct variant of the test case and it behaves the same. That
is, when you click on the GO button, nothing happens.
Comment 9•26 years ago
|
||
After looking carefully at the stripped-down sytactically-correct test case, I'm
a bit confused. What we have is a form containing an image of a GO button.
There is an action to be taken when the form is submitted -- namely putting up
an alert dialog (in the real Mitsubishi page, the action is to change the page).
But there does not appear to be anything in the html that will cause the form to
be submitted.
In 4.x, just clicking on the image caused the form to be submitted. Is that
correct behavior or was that a bug in 4.x? In seamonkey clicking on the image
does nothing (form is not submitted) which is the behavior I would have
expected.
Comment 10•26 years ago
|
||
FWIW, here's a still further simplified test case:
<html>
<head>
<base HREF="http://www.mitsubishi.com/ghp_japan/">
<script>
function changePage(){
alert("Form was submitted.");
}
</script>
</head>
<body>
<form name="SelectMenu"
method=post
action="javascript:changePage();">
<input type="image" src="./images_top/go01.gif">
</form>
</body>
</html>
Comment 11•26 years ago
|
||
Rods, looks like mFormFrame is null in nsImageControlFrame::MouseClicked() so we
don't do anything when the user clicks on the 'GO' image.
That's only part of the problem though, when testing Steves last simplified
testcase I noticed that there's a problem in the PSM glue too (it freaks out if
there's no host in the URL it gets, as is the case with javascript: URLs), the
below patch resolvs that problem but I have no idea if the patch is the right
fix for the problem.
Index: extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp
===================================================================
RCS file: /cvsroot/mozilla/extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp,v
retrieving revision 1.33
diff -u -r1.33 nsSecureBrowserUIImpl.cpp
--- nsSecureBrowserUIImpl.cpp 2000/09/19 22:40:49 1.33
+++ nsSecureBrowserUIImpl.cpp 2000/10/02 06:58:46
@@ -558,7 +558,7 @@
aURL->GetHost(getter_Copies(host));
if (host == nsnull)
- return NS_ERROR_NULL_POINTER;
+ return NS_OK;
if ( PL_strncasecmp(host, "127.0.0.1", 9) == 0 ) {
nsresult res;
Hmm, looking at this patch, why not use PL_strcmp() and not PL_strncasecmp()?
Why case insensitive? And does the above code do what it's supposed to if the
host is "127.0.0.10"? Just wondering...
Cc:ing people who might know about the PSM code...
Updated•26 years ago
|
OS: Windows NT → All
Hardware: PC → All
Comment 12•26 years ago
|
||
This is XP, btw
Comment 13•26 years ago
|
||
Many thanks Steve and Johnny for looking into this. :)
It's strange that mFormFrame is null. This should be set the first reflow of
the nsImageControlFrame when it is added to the nsFormFrame via
AddFormControlFrame (there are two AddFormControlFrame methods in nsFormFrame -
the first finds the right form to add this control too, and the second one does
the actual work, including setting mFormFrame).
A possibility is that the image control is not a child of the form control in
the content model (could verify by dumping out the content model in viewer.).
The most common explanation for something like this is invalid HTML, but if this
is with the reduced test case Steve added, I'm stumped. ???
Also, Johnny, if you saw PSM-glue returning an error when it didn't mean to
explicitly cancel form submission, this is a big no-no. Any
nsIFormSubmitObserver that returns an error code will be cancelling form
submission (that's how the "Cancel" button on the security warning dialog
cancels form submits). I'm assuming that's what the patch you attached fixes,
so that looks like a good change to me!
Comment 14•26 years ago
|
||
FWIW, I don't think this should be a beta3 stopper - the test case is unusual in
that 1) The HTML is badly malformed 2) The form action is a javascript URL and
3) the image is an image input, not a standard image with an onClick handler
that submits the form.
Pages with all three of these characteristics individually are known to work
well in the browser - and the combination of all three makes the page a pretty
rare one.
Comment 15•26 years ago
|
||
I just ran a few tests with the nightly and an nsbeta2 install I have on this
laptop. It looks like form submit to a javascript: url doesn't work at all
(this is a regression since nsbeta2, as the test case for this bug works in
nsbeta2). I don't have a clear estimate of how common form submit to a
javascript: URL is, but certainly more common than the scenario I described in
my last post.
Summary: Clicking on img GO doesn't do form submit → Submit to javascript: url's doesn't work
Comment 16•26 years ago
|
||
Thanks Eric and Jonnie for your comments. But nobody has answered the question
that I posed above -- namely what should the correct behavior be. Should the
act of simply clicking on an image in a form result in a form submission? I
would expect it to fire an on-click handler for the image but I wouldn't have
expected it to submit the form. So could it be that our current behavior is the
correct one and the behavior in 4.x as well as in beta2 was incorrect?
Comment 17•26 years ago
|
||
I don't understand Johnnie's comment about the psm glue code:
"it freaks out if there's no host in the URL it gets"
I do not observe anything going on with psm when bringing up my test case.
Could you be more specific as to what symptoms you were seeing. Furthermore, if
there is a problem there, that should be put into a separate bug report.
Comment 18•26 years ago
|
||
Inside the nsImageControlFrame when it goes to get the form and assign the
pointer it fails to find a frame for the form content pointer. The method is:
void nsFormFrame::AddFormControlFrame(nsIPresContext* aPresContext, nsIFrame&
aFrame)
The line it fails on is:
result = presShell->GetPrimaryFrameFor(formContent, (nsIFrame**)&formFrame);
So in otherwords, it was able to get a pointer to a piece of content that didn't
have a frame registered for it. Something is completely wacked in the
content/frame model. I will attach partial dumps of the content and frame model
(in the same attachment. Look at the form content and frames it is pretty
screwed up.
Comment 19•26 years ago
|
||
| Reporter | ||
Comment 20•26 years ago
|
||
Steve, yes, for <INPUT type=image> on clicking, the form should be submitted.
You can update yourself with all about it at:
http://developer.netscape.com/docs/manuals/htmlguid/tags10.htm#1312530
| Reporter | ||
Comment 21•26 years ago
|
||
Steve, yes, for <INPUT type=image> on clicking, the form should be submitted.
You can update yourself with all about it at:
http://developer.netscape.com/docs/manuals/htmlguid/tags10.htm#1312530
Comment 22•26 years ago
|
||
Marking rtm-.
How frequently is this website accessed?
If it is accessed frequently we will consider marking rtm+.
Whiteboard: [rtm-]
Comment 24•26 years ago
|
||
Steve, clicking on the image in your simplified testcase doesn't submit the
form, the reason for that is that the psm code returns an error code (that's
what I meant with 'freaks out' :-) when there's no host in the URL and that
error propagates out to the form submission code which is interrupted by this
error code. With my patch the simplified testcase works.
Comment 25•26 years ago
|
||
Now that's interesting -- the patch jst presented makes the sample program work
properly but the original mitsubishi website still does not work. So I guess
there's something else that's significant on the website besides what was
captured in my simple testcase.
Comment 26•26 years ago
|
||
Yup, there are two problems here, it seems, see my comment on 2000-10-02 00:18
(first two lines for the other problem)
Comment 27•26 years ago
|
||
Okay, now I'm going to argue the other side. ;) My assessment above that this
should be nsbeta3- was based on incomplete understanding of the problems with
this page. At least one of them (the PSM bug Johnny found) is a very low risk
fix that could potentially also fix many similar sites.
This is a recent regression. The website worked fine until nsbeta2 and probably
later. The problem is undoubtedly more widespread than this single website,
though I can't provide specific examples of other sites that submit forms to
javascript: urls. Removing the rtm- because this is basic functionality and we
should at least investigate a bit further before deciding not to fix this one.
Whiteboard: [nsbeta3-][rtm-] → [nsbeta3-]
Comment 28•26 years ago
|
||
Comment 29•26 years ago
|
||
Ouch, this is a bad one, the content sink gets confused as to what the
current form is....
When testing attachment 16026 [details] you may want to change the "dump" to an "alert" (I
was testing in viewer)
Please review the source of attachment 16026 [details], it is reduced down from the the
URL page. The problem is where the <form> tag is defined in the example. (There
is actually one to many form tags in the document when it is being created with
script, but I left it in anyway)
1) When doing 'script' it writes a form element named SelectMenu
2) Another form element named SelectMenu is written into the doc
3) When "noscript", the form element named SelectMenu is defined.
4) then the image button is defined
5) the form is closed out.
As far as the content sink knows, when the input gets created the current form
element is the one from the noscript tag, which doesn't have a frame when script
is working.
If I remove the form element from the noscript part of the document it works.
Solution:
When the sink tracks what the current form in the document, it needs to know
whether the document is doing script and whether the form element being
processed is in script or noscript context.
reassigning
Assignee: rods → harishd
Comment 30•26 years ago
|
||
I don't understand rods's test case. With jst's patch, that test case works
just fine.
I tried to see what test case would demonstrate the second problem. With jst's
patch in place, I visited the original site, selected a product, clicked on GO
and nothing happened. Then I copied the entire html from that site to a local
file on my hard disk and visited the local file. Surprisingly, everything
worked fine.
Comment 31•26 years ago
|
||
Further observations. I now put the mitsubishi webpage on our own server and
tried it. Again it works fine. But if you bring the page up from the
mitsubishi server it does not work. To see this, visit:
http://peoplestage/morse/bug1.htm
This is an exact copy of the content on the original mitsubishi page. Select
"elevator" as the product. Click on GO. And you will get to the mitsubishi
elevator page. Try this same thing from the original mitsubishi page and
nothing happens.
So the problem must have something to do with http headers that their server is
or is not generating. Will try capturing some traffic in the two cases and
compare. Stand by for more details.
Comment 32•26 years ago
|
||
Below are the difference in the traffic between fetching the page from
mitsubishi or fetching my mirrored page. The significant differences (i.e.,
other than the hostname, date, etc) are:
1. Mitsubishi site SERVER is Netscape Enterprise 3.6 SP2 whereas
my mirrored SERVER is simply Netscape Enterprise 3.6
2. Mitsubishi site returns a link field
3. Mitsubishi site returns connection:close whereas
my mirrored site returns connection:keep-alive
4. The content from my mirrored site starts off with a <base> tag whereas
the mitsubishi site does not have that (strange since I copied the
content from the mitsubishi site and there was a <base> tag when I did
the copy).
-09:02:02.264 GET /morse/bug1.htm HTTP/1.1
- Host: peoplestage
+08:57:43.261 GET /ghp_japan/home.html HTTP/1.1
+ Host: www.mitsubishi.com
- Server: Netscape-Enterprise/3.6
- Date: Tue, 03 Oct 2000 15:27:57 GMT
+ Server: Netscape-Enterprise/3.6 SP2
+ Date: Tue, 03 Oct 2000 15:50:05 GMT
- Etag: W/"1696e9-6b9a-39d9fb37"
- Last-modified: Tue, 03 Oct 2000 15:28:55 GMT
- Content-length: 27546
+ Link:
<http://www.mitsubishi.com/ghp_japan/home.html?PageServices>; rel="PageSer
+ vices"
+ Etag: "416ef-60c3-39bdb772"
+ Last-modified: Tue, 12 Sep 2000 04:56:18 GMT
+ Content-length: 24771
- Connection: keep-alive
-
- <BASE HREF="http://www.mitsubishi.com/ghp_japan/">
+ Connection: close
Comment 33•26 years ago
|
||
hey steve,
is '<BASE HREF="http://www.mitsubishi.com/ghp_japan/">' really being interpreted
as a HTTP header (in the local server case)?
If so, that is a serious bug!! Please let me know.
-- rick
Comment 34•26 years ago
|
||
No, I believe it is being interpreted as part of the content. There is a blank
line between the last header and this first content line.
The thing that surprised me is that it is coming in as part of the content from
the local server but not from the mitsubishi server. Here is the actual traffic
(not merely a diff) reveived back from the local server:
09:02:02.354 HTTP/1.1 200 OK
Server: Netscape-Enterprise/3.6
Date: Tue, 03 Oct 2000 15:27:57 GMT
Content-type: text/html
Etag: W/"1696e9-6b9a-39d9fb37"
Last-modified: Tue, 03 Oct 2000 15:28:55 GMT
Content-length: 27546
Accept-ranges: bytes
Connection: keep-alive
<BASE HREF="http://www.mitsubishi.com/ghp_japan/">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org
/TR/REC-html40/loose.dtd">
<html>
... etc
Comment 35•26 years ago
|
||
And here's the actual traffic received back from the mitsubishi server:
08:57:43.452 HTTP/1.1 200 OK
Server: Netscape-Enterprise/3.6 SP2
Date: Tue, 03 Oct 2000 15:50:05 GMT
Content-type: text/html
Link:
<http://www.mitsubishi.com/ghp_japan/home.html?PageServices>; rel="PageSer
vices"
Etag: "416ef-60c3-39bdb772"
Last-modified: Tue, 12 Sep 2000 04:56:18 GMT
Content-length: 24771
Accept-ranges: bytes
Connection: close
08:57:43.752 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org
/TR/REC-html40/loose.dtd">
<html>
... etc
Comment 36•26 years ago
|
||
I'm now at the point of seeing exactly what jst reported, namely:
looks like mFormFrame is null in nsImageControlFrame::MouseClicked()
so we don't do anything when the user clicks on the 'GO' image.
This is indeed what is happening if you click on the GO button of the mitsubishi
page at
http://www.mitsubishi.com/ghp_japan/home.html
But if you click on the go botton on the website on our local server at
http://peoplestage/morse/bug1.htm
which contains the identical content, then mFormFrame is not null (and the GO
button works as it is supposed to).
So the question I have not yet been able to answer is why do these two sites
behave differently.
| Assignee | ||
Comment 37•26 years ago
|
||
As rod explained, the reason for "GO" button not working is the FORM inside
NOSCRIPT. Parser/Sink should make sure that the FORM inside NOSCRIPT does not
get processed. Working on it..
Status: NEW → ASSIGNED
Comment 38•26 years ago
|
||
Harish, that doesn't explain why the two URL's listed above should behave
differently. They contain identical content, yet for one the GO button works
properly and for the other it does not.
Comment 39•26 years ago
|
||
OK, harish just figured out why the copy on my local server was working
properly. I generated it by doing a view-source on the mitsubishi server,
selecting-all and copying it into a local file. But I was using nav 4.x to do
this and apparently there is a bug in 4.x whereby the <noscript> tags don't get
copied. So what I put on the local server did not have any nosripts and that
explains why it worked.
If I do the view-source in mozilla and capture the content, I get everything
including the <noscript>
Comment 40•26 years ago
|
||
Marking [rtm need info].
Whiteboard: [nsbeta3-] → [nsbeta3-][rtm need info]
Comment 41•26 years ago
|
||
*** Bug 53793 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 42•26 years ago
|
||
Comment 43•26 years ago
|
||
The original test case in this bug is also dependant on the fix for bug 54966,
which just got marked rtm+ (hoping for a ++ :)
Depends on: 54966
Comment 44•26 years ago
|
||
Checked the javascript: part of the fix into the trunk, will check into the
branch tomorrow.
Comment 45•26 years ago
|
||
The javascript: part of this fix is now in the branch as well, per rtm++ bug
55906.
| Assignee | ||
Comment 46•26 years ago
|
||
| Assignee | ||
Comment 47•26 years ago
|
||
Whiteboard: [nsbeta3-][rtm need info] → [nsbeta3-][rtm need info][Fix in hand]
Comment 48•26 years ago
|
||
This bug will be fixed when Harish checks in his fix for bug 56501 into the
branch. That fix is in the trunk right now and will get checked into the branch
once the PDT blesses bug 56501 rtm++.
Marking rtm-.
Whiteboard: [nsbeta3-][rtm need info][Fix in hand] → [nsbeta3-][rtm-][Fix in hand]
| Assignee | ||
Comment 49•26 years ago
|
||
56501 changes are in. This should be fixed now.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Comment 50•26 years ago
|
||
Mitsubishi page still doesent work. Dont know if the reason is just form
submission though, because when you change country on Nav4 the list of products
changes and on N6 it doesnt... Go button doesnt do anything though.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 51•26 years ago
|
||
The "Go" button does work for me. Which build are you using?
| Assignee | ||
Comment 52•26 years ago
|
||
Also, changing country does change the product. I can see all this happeining
with my build ( branch 10/18/00 ).
Comment 53•26 years ago
|
||
Hmm, I thought I was testing on the most recent build, but then I installed
todays build and its working fine... Its fixed. Verifying.
Status: REOPENED → RESOLVED
Closed: 26 years ago → 26 years ago
Resolution: --- → FIXED
Comment 54•26 years ago
|
||
Verifying on
Windows 98 build 2000-10-20-08-MN6
Linux RedHat6.2 build 2000-10-20-09-MN6
Status: RESOLVED → VERIFIED
Updated•7 years ago
|
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•