Automatic update from web-platform-tests
Fix cross-world Promise leak in navigator.keyboard.getLayoutMap()
This CL refactors KeyboardLayout::GetKeyboardLayoutMap to use
ScriptPromiseProperty instead of maintaining a HeapVector of
ScriptPromiseResolvers.
This change aligns the implementation with Blink's preferred patterns
for Promise-returning methods while continuing to satisfy the
Keyboard API specifications:
- Concurrent requests within the same world are automatically handled
by ScriptPromiseProperty to return the same pending promise
instance.
- To ensure sequential calls return new promise instances (as
required by the spec), `layout_map_property_` is now explicitly
cleared once it has reached a resolved or rejected state.
Bug: 501485453
Change-Id: Ia19bc3408e61ec160764f6229b6158fa5a912c3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7751051
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Joe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1615641}
--
wpt-commits: cae8fa0e115f4ac143bd782a20c172016b46f93c
wpt-pr: 59254
17 lines
433 B
HTML
17 lines
433 B
HTML
<!DOCTYPE html>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script>
|
|
'use strict';
|
|
|
|
promise_test(() => {
|
|
const p1 = navigator.keyboard.getLayoutMap();
|
|
return p1.then(() => {
|
|
const p2 = navigator.keyboard.getLayoutMap();
|
|
assert_not_equals(p1, p2);
|
|
return p2;
|
|
});
|
|
}, '[Keyboard Map] getLayoutMap() returns a new promise for sequential calls');
|
|
|
|
</script>
|