js/xpconnect/tests/mochitest/file_documentdomain.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/mochitest/file_documentdomain.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +<script type="application/javascript">
     1.8 +
     1.9 +  function setDomain(domain) {
    1.10 +    document.domain = domain;
    1.11 +  }
    1.12 +
    1.13 +  function tryToAccess(otherWin) {
    1.14 +    try {
    1.15 +      var text = otherWin.document.getElementById('foo').innerHTML;
    1.16 +      return /Better Late/.exec(text);
    1.17 +    } catch (e) { return false; }
    1.18 +  }
    1.19 +
    1.20 +  var gRef = null;
    1.21 +  function storeReference(otherWin) {
    1.22 +    gRef = otherWin.document.getElementById('foo');
    1.23 +  }
    1.24 +
    1.25 +  function tryToAccessStored() {
    1.26 +    try {
    1.27 +      return /Better Late/.exec(gRef.innerHTML);
    1.28 +    } catch (e) { return false; }
    1.29 +  }
    1.30 +
    1.31 +
    1.32 +</script>
    1.33 +</head>
    1.34 +<body>
    1.35 +<span id="foo">Better Late than Never</span>
    1.36 +</body>
    1.37 +</html>

mercurial