Tue, 06 Jan 2015 21:39:09 +0100
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 /* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 //
8 // return a string representing the html content in html format
9 //
10 function htmlString(node, indent)
11 {
12 var html = ""
13 indent += " "
15 var type = node.nodeType
16 if (type == Node.ELEMENT) {
18 // open tag
19 html += "\n" + indent + "<" + node.tagName
21 // dump the attributes if any
22 attributes = node.attributes
23 if (null != attributes) {
24 var countAttrs = attributes.length
25 var index = 0
26 while(index < countAttrs) {
27 att = attributes[index]
28 if (null != att) {
29 html += " "
30 html += att.name + "=" + att.value;
31 }
32 index++
33 }
34 }
36 // end tag
37 html += ">"
39 // recursively dump the children
40 if (node.hasChildNodes) {
41 // get the children
42 var children = node.childNodes
43 var length = children.length
44 var count = 0;
45 while(count < length) {
46 child = children[count]
47 html += htmlString(child, indent)
48 count++
49 }
50 }
52 // close tag
53 html += "\n" + indent + "</" + node.tagName + ">"
54 }
55 // if it's a piece of text just dump the text
56 else if (type == Node.TEXT) {
57 html += node.data
58 }
60 return html;
61 }
63 htmlString(document.documentElement, "")