Bug 114615 - [testcase] Error in setting window location with javascript from a page which contains GET/POST data
Summary: [testcase] Error in setting window location with javascript from a page which...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: 3.4.1
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-18 15:46 UTC by Fabio Rossi
Modified: 2012-06-18 14:06 UTC (History)
2 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 Fabio Rossi 2005-10-18 15:46:56 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    Gentoo Packages
Compiler:          gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8) 
OS:                Linux

I have created a PHP/HTML page with a form which sends data to the page itself. When the page receives GET/POST data it executes some javascript code *to change* the location of the window. I have used two ways to change locations:

*** PAGE 1 ***

<?php
    if( isset($_REQUEST['send']) )
        echo "<script type=\"text/javascript\">window.location='" . $_SERVER['PHP_SELF'] . "'</script>";
?>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <input name="send" value="send" type="submit" />
</form>

*** PAGE 2 ***

<?php
    if( isset($_REQUEST['send']) )
        echo "<script type=\"text/javascript\">window.location.replace(window.location.href)</script>";
?>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <input name="send" value="send" type="submit" />
</form>

It seems that konqueror simply reloads the page because the new location is
equal to the old one (and in this way it stores GET/POST data). Infact, with
GET method I get these results:

* GET - page 1: it works (OK)
* GET - page 2: endless loop (WRONG)

With POST method I get this message:

<<< The page you are trying to view is the result of posted form data. If you
resend the data, any action the form carried out (such as search or online
purchase) will be repeated. >>>

* POST - page 1: above message (WRONG)
* POST - page 2: above message (WRONG)

I have tested all four pages with firefox and opera: with POST method no
problems, but they fail on GET method, page 2.
Comment 1 Philip Rodrigues 2006-09-07 15:13:41 UTC
Does this problem still exist for you in KDE 3.5?
Comment 2 Fabio Rossi 2006-09-07 15:45:33 UTC
Yes, I confirm the same behaviour with

Qt: 3.3.6
KDE: 3.5.2
Konqueror: 3.5.2
Comment 3 Fabio Rossi 2006-11-18 00:12:20 UTC
I confirm the same behaviour with:

Qt: 3.3.6
KDE: 3.5.5
Konqueror: 3.5.5
Comment 4 Joseph Tate 2007-01-06 19:29:08 UTC
It looks like the window.location.replace=$SELF acts like a wondow.reload, which on a POST reposts form data.  Confirmed on KDE 3.5.4 using qt 3.3.6.
Comment 5 Allan Sandfeld 2007-05-24 13:50:58 UTC
I am actually quite sure "GET - page 2" works correctly. When sending form values with GET they get added to the location.href, that's how it works. Thus an infinite recursion is correct.

With the POST cases though, it seems the method should be changed to GET when the location changes.

Comment 6 Myriam Schweingruber 2012-06-18 14:06:03 UTC
Message from the Bugsquad and Konqueror teams:
This bug is closed as outdated, as we do not have the manpower to maintain the KDE3 version anymore.
If you still can reproduce this issue with Konqueror 4.8.4 or later, please open a new report.
Thank you for your understanding.