Bug 66958 - Reload does not reload the current page in web sites with frames, it reloads the home page
Summary: Reload does not reload the current page in web sites with frames, it reloads ...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 60478 77792 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-31 10:23 UTC by Pablo de Vicente
Modified: 2008-11-04 09:34 UTC (History)
3 users (show)

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 Pablo de Vicente 2003-10-31 10:23:32 UTC
Version:            (using KDE KDE 3.1.92)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc 3.3.1 
OS:          Linux

When logging into a web site with frames if one is viewing a page which is not the home page, and then reloads that page the home page is rendered. This does not happen with mozilla, for example.

Try this web please: http://www.oan.es

and then select any page from any link in the main page or the left side buttons, for example browse using the blue button "Informaci
Comment 1 Stephan Kulow 2003-10-31 13:12:41 UTC
there are reasons why frames are deprecated :)
Comment 2 Thomas Friedrichsmeier 2005-03-29 19:02:37 UTC
Still present in 3.3.2 and can't find a mention in the changelog for 3.4 (I don't have 3.4 installed, yet).
Of course there are reasons why frames are deprecated. There are also reasons why it would still be nicer 99% of the time, if reload would reload the frameset with the _current_ pages instead of the initial pages.
This thing has bitten me time and again, when I simply wasn't consciously aware, that I was visiting a website with frames, and that this website - in konqueror - would behave entirely different when pressing reload than what you'd normally expect.
So while frames are evil indeed, they are an evil which is still widely used. It's an evil which _can_ be alleviated in this particular regard. So is there a reason not to pursue this bug / wishlist item? Are there any relevant cases when the current behavior is preferable to the behavior requested?

