Bug 44173 - Page rendering aborts prematurely if invalid history index requested
Summary: Page rendering aborts prematurely if invalid history index requested
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: kjs (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-20 20:33 UTC by yourst
Modified: 2002-10-31 15:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yourst 2002-06-20 20:20:40 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           konqueror
Version:           KDE 3.0.1 
Severity:          normal
Installed from:    Compiled From Sources
Compiler:          gcc 3.1
OS:                Linux
OS/Compiler notes: Not Specified

Some web pages fail to render correctly if something like:

window.history.forward();

is the first line in a javascript when there are no more pages to go forward to. The problem is in konqueror itself in konq_view.cc (see patch below.) Basically stop() gets called before we check if the history index is even valid; this breaks many pages where history.forward() is called as a preventative measure. Other browsers all (correctly) ignore this.

Example page (hangs during rendering on all KDE 3.x versions plus current CVS):

<HTML><HEAD>
  <SCRIPT Language="javascript">
  javascript:window.history.forward(1);
  </SCRIPT>
</HEAD><BODY>
  Testing!
</BODY></HTML>

Patch to fix this:

--- /net/cvs.kde.org/kdebase/konqueror/konq_view.cc.orig        Thu Jun 20 16:02:45 2002
+++ /net/cvs.kde.org/kdebase/konqueror/konq_view.cc     Thu Jun 20 16:05:24 2002
@@ -6248 +6246 @@
       return;
   }

-  stop();
-
   int newPos = m_lstHistory.at() + steps;
 #ifdef DEBUG_HISTORY
   kdDebug(1202) << "go : steps=" << steps
@@ -6366 +6348 @@
   if( newPos < 0 || (uint)newPos >= m_lstHistory.count() )
     return;

+  stop();
+
   // Yay we can move there without a loop !
   HistoryEntry *currentHistoryEntry = m_lstHistory.at( newPos ); // sets current item


(Submitted via bugs.kde.org)
Comment 1 David Faure 2002-10-31 15:50:32 UTC
Patch was perfectly correct! Too bad I didn't see it before 02-Oct, when I fixed this  
exact same bug...  
  
revision 1.313 
date: 2002/10/02 14:48:13;  author: faure;  state: Exp;  lines: +6 -3 
Fixed window.history.forward(1) (on a new window, pretty stupid thing to do), 
by moving the stop() call under the sanity check for the argument. 
This fixes the login window on www.hsbc.ca. George said ok :) 
============================================================================= 
 
Please send patches to kfm-devel in the future - I read this with more priority than 
the huge buglist...