1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/tests/test_picker_no_crash.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test for crashes when the parent window of a file picker is closed via script</title> 1.8 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.10 +</head> 1.11 + 1.12 +<script type="application/javascript"> 1.13 + 1.14 +SimpleTest.waitForExplicitFinish(); 1.15 + 1.16 +var childWindow; 1.17 + 1.18 +function testStepOne() { 1.19 + childWindow = window.open('window_picker_no_crash_child.html', 'childWindow', 'width=300,height=150'); 1.20 + SimpleTest.waitForFocus(testStepTwo, childWindow); 1.21 +} 1.22 + 1.23 +function testStepTwo() { 1.24 + childWindow.document.form1.uploadbox.click(); 1.25 + // This should not crash the browser 1.26 + childWindow.close(); 1.27 + setTimeout("testStepThree();", 5000); 1.28 +} 1.29 + 1.30 +function testStepThree() { 1.31 + ok(true, "browser didn't crash"); 1.32 + SimpleTest.finish(); 1.33 +} 1.34 + 1.35 +SimpleTest.waitForFocus(testStepOne); 1.36 +</script> 1.37 +</body> 1.38 +</html>