content/xml/tests/script.xml

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 <?xml version="1.0"?>
     2 <?xml-stylesheet href="docbook.css" type="text/css"?>
     3 <!DOCTYPE Book System "file:///E|/Program%20Files/SoftQuad/XMetaL/Rules/docbook.dtd">
     4 <Book xmlns:html="http://www.w3.org/1999/xhtml">
     5   <Title>The Book</Title>
     6   <Chapter>
     7     <Title>Chapter 1.</Title>
     8     <Para>Yada yada <html:img src="mzcolor.gif"/> yada.</Para>
     9   </Chapter>
    10   <html:script>
    11 <![CDATA[
    12 function list(node)
    13 {
    14     var type = node.nodeType;
    15     if (type == Node.ELEMENT_NODE) {
    17         // open tag
    18         dump("\<" + node.tagName);
    20         // dump the attributes if any
    21         attributes = node.attributes;
    22         if (null != attributes) {
    23             var countAttrs = attributes.length;
    24             var index = 0;
    25             while(index < countAttrs) {
    26                 att = attributes[index];
    27                 if (null != att) {
    28                     dump(" " + att.name + "=" + att.value);
    29                 }
    30                 index++;
    31             }
    32         }
    34         // recursively dump the children
    35         if (node.hasChildNodes()) {
    36 	    // close tag
    37             dump(">");
    39             // get the children
    40             var children = node.childNodes;
    41             var length = children.length;
    42             var count = 0;
    43             while(count < length) {
    44                 child = children[count];
    45                 list(child);
    46                 count++;
    47             }
    48             dump("</" + node.tagName + ">");
    49         }
    50 	else {
    51 	    // close tag
    52             dump("/>");
    53         }
    56     }
    57     // if it's a piece of text just dump the text
    58     else if (type == Node.TEXT_NODE) {
    59         dump(node.data);
    60     }
    61 }
    63 list(document.documentElement);
    64 dump("\n");
    65 ]]>
    66   </html:script>	
    67 </Book>

mercurial