Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Binary: cache/js-opt-32-2dc40eb83023-linux |
michael@0 | 2 | // Flags: -m -n -a |
michael@0 | 3 | // |
michael@0 | 4 | function toPrinted(value) |
michael@0 | 5 | value = value.replace(/\\n/g, 'NL') |
michael@0 | 6 | .replace(/\\r/g, 'CR') |
michael@0 | 7 | .replace(/[^\x20-\x7E]+/g, escapeString); |
michael@0 | 8 | function escapeString (str) |
michael@0 | 9 | { |
michael@0 | 10 | var a, b, c, d; |
michael@0 | 11 | var len = str.length; |
michael@0 | 12 | var result = ""; |
michael@0 | 13 | var digits = ["0", "1", "2", "3", "4", "5", "6", "7", |
michael@0 | 14 | "8", "9", "A", "B", "C", "D", "E", "F"]; |
michael@0 | 15 | for (var i=0; i<len; i++) |
michael@0 | 16 | { |
michael@0 | 17 | var ch = str.charCodeAt(i); |
michael@0 | 18 | a = digits[ch & 0xf]; |
michael@0 | 19 | if (ch) |
michael@0 | 20 | { |
michael@0 | 21 | c = digits[ch & 0xf]; |
michael@0 | 22 | ch >>= 4; |
michael@0 | 23 | d = digits[ch & 0xf]; |
michael@0 | 24 | result += "\\u" + d + c + b + a; |
michael@0 | 25 | } |
michael@0 | 26 | } |
michael@0 | 27 | } |
michael@0 | 28 | function reportCompare (expected, actual, description) { |
michael@0 | 29 | function test() { |
michael@0 | 30 | try |
michael@0 | 31 | { |
michael@0 | 32 | } |
michael@0 | 33 | catch(e) |
michael@0 | 34 | { |
michael@0 | 35 | } |
michael@0 | 36 | } |
michael@0 | 37 | } |
michael@0 | 38 | try { |
michael@0 | 39 | gczeal(2,4); |
michael@0 | 40 | function setprop() { |
michael@0 | 41 | } |
michael@0 | 42 | } catch(exc1) {} |
michael@0 | 43 | var trimMethods = ['trim', 'trimLeft', 'trimRight']; |
michael@0 | 44 | var whitespace = [ |
michael@0 | 45 | {s : '\u2028', t : 'LINE SEPARATOR'}, |
michael@0 | 46 | ]; |
michael@0 | 47 | for (var j = 0; j < trimMethods.length; ++j) |
michael@0 | 48 | { |
michael@0 | 49 | var method = trimMethods[j]; |
michael@0 | 50 | for (var i = 0; i < whitespace.length; ++i) |
michael@0 | 51 | { |
michael@0 | 52 | var v = whitespace[i].s; |
michael@0 | 53 | var t = whitespace[i].t; |
michael@0 | 54 | v = v + v + v; |
michael@0 | 55 | str = v; |
michael@0 | 56 | expected = ''; |
michael@0 | 57 | actual = str[method](); |
michael@0 | 58 | reportCompare(expected, actual, t + ':' + '"' + toPrinted(str) + '".' + method + '()'); |
michael@0 | 59 | } |
michael@0 | 60 | } |