script: Check if IndexedDB key path is ECMAScript identifier name (#39255)

From IndexedDB spec, when we check whether a key path is valid, we have
to check whether it is an ECMAScript identifier name. We have not yet
implemented this logic, and always return true.

This patch uses the function `js::rust::wrappers::JS_IsIdentifier` to
achieve this checking.

Testing: Pass WPT tests that were expected to fail.
Fixes: #25324

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
This commit is contained in:
Kingsley Yung 2025-09-12 23:02:28 +08:00 committed by GitHub
parent 25147c75cb
commit a4c6108cbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 48 additions and 37 deletions

View file

@ -211,7 +211,7 @@ impl IDBDatabaseMethods<crate::DomTypeHolder> for IDBDatabase {
// Step 5
if let Some(path) = key_path {
if !is_valid_key_path(path) {
if !is_valid_key_path(path)? {
return Err(Error::Syntax(None));
}
}