dom/tests/mochitest/general/file_moving_xhr.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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