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.

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

mercurial