Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | function zero(...rest) |
michael@0 | 2 | { |
michael@0 | 3 | assertEq(rest.length, 0, "zero rest wrong length"); |
michael@0 | 4 | } |
michael@0 | 5 | |
michael@0 | 6 | function tzero() |
michael@0 | 7 | { |
michael@0 | 8 | zero(); |
michael@0 | 9 | } |
michael@0 | 10 | |
michael@0 | 11 | tzero(); tzero(); tzero(); |
michael@0 | 12 | |
michael@0 | 13 | function one(...rest) |
michael@0 | 14 | { |
michael@0 | 15 | assertEq(rest.length, 1, "one rest wrong length"); |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | function tone() |
michael@0 | 19 | { |
michael@0 | 20 | one(0); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | tone(); tone(); tone(); |
michael@0 | 24 | |
michael@0 | 25 | function two(...rest) |
michael@0 | 26 | { |
michael@0 | 27 | assertEq(rest.length, 2, "two rest wrong length"); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | function ttwo() |
michael@0 | 31 | { |
michael@0 | 32 | two(0, 1); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | ttwo(); ttwo(); ttwo(); |
michael@0 | 36 | |
michael@0 | 37 | function zeroWithLeading0(x, ...rest) |
michael@0 | 38 | { |
michael@0 | 39 | assertEq(rest.length, 0, "zeroWithLeading0 rest wrong length"); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | function tzeroWithLeading0() |
michael@0 | 43 | { |
michael@0 | 44 | zeroWithLeading0(); |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | tzeroWithLeading0(); tzeroWithLeading0(); tzeroWithLeading0(); |
michael@0 | 48 | |
michael@0 | 49 | function zeroWithLeading1(x, ...rest) |
michael@0 | 50 | { |
michael@0 | 51 | assertEq(rest.length, 0, "zeroWithLeading1 rest wrong length"); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | function tzeroWithLeading1() |
michael@0 | 55 | { |
michael@0 | 56 | zeroWithLeading1(0); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | tzeroWithLeading1(); tzeroWithLeading1(); tzeroWithLeading1(); |
michael@0 | 60 | |
michael@0 | 61 | function oneWithLeading(x, ...rest) |
michael@0 | 62 | { |
michael@0 | 63 | assertEq(rest.length, 1, "oneWithLeading rest wrong length"); |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | function toneWithLeading() |
michael@0 | 67 | { |
michael@0 | 68 | oneWithLeading(0, 1); |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | toneWithLeading(); toneWithLeading(); toneWithLeading(); |
michael@0 | 72 | |
michael@0 | 73 | function twoWithLeading(x, ...rest) |
michael@0 | 74 | { |
michael@0 | 75 | assertEq(rest.length, 2, "twoWithLeading rest wrong length"); |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | function ttwoWithLeading() |
michael@0 | 79 | { |
michael@0 | 80 | twoWithLeading(0, 1, 2); |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | ttwoWithLeading(); ttwoWithLeading(); ttwoWithLeading(); |