Stanimir Stamenkov wrote:
Sun, 17 Jul 2011 21:11:48 +0300, /Stanimir Stamenkov/:Here's already revised code to handle forms found in frames, additionally: let lm = Components.classes["@mozilla.org/login-manager;1"] .getService(Components.interfaces.nsILoginManager); function fillForms(doc) { let forms = doc.forms; for (let i = 0; i < forms.length; i++) { lm.fillForm(forms[i]); } } fillForms(content.document); let frames = content.frames; for (let i = 0; i < frames.length; i++) { fillForms(frames[i].document); }Here's the code for a complimentary button which will allow saving the passwords on pages which normally suppress it. I've generally taken the code of the "remember password" [1] bookmarklet and enhanced it to traverse into frames: let ca, cea, cs; ca = cea = cs = 0; function rememberPasswords(document) { let documentForms = document.forms; for (let i = 0; i < documentForms.length; i++) { let form = documentForms[i]; let formElements = form.elements; if (form.hasAttribute("onsubmit")) { form.onsubmit = ""; cs++; } if (form.attributes["autocomplete"]) { form.attributes["autocomplete"].value = "on"; ca++; } for (let j = 0; j < formElements.length; j++) { let element = formElements[j]; if (element.attributes["autocomplete"]) { element.attributes["autocomplete"].value = "on"; cea++; } } } } rememberPasswords(content.document); let frames = content.frames; for (let i = 0; i < frames.length; i++) { rememberPasswords(frames[i].document); } function n(i, what) { return i + " " + what + ((i == 1) ? "" : "s") } alert("Removed autocomplete=off from " + n(ca, "form") + " and from " + n(cea, "form element") + ", and removed onsubmit from " + n(cs, "form") + ". After you type your password and submit the form," + " the browser will offer to remember your password."); Having this in a chrome button rather than as a bookmarklet should make it work in more cases where the password forms are found in frames with a different than the embedding document origin. This should generally make the "nsLoginManager.js" hacks suggested elsewhere, unnecessary. [1] https://www.squarefree.com/bookmarklets/forms.html#remember_password
Thanks. Can't wait to try it out. -- JD.. _______________________________________________ support-seamonkey mailing list [email protected] https://lists.mozilla.org/listinfo/support-seamonkey

