Open Bug 502615 Opened 12 years ago Updated 2 years ago

Inconsistent behavior of JS

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
Windows XP
defect

Tracking

()

UNCONFIRMED

People

(Reporter: samliberman, Unassigned)

Details

(Keywords: testcase, Whiteboard: DUPEME)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)

If you navigate to page with following source:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>
<script type="text/javascript" language="javascript">
    function redirect(){
        window.location = "http://www.google.com";
        
    }
    setTimeout('redirect()', 10);

</script>
</body>
</html>

it will redirect you to google.com if you hit back button it will allow you to stay on this page. However if you add:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body>
<script type="text/javascript" language="javascript">
    function redirect(){
        window.location = "http://www.google.com";
        
    }
    alert("Test");
    setTimeout('redirect()', 10);

</script>
</body>
</html>
 it will redirect you even if you hit back button.

Reproducible: Always

Steps to Reproduce:
1. Navigate to such page.
2. Hit back button
3. See the difference
Actual Results:  
You stay on your page and not redirected in case of no alert

Expected Results:  
Redirect to google.com every time.
Attached file Testcase part 1
Attached file Testcase part 2
hmmmm...
Keywords: testcase
Version: unspecified → Trunk
sorry for the spam..
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Summary: Inconsisten behavior of JS → Inconsistent behavior of JS
Not a JS engine bug, Tyler please note for future reference the issue of page navigation, scripted redirect via location setting, setTimeout, alert: these spell D-O-M.

/be
Assignee: general → nobody
Component: JavaScript Engine → DOM
QA Contact: general → general
Whiteboard: DUPEME
Sorry brendan, will remember. Would this make this NEW?
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.