Add var before local variables

This commit is contained in:
Grégory Soutadé 2015-01-21 18:56:50 +01:00
parent 035576998d
commit e0f8670a58

View File

@ -41,7 +41,7 @@ function a2hex(str) {
var hex = '';
for (var i = 0; i < str.length; i++)
{
c = str.charCodeAt(i).toString(16);
var c = str.charCodeAt(i).toString(16);
if (c.length == 1) c = "0" + c;
hex += c;
}
@ -65,18 +65,20 @@ function notify(text, data)
function generate_request(domain, login, mkey)
{
v = "@@" + domain + ";" + login;
var v = "@@" + domain + ";" + login;
debug("will encrypt " + v);
debug("with " + a2hex(mkey));
enc = aes.encryptLongString(v, aes.init(mkey));
var enc = aes.encryptLongString(v, aes.init(mkey));
aes.finish();
debug("res " + enc);
debug("res " + a2hex(enc));
return enc;
}
function ask_server(form, field, logins, domain, wdomain, mkey, salt, submit)
{
var a, b;
mkey = pkdbf2.pkdbf2(mkey, salt, pkdbf2_level, 256/8);
keys = "";
@ -104,14 +106,14 @@ function ask_server(form, field, logins, domain, wdomain, mkey, salt, submit)
// gPassRequest.addEventListener("progress", function(evt) { ; }, false);
gPassRequest.addEventListener("load", function(evt) {
ciphered_password = "";
server_pkdbf2_level = 0;
server_version = 0;
var ciphered_password = "";
var server_pkdbf2_level = 0;
var server_version = 0;
r = this.responseText.split("\n");
var r = this.responseText.split("\n");
debug("resp " + r);
for(a=0; a<r.length; a++)
for(var a=0; a<r.length; a++)
{
debug("Analyse " + r[a]);
@ -236,7 +238,7 @@ function ask_server(form, field, logins, domain, wdomain, mkey, salt, submit)
function wildcard_domain(domain)
{
parts = domain.split(".");
var parts = domain.split(".");
if (parts.length >= 3)
{
@ -262,20 +264,20 @@ function on_sumbit(e)
var form = this;
var fields = form.getElementsByTagName("input");
domain = parseURI.parseUri(form.ownerDocument.baseURI);
var domain = parseURI.parseUri(form.ownerDocument.baseURI);
domain = domain["host"];
wdomain = wildcard_domain(domain);
var wdomain = wildcard_domain(domain);
salt = parseURI.parseUri(prefSet.prefs.account_url);
var salt = parseURI.parseUri(prefSet.prefs.account_url);
salt = salt["host"] + salt["path"];
debug("salt " + salt);
user = null;
all_logins = new Array;
var user = null;
var all_logins = new Array();
// Get all <input type="text"> && <input type="email">
for (i=0; i<fields.length; i++)
for (var i=0; i<fields.length; i++)
{
var field = fields[i];
if (field.getAttribute("type") == "text" || field.getAttribute("type") == "email")
@ -299,7 +301,7 @@ function on_sumbit(e)
logins = all_logins;
// Look for <input type="password" value="@@...">
for (i=0; i<fields.length; i++)
for (var i=0; i<fields.length; i++)
{
var field = fields[i];
@ -340,9 +342,9 @@ function on_sumbit(e)
function document_loaded(event)
{
doc = event.target;
var doc = event.target;
// If there is a password in the form, add a "submit" listener
for(i=0; i<doc.forms.length; i++)
for(var i=0; i<doc.forms.length; i++)
{
var form = doc.forms[i];
var fields = form.getElementsByTagName("input");