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.
michael@0 | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
michael@0 | 2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
michael@0 | 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
michael@0 | 4 | <head> |
michael@0 | 5 | <title>script.aculo.us Unit test file</title> |
michael@0 | 6 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
michael@0 | 7 | <script src="../../lib/prototype.js" type="text/javascript"></script> |
michael@0 | 8 | <script src="../../src/scriptaculous.js" type="text/javascript"></script> |
michael@0 | 9 | <script src="../../src/unittest.js" type="text/javascript"></script> |
michael@0 | 10 | <link rel="stylesheet" href="../test.css" type="text/css" /> |
michael@0 | 11 | <style type="text/css" media="screen"> |
michael@0 | 12 | /* <![CDATA[ */ |
michael@0 | 13 | #testcss1 { font-size:11px; color: #f00; } |
michael@0 | 14 | #testcss2 { font-size:12px; color: #0f0; display: none; } |
michael@0 | 15 | /* ]]> */ |
michael@0 | 16 | </style> |
michael@0 | 17 | </head> |
michael@0 | 18 | <body> |
michael@0 | 19 | <h1>script.aculo.us Unit test file</h1> |
michael@0 | 20 | <p> |
michael@0 | 21 | This is a preliminary version mostly for testing the unittest library. |
michael@0 | 22 | </p> |
michael@0 | 23 | |
michael@0 | 24 | <!-- Log output --> |
michael@0 | 25 | <div id="testlog"> </div> |
michael@0 | 26 | |
michael@0 | 27 | <!-- Test elements follow --> |
michael@0 | 28 | <div id="test_1" class="a bbbbbbbbbbbb cccccccccc dddd"> </div> |
michael@0 | 29 | |
michael@0 | 30 | <div id="test_2"> <span> </span> |
michael@0 | 31 | |
michael@0 | 32 | |
michael@0 | 33 | |
michael@0 | 34 | <div><div></div> </div><span> </span> |
michael@0 | 35 | </div> |
michael@0 | 36 | |
michael@0 | 37 | <ul id="tlist"><li id="tlist_1">x1</li><li id="tlist_2">x2</li></ul> |
michael@0 | 38 | <ul id="tlist2"><li class="a" id="tlist2_1">x1</li><li id="tlist2_2">x2</li></ul> |
michael@0 | 39 | |
michael@0 | 40 | <div id="testmoveby" style="background-color:#333;width:100px;">XXXX</div> |
michael@0 | 41 | |
michael@0 | 42 | <div id="testcss1">testcss1<span id="testcss1_span" style="display:none;">blah</span></div><div id="testcss2">testcss1</div> |
michael@0 | 43 | |
michael@0 | 44 | <!-- Tests follow --> |
michael@0 | 45 | <script type="text/javascript" language="javascript" charset="utf-8"> |
michael@0 | 46 | // <![CDATA[ |
michael@0 | 47 | |
michael@0 | 48 | var testObj = { |
michael@0 | 49 | isNice: function(){ |
michael@0 | 50 | return true; |
michael@0 | 51 | }, |
michael@0 | 52 | isBroken: function(){ |
michael@0 | 53 | return false; |
michael@0 | 54 | } |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | new Test.Unit.Runner({ |
michael@0 | 58 | |
michael@0 | 59 | testAssertEqual: function() { with(this) { |
michael@0 | 60 | assertEqual(0, 0); |
michael@0 | 61 | assertEqual(0, 0, "test"); |
michael@0 | 62 | |
michael@0 | 63 | assertEqual(0,'0'); |
michael@0 | 64 | assertEqual(65.0, 65); |
michael@0 | 65 | |
michael@0 | 66 | assertEqual("a", "a"); |
michael@0 | 67 | assertEqual("a", "a", "test"); |
michael@0 | 68 | |
michael@0 | 69 | assertNotEqual(0, 1); |
michael@0 | 70 | assertNotEqual("a","b"); |
michael@0 | 71 | assertNotEqual({},{}); |
michael@0 | 72 | assertNotEqual([],[]); |
michael@0 | 73 | assertNotEqual([],{}); |
michael@0 | 74 | }}, |
michael@0 | 75 | |
michael@0 | 76 | testAssertRespondsTo: function() { with(this) { |
michael@0 | 77 | assertRespondsTo('isNice', testObj); |
michael@0 | 78 | assertRespondsTo('isBroken', testObj); |
michael@0 | 79 | }}, |
michael@0 | 80 | |
michael@0 | 81 | testAssertIndentical: function() { with(this) { |
michael@0 | 82 | assertIdentical(0, 0); |
michael@0 | 83 | assertIdentical(0, 0, "test"); |
michael@0 | 84 | assertIdentical(1, 1); |
michael@0 | 85 | assertIdentical('a', 'a'); |
michael@0 | 86 | assertIdentical('a', 'a', "test"); |
michael@0 | 87 | assertIdentical('', ''); |
michael@0 | 88 | assertIdentical(undefined, undefined); |
michael@0 | 89 | assertIdentical(null, null); |
michael@0 | 90 | assertIdentical(true, true); |
michael@0 | 91 | assertIdentical(false, false); |
michael@0 | 92 | |
michael@0 | 93 | var obj = {a:'b'}; |
michael@0 | 94 | assertIdentical(obj, obj); |
michael@0 | 95 | |
michael@0 | 96 | assertNotIdentical({1:2,3:4},{1:2,3:4}); |
michael@0 | 97 | |
michael@0 | 98 | assertIdentical(1, 1.0); // both are typeof == 'number' |
michael@0 | 99 | |
michael@0 | 100 | assertNotIdentical(1, '1'); |
michael@0 | 101 | assertNotIdentical(1, '1.0'); |
michael@0 | 102 | }}, |
michael@0 | 103 | |
michael@0 | 104 | testAssertMatch: function() { with(this) { |
michael@0 | 105 | assertMatch(/knowmad.jpg$/, 'http://script.aculo.us/images/knowmad.jpg'); |
michael@0 | 106 | assertMatch(/Fuc/, 'Thomas Fuchs'); |
michael@0 | 107 | assertMatch(/^\$(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/, '$19.95'); |
michael@0 | 108 | assertMatch(/(\d{3}\) ?)|(\d{3}[- \.])?\d{3}[- \.]\d{4}(\s(x\d+)?){0,1}$/, '704-343-9330'); |
michael@0 | 109 | assertMatch(/^(?:(?:(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\/|-|\.)(?:0?2\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\d)?\d{2})(\/|-|\.)(?:(?:(?:0?[13578]|1[02])\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\2(?:0?[1-9]|1\d|2[0-8]))))$/, '2001-06-16'); |
michael@0 | 110 | assertMatch(/^((0?[123456789])|(1[012]))\s*:\s*([012345]\d)(\s*:\s*([012345]\d))?\s*[ap]m\s*-\s*((0?[123456789])|(1[012]))\s*:\s*([012345]\d)(\s*:\s*([012345]\d))?\s*[ap]m$/i, '2:00PM-2:15PM'); |
michael@0 | 111 | |
michael@0 | 112 | }}, |
michael@0 | 113 | |
michael@0 | 114 | testAssertInstanceOf: function() { with(this) { |
michael@0 | 115 | assertInstanceOf(Effect.Opacity, new Effect.Opacity('testcss1',{sync:true})); |
michael@0 | 116 | assertNotInstanceOf(String, new Effect.Opacity('testcss1',{sync:true})); |
michael@0 | 117 | |
michael@0 | 118 | // note: fails with firefox 1.0.X (bug, fixed in Deer Park) |
michael@0 | 119 | assertNotInstanceOf(Effect.Parallel, new Effect.Opacity('testcss1',{sync:true}), "(note: fails with firefox 1.0.X, fixed in Deer Park)"); |
michael@0 | 120 | }}, |
michael@0 | 121 | |
michael@0 | 122 | testAssertReturns: function() { with(this) { |
michael@0 | 123 | |
michael@0 | 124 | assertReturnsTrue('isNice',testObj); |
michael@0 | 125 | assertReturnsFalse('isBroken',testObj); |
michael@0 | 126 | |
michael@0 | 127 | assertReturnsTrue('nice',testObj); |
michael@0 | 128 | assertReturnsFalse('broken',testObj); |
michael@0 | 129 | |
michael@0 | 130 | }}, |
michael@0 | 131 | |
michael@0 | 132 | testAssertVisible: function() { with(this) { |
michael@0 | 133 | assertVisible('testcss1'); |
michael@0 | 134 | assertNotVisible('testcss1_span'); |
michael@0 | 135 | assertNotVisible('testcss2', "Due to a Safari bug, this test fails in Safari."); |
michael@0 | 136 | |
michael@0 | 137 | Element.hide('testcss1'); |
michael@0 | 138 | assertNotVisible('testcss1'); |
michael@0 | 139 | assertNotVisible('testcss1_span'); |
michael@0 | 140 | Element.show('testcss1'); |
michael@0 | 141 | assertVisible('testcss1'); |
michael@0 | 142 | assertNotVisible('testcss1_span'); |
michael@0 | 143 | |
michael@0 | 144 | Element.show('testcss1_span'); |
michael@0 | 145 | assertVisible('testcss1_span'); |
michael@0 | 146 | Element.hide('testcss1'); |
michael@0 | 147 | assertNotVisible('testcss1_span'); // hidden by parent |
michael@0 | 148 | }} |
michael@0 | 149 | |
michael@0 | 150 | }, "testlog"); |
michael@0 | 151 | // ]]> |
michael@0 | 152 | </script> |
michael@0 | 153 | </body> |
michael@0 | 154 | </html> |