dom/tests/mochitest/general/file_moving_xhr.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

     1 <html>
     2     <head>
     3         <script>
     4             function createXHR() {
     5                 var xhr = new XMLHttpRequest();
     6                 xhr.expando = "foo";
     7                 return xhr;
     8             }
    10             function tryToUseXHR(xhr, ok) {
    11                 function expectException(op, reason) {
    12                     try {
    13                         var result = op();
    14                         ok(false, "should have thrown an exception, got: " + result);
    15                     } catch (e) {
    16                         ok(/Permission denied/.test(e.toString()), reason);
    17                     }
    18                 }
    20                 expectException(function() { xhr.open(); }, "should not have access to any functions");
    21                 expectException(function() { xhr.foo = "foo"; }, "should not be able to add expandos");
    22                 expectException(function() { xhr.withCredentials = true; }, "should not be able to set attributes");
    23             }
    24         </script>
    25     </head>
    26     <body>
    27     </body>
    28 </html>

mercurial