dom/tests/mochitest/general/file_moving_xhr.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/general/file_moving_xhr.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +<html>
     1.5 +    <head>
     1.6 +        <script>
     1.7 +            function createXHR() {
     1.8 +                var xhr = new XMLHttpRequest();
     1.9 +                xhr.expando = "foo";
    1.10 +                return xhr;
    1.11 +            }
    1.12 +
    1.13 +            function tryToUseXHR(xhr, ok) {
    1.14 +                function expectException(op, reason) {
    1.15 +                    try {
    1.16 +                        var result = op();
    1.17 +                        ok(false, "should have thrown an exception, got: " + result);
    1.18 +                    } catch (e) {
    1.19 +                        ok(/Permission denied/.test(e.toString()), reason);
    1.20 +                    }
    1.21 +                }
    1.22 +
    1.23 +                expectException(function() { xhr.open(); }, "should not have access to any functions");
    1.24 +                expectException(function() { xhr.foo = "foo"; }, "should not be able to add expandos");
    1.25 +                expectException(function() { xhr.withCredentials = true; }, "should not be able to set attributes");
    1.26 +            }
    1.27 +        </script>
    1.28 +    </head>
    1.29 +    <body>
    1.30 +    </body>
    1.31 +</html>

mercurial