[Webkit-unassigned] [Bug 18472] New: JavaScript cached, window.onload not fired when returning to the form via back button

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Apr 13 22:42:26 PDT 2008


http://bugs.webkit.org/show_bug.cgi?id=18472

           Summary: JavaScript  cached, window.onload not fired when
                    returning to the form via back button
           Product: WebKit
           Version: 525.x (Safari 3.1)
          Platform: PC
               URL: http://jira.atlassian.com/browse/JRA-14724
        OS/Version: Windows 2000
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: dushan.hanuska at atlassian.com


It seems that if I submit a form and then return to it via browser's back
button:
- JavaScript variables are not reset, i.e. they are set with their last values
- window.onload does not fire

This behavior is new. I tested our pages in Safari 3.0.4 and it all worked
fine. After upgrading to Safari 3.1 the above described behavior occurred.

The easiest way to test it is with the following HTML file:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<body>
<form action="http://www.atlassian.com/" id="jiraform" name="jiraform">
        <input type="text" name="abc"> <input type="submit">
</form>
<script type="text/javascript" charset="utf-8">
(function() {
    var disableFormSubmit = function() {
        var f = document.jiraform;
        f.onsubmit = function () {
            if (f.submitted) {
                return  false;
            }
            f.submitted = true;
            return true;
        };
    };
    if (window.onload) {
        var oldOnLoad = window.onload;
        window.onload = new function () {
            oldOnLoad();
            document.jiraform.submitted = false;
            disableFormSubmit();
        };
    }
    else {
        window.onload = new function () {
            document.jiraform.submitted = false;
            disableFormSubmit();
        };
    }
})();
</script>
</body>
</html>

Steps to reproduce the problem:
- load the file in the browser
- enter some text into the input field
- click Submit button
- after navigating to the next page, click the browser's back button
- notice that form is pre-populated with the originally submitted value, Submit
button no longer works.

This code is similar to our code in JIRA. The purpose of this code is to set a
'submitted' attribute on the form object to prevent accidental re-submitting of
the form (e.g. user clicks the Submit button twice).

The reason why this does not work is:
- originally non-existent variable document.jiraform.submitted now exists and
equals to true
- window.onload was not fired

Cheers,
Dushan


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list