Skip to content

Commit 9c52c98

Browse files
TusharSariyamoz-wptsync-bot
authored andcommitted
When HandlingTypeChanges from/to Text to Password re-use input state and set or unset the NS_MAYBE_MASKED flag.
Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io> Differential Revision: https://phabricator.services.mozilla.com/D285372 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=928224 gecko-commit: bd0c906ca0a5a1026a6bfeebcd3fda3beb28a4b5 gecko-reviewers: masayuki, layout-reviewers
1 parent 713b899 commit 9c52c98

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<title>Change type attribute inside keypress event handler</title>
3+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=928224">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script src="/resources/testdriver.js"></script>
7+
<script src="/resources/testdriver-vendor.js"></script>
8+
9+
<body>
10+
<input id="target" type="text">
11+
12+
<script>
13+
promise_test(async () => {
14+
target.focus();
15+
target.addEventListener("keypress", () => {
16+
target.type = "password";
17+
});
18+
await test_driver.send_keys(target, "xyz");
19+
assert_equals(target.value, "xyz");
20+
}, "characters are not dropped when type changes to password during keypress");
21+
</script>
22+
</body>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>value is properly masked if input type changes to password</title>
4+
5+
<p>Test passes if the input element below does not display its value as plain text.</p>
6+
7+
<input type="password" value="abc">
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<link rel="match" href="type-change-to-password-ref.html">
4+
<title>value is properly masked if input type changes to password</title>
5+
6+
<p>Test passes if the input element below does not display its value as plain text.</p>
7+
8+
<input id="i" type="text" value="abc">
9+
10+
<script>
11+
i.getBoundingClientRect();
12+
i.type = 'password';
13+
</script>

0 commit comments

Comments
 (0)