function getLoadContext() {
return SpecialPowers.wrap(window).docShell.QueryInterface(
SpecialPowers.Ci.nsILoadContext);
}
function pasteText(str) {
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
let trans = Cc["@mozilla.org/widget/transferable;1"].
createInstance(Ci.nsITransferable);
trans.init(getLoadContext());
let s = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString);
s.data = str;
trans.setTransferData("text/plain", s);
let inputEvent = null;
window.addEventListener("input", aEvent => { inputEvent = aEvent; }, {once: true});
getEditor().pasteTransferable(trans);
is(inputEvent.type, "input", "input event should be fired");
is(inputEvent.inputType, "insertFromPaste", "inputType should be insertFromPaste");
is(inputEvent.data, str, `data should be "${str}"`);
is(inputEvent.dataTransfer, null, "dataTransfer should be null on password field");
}
SimpleTest.waitForFocus(async () => {
let input1 = document.getElementById("input1");
input1.focus();
let reference = snapshotWindow(window, false);
// Bug 1501376 - Password should be masked immediately when pasting text
input1.value = "";
pasteText("abcdef");
assertSnapshots(reference, snapshotWindow(window), true, null, "Password should be masked immediately when pasting text", "reference is masked");
SimpleTest.finish();
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.