# HG changeset patch # User Ian Neal # Date 1728342167 -3600 # Parent e99ed24e71ea5e6e003b98392680f0df697f6de1 Bug 1923232 - Switch from using keys helper to using JS Object keys method. r=frg a=frg diff --git a/suite/extensions/irc/js/lib/command-manager.js b/suite/extensions/irc/js/lib/command-manager.js --- a/suite/extensions/irc/js/lib/command-manager.js +++ b/suite/extensions/irc/js/lib/command-manager.js @@ -538,17 +538,17 @@ function cmgr_list(partialName, flags, e if (a > b) return 1; return -1; } var ary = new Array(); - var commandNames = keys(this.commands); + var commandNames = Object.keys(this.commands); for (var name of commandNames) { let command = this.commands[name]; if ((!flags || (command.flags & flags)) && (!partialName || command.name.startsWith(partialName))) { if (exact && partialName && diff --git a/suite/extensions/irc/js/lib/utils.js b/suite/extensions/irc/js/lib/utils.js --- a/suite/extensions/irc/js/lib/utils.js +++ b/suite/extensions/irc/js/lib/utils.js @@ -618,27 +618,16 @@ function getContentDocument(frame) } catch (ex) { // throws exception is contentDocument is gone return null; } } -function keys (o) -{ - var rv = new Array(); - - for (var p in o) - rv.push(p); - - return rv; - -} - /* the offset should be in seconds, it will be rounded to 2 decimal places */ function formatDateOffset (offset, format) { var seconds = offset % 60; seconds = Math.round((seconds + Number.EPSILON) * 100) / 100; var minutes = Math.floor(offset / 60); var hours = Math.floor(minutes / 60); minutes = minutes % 60; diff --git a/suite/extensions/irc/xul/content/commands.js b/suite/extensions/irc/xul/content/commands.js --- a/suite/extensions/irc/xul/content/commands.js +++ b/suite/extensions/irc/xul/content/commands.js @@ -1432,17 +1432,17 @@ function cmdNetwork(e) dispatch("create-tab-for-view", { view: network }); dispatch("set-current-view", { view: network }); } function cmdNetworks(e) { var wrapper = newInlineText(MSG_NETWORKS_HEADA); - var netnames = keys(client.networks).sort(); + var netnames = Object.keys(client.networks).sort(); for (let i = 0; i < netnames.length; i++) { let net = client.networks[netnames[i]]; let hasSecure = networkHasSecure(net.serverList); var linkData = { "data": net.unicodeName, @@ -3986,17 +3986,17 @@ function cmdIgnore(e) else { if (e.network.unignore(e.mask)) display(getMsg(MSG_IGNORE_DEL, e.mask)); else display(getMsg(MSG_IGNORE_DELERR, e.mask)); } // Update pref: - var ignoreList = keys(e.network.ignoreList); + var ignoreList = Object.keys(e.network.ignoreList); e.network.prefs["ignoreList"] = ignoreList; e.network.prefs["ignoreList"].update(); } else { var list = new Array(); for (var m in e.network.ignoreList) list.push(m); diff --git a/suite/extensions/irc/xul/content/config.js b/suite/extensions/irc/xul/content/config.js --- a/suite/extensions/irc/xul/content/config.js +++ b/suite/extensions/irc/xul/content/config.js @@ -364,18 +364,17 @@ function opdata_loadXUL(tabOrder) this.tabbox.appendChild(this.tabs); this.tabbox.appendChild(this.tabPanels); this.deck.appendChild(this.tabbox); this.deckIndex = this.deck.childNodes.length - 1; this.loadData(); - var prefList = keys(this.prefs); - prefList.sort(sortByLabel); + var prefList = Object.keys(this.prefs).sort(sortByLabel); for (var i = 0; i < tabOrder.length; i++) { var pto = tabOrder[i]; var needTab = pto.fixed; if (!needTab) { // Not a "always visible" tab, check we need it. @@ -1087,26 +1086,26 @@ function pwin_onLoad() // Add the client object... this.prefObjects.addObject(client); // ...and everyone else. var i, j; /* We sort the keys (property names, i.e. network names). This means the UI * will show them in lexographical order, which is good. */ - var sortedNets = keys(client.networks).sort(); + var sortedNets = Object.keys(client.networks).sort(); for (i = 0; i < sortedNets.length; i++) { net = client.networks[sortedNets[i]]; this.prefObjects.addObject(net); - var sortedChans = keys(net.channels).sort(); + var sortedChans = Object.keys(net.channels).sort(); for (j = 0; j < sortedChans.length; j++) this.prefObjects.addObject(net.channels[sortedChans[j]]); - var sortedUsers = keys(net.users).sort(); + var sortedUsers = Object.keys(net.users).sort(); for (j = 0; j < sortedUsers.length; j++) this.prefObjects.addObject(net.users[sortedUsers[j]]); } // Select the first item in the list. var prefTree = document.getElementById("pref-tree-object"); if ("selection" in prefTree.treeBoxObject) prefTree.treeBoxObject.selection.select(0);