content/html/document/test/bug196523-subframe.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE html>
michael@0 2 <script>
michael@0 3 function checkDomain(str, msg) {
michael@0 4 window.parent.postMessage((str == document.domain) + ";" +msg,
michael@0 5 "http://mochi.test:8888");
michael@0 6 }
michael@0 7
michael@0 8 function reportException(msg) {
michael@0 9 window.parent.postMessage(false + ";" + msg, "http://mochi.test:8888");
michael@0 10 }
michael@0 11
michael@0 12 var win1;
michael@0 13 try {
michael@0 14 win1 = window.open("", "", "width=100,height=100");
michael@0 15 var otherDomain1 = win1.document.domain;
michael@0 16 win1.close();
michael@0 17 checkDomain(otherDomain1, "Opened document should have our domain");
michael@0 18 } catch(e) {
michael@0 19 reportException("Exception getting document.domain: " + e);
michael@0 20 } finally {
michael@0 21 win1.close();
michael@0 22 }
michael@0 23
michael@0 24 document.domain = "example.org";
michael@0 25
michael@0 26 var win2;
michael@0 27 try {
michael@0 28 win2 = window.open("", "", "width=100,height=100");
michael@0 29 var otherDomain2 = win2.document.domain;
michael@0 30 checkDomain(otherDomain2, "Opened document should have our domain");
michael@0 31 win2.close();
michael@0 32 } catch(e) {
michael@0 33 reportException("Exception getting document.domain after domain set: " + e);
michael@0 34 } finally {
michael@0 35 win2.close();
michael@0 36 }
michael@0 37 </script>

mercurial