No bug, Stop leaking random variables to the global scope. rs=silver@warwickcompsoc.co.uk (James Ross), a=NPOTFFB

git-svn-id: svn://10.0.0.236/trunk@258551 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gijskruitbosch%gmail.com
2009-10-02 16:18:15 +00:00
parent b4f0a0c4eb
commit a08b3e4d25
8 changed files with 19 additions and 16 deletions

View File

@@ -280,7 +280,8 @@ function dcc_findbyid(id)
}
var val = -1;
// JavaScript won't let you delete things declared with "var", workaround:
window.val = -1;
const DCC_STATE_FAILED = val++; // try connect (accept), but it failed.
const DCC_STATE_INIT = val++; // not "doing" anything
@@ -291,7 +292,7 @@ const DCC_STATE_CONNECTED = val++; // all going ok.
const DCC_STATE_DONE = val++; // finished ok.
const DCC_STATE_ABORTED = val++; // send wasn't accepted in time.
delete val;
delete window.val;
const DCC_DIR_UNKNOWN = 0;
const DCC_DIR_SENDING = 1;
@@ -794,7 +795,7 @@ function dchat_dataavailable(e)
if (incomplete)
this.savedLine = lines.pop();
for (i in lines)
for (var i in lines)
{
var ev = new CEvent("dcc-chat", "rawdata", this, "onRawData");
ev.data = lines[i];

View File

@@ -78,7 +78,8 @@ function decodeParam(number, charsetOrObject)
return rv;
}
var i = 1;
// JavaScript won't let you delete things declared with "var", workaround:
window.i = 1;
const NET_OFFLINE = i++; // Initial, disconected.
const NET_WAITING = i++; // Waiting before trying.
@@ -87,7 +88,7 @@ const NET_CANCELLING = i++; // Cancelling connect.
const NET_ONLINE = i++; // Connected ok.
const NET_DISCONNECTING = i++; // Disconnecting.
delete i;
delete window.i;
/*
* irc network
@@ -1220,7 +1221,7 @@ function serv_ppline(e)
if (incomplete)
this.savedLine = lines.pop();
for (i in lines)
for (var i in lines)
{
var ev = new CEvent("server", "rawdata", this, "onRawData");
ev.data = lines[i].replace(/\r/g, "");

View File

@@ -105,7 +105,7 @@ MenuManager.prototype.createMenus =
function mmgr_createtb(document, menuid)
{
var menu = document.getElementById(menuid);
for (id in this.menuSpecs)
for (var id in this.menuSpecs)
{
var domID;
if ("domID" in this.menuSpecs[id])

View File

@@ -20,7 +20,7 @@ function fade(str)
var colors = new Array(1, 14, 10, 15, 0);
var cIndex = 0;
var msg = "";
for (i = 0; i < str.length; i++)
for (var i = 0; i < str.length; i++)
{
msg += "%03" + colors[cIndex] + str[i];
if ((++cIndex) == 5)

View File

@@ -55,8 +55,9 @@ OPS.push({ key: "filter", canStop: true });
// Define constants for each operation.
// JavaScript won't let you delete things declared with "var", workaround:
// NOTE: This order MUST be the same as those above!
var s = 0;
window.s = 0;
const OP_LIST = ++s; // A /list operation on the server.
const OP_LOAD = ++s; // Loading the saved file.
const OP_FILTER = ++s; // Filtering the loaded list.
@@ -71,7 +72,7 @@ const STATE_ERROR = ++s; // Error occurred: don't try do to any more.
const STATE_START = ++s; // Starting an operation.
const STATE_RUN = ++s; // Running...
const STATE_STOP = ++s; // Clean-up/ending operation.
delete s;
delete window.s;
// Store all the operation data here.

View File

@@ -1052,7 +1052,7 @@ function cmdChanUserMode(e)
}
else if (e.nicknameList)
{
for (i = 0; i < e.nicknameList.length; i++)
for (var i = 0; i < e.nicknameList.length; i++)
{
user = e.channel.getUser(e.nicknameList[i]);
if (!user)
@@ -1466,7 +1466,7 @@ function cmdNetworks(e)
var netnames = keys(client.networks).sort();
var lastname = netnames[netnames.length - 1];
for (n in netnames)
for (var n in netnames)
{
var net = client.networks[netnames[n]];
var a = document.createElementNS(XHTML_NS, "html:a");

View File

@@ -437,7 +437,7 @@ function opdata_loadData()
// Now get the list of pref names, and add them...
var prefList = this.parent.prefManager.prefNames;
for (i in prefList)
for (var i in prefList)
this.addPref(prefList[i]);
}
@@ -748,7 +748,7 @@ function pdata_loadData()
this.edit.removeChild(this.edit.firstChild);
// Add new ones.
for (i = 0; i < this.val.length; i++)
for (var i = 0; i < this.val.length; i++)
{
var item = document.createElement("listitem");
item.value = this.val[i];
@@ -1011,7 +1011,7 @@ function pwin_onLoad()
"(?:\\.(users|channels)?\\.([^.]+))?\\.");
var rv = new Object();
var netList = client.prefManager.prefBranch.getChildList("networks.", rv);
for (i in netList)
for (var i in netList)
{
var m = netList[i].match(prefRE);
if (!m)

View File

@@ -257,7 +257,7 @@ function changeCSS(url, id)
if (!id)
id = "main-css";
node = document.getElementById(id);
var node = document.getElementById(id);
if (!node)
{