js/src/jit-test/tests/ion/invalidation/framedescriptors.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
michael@0 2 function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
michael@0 3 function core_md5(x, len) {
michael@0 4 var a = 1732584193;
michael@0 5 var b = -271733879;
michael@0 6 var c = -1732584194;
michael@0 7 var d = 271733878;
michael@0 8 for(var i = 0; i < x.length; i += 16)
michael@0 9 c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
michael@0 10 }
michael@0 11 function md5_cmn(q, a, b, x, s, t) {
michael@0 12 return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
michael@0 13 }
michael@0 14 function md5_ff(a, b, c, d, x, s, t) {
michael@0 15 return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
michael@0 16 }
michael@0 17 function safe_add(x, y) {
michael@0 18 var lsw = (x & 0xFFFF) + (y & 0xFFFF);
michael@0 19 var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
michael@0 20 return (msw << 16) | (lsw & 0xFFFF);
michael@0 21 }
michael@0 22 function bit_rol(num, cnt) {
michael@0 23 return (num << cnt) | (num >>> (32 - cnt));
michael@0 24 }
michael@0 25 function str2binl(str) {
michael@0 26 var bin = Array();
michael@0 27 var mask = (1 << chrsz) - 1;
michael@0 28 for(var i = 0; i < str.length * chrsz; i += chrsz)
michael@0 29 bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
michael@0 30 return bin;
michael@0 31 }
michael@0 32 function binl2hex(binarray) {}
michael@0 33 var plainText = "Rebellious subjects, enemies to peace,\n\
michael@0 34 Throw your mistemper'd weapons to the ground,\n\
michael@0 35 To know our further pleasure in this case,\n\
michael@0 36 To old Free-town, our common judgment-place.\n\
michael@0 37 Once more, on pain of death, all men depart."
michael@0 38 for (var i = 0; i <4; i++)
michael@0 39 plainText += plainText;
michael@0 40 var md5Output = hex_md5(plainText);

mercurial