Bug 1923227 - Switch from using arrayRemoveAt and arrayInsertAt helpers to using JS Array splice and unshift methods. r=frg
This commit is contained in:
Родитель
7c944a0e96
Коммит
9524cfbc26
|
@ -185,7 +185,7 @@ function ep_remhookname(name, hooks)
|
|||
for (var h in hooks)
|
||||
if (hooks[h].name.toLowerCase() == name.toLowerCase())
|
||||
{
|
||||
arrayRemoveAt (hooks, h);
|
||||
hooks.splice(h, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ function ep_remhooki(idx, hooks)
|
|||
if (typeof hooks == "undefined")
|
||||
hooks = this.hooks;
|
||||
|
||||
return arrayRemoveAt (hooks, idx);
|
||||
return hooks.splice(idx, 1);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1098,7 +1098,7 @@ function serv_senddata (msg)
|
|||
if (this.sendQueue.length == 0)
|
||||
this.parent.eventPump.addEvent (new CEvent ("server", "senddata",
|
||||
this, "onSendData"));
|
||||
arrayInsertAt (this.sendQueue, 0, new String(msg));
|
||||
this.sendQueue.unshift(new String(msg));
|
||||
}
|
||||
|
||||
// Utility method for splitting large lines prior to sending.
|
||||
|
@ -4090,10 +4090,10 @@ function CIRCChanUser(parent, unicodeName, encodedName, modes, userInChannel, na
|
|||
var mode = modes[m][1];
|
||||
if (modes[m][0] == "-")
|
||||
{
|
||||
if (existingUser.modes.includes(mode))
|
||||
let idx = existingUser.modes.indexOf(mode);
|
||||
if (idx >= 0)
|
||||
{
|
||||
var i = existingUser.modes.indexOf(mode);
|
||||
arrayRemoveAt(existingUser.modes, i);
|
||||
existingUser.modes.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -98,13 +98,10 @@ function pm_addobserver(observer)
|
|||
PrefManager.prototype.removeObserver =
|
||||
function pm_removeobserver(observer)
|
||||
{
|
||||
for (var i = 0; i < this.observers.length; i++)
|
||||
let idx = this.observers.indexOf(observer);
|
||||
if (idx >= 0)
|
||||
{
|
||||
if (this.observers[i] == observer)
|
||||
{
|
||||
arrayRemoveAt(this.observers, i);
|
||||
break;
|
||||
}
|
||||
this.observers.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -696,16 +696,6 @@ function arrayHasElementAt(ary, i)
|
|||
return typeof ary[i] != "undefined";
|
||||
}
|
||||
|
||||
function arrayInsertAt (ary, i, o)
|
||||
{
|
||||
ary.splice (i, 0, o);
|
||||
}
|
||||
|
||||
function arrayRemoveAt (ary, i)
|
||||
{
|
||||
ary.splice (i, 1);
|
||||
}
|
||||
|
||||
function objectContains(o, p)
|
||||
{
|
||||
return Object.hasOwnProperty.call(o, p);
|
||||
|
|
|
@ -2827,7 +2827,7 @@ function cmdAlias(e)
|
|||
}
|
||||
|
||||
// Command Manager is updated when the preference changes.
|
||||
arrayRemoveAt(aliasDefs, ary[0]);
|
||||
aliasDefs.splice(ary[0], 1);
|
||||
aliasDefs.update();
|
||||
|
||||
feedback(e, getMsg(MSG_ALIAS_REMOVED, e.aliasName));
|
||||
|
@ -3054,7 +3054,7 @@ function cmdOpenAtStartup(e)
|
|||
// no, please don't open at startup
|
||||
if (index != -1)
|
||||
{
|
||||
arrayRemoveAt(list, index);
|
||||
list.splice(index, 1);
|
||||
list.update();
|
||||
display(getMsg(MSG_STARTUP_REMOVED, url));
|
||||
}
|
||||
|
@ -3373,7 +3373,7 @@ function cmdNotify(e)
|
|||
}
|
||||
else
|
||||
{
|
||||
arrayRemoveAt (net.prefs["notifyList"], idx);
|
||||
net.prefs["notifyList"].splice(idx, 1);
|
||||
subs.push(nickname);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1447,7 +1447,7 @@ function my_734(e)
|
|||
{
|
||||
var j = this.prefs["notifyList"].indexOf(nickList[i]);
|
||||
if (j >= 0)
|
||||
arrayRemoveAt(this.prefs["notifyList"], j);
|
||||
this.prefs["notifyList"].splice(j, 1);
|
||||
}
|
||||
this.prefs["notifyList"].update();
|
||||
|
||||
|
|
|
@ -3421,7 +3421,7 @@ function getTabForObject(source, create)
|
|||
}
|
||||
|
||||
var viewKey = Number(tb.getAttribute("viewKey"));
|
||||
arrayRemoveAt(client.viewsArray, viewKey);
|
||||
client.viewsArray.splice(viewKey, 1);
|
||||
for (i = viewKey; i < client.viewsArray.length; i++)
|
||||
client.viewsArray[i].tb.setAttribute("viewKey", i);
|
||||
client.tabs.removeChild(tb);
|
||||
|
@ -3500,7 +3500,7 @@ function getTabForObject(source, create)
|
|||
if (beforeTab)
|
||||
{
|
||||
var viewKey = beforeTab.getAttribute("viewKey");
|
||||
arrayInsertAt(client.viewsArray, viewKey, {source: source, tb: tb});
|
||||
client.viewsArray.splice(viewKey, 0, {source: source, tb: tb});
|
||||
for (i = viewKey; i < client.viewsArray.length; i++)
|
||||
client.viewsArray[i].tb.setAttribute("viewKey", i);
|
||||
client.tabs.insertBefore(tb, beforeTab);
|
||||
|
@ -3778,7 +3778,7 @@ function deleteTab(tb)
|
|||
// Re-index higher tabs.
|
||||
for (var i = key + 1; i < client.viewsArray.length; i++)
|
||||
client.viewsArray[i].tb.setAttribute("viewKey", i - 1);
|
||||
arrayRemoveAt(client.viewsArray, key);
|
||||
client.viewsArray.splice(key, 1);
|
||||
client.tabs.removeChild(tb);
|
||||
setTimeout(updateTabAttributes, 0);
|
||||
|
||||
|
|
|
@ -760,7 +760,7 @@ function xtvr_remchild(index)
|
|||
var delta = -orphan.visualFootprint;
|
||||
var changeStart = orphan.calculateVisualRow();
|
||||
delete orphan.parentRecord;
|
||||
arrayRemoveAt(this.childData, index);
|
||||
this.childData.splice(index, 1);
|
||||
|
||||
if (!orphan.isHidden && "isContainerOpen" in this && this.isContainerOpen)
|
||||
this.onVisualFootprintChanged(changeStart, delta);
|
||||
|
|
Загрузка…
Ссылка в новой задаче