1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/bugs/test_bug504862.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=504862 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 504862</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 +</head> 1.14 +<body onload="runTest()"> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=504862">Mozilla Bug 504862</a> 1.16 +<script class="testbody" type="text/javascript"> 1.17 + 1.18 +/** Test for Bug 504862 **/ 1.19 +SimpleTest.waitForExplicitFinish(); 1.20 +function onMsgRcv(event) 1.21 +{ 1.22 + is(event.data, "args: undefined", "Unexpected cross origin dialog arguments."); 1.23 +} 1.24 + 1.25 +function runTest() { 1.26 + window.addEventListener("message", onMsgRcv, false); 1.27 + 1.28 + var result = window.showModalDialog("file_bug504862.html", "my args"); 1.29 + // NB: We used to clear returnValue on each navigation, but now we do a 1.30 + // security check on access, so we can safely make returnValue live on 1.31 + // the browsing context, per spec. 1.32 + is(result, 3, "window sees previous dialog documents return value."); 1.33 + 1.34 + result = window.showModalDialog("http://test1.example.com/tests/dom/tests/mochitest/bugs/file_bug504862.html", "my args"); 1.35 + 1.36 + is(result, null, "Able to see return value from cross origin dialog."); 1.37 + 1.38 + SimpleTest.finish(); 1.39 +} 1.40 + 1.41 +</script> 1.42 +</pre> 1.43 +</body> 1.44 +</html>