/usr/share/xul-ext/video-without-flash/content/utils.js is in xul-ext-video-without-flash 3.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | var utils = {
get:function(uri){
const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1",
"nsIXMLHttpRequest",
"open");
let xmlhttp = XMLHttpRequest("GET", uri, false);
xmlhttp.send();
return xmlhttp.responseText;
},
url_vars_to_array: function(url){
var arr_variable = url.split('&');
var arr_assoc = {};
var i;
for(i=0;i<arr_variable.length;i++){
var arr_tmp = arr_variable[i].split('=');
arr_assoc[arr_tmp[0]] = arr_tmp[1];
}
return arr_assoc;
},
// return the two-digit hexadecimal code for a byte
toHexString:function(charCode)
{
return ("0" + charCode.toString(16)).slice(-2);
},
// do a md5 sum
md5:function(str){
var converter =
Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
// we use UTF-8 here, you can choose other encodings.
converter.charset = "UTF-8";
// result is an out parameter,
// result.value will contain the array length
var result = {};
// data is an array of bytes
var data = converter.convertToByteArray(str, result);
var ch = Components.classes["@mozilla.org/security/hash;1"]
.createInstance(Components.interfaces.nsICryptoHash);
ch.init(ch.MD5);
ch.update(data, data.length);
var hash = ch.finish(false);
// convert the binary hash data to a hex string.
var s = [this.toHexString(hash.charCodeAt(i)) for (i in hash)].join("");
return s;
}
};
|