mirror of
https://github.com/servo/servo.git
synced 2025-08-26 23:58:20 +01:00
Stub out IDBIndex (#38813)
Stubs the IDBIndex interface. Testing: Mostly stubbing. Eventually covered by WPT. Fixes: Partially #38100 --------- Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
18230e9630
commit
f30be4e1ab
5 changed files with 108 additions and 57 deletions
76
components/script/dom/idbindex.rs
Normal file
76
components/script/dom/idbindex.rs
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
use dom_struct::dom_struct;
|
||||||
|
use script_bindings::codegen::GenericBindings::IDBIndexBinding::IDBIndexMethods;
|
||||||
|
use script_bindings::str::DOMString;
|
||||||
|
|
||||||
|
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||||
|
use crate::dom::bindings::root::DomRoot;
|
||||||
|
use crate::dom::globalscope::GlobalScope;
|
||||||
|
use crate::dom::idbobjectstore::IDBObjectStore;
|
||||||
|
use crate::script_runtime::CanGc;
|
||||||
|
|
||||||
|
#[dom_struct]
|
||||||
|
pub(crate) struct IDBIndex {
|
||||||
|
reflector_: Reflector,
|
||||||
|
object_store: DomRoot<IDBObjectStore>,
|
||||||
|
name: DOMString,
|
||||||
|
multi_entry: bool,
|
||||||
|
unique: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IDBIndex {
|
||||||
|
pub fn new_inherited(
|
||||||
|
object_store: DomRoot<IDBObjectStore>,
|
||||||
|
name: DOMString,
|
||||||
|
multi_entry: bool,
|
||||||
|
unique: bool,
|
||||||
|
) -> IDBIndex {
|
||||||
|
IDBIndex {
|
||||||
|
reflector_: Reflector::new(),
|
||||||
|
object_store,
|
||||||
|
name,
|
||||||
|
multi_entry,
|
||||||
|
unique,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[expect(dead_code)]
|
||||||
|
pub fn new(
|
||||||
|
global: &GlobalScope,
|
||||||
|
object_store: DomRoot<IDBObjectStore>,
|
||||||
|
name: DOMString,
|
||||||
|
multi_entry: bool,
|
||||||
|
unique: bool,
|
||||||
|
can_gc: CanGc,
|
||||||
|
) -> DomRoot<IDBIndex> {
|
||||||
|
reflect_dom_object(
|
||||||
|
Box::new(IDBIndex::new_inherited(
|
||||||
|
object_store,
|
||||||
|
name,
|
||||||
|
multi_entry,
|
||||||
|
unique,
|
||||||
|
)),
|
||||||
|
global,
|
||||||
|
can_gc,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IDBIndexMethods<crate::DomTypeHolder> for IDBIndex {
|
||||||
|
// https://www.w3.org/TR/IndexedDB/#dom-idbindex-objectstore
|
||||||
|
fn ObjectStore(&self) -> DomRoot<IDBObjectStore> {
|
||||||
|
self.object_store.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/IndexedDB/#dom-idbindex-multientry
|
||||||
|
fn MultiEntry(&self) -> bool {
|
||||||
|
self.multi_entry
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/IndexedDB/#dom-idbindex-unique
|
||||||
|
fn Unique(&self) -> bool {
|
||||||
|
self.unique
|
||||||
|
}
|
||||||
|
}
|
|
@ -428,6 +428,7 @@ pub(crate) mod htmlunknownelement;
|
||||||
pub(crate) mod htmlvideoelement;
|
pub(crate) mod htmlvideoelement;
|
||||||
pub(crate) mod idbdatabase;
|
pub(crate) mod idbdatabase;
|
||||||
pub(crate) mod idbfactory;
|
pub(crate) mod idbfactory;
|
||||||
|
pub(crate) mod idbindex;
|
||||||
pub(crate) mod idbkeyrange;
|
pub(crate) mod idbkeyrange;
|
||||||
pub(crate) mod idbobjectstore;
|
pub(crate) mod idbobjectstore;
|
||||||
pub(crate) mod idbopendbrequest;
|
pub(crate) mod idbopendbrequest;
|
||||||
|
|
31
components/script_bindings/webidls/IDBIndex.webidl
Normal file
31
components/script_bindings/webidls/IDBIndex.webidl
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
/*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* https://w3c.github.io/IndexedDB/#idbindex
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
[Pref="dom_indexeddb_enabled", Exposed=(Window,Worker)]
|
||||||
|
interface IDBIndex {
|
||||||
|
// attribute DOMString name;
|
||||||
|
[SameObject] readonly attribute IDBObjectStore objectStore;
|
||||||
|
// readonly attribute any keyPath;
|
||||||
|
readonly attribute boolean multiEntry;
|
||||||
|
readonly attribute boolean unique;
|
||||||
|
|
||||||
|
// [NewObject] IDBRequest get(any query);
|
||||||
|
// [NewObject] IDBRequest getKey(any query);
|
||||||
|
// [NewObject] IDBRequest getAll(optional any queryOrOptions,
|
||||||
|
// optional [EnforceRange] unsigned long count);
|
||||||
|
// [NewObject] IDBRequest getAllKeys(optional any queryOrOptions,
|
||||||
|
// optional [EnforceRange] unsigned long count);
|
||||||
|
// [NewObject] IDBRequest getAllRecords(optional IDBGetAllOptions options = {});
|
||||||
|
// [NewObject] IDBRequest count(optional any query);
|
||||||
|
|
||||||
|
// [NewObject] IDBRequest openCursor(optional any query,
|
||||||
|
// optional IDBCursorDirection direction = "next");
|
||||||
|
// [NewObject] IDBRequest openKeyCursor(optional any query,
|
||||||
|
// optional IDBCursorDirection direction = "next");
|
||||||
|
};
|
54
tests/wpt/meta/IndexedDB/idlharness.any.js.ini
vendored
54
tests/wpt/meta/IndexedDB/idlharness.any.js.ini
vendored
|
@ -32,39 +32,12 @@
|
||||||
[IDBObjectStore interface: operation deleteIndex(DOMString)]
|
[IDBObjectStore interface: operation deleteIndex(DOMString)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[IDBIndex interface: existence and properties of interface object]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface object length]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface object name]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: existence and properties of interface prototype object]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: existence and properties of interface prototype object's "constructor" property]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: existence and properties of interface prototype object's @@unscopables property]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: attribute name]
|
[IDBIndex interface: attribute name]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[IDBIndex interface: attribute objectStore]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: attribute keyPath]
|
[IDBIndex interface: attribute keyPath]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[IDBIndex interface: attribute multiEntry]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: attribute unique]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: operation get(any)]
|
[IDBIndex interface: operation get(any)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -196,39 +169,12 @@
|
||||||
[IDBObjectStore interface: operation deleteIndex(DOMString)]
|
[IDBObjectStore interface: operation deleteIndex(DOMString)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[IDBIndex interface: existence and properties of interface object]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface object length]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface object name]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: existence and properties of interface prototype object]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: existence and properties of interface prototype object's "constructor" property]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: existence and properties of interface prototype object's @@unscopables property]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: attribute name]
|
[IDBIndex interface: attribute name]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[IDBIndex interface: attribute objectStore]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: attribute keyPath]
|
[IDBIndex interface: attribute keyPath]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[IDBIndex interface: attribute multiEntry]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: attribute unique]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[IDBIndex interface: operation get(any)]
|
[IDBIndex interface: operation get(any)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
[The CanvasPath interface object should be exposed.]
|
[The CanvasPath interface object should be exposed.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[The IDBIndex interface object should be exposed.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[The IDBCursor interface object should be exposed.]
|
[The IDBCursor interface object should be exposed.]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue