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 function run_test () {
2 for (var i = 0; i < tests.length && tests[i][0]; ++i) {
3 if (!tests[i][0].call()) {
4 do_throw(tests[i][1]);
5 }
6 }
7 }
9 var tests = [
10 [ test1, "Unable to parse basic XML document" ],
11 [ test2, "ParseXML doesn't return nsIDOMDocument" ],
12 [ test3, "ParseXML return value's documentElement is not nsIDOMElement" ],
13 [ test4, "" ],
14 [ test5, "" ],
15 [ test6, "" ],
16 [ null ]
17 ];
19 function test1() {
20 return ParseXML("<root/>");
21 }
23 function test2() {
24 return (ParseXML("<root/>") instanceof nsIDOMDocument);
25 }
27 function test3() {
28 return (ParseXML("<root/>").documentElement instanceof nsIDOMElement);
29 }
31 function test4() {
32 var doc = ParseXML("<root/>");
33 do_check_eq(doc.documentElement.namespaceURI, null);
34 return true;
35 }
37 function test5() {
38 var doc = ParseXML("<root xmlns=''/>");
39 do_check_eq(doc.documentElement.namespaceURI, null);
40 return true;
41 }
43 function test6() {
44 var doc = ParseXML("<root xmlns='ns1'/>");
45 do_check_neq(doc.documentElement.namespaceURI, null);
46 do_check_eq(doc.documentElement.namespaceURI, 'ns1');
47 return true;
48 }