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> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Get text between offsets tests</title> |
michael@0 | 5 | <link rel="stylesheet" type="text/css" |
michael@0 | 6 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 7 | |
michael@0 | 8 | <script type="application/javascript" |
michael@0 | 9 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="../common.js"></script> |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../text.js"></script> |
michael@0 | 14 | |
michael@0 | 15 | <script type="application/javascript"> |
michael@0 | 16 | function doTest() |
michael@0 | 17 | { |
michael@0 | 18 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 19 | // |
michael@0 | 20 | // __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__ |
michael@0 | 21 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
michael@0 | 22 | |
michael@0 | 23 | var IDs = [ "i1", "d1", "e1", "t1" ]; |
michael@0 | 24 | |
michael@0 | 25 | testCharacterCount(IDs, 15); |
michael@0 | 26 | |
michael@0 | 27 | testText(IDs, 0, 1, "h"); |
michael@0 | 28 | testText(IDs, 1, 3, "el"); |
michael@0 | 29 | testText(IDs, 14, 15, "d"); |
michael@0 | 30 | testText(IDs, 0, 15, "hello my friend"); |
michael@0 | 31 | testText(IDs, 0, -1, "hello my friend"); |
michael@0 | 32 | |
michael@0 | 33 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 34 | // |
michael@0 | 35 | // __B__r__a__v__e__ __S__i__r__ __ __R__o__b__i__n__ __ __ __r__a__n |
michael@0 | 36 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
michael@0 | 37 | |
michael@0 | 38 | IDs = [ "i2", "dpre2", "epre2", "t2" ]; |
michael@0 | 39 | |
michael@0 | 40 | testCharacterCount(IDs, 22); |
michael@0 | 41 | |
michael@0 | 42 | testText(IDs, 0, 1, "B"); |
michael@0 | 43 | testText(IDs, 5, 6, " "); |
michael@0 | 44 | testText(IDs, 9, 11, " "); |
michael@0 | 45 | testText(IDs, 16, 19, " "); |
michael@0 | 46 | testText(IDs, 0, 22, "Brave Sir Robin ran"); |
michael@0 | 47 | testText(IDs, 0, -1, "Brave Sir Robin ran"); |
michael@0 | 48 | |
michael@0 | 49 | testCharacterCount(["d2", "e2"], 19); |
michael@0 | 50 | testText(["d2", "e2"], 0, 19, "Brave Sir Robin ran"); |
michael@0 | 51 | |
michael@0 | 52 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 53 | // |
michael@0 | 54 | // __o__n__e__w__o__r__d__\n |
michael@0 | 55 | // 0 1 2 3 4 5 6 7 |
michael@0 | 56 | // __\n |
michael@0 | 57 | // 8 |
michael@0 | 58 | // __t__w__o__ __w__o__r__d__s__\n |
michael@0 | 59 | // 9 10 11 12 13 14 15 16 17 18 |
michael@0 | 60 | |
michael@0 | 61 | var IDs = ["d3", "dbr3", "e3", "ebr3", "t3"]; |
michael@0 | 62 | |
michael@0 | 63 | testCharacterCount(IDs, 19); |
michael@0 | 64 | |
michael@0 | 65 | testText(IDs, 0, 19, "oneword\n\ntwo words\n"); |
michael@0 | 66 | testText(IDs, 0, -1, "oneword\n\ntwo words\n"); |
michael@0 | 67 | |
michael@0 | 68 | SimpleTest.finish(); |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 72 | addA11yLoadEvent(doTest); |
michael@0 | 73 | </script> |
michael@0 | 74 | </head> |
michael@0 | 75 | <body> |
michael@0 | 76 | |
michael@0 | 77 | <p id="display"></p> |
michael@0 | 78 | <div id="content" style="display: none"></div> |
michael@0 | 79 | <pre id="test"> |
michael@0 | 80 | </pre> |
michael@0 | 81 | |
michael@0 | 82 | <input id="i1" value="hello my friend"/> |
michael@0 | 83 | <div id="d1">hello my friend</div> |
michael@0 | 84 | <div id="e1" contenteditable="true">hello my friend</div> |
michael@0 | 85 | <textarea id="t1">hello my friend</textarea> |
michael@0 | 86 | |
michael@0 | 87 | <input id="i2" value="Brave Sir Robin ran"/> |
michael@0 | 88 | <pre><div id="dpre2">Brave Sir Robin ran</div></pre> |
michael@0 | 89 | <pre><div id="epre2" contenteditable="true">Brave Sir Robin ran</div></pre> |
michael@0 | 90 | <textarea id="t2" cols="300">Brave Sir Robin ran</textarea> |
michael@0 | 91 | <div id="d2">Brave Sir Robin ran</div> |
michael@0 | 92 | <div id="e2" contenteditable="true">Brave Sir Robin ran</div> |
michael@0 | 93 | |
michael@0 | 94 | <pre> |
michael@0 | 95 | <div id="d3">oneword |
michael@0 | 96 | |
michael@0 | 97 | two words |
michael@0 | 98 | </div> |
michael@0 | 99 | <div id="dbr3">oneword<br/><br/>two words<br/><br/></div> |
michael@0 | 100 | <div id="e3" contenteditable="true">oneword |
michael@0 | 101 | |
michael@0 | 102 | two words |
michael@0 | 103 | </div> |
michael@0 | 104 | <div id="ebr3" contenteditable="true">oneword<br/><br/>two words<br/><br/></div> |
michael@0 | 105 | <textarea id="t3" cols="300">oneword |
michael@0 | 106 | |
michael@0 | 107 | two words |
michael@0 | 108 | </textarea> |
michael@0 | 109 | </pre> |
michael@0 | 110 | |
michael@0 | 111 | </body> |
michael@0 | 112 | </html> |