content/xml/tests/load/loadauth.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <html>
     2 <head>
     3 <title>Synchronized document.load() test</title>
     4 <style type="text/css">
     5 .box {
     6   display: box;
     7   border: 1px solid black;
     8   margin-bottom: 0.5em;
     9 }
    10 .boxheader {
    11   font-weight: bold;
    12   color: maroon;
    13 }
    14 pre {
    15   margin-left: 2em;
    16 }
    17 </style>
    18 <script type="text/javascript">
    19 var xmlDoc = document.implementation.createDocument("", "test", null);
    21 function documentLoaded(e) {
    22   var s = new XMLSerializer();
    23   var str = s.serializeToString(xmlDoc);
    24   document.getElementById("id1").firstChild.nodeValue = str;
    25   var eventProperties = "";
    26   for (prop in e) {
    27     eventProperties += prop + " : '" + e[prop] + "'\n";
    28   }
    29   document.getElementById("id2").firstChild.nodeValue = 
    30     "Event object: " + e + "\n" +
    31     "Event properties:\n" + 
    32     eventProperties;
    33 }
    35 xmlDoc.addEventListener("load", documentLoaded, false);
    37 function execute()
    38 {
    39   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    40   xmlDoc.load("http://green/heikki/login/data.xml");
    41 }
    43 </script>
    44 </head>
    45 <body onload="execute();">
    46 <h1>Synchronized document.load() test</h1>
    48 <div class="box"><span class="boxheader">XML document serialized</span>
    49 <pre id="id1">@@No result@@</pre>
    50 </div>
    51 <div class="box"><span class="boxheader">Event information</span>
    52 <pre id="id2">@@No result@@</pre>
    53 </div>
    55 </body>
    56 </body>
    57 </html>

mercurial