Closed
Bug 207596
Opened 23 years ago
Closed 23 years ago
javascript return true displays blank page except for word true
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: Ray.Trimble, Assigned: bugzilla)
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6
I use 141.com for email. You couldn't use URL because page is inside login but I
did view and copy source. With Firebird, 0.6 and nightly, clicking "delete"
displays a page which is blank except for word "true" in top left corner. With
Mozilla 1.3, Netscape 4.5, or IE 5 marked messages are deleted and the list is
redisplayed.
HTML says <p><a
href="javascript:doButton('Delete')"><b><script>w(X.DelSelMsgs)</script></b></a>
Javascript says:
function doButton(sButton)
{
if (sButton=="TopNextPage"
|| sButton=="TopLastPage"
|| sButton=="TopGoto"
|| sButton=="TopFirstPage"
|| sButton=="TopPriorPage"
|| sButton=="NextPage"
|| sButton=="LastPage"
|| sButton=="Goto"
|| sButton=="FirstPage"
|| sButton=="PriorPage")
{
var nCounter = document.forms.length;
var nForms = 0;
while (nForms < nCounter)
{
if (document.forms[nForms].name == sButton)
document.forms[nForms].submit();
nForms++
}
} else if (sButton=="Delete"
|| sButton=="Delete All"
|| sButton=="Move To"
|| sButton=="Goto Mailbox"){
document.mboxsummary.imail_action.value=sButton;
document.mboxsummary.submit();
return true;
}
}
Reproducible: Always
Steps to Reproduce:
1. View mail
2. Check boxes for one or more messages
3. Click "delete selected messages"
Actual Results:
Blank page display except for word "true" in top left corner. Back button
returns me to mail list. If I exit from mail and reenter, selected messages have
not been deleted. Javascript window doesn't show any errors.
Expected Results:
Refreshed the page without the deleted messages.
I have just started using Firebird, and have done very little customization. I
haven't done anything with themes.
Ray, this sounds like a dupe of bug #205989 where some problems with JavaScript
have been fixed. You mentioned "with Firebird, 0.6 and nightly" - so which
nightly did you try? A fix for the above mentioned bug has been provided by
2003-05-21 so all nightlies after 2003-05-22 should work - otherwise your bug
seems to be different and we'll have to investigate further.
Via mail: the build used by Ray was 2003-05-27 hence I had a quick look on the
source code and from my point of view (with little till no knowledge on JS ;o) )
the problem may be caused by missing void( ... )-operator around the call of
doButton().
So the call of the function should look like
<p><a href="javascript:void(
doButton('Delete'))"><b><script>w(X.DelSelMsgs)</script></b></a>
to ignore any return value which may be returned by doButton( ), but as
mentioned above this should be confirmed by some more experienced JS folks...
Nevertheless this is definitely not related to bug #205989 since this was
already fixed in build 2003-05-27 used by Ray!
Comment 3•23 years ago
|
||
void isn't part of javascript at all, so that's not it. This does sound like
that javascript issue Erik mentioned.
what is the URL bar showing in this? Can you save as web page, Complete and
attach it? I'd need to see what the form itself is trying to do on submit, but
the JS pasted into the bug looks fine.
Mike, I found this void-stuff at http://tech.irt.org/articles/js170/ - there's
an chapter "Why and when to use the void" where it is said, that it's often used
within links (like in our case) to avoid the browser to display the returned
result - that seems to match the code fractions provided by Ray.
I can attach a testcase which I used to play around with but perhaps it's a
better idea to use the _complete_ page provided by Ray to see what's exactly
going on!
This is the simplified testcase from the code fragments provided by Ray in
comment #0. If some more experienced dude finds that this testcase (or perhaps
the conclusions I've takeen out of the results) is absolutely nonsense then
please don't flame around since this is the first time I started to play around
with JS - thanks! :)
Comment 6•23 years ago
|
||
Argh, I need to drink coffee before I read bugs. Erik, you're right on this for
sure. As this is expected javascript behaviour and occurs in IE 6.0 as well
using your testcase, I think this is probably Tech Evangelism as the function
really shouldn't be returning a value in any case.
http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/ops.html#1042625
Ok, but there's still some weirdness about this bug since Ray mentioned, that
a) with Mozilla 1.3, Netscape 4.5, or IE 5 marked messages are deleted and
b) according to the provided coding there really should be done something
before 'return' gets executed
document.mboxsummary.imail_action.value=sButton;
document.mboxsummary.submit();
return true;
so either we have two different problems here (1. displaying the "true", which
might be coding related and 2. not deleting the messages) or this "not deleting
the messages"-problem is caused by "the loading a new page and display
'true'"-stuff.
Comment 8•23 years ago
|
||
Using the simplified testcase I see the exact same behaviour in Mozilla and IE.
Isn't this INVALID?
Well, if we exactly rely on the summary, then this one is either invalid or a
tech evangelism issue, since returning true from JS used in a link without
void() operator displays the returned value, which is 'true'.
But reading the filed bug report we see that there are probably two problems
which seem to be related somehow: the first one, which is the displayed 'true'
after clicking [Delete] and the second one, which is the fact, that the marked
messages additionally don't get deleted, when clicking the link.
The attached testcase just shows, that without using the void operator we just
get displayed what the related JS function returns - so it#s just a confirmation
that problem #1 is caused by a coding error.
Thus, from my point of view based on the code fragments the first problem is a
tech evangelism issue since using the void operator in links is necessary.
Nevertheless the second problem makes me wonder: why don't get the marked
messages deleted? if you look at the code fragments in comment #0 they don't do
much in the branch for 'Delete' - just setting a variable to 'Delete' (or any
other value of sButton) and the form gets submitted and next they return true.
Is it possible that the submition procedure gets disturbed since Moz.Firebird
loads a new page to display the 'true'?
But why does it work with IE, NS 4.7 or SeaMonkey 1.3? Without knowing what's
really going on I don't suggest resolving this one invalid or moving it over to
tech evangelism.
Perhaps a compromise would be to move this one over to tech evangelism and to
ask the mail provider to put the missing void() to the link. Then we would need
a second bug - perhaps marked dependent on the first - which just deals with the
not deleted messages stuff.
Comment 10•23 years ago
|
||
This is the original testcase; I had to add a form with an input in it to get
it to go without JS errors, but once it did, it submitted rather than creating
a blank page. Reporter, could you upload the entire page?
Comment 11•23 years ago
|
||
Hmm, could someone retest this with a build newer than 20030522? This could have
been due to the regression bug 205989 which was fixed on 5/21.
Comment 12•23 years ago
|
||
johnny, reporter was using 05/27 nightly per comment #2, that was the first
thing we cheecked :-)
| Reporter | ||
Comment 13•23 years ago
|
||
On June 3, Erik Fornoff sent me an email in which he asked (among other things)
if I had created a new profile when I downloaded the nightly. I hadn't. I just
now downloaded the 6/7 nightly and created a new profile. It handles my problem
web page just fine.
My apologies for bothering you, and thanks for your concern.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
| Reporter | ||
Comment 14•23 years ago
|
||
Postscript:
Just tried the new nightly with the old profile, and that also works. So maybe
the problem was fixed between May 27 and Jun 7.
You need to log in
before you can comment on or make changes to this bug.
Description
•