1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/html/document/test/bug196523-subframe.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +<!DOCTYPE html> 1.5 +<script> 1.6 + function checkDomain(str, msg) { 1.7 + window.parent.postMessage((str == document.domain) + ";" +msg, 1.8 + "http://mochi.test:8888"); 1.9 + } 1.10 + 1.11 + function reportException(msg) { 1.12 + window.parent.postMessage(false + ";" + msg, "http://mochi.test:8888"); 1.13 + } 1.14 + 1.15 + var win1; 1.16 + try { 1.17 + win1 = window.open("", "", "width=100,height=100"); 1.18 + var otherDomain1 = win1.document.domain; 1.19 + win1.close(); 1.20 + checkDomain(otherDomain1, "Opened document should have our domain"); 1.21 + } catch(e) { 1.22 + reportException("Exception getting document.domain: " + e); 1.23 + } finally { 1.24 + win1.close(); 1.25 + } 1.26 + 1.27 + document.domain = "example.org"; 1.28 + 1.29 + var win2; 1.30 + try { 1.31 + win2 = window.open("", "", "width=100,height=100"); 1.32 + var otherDomain2 = win2.document.domain; 1.33 + checkDomain(otherDomain2, "Opened document should have our domain"); 1.34 + win2.close(); 1.35 + } catch(e) { 1.36 + reportException("Exception getting document.domain after domain set: " + e); 1.37 + } finally { 1.38 + win2.close(); 1.39 + } 1.40 +</script>