tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 2cf11ce77a1ab8548351e91f870a7b26cd33631c
parent d3763246899985b5eaf6fede1716e350b44aeaa2
Author: atbrakhi <atbrakhi@igalia.com>
Date:   Thu,  9 Oct 2025 20:33:21 +0000

Bug 1992155 [wpt PR 55176] - script: Support `keyCode`, `charCode` in KeyboardEvent constructor, a=testonly

Automatic update from web-platform-tests
add wpt test

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

--
review fix

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

--

wpt-commits: 5dcd93b9270bf0685f710d1e8d611e5ad9d2a845, dc41111de45ac548bc710e977b18eff96a804df0
wpt-pr: 55176

Diffstat:
Atesting/web-platform/tests/uievents/keyboard/keyboardevent-legacy.html | 29+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/uievents/keyboard/keyboardevent-legacy.html b/testing/web-platform/tests/uievents/keyboard/keyboardevent-legacy.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>KeyboardEvent legacy fields initialization Test: KeyCode and charCode</title> +<link rel="author" title="Rakhi Sharma" href="mailto:atbrakhi@igalia.com"> +<link rel="help" href="https://w3c.github.io/uievents/#legacy-dictionary-KeyboardEventInit"> +<link rel="help" href="https://w3c.github.io/uievents/#idl-keyboardeventinit"> +<meta name="assert" content="KeyboardEvent constructor should initialize legacy keyCode and charCode attributes."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<div id="log"></div> + +<script> +var t = async_test("KeyboardEvent constructor should initialize legacy keyCode and charCode"); + +t.step(function() { + const evPress = new KeyboardEvent("keypress", { keyCode: 65, charCode: 65 }); + assert_equals(evPress.keyCode, 65, "keypress: initialized keyCode"); + assert_equals(evPress.charCode, 65, "keypress: initialized charCode"); +}); + +t.step(function() { + const evDown = new KeyboardEvent("keydown", { keyCode: 13, charCode: 0 }); + assert_equals(evDown.keyCode, 13, "keydown: initialized keyCode"); + assert_equals(evDown.charCode, 0, "keydown: initialized charCode should be 0"); +}); + +t.done(); +</script>