(Note: being somewhat argumentative here, since comment #1 seems to suggest that this report will be willfully ignored. I know dealing with bugs like this is tedious and timeconsuming, and I don't "demand" immediate resolution or something. Just trying to make sure this is not being ignored)
Comment 3 Tommi Tervo 2005-10-11 15:31:16 UTC
*** Bug 77792 has been marked as a duplicate of this bug. ***
Comment 4 Tommi Tervo 2005-10-17 14:23:31 UTC
*** Bug 60478 has been marked as a duplicate of this bug. ***
Comment 5 Hasso Tepper 2007-01-14 20:51:09 UTC
SVN commit 623425 by hasso:

Implement soft frameset reload strategy - reload individual frames only.
Frameset can be still reset via moving cursor into URL bar and pressing
the enter key.

Reviewed by Germain Garand.

BUG:66958



 M  +1 -1      kdebase/konqueror/konq_mainwindow.cc  
 M  +5 -2      kdebase/konqueror/konq_view.cc  
 M  +1 -1      kdebase/konqueror/konq_view.h  
 M  +19 -0     kdelibs/khtml/khtml_part.cpp  
 M  +2 -0      kdelibs/kparts/browserextension.cpp  
 M  +7 -0      kdelibs/kparts/browserextension.h  


--- branches/KDE/3.5/kdebase/konqueror/konq_mainwindow.cc #623424:623425
@@ -1766,7 +1766,7 @@
 
   KonqOpenURLRequest req( reloadView->typedURL() );
   req.userRequestedReload = true;
-  if ( reloadView->prepareReload( req.args ) )
+  if ( reloadView->prepareReload( req.args, true /* softReload */ ) )
   {
       reloadView->lockHistory();
       // Reuse current servicetype for local files, but not for remote files (it could have changed, e.g. over HTTP)
--- branches/KDE/3.5/kdebase/konqueror/konq_view.cc #623424:623425
@@ -170,7 +170,7 @@
   // Typing "Enter" again after the URL of an aborted view, triggers a reload.
   if ( m_bAborted && m_pPart && m_pPart->url() == url && !args.doPost())
   {
-    if ( !prepareReload( args ) )
+    if ( !prepareReload( args, false /* not softReload */ ) )
       return;
     if ( ext )
       ext->setURLArgs( args );
@@ -1347,9 +1347,12 @@
       KGlobal::_activeInstance = m_pPart->instance();
 }
 
-bool KonqView::prepareReload( KParts::URLArgs& args )
+bool KonqView::prepareReload( KParts::URLArgs& args, bool softReload )
 {
     args.reload = true;
+    if ( softReload )
+        args.softReload = true;
+
     // Repost form data if this URL is the result of a POST HTML form.
     if ( m_doPost && !args.redirectedRequest() )
     {
--- branches/KDE/3.5/kdebase/konqueror/konq_view.h #623424:623425
@@ -314,7 +314,7 @@
 
   // Called before reloading this view. Sets args.reload to true, and offers to repost form data.
   // Returns false in case the reload must be cancelled.
-  bool prepareReload( KParts::URLArgs& args );
+  bool prepareReload( KParts::URLArgs& args, bool softReload );
 
   // overload for the QString version
   void setLocationBarURL( const KURL& locationBarURL );
--- branches/KDE/3.5/kdelibs/khtml/khtml_part.cpp #623424:623425
@@ -639,6 +639,25 @@
       isFrameSet = htmlDoc->body() && (htmlDoc->body()->id() == ID_FRAMESET);
   }
 
+  if (isFrameSet && urlcmp( url.url(), m_url.url(), true, true ) && args.softReload)
+  {
+    QValueList<khtml::ChildFrame*>::Iterator it = d->m_frames.begin();
+    const QValueList<khtml::ChildFrame*>::Iterator end = d->m_frames.end();
+    for (; it != end; ++it) {
+      KHTMLPart* const part = static_cast<KHTMLPart *>((KParts::ReadOnlyPart *)(*it)->m_part);
+      if (part->inherits("KHTMLPart"))
+      {
+        // We are reloading frames to make them jump into offsets.
+        KParts::URLArgs partargs( part->d->m_extension->urlArgs() );
+        partargs.reload = true;
+        part->d->m_extension->setURLArgs(partargs);
+
+        part->openURL( part->url() );
+      }
+    }/*next it*/
+    return true;
+  }
+
   if ( url.hasRef() && !isFrameSet )
   {
     bool noReloadForced = !args.reload && !args.redirectedRequest() && !args.doPost();
--- branches/KDE/3.5/kdelibs/kparts/browserextension.cpp #623424:623425
@@ -87,6 +87,7 @@
 URLArgs::URLArgs()
 {
   reload = false;
+  softReload = false;
   xOffset = 0;
   yOffset = 0;
   trustedSource = false;
@@ -116,6 +117,7 @@
   delete d; d= 0;
 
   reload = args.reload;
+  softReload = args.softReload;
   xOffset = args.xOffset;
   yOffset = args.yOffset;
   serviceType = args.serviceType;
--- branches/KDE/3.5/kdelibs/kparts/browserextension.h #623424:623425
@@ -74,6 +74,13 @@
    */
   bool reload;
   /**
+   * @p softReload is set when user just hits reload button. It's used
+   * currently for two different frameset reload strategies. In case of
+   * soft reload individual frames are reloaded instead of reloading whole
+   * frameset.
+   */
+  bool softReload;
+  /**
    * @p xOffset is the horizontal scrolling of the part's widget
    * (in case it's a scrollview). This is saved into the history
    * and restored when going back in the history.
Comment 6 Hasso Tepper 2007-01-16 09:30:25 UTC
Patch was reverted because it's BIC. Will try to solve this in binary compatible way in next days.
Comment 7 Germain Garand 2007-07-23 02:58:37 UTC
SVN commit 691143 by ggarand:

reinstating patch by Hasso Tepper that was once reverted for BIC problems,
then forgotten.

(kdelibs part)

CCBUG: 66958



 M  +22 -2     khtml/khtml_part.cpp  
 M  +2 -0      kparts/browserextension.cpp  
 M  +7 -0      kparts/browserextension.h  


--- trunk/KDE/kdelibs/khtml/khtml_part.cpp #691142:691143
@@ -632,6 +632,26 @@
       isFrameSet = htmlDoc->body() && (htmlDoc->body()->id() == ID_FRAMESET);
   }
 
+  if (isFrameSet && urlcmp( url.url(), this->url().url(), KUrl::CompareWithoutTrailingSlash | KUrl::CompareWithoutFragment ) 
+                 && args.softReload)
+  {
+    QList<khtml::ChildFrame*>::Iterator it = d->m_frames.begin();
+    const QList<khtml::ChildFrame*>::Iterator end = d->m_frames.end();
+    for (; it != end; ++it) {
+      KHTMLPart* const part = qobject_cast<KHTMLPart *>( (*it)->m_part );
+      if (part)
+      {
+        // We are reloading frames to make them jump into offsets.
+        KParts::URLArgs partargs( part->d->m_extension->urlArgs() );
+        partargs.reload = true;
+        part->d->m_extension->setUrlArgs(partargs);
+
+        part->openUrl( part->url() );
+      }
+    }/*next it*/
+    return true;
+  }
+
   if ( url.hasRef() && !isFrameSet )
   {
     bool noReloadForced = !args.reload && !args.redirectedRequest() && !args.doPost();
@@ -2594,8 +2614,8 @@
     QList<khtml::ChildFrame*>::Iterator it = m_frames.begin();
     const QList<khtml::ChildFrame*>::Iterator itEnd = m_frames.end();
     for (; it != itEnd; ++it) {
-      KHTMLPart* const part = static_cast<KHTMLPart *>((KParts::ReadOnlyPart *)(*it)->m_part);
-      if (part->inherits("KHTMLPart"))
+      KHTMLPart* const part = qobject_cast<KHTMLPart *>( (*it)->m_part );
+      if (part)
         part->d->setFlagRecursively(flag, value);
     }/*next it*/
   }
--- trunk/KDE/kdelibs/kparts/browserextension.cpp #691142:691143
@@ -118,6 +118,7 @@
 URLArgs::URLArgs()
 {
   reload = false;
+  softReload = false;
   xOffset = 0;
   yOffset = 0;
   trustedSource = false;
@@ -147,6 +148,7 @@
   delete d; d= 0;
 
   reload = args.reload;
+  softReload = args.softReload;
   xOffset = args.xOffset;
   yOffset = args.yOffset;
   serviceType = args.serviceType;
--- trunk/KDE/kdelibs/kparts/browserextension.h #691142:691143
@@ -81,6 +81,13 @@
    */
   bool reload;
   /**
+   * @p softReload is set when user just hits reload button. It's used
+   * currently for two different frameset reload strategies. In case of
+   * soft reload individual frames are reloaded instead of reloading whole
+   * frameset.
+   */
+  bool softReload;
+  /**
    * @p xOffset is the horizontal scrolling of the part's widget
    * (in case it's a scrollview). This is saved into the history
    * and restored when going back in the history.
Comment 8 Germain Garand 2007-07-23 02:59:40 UTC
SVN commit 691145 by ggarand:

reinstating patch by Hasso Tepper that was once reverted for BIC problems,
then forgotten.

(kdebase part)

BUG: 66958



 M  +1 -1      konqmainwindow.cpp  
 M  +5 -2      konqview.cpp  
 M  +1 -1      konqview.h  


--- trunk/KDE/kdebase/apps/konqueror/src/konqmainwindow.cpp #691144:691145
@@ -1773,7 +1773,7 @@
 
   KonqOpenURLRequest req( reloadView->typedUrl() );
   req.userRequestedReload = true;
-  if ( reloadView->prepareReload( req.args ) )
+  if ( reloadView->prepareReload( req.args, true /* softReload */ ) )
   {
       reloadView->lockHistory();
       // Reuse current servicetype for local files, but not for remote files (it could have changed, e.g. over HTTP)
--- trunk/KDE/kdebase/apps/konqueror/src/konqview.cpp #691144:691145
@@ -171,7 +171,7 @@
   // Typing "Enter" again after the URL of an aborted view, triggers a reload.
   if ( m_bAborted && m_pPart && m_pPart->url() == url && !args.doPost())
   {
-    if ( !prepareReload( args ) )
+    if ( !prepareReload( args, false /* not softReload */ ) )
       return;
     if ( ext )
       ext->setUrlArgs( args );
@@ -1327,9 +1327,12 @@
       KGlobal::setActiveComponent( m_pPart->componentData() );
 }
 
-bool KonqView::prepareReload( KParts::URLArgs& args )
+bool KonqView::prepareReload( KParts::URLArgs& args, bool softReload )
 {
     args.reload = true;
+    if ( softReload )
+        args.softReload = true;
+
     // Repost form data if this URL is the result of a POST HTML form.
     if ( m_doPost && !args.redirectedRequest() )
     {
--- trunk/KDE/kdebase/apps/konqueror/src/konqview.h #691144:691145
@@ -319,7 +319,7 @@
 
   // Called before reloading this view. Sets args.reload to true, and offers to repost form data.
   // Returns false in case the reload must be canceled.
-  bool prepareReload( KParts::URLArgs& args );
+  bool prepareReload( KParts::URLArgs& args, bool softReload );
 
   // overload for the QString version
   void setLocationBarURL( const KUrl& locationBarURL );
Comment 9 Andrea Iacovitti 2008-11-04 09:34:30 UTC
This bug have to be reopen for kde 4.1.2 (tested on debian), i think it's a regression due to revision 825638, hunk :

@@ -648,8 +666,7 @@
       isFrameSet = htmlDoc->body() && (htmlDoc->body()->id() == ID_FRAMESET);
   }
 
-  if (isFrameSet && urlcmp( url.url(), this->url().url(), KUrl::CompareWithoutTrailingSlash | KUrl::CompareWithoutFragment )
-                 && browserArgs.softReload)
+  if (isFrameSet && d->isLocalAnchorJump(url) && browserArgs.softReload)
   {
     QList<khtml::ChildFrame*>::Iterator it = d->m_frames.begin();
     const QList<khtml::ChildFrame*>::Iterator end = d->m_frames.end();


Hope will help.
cheers,
ANdrea