Bug 641217 - Show context menu for password fields [r+a=mfinkle]

This commit is contained in:
Matt Brubeck 2011-03-12 09:10:56 -08:00
parent 604e2ffe61
commit 07b44c3900

View File

@ -847,11 +847,14 @@ var ContextHandler = {
state.linkProtocol = this._getProtocol(this._getURI(state.linkURL));
break;
} else if ((elem instanceof Ci.nsIDOMHTMLInputElement &&
elem.mozIsTextField(true)) || elem instanceof Ci.nsIDOMHTMLTextAreaElement) {
elem.mozIsTextField(false)) || elem instanceof Ci.nsIDOMHTMLTextAreaElement) {
let selectionStart = elem.selectionStart;
let selectionEnd = elem.selectionEnd;
state.types.push("input-text");
// Don't include "copy" for password fields.
if (elem.mozIsTextField(true)) {
if (selectionStart != selectionEnd) {
state.types.push("copy");
state.string = elem.value.slice(selectionStart, selectionEnd);
@ -859,6 +862,7 @@ var ContextHandler = {
state.types.push("copy-all");
state.string = elem.value;
}
}
if (selectionStart > 0 || selectionEnd < elem.textLength)
state.types.push("select-all");