Bug 106748

Summary: Reading freemail.hu webmail is broken (Regression)
Product: [Applications] konqueror Reporter: András Manţia <amantia>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: finex, hopparz, maksim
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: framebug.tar.bz2

Description András Manţia 2005-06-03 20:41:26 UTC
Version:           3.4.0 (using KDE KDE 3.4.0)
Installed from:    SuSE RPMs
OS:                Linux

Since KDE 3.4.0, reading of the webmail on http://freemail.hu is broken. Might be a frame reloading issue as the problem is:
- when you log in and try to read mail, the list of folders and mails in the current folder appears above the message area, but it disappears quickly and the whole area is replaced by the message text itself

I've created a test user to reproduce, as it may be hard for you to do (it is in Hungarian).
Go to http://freemail.hu
As "Nev" use "konqui_test".
As "Jelszo" use "konqui".

Press Enter and you should be logged in now.
Now in the left-top area a little bit under the freemail logo, there is the "Olvas" text. Click on it and in the main area the bug will be visible.

The created user will be valid for 3 months from now (unless somebody logs in meantime using this id).

This worked with older Konqueror releases,  but I couldn't say when it got broken. It works with Firefox as well.
Comment 1 András Manţia 2005-09-28 16:12:33 UTC
Well, the bug is still present and the username above is not valid anymore. If anyone cares to fix it, I will create a new user.

This is a very annoying bug for Hungarian users...
Comment 2 Germain Garand 2005-09-28 17:29:49 UTC
then please do, yes... 
Comment 3 András Manţia 2005-09-29 10:09:44 UTC
The same user/pass should work again.
Comment 4 András Manţia 2005-11-09 10:03:05 UTC
The problem is still present in 3.5 from svn. I've tried to find the 
reason (create a small testcase), but I wasn't quite successful. I have 
a guess though which might indicate that the problem is JavaScript 
interpretation related. If you click onto the "Olvas" link in the left 
menu, a page called "readnavig?sid=LONGSTRING" is opened in the right 
frame with the following (or similar) content:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
 if ( top.current_mmax == 0 ) top.current_mmax = 5
 if ( top.current_page == 0 ) top.current_page=((5-1)/top.pagesize)+1;
 if ( top.current_msgnum == 0 ) top.current_msgnum=5;
 if ( top.current_read_msgnum == 0 ) top.current_read_msgnum=5;
 if ( top.current_fullfolder != 0 ) 
document.location.href='folder_m?sid=0acAy1Dh0EMmbTvyXpSm2PU3lK8Of7iyw48ZuYIjRbOnFi2YQecNL0O3j5zQ3GGEv0s5QT6jeKec_';
 if ( top.current_fullmail != 0 ) 
document.location.href='read_m?sid=0acAy1Dh0EMmbTvyXpSm2PU3lK8Of7iyw48ZuYIjRbOnFi2YQecNL0O3j5zQ3GGEv0s5QT6jeKec_&folder='
</SCRIPT>
</HEAD>
<frameset ROWS="145,*" FRAMESPACING="0" BORDER="0" FRAMEBORDER="no">
        <frameset COLS="230,*" FRAMESPACING="0" BORDER="0" 
FRAMEBORDER="no">
                <frameset ROWS="35,*" FRAMESPACING="0" BORDER="0" 
FRAMEBORDER="no" BORDER="0">
                        <frame NAME="folders_top" 
SRC="folders_top?sid=0acAy1Dh0EMmbTvyXpSm2PU3lK8Of7iyw48ZuYIjRbOnFi2YQecNL0O3j5zQ3GGEv0s5QT6jeKec_" 
MARGI
                        <frame NAME="folders" 
SRC="folders?sid=0acAy1Dh0EMmbTvyXpSm2PU3lK8Of7iyw48ZuYIjRbOnFi2YQecNL0O3j5zQ3GGEv0s5QT6jeKec_" 
MARGINHEIGHT=
                </frameset>
                <frame NAME="folder_m" 
SRC="folder_m?sid=0acAy1Dh0EMmbTvyXpSm2PU3lK8Of7iyw48ZuYIjRbOnFi2YQecNL0O3j5zQ3GGEv0s5QT6jeKec_" 
MARGINHEIGHT="0" MA
        </frameset>
        <frame NAME="read_m" 
SRC="javascript:this.document.location.href='read_m?sid=0acAy1Dh0EMmbTvyXpSm2PU3lK8Of7iyw48ZuYIjRbOnFi2YQecNL0O3j5zQ3GGEv0s5QT
</frameset>
</HTML>

It seems that in Konqueror 
 if ( top.current_fullmail != 0 ) 
