Bug 1240454 - Remove array comprehensions from toolkit
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -1335,46 +1335,46 @@ var FormLikeFactory = {
let doc = aField.ownerDocument;
log("Created non-form FormLike for rootElement:", doc.documentElement);
let formLike = {
action: LoginUtils._getPasswordOrigin(doc.baseURI),
autocomplete: "on",
// Exclude elements inside the rootElement that are already in a <form> as
// they will be handled by their own FormLike.
- elements: [for (el of doc.documentElement.querySelectorAll("input")) if (!el.form) el],
+ elements: Array.from(doc.documentElement.querySelectorAll("input")).filter(el => !el.form);
ownerDocument: doc,
rootElement: doc.documentElement,
};
this._addToJSONProperty(formLike);
return formLike;
},
/**
* Add a `toJSON` property to a FormLike so logging which ends up going
* through dump doesn't include usless garbage from DOM objects.
*/
_addToJSONProperty(aFormLike) {
function prettyElementOutput(aElement) {
let idText = aElement.id ? "#" + aElement.id : "";
- let classText = [for (className of aElement.classList) "." + className].join("");
+ let classText = Array.from(aElement.classList).map(className => "." + className).join("");
return `<${aElement.nodeName + idText + classText}>`;
}
Object.defineProperty(aFormLike, "toJSON", {
value: () => {
let cleansed = {};
for (let key of Object.keys(aFormLike)) {
let value = aFormLike[key];
let cleansedValue = value;
switch (key) {
case "elements": {
- cleansedValue = [for (element of value) prettyElementOutput(element)];
+ cleansedValue = value.map(prettyElementOutput);
break;
}
case "ownerDocument": {
cleansedValue = {
location: {
href: value.location.href,
},