frozen array in XRInputSourcesChangeEvent, update to_frozen_array doc (#34100)

* frozen array in XRInputSourcesChangeEvent, update 	o_frozen_array doc

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* simplified changes

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* added tests

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

---------

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
chickenleaf 2024-11-02 19:57:59 +05:30 committed by GitHub
parent f47cc927a0
commit 900d13fc2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 13 deletions

View file

@ -844130,7 +844130,7 @@
]
],
"events_input_sources_change.https.html": [
"b2a17d4e17ae03bf7ed51e07095aa36dcce033a3",
"db8a8233fe55a920a077a644d711a455daf14b6b",
[
null,
{}

View file

@ -5,6 +5,7 @@
<script src="resources/webxr_test_constants.js"></script>
<script>
"use strict"
let testName = "Transient input sources fire events in the right order";
let watcherDone = new Event("watcherdone");
@ -25,6 +26,17 @@ let testFunction = function(session, fakeDeviceController, t) {
assert_equals(event.session, session);
validateSameObject(event);
assert_throws_js(
TypeError,
() => { event.added[0] = "test"; },
"added array must be frozen"
);
assert_throws_js(
TypeError,
() => { event.removed[0] = "test"; },
"removed array must be frozen"
);
// The first change event should be adding our controller.
if (inputChangeEvents === 1) {
validateAdded(event.added, 1);