document.location.href='read_m?sid=0acAy1Dh0EMmbTvyXpSm2PU3lK8Of7iyw48ZuYIjRbOnFi2YQecNL0O3j5zQ3GGEv0s5QT6jeKec_&folder='

is evaluated as  top.current_fullmail != 0 is true, so the main message 
is shown instead of the frames, while in Firefox and other browsers 
this statement is false.

In the main document's source
var current_fullmail=0;

so I have no idea what is happening there.

PS: The account is extended again.
Comment 5 András Manţia 2005-11-09 10:54:43 UTC
I finally could make a small testcase. Load the readnavig.html in 
Konqueror to witness the bug. The bug is in line 6:
<frame NAME="read_m" 
SRC="javascript:this.document.location.href='read_m.html'" 
MARGINHEIGHT="0" MARGINWIDTH="0">

Konqueror unconditionally loads the read_m.html as the main document 
instead of putting it in the frame. You can even see as the location 
entry changes.

Andras


Created an attachment (id=13357)
framebug.tar.bz2
Comment 6 András Manţia 2005-11-09 12:25:34 UTC
Further investigations indicates that the javascript is executed for the 
current document, not for the frame itself.
In KHTMLPart::requestFrame there is the following code:
 // Support for <frame src="javascript:string">
  if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
  {
      QVariant res = executeScript( DOM::Node(frame->element()), 
KURL::decode_string( url.right( url.length() - 11) ) );
      KURL myurl;
      myurl.setProtocol("javascript");
      if ( res.type() == QVariant::String )
        myurl.setPath(res.asString());
      return processObjectRequest(*it, myurl, QString("text/html") );
  }

