js/xpconnect/tests/mochitest/file_expandosharing.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/mochitest/file_expandosharing.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 +  function setup() {
     1.9 +    // Set up different target objects for expandos, one for each binding type.
    1.10 +    window.targetWN = window;
    1.11 +    window.targetDOM = new XMLHttpRequest();
    1.12 +    window.targetJS = new Date();
    1.13 +  }
    1.14 +
    1.15 +  function placeExpando(name, val, target) {
    1.16 +    target[name] = val;
    1.17 +  }
    1.18 +
    1.19 +  // If val === null, then we shouldn't have access.
    1.20 +  function checkExpando(name, val, target, msg) {
    1.21 +    if (val !== null) {
    1.22 +      ok(name in target, msg);
    1.23 +      try {
    1.24 +        is(target[name], val, "Got the right expando value");
    1.25 +      } catch(e) { ok(false, "Threw when accessing same-origin expando"); }
    1.26 +    }
    1.27 +    else {
    1.28 +      ok(!(name in target), msg);
    1.29 +    }
    1.30 +  }
    1.31 +
    1.32 +</script>
    1.33 +</head>
    1.34 +<body onload="setup();">
    1.35 +    <span>Salut, Ma Cherise. ;-)</span>
    1.36 +</body>
    1.37 +</html>

mercurial