executeScript() request the KJSProxy with KHTMLPart::jScript(). Here 
d->m_frame->m_jscript is returned, altough I believe a new one should 
be created, because I get the following debug output:
andris@stein:~/a> konqueror readnavig.html
khtml (jscript): Window::Window this=0x8479148 part=0x8409c00 
frame=0x836f420 <---------  [the KJSProxy is created at the beginning]
khtml (jscript): Location::put href m_part=0x8409c00 <-------- [the same 
part is used when changing the location![
khtml (jscript): Window::goURL dstUrl=file:///home/andris/a/read_m.html

I give up at this point due to the lack of knowledge in this area and 
the lack of time.
Comment 7 András Manţia 2006-01-22 10:07:24 UTC
An update: the bug is present in 3.5.1. :-(
Comment 8 András Manţia 2006-03-05 18:00:41 UTC
Is there somebody who can look at this or guide me a little how to fix it? This bug is the one which makes me install Firefox as a default browser for a library users (hundreds of visitors), instead of Konqueror.
Comment 9 Maksim Orlovich 2006-03-05 22:17:57 UTC
I'd suggest e-mailing kfm-devel. David is the person most likely to be able to help you with this.
Comment 10 Maksim Orlovich 2006-09-29 03:18:59 UTC
I actually started on this right now, it affects amazon.com as well (See bug #134791). I am just wondering whether you've done any testcasing on this --- the behavior of other browsers is quite bizarre and I am unable to come up with a good model for it. 
Comment 11 András Manţia 2006-09-29 10:58:33 UTC
Haven't I attached a small example to reproduce it? If not, I will dig 
up and do it again (I'm not at home, but I might have the testcase on 
my laptop).
And some time ago I tried Konqueror from KDE4 and I was amazed that 
there it worked. I did a quick diff, but couldn't find the change, 
well, as many things changed due to the Qt4 porting.
Comment 12 Maksim Orlovich 2006-09-29 15:12:29 UTC
Nothing relevant is changed there, that's weird. And I don't mean a testcase to reproduce --- I have that --- I meant more if you did any testing of details of behavior, but I guess not. Well, fair enough, not your responsibility anyway.
Comment 13 András Manţia 2006-09-29 15:21:09 UTC
All I did is what I summarized in the bug report. I will test again the 
KDE4 version once I'm home (2 days from now) to see if I'm really right 
that it is not broken there.
Comment 14 Maksim Orlovich 2006-09-30 16:35:32 UTC
SVN commit 590600 by orlovich:

Evaluate scripts in <iframe src=javascript:..> in the right context.
Affects amazon and freemail.hu
BUG:134791
BUG:106748



 M  +13 -6     khtml_part.cpp  


--- branches/KDE/3.5/kdelibs/khtml/khtml_part.cpp #590599:590600
@@ -4314,12 +4314,19 @@
   // Support for <frame src="javascript:string">
   if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
   {
-      QVariant res = executeScript( DOM::Node(frame->element()), KURL::decode_string( url.right( url.length() - 11) ) );
-      KURL myurl;
-      myurl.setProtocol("javascript");
-      if ( res.type() == QVariant::String )
-	myurl.setPath(res.asString());
-      return processObjectRequest(*it, myurl, QString("text/html") );
+    if ( processObjectRequest(*it, KURL("about:blank"), QString("text/html") ) ) {
+      KHTMLPart* p = static_cast<KHTMLPart*>(static_cast<KParts::ReadOnlyPart *>((*it)->m_part));
+      
+      // See if we want to replace content with javascript: output..
+      QVariant res = p->executeScript( DOM::Node(), KURL::decode_string( url.right( url.length() - 11) ) );
+      if ( res.type() == QVariant::String ) {
+        p->begin();
+        p->write( res.asString() );
+        p->end();
+      }
+      return true;
+    }
+    return false;
   }
   KURL u = url.isEmpty() ? KURL() : completeURL( url );
   return requestObject( *it, u );
Comment 15 András Manţia 2006-10-01 13:16:52 UTC
This is amazing! I'm just updating my checkout to test, but it's good 
it's done before 3.5.5. It means that for many users here at the city 
library Konqueror will work just as good as Firefox (and even better in 
some cases).
Comment 16 Maksim Orlovich 2006-10-01 14:27:02 UTC
Could you please confirm it fully works, since there may be something else broken?
Comment 17 András Manţia 2006-10-01 16:14:43 UTC
Yes, I tested now and it works (there are some tabbed browsing issues, 
but that is not related to this bug).
Comment 18 Tommi Tervo 2006-10-24 12:25:36 UTC
*** Bug 136224 has been marked as a duplicate of this bug. ***
Comment 19 Zoltan Hoppar 2006-10-26 13:35:11 UTC
The problem isn't fully busted. After log in the main frame opens only in horizontally quarter size, but everything in place. If you enter to read the mails, now opens all correctly of it, exept one - the last arrived mail content frame not executes 'til I click one to show it. In content window frame the command icons are also not working, but if you click - opens another tab, with an unusable content on white page. Similar to if I want to answer to the mail, the answer frame opens correctly, but down the javascript buttons makes the same.
Comment 20 András Manţia 2007-01-23 16:12:39 UTC
#19 confirmed, so I reopen. The current working test account is:
- "Nev" : "konqueroruser" 
- "Jelszo": "kubuntu"
 
Comment 21 András Manţia 2008-04-05 17:35:54 UTC
Bug still present (but use http://freemail.hu/fm/login1?ver=0 to get this version of the web page).
Comment 22 FiNeX 2008-04-06 23:43:49 UTC
I've tried to login from http://freemail.hu/fm/login1?ver=0 with konqueror 4.0.3.
The page is rendered not so bad. The email list is ever on top and the mail content is on bottom. Scrolling it doesn't hide the email list.
Comment 23 András Manţia 2008-04-07 00:32:22 UTC
The problem here is that when you click on the Olvas link on the left, 
the email list will appear on the top, but the email content will not 
appear below, unless you click on an email. Instead it shows:
read_m?sid=2qsbX7q27EkGx2H8PKBtG4d.mJEHymWDj69CwBlIKx7s3mzNQTaakmI9z3iMVhJKAfQhu2BuKWQJ1lSTXC7FcPg__&folder=new&msgnum=4&autoopen=0

Anyway, this (the "old freemail") interface is usable, but not known for 
regular users. The new one (http://freemail.hu) is the one that is 
completely unusable.
Comment 24 FiNeX 2008-04-07 17:49:57 UTC
I've see the "read_m?..." string too. Clicking on "olvas" should show even the first email content?

The new interface is unusable.
Comment 25 András Manţia 2008-04-07 18:25:52 UTC
> ------- I've see the "read_m?..." string too. Clicking on "olvas"
> should show even the first email content?

Not exactly,  a line:
konqueroruser@freemail.hu  	Mappa: - 	nincs levél megnyitva

(nincs levél megnyitva = there is no opened mail)
Comment 26 Maksim Orlovich 2008-04-07 19:08:00 UTC
SVN commit 794482 by orlovich:

Let a redirect from within a javascript: frame source win out over the text..
(For src="javascript:this.window.location.href='foo'", on the old freemail.hu,
better written as src="foo")

CCBUG:106748


 M  +1 -1      khtml_part.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=794482
Comment 27 Maksim Orlovich 2008-04-07 19:11:15 UTC
SVN commit 794484 by orlovich:

automatically merged revision 794482:
Let a redirect from within a javascript: frame source win out over the text..
(For src="javascript:this.window.location.href='foo'", on the old freemail.hu,
better written as src="foo")

CCBUG:106748

 M  +1 -1      khtml_part.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=794484
Comment 28 András Manţia 2008-08-26 20:00:38 UTC
Let's mark it close, because it works in KDE4 trunk.