mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-11-30 12:33:54 +03:00
Update the Indexed DB API (#4028)
This commit is contained in:
parent
cdcbaf1a75
commit
19a17871f1
@ -101,6 +101,9 @@
|
||||
* Update `AbortSignal` and `AbortController` according to the WHATWG specification.
|
||||
[#4026](https://github.com/rustwasm/wasm-bindgen/pull/4026)
|
||||
|
||||
* Update the Indexed DB API.
|
||||
[#4027](https://github.com/rustwasm/wasm-bindgen/pull/4027)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`.
|
||||
|
@ -725,7 +725,9 @@ IdbOpenDbRequest = ["EventTarget", "IdbRequest"]
|
||||
IdbRequest = ["EventTarget"]
|
||||
IdbRequestReadyState = []
|
||||
IdbTransaction = ["EventTarget"]
|
||||
IdbTransactionDurability = []
|
||||
IdbTransactionMode = []
|
||||
IdbTransactionOptions = []
|
||||
IdbVersionChangeEvent = ["Event"]
|
||||
IdbVersionChangeEventInit = []
|
||||
IdleDeadline = []
|
||||
|
@ -13,116 +13,116 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub type HtmlMenuItemElement;
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = type)]
|
||||
#[doc = "Getter for the `type` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/type)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn type_(this: &HtmlMenuItemElement) -> String;
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn type_(this: &HtmlMenuItemElement) -> String;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = type)]
|
||||
#[doc = "Setter for the `type` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/type)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn set_type(this: &HtmlMenuItemElement, value: &str);
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn set_type(this: &HtmlMenuItemElement, value: &str);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = label)]
|
||||
#[doc = "Getter for the `label` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/label)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn label(this: &HtmlMenuItemElement) -> String;
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn label(this: &HtmlMenuItemElement) -> String;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = label)]
|
||||
#[doc = "Setter for the `label` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/label)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn set_label(this: &HtmlMenuItemElement, value: &str);
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn set_label(this: &HtmlMenuItemElement, value: &str);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = icon)]
|
||||
#[doc = "Getter for the `icon` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/icon)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn icon(this: &HtmlMenuItemElement) -> String;
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn icon(this: &HtmlMenuItemElement) -> String;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = icon)]
|
||||
#[doc = "Setter for the `icon` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/icon)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn set_icon(this: &HtmlMenuItemElement, value: &str);
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn set_icon(this: &HtmlMenuItemElement, value: &str);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = disabled)]
|
||||
#[doc = "Getter for the `disabled` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/disabled)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn disabled(this: &HtmlMenuItemElement) -> bool;
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn disabled(this: &HtmlMenuItemElement) -> bool;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = disabled)]
|
||||
#[doc = "Setter for the `disabled` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/disabled)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn set_disabled(this: &HtmlMenuItemElement, value: bool);
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn set_disabled(this: &HtmlMenuItemElement, value: bool);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = checked)]
|
||||
#[doc = "Getter for the `checked` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/checked)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn checked(this: &HtmlMenuItemElement) -> bool;
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn checked(this: &HtmlMenuItemElement) -> bool;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = checked)]
|
||||
#[doc = "Setter for the `checked` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/checked)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn set_checked(this: &HtmlMenuItemElement, value: bool);
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn set_checked(this: &HtmlMenuItemElement, value: bool);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = radiogroup)]
|
||||
#[doc = "Getter for the `radiogroup` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/radiogroup)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn radiogroup(this: &HtmlMenuItemElement) -> String;
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn radiogroup(this: &HtmlMenuItemElement) -> String;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = radiogroup)]
|
||||
#[doc = "Setter for the `radiogroup` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/radiogroup)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn set_radiogroup(this: &HtmlMenuItemElement, value: &str);
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn set_radiogroup(this: &HtmlMenuItemElement, value: &str);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "HTMLMenuItemElement" , js_name = defaultChecked)]
|
||||
#[doc = "Getter for the `defaultChecked` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/defaultChecked)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
pub fn default_checked(this: &HtmlMenuItemElement) -> bool;
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn default_checked(this: &HtmlMenuItemElement) -> bool;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "HTMLMenuItemElement" , js_name = defaultChecked)]
|
||||
#[doc = "Setter for the `defaultChecked` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMenuItemElement/defaultChecked)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `HtmlMenuItemElement`*"]
|
||||
#[deprecated(note = "Absent in all major browsers")]
|
||||
pub fn set_default_checked(this: &HtmlMenuItemElement, value: bool);
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBCursor/request)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbCursor`, `IdbRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn request(this: &IdbCursor) -> IdbRequest;
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBCursor" , js_name = advance)]
|
||||
#[doc = "The `advance()` method."]
|
||||
|
@ -97,6 +97,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/storage)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `StorageType`*"]
|
||||
#[deprecated]
|
||||
pub fn storage(this: &IdbDatabase) -> StorageType;
|
||||
# [wasm_bindgen (method , structural , js_class = "IDBDatabase" , js_name = close)]
|
||||
#[doc = "The `close()` method."]
|
||||
@ -112,6 +113,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/createMutableFile)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn create_mutable_file(this: &IdbDatabase, name: &str) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBDatabase" , js_name = createMutableFile)]
|
||||
@ -120,6 +122,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/createMutableFile)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn create_mutable_file_with_type(
|
||||
this: &IdbDatabase,
|
||||
name: &str,
|
||||
@ -143,7 +146,7 @@ extern "C" {
|
||||
pub fn create_object_store_with_optional_parameters(
|
||||
this: &IdbDatabase,
|
||||
name: &str,
|
||||
optional_parameters: &IdbObjectStoreParameters,
|
||||
options: &IdbObjectStoreParameters,
|
||||
) -> Result<IdbObjectStore, JsValue>;
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBDatabase" , js_name = deleteObjectStore)]
|
||||
#[doc = "The `deleteObjectStore()` method."]
|
||||
@ -198,4 +201,46 @@ extern "C" {
|
||||
store_names: &::wasm_bindgen::JsValue,
|
||||
mode: IdbTransactionMode,
|
||||
) -> Result<IdbTransaction, JsValue>;
|
||||
#[cfg(web_sys_unstable_apis)]
|
||||
#[cfg(all(
|
||||
feature = "IdbTransaction",
|
||||
feature = "IdbTransactionMode",
|
||||
feature = "IdbTransactionOptions",
|
||||
))]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBDatabase" , js_name = transaction)]
|
||||
#[doc = "The `transaction()` method."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/transaction)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbTransaction`, `IdbTransactionMode`, `IdbTransactionOptions`*"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
|
||||
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
|
||||
pub fn transaction_with_str_and_mode_and_options(
|
||||
this: &IdbDatabase,
|
||||
store_names: &str,
|
||||
mode: IdbTransactionMode,
|
||||
options: &IdbTransactionOptions,
|
||||
) -> Result<IdbTransaction, JsValue>;
|
||||
#[cfg(web_sys_unstable_apis)]
|
||||
#[cfg(all(
|
||||
feature = "IdbTransaction",
|
||||
feature = "IdbTransactionMode",
|
||||
feature = "IdbTransactionOptions",
|
||||
))]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBDatabase" , js_name = transaction)]
|
||||
#[doc = "The `transaction()` method."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/transaction)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbTransaction`, `IdbTransactionMode`, `IdbTransactionOptions`*"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
|
||||
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
|
||||
pub fn transaction_with_str_sequence_and_mode_and_options(
|
||||
this: &IdbDatabase,
|
||||
store_names: &::wasm_bindgen::JsValue,
|
||||
mode: IdbTransactionMode,
|
||||
options: &IdbTransactionOptions,
|
||||
) -> Result<IdbTransaction, JsValue>;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/deleteDatabase)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbOptions`, `IdbOpenDbRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn delete_database_with_options(
|
||||
this: &IdbFactory,
|
||||
name: &str,
|
||||
@ -50,6 +51,14 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbRequest`*"]
|
||||
pub fn open(this: &IdbFactory, name: &str) -> Result<IdbOpenDbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbOpenDbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBFactory" , js_name = open)]
|
||||
#[doc = "The `open()` method."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbRequest`*"]
|
||||
pub fn open_with_u32(
|
||||
this: &IdbFactory,
|
||||
name: &str,
|
||||
@ -67,14 +76,6 @@ extern "C" {
|
||||
name: &str,
|
||||
version: f64,
|
||||
) -> Result<IdbOpenDbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbOpenDbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBFactory" , js_name = open)]
|
||||
#[doc = "The `open()` method."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbRequest`*"]
|
||||
pub fn open(this: &IdbFactory, name: &str) -> Result<IdbOpenDbRequest, JsValue>;
|
||||
#[cfg(all(feature = "IdbOpenDbOptions", feature = "IdbOpenDbRequest",))]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBFactory" , js_name = open)]
|
||||
#[doc = "The `open()` method."]
|
||||
@ -82,6 +83,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/open)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `IdbOpenDbOptions`, `IdbOpenDbRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn open_with_idb_open_db_options(
|
||||
this: &IdbFactory,
|
||||
name: &str,
|
||||
|
@ -11,6 +11,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub type IdbFileHandle;
|
||||
#[cfg(feature = "IdbMutableFile")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = mutableFile)]
|
||||
@ -19,6 +20,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/mutableFile)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn mutable_file(this: &IdbFileHandle) -> Option<IdbMutableFile>;
|
||||
#[cfg(feature = "IdbMutableFile")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = fileHandle)]
|
||||
@ -27,6 +29,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/fileHandle)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn file_handle(this: &IdbFileHandle) -> Option<IdbMutableFile>;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = active)]
|
||||
#[doc = "Getter for the `active` field of this object."]
|
||||
@ -34,6 +37,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/active)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn active(this: &IdbFileHandle) -> bool;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = location)]
|
||||
#[doc = "Getter for the `location` field of this object."]
|
||||
@ -41,6 +45,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/location)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn location(this: &IdbFileHandle) -> Option<f64>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = location)]
|
||||
#[doc = "Setter for the `location` field of this object."]
|
||||
@ -48,6 +53,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/location)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn set_location(this: &IdbFileHandle, value: Option<f64>);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = oncomplete)]
|
||||
#[doc = "Getter for the `oncomplete` field of this object."]
|
||||
@ -55,6 +61,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/oncomplete)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn oncomplete(this: &IdbFileHandle) -> Option<::js_sys::Function>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = oncomplete)]
|
||||
#[doc = "Setter for the `oncomplete` field of this object."]
|
||||
@ -62,6 +69,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/oncomplete)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn set_oncomplete(this: &IdbFileHandle, value: Option<&::js_sys::Function>);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = onabort)]
|
||||
#[doc = "Getter for the `onabort` field of this object."]
|
||||
@ -69,6 +77,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/onabort)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn onabort(this: &IdbFileHandle) -> Option<::js_sys::Function>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = onabort)]
|
||||
#[doc = "Setter for the `onabort` field of this object."]
|
||||
@ -76,6 +85,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/onabort)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn set_onabort(this: &IdbFileHandle, value: Option<&::js_sys::Function>);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileHandle" , js_name = onerror)]
|
||||
#[doc = "Getter for the `onerror` field of this object."]
|
||||
@ -83,6 +93,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/onerror)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn onerror(this: &IdbFileHandle) -> Option<::js_sys::Function>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "IDBFileHandle" , js_name = onerror)]
|
||||
#[doc = "Setter for the `onerror` field of this object."]
|
||||
@ -90,6 +101,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/onerror)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn set_onerror(this: &IdbFileHandle, value: Option<&::js_sys::Function>);
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = abort)]
|
||||
#[doc = "The `abort()` method."]
|
||||
@ -97,6 +109,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/abort)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`*"]
|
||||
#[deprecated]
|
||||
pub fn abort(this: &IdbFileHandle) -> Result<(), JsValue>;
|
||||
#[cfg(feature = "IdbFileRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = append)]
|
||||
@ -105,6 +118,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn append_with_str(
|
||||
this: &IdbFileHandle,
|
||||
value: &str,
|
||||
@ -116,6 +130,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn append_with_array_buffer(
|
||||
this: &IdbFileHandle,
|
||||
value: &::js_sys::ArrayBuffer,
|
||||
@ -127,6 +142,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn append_with_array_buffer_view(
|
||||
this: &IdbFileHandle,
|
||||
value: &::js_sys::Object,
|
||||
@ -138,6 +154,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn append_with_u8_array(
|
||||
this: &IdbFileHandle,
|
||||
value: &mut [u8],
|
||||
@ -149,6 +166,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/append)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `Blob`, `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn append_with_blob(
|
||||
this: &IdbFileHandle,
|
||||
value: &Blob,
|
||||
@ -160,6 +178,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/flush)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn flush(this: &IdbFileHandle) -> Result<Option<IdbFileRequest>, JsValue>;
|
||||
#[cfg(feature = "IdbFileRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = getMetadata)]
|
||||
@ -168,6 +187,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/getMetadata)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn get_metadata(this: &IdbFileHandle) -> Result<Option<IdbFileRequest>, JsValue>;
|
||||
#[cfg(all(feature = "IdbFileMetadataParameters", feature = "IdbFileRequest",))]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = getMetadata)]
|
||||
@ -176,6 +196,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/getMetadata)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileMetadataParameters`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn get_metadata_with_parameters(
|
||||
this: &IdbFileHandle,
|
||||
parameters: &IdbFileMetadataParameters,
|
||||
@ -187,6 +208,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsArrayBuffer)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn read_as_array_buffer_with_u32(
|
||||
this: &IdbFileHandle,
|
||||
size: u32,
|
||||
@ -198,6 +220,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsArrayBuffer)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn read_as_array_buffer_with_f64(
|
||||
this: &IdbFileHandle,
|
||||
size: f64,
|
||||
@ -209,6 +232,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsText)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn read_as_text_with_u32(
|
||||
this: &IdbFileHandle,
|
||||
size: u32,
|
||||
@ -220,6 +244,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsText)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn read_as_text_with_f64(
|
||||
this: &IdbFileHandle,
|
||||
size: f64,
|
||||
@ -231,6 +256,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsText)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn read_as_text_with_u32_and_encoding(
|
||||
this: &IdbFileHandle,
|
||||
size: u32,
|
||||
@ -243,6 +269,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/readAsText)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn read_as_text_with_f64_and_encoding(
|
||||
this: &IdbFileHandle,
|
||||
size: f64,
|
||||
@ -255,6 +282,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/truncate)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn truncate(this: &IdbFileHandle) -> Result<Option<IdbFileRequest>, JsValue>;
|
||||
#[cfg(feature = "IdbFileRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBFileHandle" , js_name = truncate)]
|
||||
@ -263,6 +291,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/truncate)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn truncate_with_u32(
|
||||
this: &IdbFileHandle,
|
||||
size: u32,
|
||||
@ -274,6 +303,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/truncate)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn truncate_with_f64(
|
||||
this: &IdbFileHandle,
|
||||
size: f64,
|
||||
@ -285,6 +315,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn write_with_str(
|
||||
this: &IdbFileHandle,
|
||||
value: &str,
|
||||
@ -296,6 +327,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn write_with_array_buffer(
|
||||
this: &IdbFileHandle,
|
||||
value: &::js_sys::ArrayBuffer,
|
||||
@ -307,6 +339,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn write_with_array_buffer_view(
|
||||
this: &IdbFileHandle,
|
||||
value: &::js_sys::Object,
|
||||
@ -318,6 +351,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn write_with_u8_array(
|
||||
this: &IdbFileHandle,
|
||||
value: &[u8],
|
||||
@ -329,6 +363,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileHandle/write)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `Blob`, `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn write_with_blob(
|
||||
this: &IdbFileHandle,
|
||||
value: &Blob,
|
||||
|
@ -9,25 +9,30 @@ extern "C" {
|
||||
#[doc = "The `IdbFileMetadataParameters` dictionary."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"]
|
||||
#[deprecated]
|
||||
pub type IdbFileMetadataParameters;
|
||||
#[doc = "Get the `lastModified` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, getter = "lastModified")]
|
||||
pub fn get_last_modified(this: &IdbFileMetadataParameters) -> Option<bool>;
|
||||
#[doc = "Change the `lastModified` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, setter = "lastModified")]
|
||||
pub fn set_last_modified(this: &IdbFileMetadataParameters, val: bool);
|
||||
#[doc = "Get the `size` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, getter = "size")]
|
||||
pub fn get_size(this: &IdbFileMetadataParameters) -> Option<bool>;
|
||||
#[doc = "Change the `size` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, setter = "size")]
|
||||
pub fn set_size(this: &IdbFileMetadataParameters, val: bool);
|
||||
}
|
||||
@ -35,6 +40,7 @@ impl IdbFileMetadataParameters {
|
||||
#[doc = "Construct a new `IdbFileMetadataParameters`."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileMetadataParameters`*"]
|
||||
#[deprecated]
|
||||
pub fn new() -> Self {
|
||||
#[allow(unused_mut)]
|
||||
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
|
||||
|
@ -11,6 +11,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub type IdbFileRequest;
|
||||
#[cfg(feature = "IdbFileHandle")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileRequest" , js_name = fileHandle)]
|
||||
@ -19,6 +20,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest/fileHandle)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn file_handle(this: &IdbFileRequest) -> Option<IdbFileHandle>;
|
||||
#[cfg(feature = "IdbFileHandle")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileRequest" , js_name = lockedFile)]
|
||||
@ -27,6 +29,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest/lockedFile)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn locked_file(this: &IdbFileRequest) -> Option<IdbFileHandle>;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBFileRequest" , js_name = onprogress)]
|
||||
#[doc = "Getter for the `onprogress` field of this object."]
|
||||
@ -34,6 +37,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest/onprogress)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn onprogress(this: &IdbFileRequest) -> Option<::js_sys::Function>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "IDBFileRequest" , js_name = onprogress)]
|
||||
#[doc = "Setter for the `onprogress` field of this object."]
|
||||
@ -41,5 +45,6 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBFileRequest/onprogress)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileRequest`*"]
|
||||
#[deprecated]
|
||||
pub fn set_onprogress(this: &IdbFileRequest, value: Option<&::js_sys::Function>);
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/locale)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`*"]
|
||||
#[deprecated]
|
||||
pub fn locale(this: &IdbIndex) -> Option<String>;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBIndex" , js_name = isAutoLocale)]
|
||||
#[doc = "Getter for the `isAutoLocale` field of this object."]
|
||||
@ -68,6 +69,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/isAutoLocale)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`*"]
|
||||
#[deprecated]
|
||||
pub fn is_auto_locale(this: &IdbIndex) -> bool;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = count)]
|
||||
@ -86,7 +88,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn count_with_key(
|
||||
this: &IdbIndex,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = get)]
|
||||
@ -95,7 +97,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/get)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn get(this: &IdbIndex, key: &::wasm_bindgen::JsValue) -> Result<IdbRequest, JsValue>;
|
||||
pub fn get(this: &IdbIndex, query: &::wasm_bindgen::JsValue) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getAll)]
|
||||
#[doc = "The `getAll()` method."]
|
||||
@ -113,7 +115,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn get_all_with_key(
|
||||
this: &IdbIndex,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getAll)]
|
||||
@ -124,8 +126,8 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn get_all_with_key_and_limit(
|
||||
this: &IdbIndex,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
limit: u32,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
count: u32,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getAllKeys)]
|
||||
@ -144,7 +146,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn get_all_keys_with_key(
|
||||
this: &IdbIndex,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getAllKeys)]
|
||||
@ -155,8 +157,8 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn get_all_keys_with_key_and_limit(
|
||||
this: &IdbIndex,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
limit: u32,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
count: u32,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = getKey)]
|
||||
@ -165,7 +167,8 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBIndex/getKey)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn get_key(this: &IdbIndex, key: &::wasm_bindgen::JsValue) -> Result<IdbRequest, JsValue>;
|
||||
pub fn get_key(this: &IdbIndex, query: &::wasm_bindgen::JsValue)
|
||||
-> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = openCursor)]
|
||||
#[doc = "The `openCursor()` method."]
|
||||
@ -183,7 +186,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn open_cursor_with_range(
|
||||
this: &IdbIndex,
|
||||
range: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(all(feature = "IdbCursorDirection", feature = "IdbRequest",))]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = openCursor)]
|
||||
@ -194,7 +197,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbCursorDirection`, `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn open_cursor_with_range_and_direction(
|
||||
this: &IdbIndex,
|
||||
range: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
direction: IdbCursorDirection,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
@ -214,7 +217,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn open_key_cursor_with_range(
|
||||
this: &IdbIndex,
|
||||
range: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(all(feature = "IdbCursorDirection", feature = "IdbRequest",))]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBIndex" , js_name = openKeyCursor)]
|
||||
@ -225,7 +228,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbCursorDirection`, `IdbIndex`, `IdbRequest`*"]
|
||||
pub fn open_key_cursor_with_range_and_direction(
|
||||
this: &IdbIndex,
|
||||
range: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
direction: IdbCursorDirection,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
}
|
||||
|
@ -13,11 +13,13 @@ extern "C" {
|
||||
#[doc = "Get the `locale` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, getter = "locale")]
|
||||
pub fn get_locale(this: &IdbIndexParameters) -> Option<String>;
|
||||
#[doc = "Change the `locale` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbIndexParameters`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, setter = "locale")]
|
||||
pub fn set_locale(this: &IdbIndexParameters, val: Option<&str>);
|
||||
#[doc = "Get the `multiEntry` field of this object."]
|
||||
|
@ -11,6 +11,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"]
|
||||
#[deprecated]
|
||||
pub type IdbLocaleAwareKeyRange;
|
||||
# [wasm_bindgen (catch , static_method_of = IdbLocaleAwareKeyRange , js_class = "IDBLocaleAwareKeyRange" , js_name = bound)]
|
||||
#[doc = "The `bound()` method."]
|
||||
@ -18,6 +19,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound_static)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"]
|
||||
#[deprecated]
|
||||
pub fn bound(
|
||||
lower: &::wasm_bindgen::JsValue,
|
||||
upper: &::wasm_bindgen::JsValue,
|
||||
@ -28,6 +30,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound_static)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"]
|
||||
#[deprecated]
|
||||
pub fn bound_with_lower_open(
|
||||
lower: &::wasm_bindgen::JsValue,
|
||||
upper: &::wasm_bindgen::JsValue,
|
||||
@ -39,6 +42,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBLocaleAwareKeyRange/bound_static)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbLocaleAwareKeyRange`*"]
|
||||
#[deprecated]
|
||||
pub fn bound_with_lower_open_and_upper_open(
|
||||
lower: &::wasm_bindgen::JsValue,
|
||||
upper: &::wasm_bindgen::JsValue,
|
||||
|
@ -11,6 +11,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub type IdbMutableFile;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = name)]
|
||||
#[doc = "Getter for the `name` field of this object."]
|
||||
@ -18,6 +19,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/name)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn name(this: &IdbMutableFile) -> String;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = type)]
|
||||
#[doc = "Getter for the `type` field of this object."]
|
||||
@ -25,6 +27,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/type)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn type_(this: &IdbMutableFile) -> String;
|
||||
#[cfg(feature = "IdbDatabase")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = database)]
|
||||
@ -33,6 +36,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/database)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbDatabase`, `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn database(this: &IdbMutableFile) -> IdbDatabase;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = onabort)]
|
||||
#[doc = "Getter for the `onabort` field of this object."]
|
||||
@ -40,6 +44,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/onabort)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn onabort(this: &IdbMutableFile) -> Option<::js_sys::Function>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "IDBMutableFile" , js_name = onabort)]
|
||||
#[doc = "Setter for the `onabort` field of this object."]
|
||||
@ -47,6 +52,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/onabort)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn set_onabort(this: &IdbMutableFile, value: Option<&::js_sys::Function>);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBMutableFile" , js_name = onerror)]
|
||||
#[doc = "Getter for the `onerror` field of this object."]
|
||||
@ -54,6 +60,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/onerror)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn onerror(this: &IdbMutableFile) -> Option<::js_sys::Function>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "IDBMutableFile" , js_name = onerror)]
|
||||
#[doc = "Setter for the `onerror` field of this object."]
|
||||
@ -61,6 +68,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/onerror)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn set_onerror(this: &IdbMutableFile, value: Option<&::js_sys::Function>);
|
||||
#[cfg(feature = "DomRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBMutableFile" , js_name = getFile)]
|
||||
@ -69,6 +77,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/getFile)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `DomRequest`, `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn get_file(this: &IdbMutableFile) -> Result<DomRequest, JsValue>;
|
||||
#[cfg(feature = "IdbFileHandle")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBMutableFile" , js_name = open)]
|
||||
@ -77,5 +86,6 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBMutableFile/open)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFileHandle`, `IdbMutableFile`*"]
|
||||
#[deprecated]
|
||||
pub fn open(this: &IdbMutableFile) -> Result<IdbFileHandle, JsValue>;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn count_with_key(
|
||||
this: &IdbObjectStore,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbIndex")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = createIndex)]
|
||||
@ -141,7 +141,7 @@ extern "C" {
|
||||
this: &IdbObjectStore,
|
||||
name: &str,
|
||||
key_path: &str,
|
||||
optional_parameters: &IdbIndexParameters,
|
||||
options: &IdbIndexParameters,
|
||||
) -> Result<IdbIndex, JsValue>;
|
||||
#[cfg(all(feature = "IdbIndex", feature = "IdbIndexParameters",))]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = createIndex)]
|
||||
@ -154,7 +154,7 @@ extern "C" {
|
||||
this: &IdbObjectStore,
|
||||
name: &str,
|
||||
key_path: &::wasm_bindgen::JsValue,
|
||||
optional_parameters: &IdbIndexParameters,
|
||||
options: &IdbIndexParameters,
|
||||
) -> Result<IdbIndex, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = delete)]
|
||||
@ -165,7 +165,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn delete(
|
||||
this: &IdbObjectStore,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = deleteIndex)]
|
||||
#[doc = "The `deleteIndex()` method."]
|
||||
@ -173,7 +173,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/deleteIndex)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`*"]
|
||||
pub fn delete_index(this: &IdbObjectStore, index_name: &str) -> Result<(), JsValue>;
|
||||
pub fn delete_index(this: &IdbObjectStore, name: &str) -> Result<(), JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = get)]
|
||||
#[doc = "The `get()` method."]
|
||||
@ -181,8 +181,10 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/get)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn get(this: &IdbObjectStore, key: &::wasm_bindgen::JsValue)
|
||||
-> Result<IdbRequest, JsValue>;
|
||||
pub fn get(
|
||||
this: &IdbObjectStore,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getAll)]
|
||||
#[doc = "The `getAll()` method."]
|
||||
@ -200,7 +202,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn get_all_with_key(
|
||||
this: &IdbObjectStore,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getAll)]
|
||||
@ -211,8 +213,8 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn get_all_with_key_and_limit(
|
||||
this: &IdbObjectStore,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
limit: u32,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
count: u32,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getAllKeys)]
|
||||
@ -231,7 +233,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn get_all_keys_with_key(
|
||||
this: &IdbObjectStore,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getAllKeys)]
|
||||
@ -242,8 +244,8 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn get_all_keys_with_key_and_limit(
|
||||
this: &IdbObjectStore,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
limit: u32,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
count: u32,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = getKey)]
|
||||
@ -254,7 +256,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn get_key(
|
||||
this: &IdbObjectStore,
|
||||
key: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbIndex")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = index)]
|
||||
@ -281,7 +283,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn open_cursor_with_range(
|
||||
this: &IdbObjectStore,
|
||||
range: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(all(feature = "IdbCursorDirection", feature = "IdbRequest",))]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = openCursor)]
|
||||
@ -292,7 +294,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbCursorDirection`, `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn open_cursor_with_range_and_direction(
|
||||
this: &IdbObjectStore,
|
||||
range: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
direction: IdbCursorDirection,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
@ -312,7 +314,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn open_key_cursor_with_range(
|
||||
this: &IdbObjectStore,
|
||||
range: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(all(feature = "IdbCursorDirection", feature = "IdbRequest",))]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBObjectStore" , js_name = openKeyCursor)]
|
||||
@ -323,7 +325,7 @@ extern "C" {
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbCursorDirection`, `IdbObjectStore`, `IdbRequest`*"]
|
||||
pub fn open_key_cursor_with_range_and_direction(
|
||||
this: &IdbObjectStore,
|
||||
range: &::wasm_bindgen::JsValue,
|
||||
query: &::wasm_bindgen::JsValue,
|
||||
direction: IdbCursorDirection,
|
||||
) -> Result<IdbRequest, JsValue>;
|
||||
#[cfg(feature = "IdbRequest")]
|
||||
|
@ -9,27 +9,32 @@ extern "C" {
|
||||
#[doc = "The `IdbOpenDbOptions` dictionary."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"]
|
||||
#[deprecated]
|
||||
pub type IdbOpenDbOptions;
|
||||
#[cfg(feature = "StorageType")]
|
||||
#[doc = "Get the `storage` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`, `StorageType`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, getter = "storage")]
|
||||
pub fn get_storage(this: &IdbOpenDbOptions) -> Option<StorageType>;
|
||||
#[cfg(feature = "StorageType")]
|
||||
#[doc = "Change the `storage` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`, `StorageType`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, setter = "storage")]
|
||||
pub fn set_storage(this: &IdbOpenDbOptions, val: StorageType);
|
||||
#[doc = "Get the `version` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, getter = "version")]
|
||||
pub fn get_version(this: &IdbOpenDbOptions) -> Option<f64>;
|
||||
#[doc = "Change the `version` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"]
|
||||
#[deprecated]
|
||||
#[wasm_bindgen(method, setter = "version")]
|
||||
pub fn set_version(this: &IdbOpenDbOptions, val: f64);
|
||||
}
|
||||
@ -37,6 +42,7 @@ impl IdbOpenDbOptions {
|
||||
#[doc = "Construct a new `IdbOpenDbOptions`."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbOpenDbOptions`*"]
|
||||
#[deprecated]
|
||||
pub fn new() -> Self {
|
||||
#[allow(unused_mut)]
|
||||
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
|
||||
|
@ -12,6 +12,14 @@ extern "C" {
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbTransaction`*"]
|
||||
pub type IdbTransaction;
|
||||
#[cfg(feature = "DomStringList")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBTransaction" , js_name = objectStoreNames)]
|
||||
#[doc = "Getter for the `objectStoreNames` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/objectStoreNames)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `DomStringList`, `IdbTransaction`*"]
|
||||
pub fn object_store_names(this: &IdbTransaction) -> DomStringList;
|
||||
#[cfg(feature = "IdbTransactionMode")]
|
||||
# [wasm_bindgen (structural , catch , method , getter , js_class = "IDBTransaction" , js_name = mode)]
|
||||
#[doc = "Getter for the `mode` field of this object."]
|
||||
@ -78,14 +86,6 @@ extern "C" {
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbTransaction`*"]
|
||||
pub fn set_onerror(this: &IdbTransaction, value: Option<&::js_sys::Function>);
|
||||
#[cfg(feature = "DomStringList")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "IDBTransaction" , js_name = objectStoreNames)]
|
||||
#[doc = "Getter for the `objectStoreNames` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/objectStoreNames)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `DomStringList`, `IdbTransaction`*"]
|
||||
pub fn object_store_names(this: &IdbTransaction) -> DomStringList;
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBTransaction" , js_name = abort)]
|
||||
#[doc = "The `abort()` method."]
|
||||
#[doc = ""]
|
||||
@ -99,6 +99,7 @@ extern "C" {
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/commit)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbTransaction`*"]
|
||||
#[deprecated]
|
||||
pub fn commit(this: &IdbTransaction) -> Result<(), JsValue>;
|
||||
#[cfg(feature = "IdbObjectStore")]
|
||||
# [wasm_bindgen (catch , method , structural , js_class = "IDBTransaction" , js_name = objectStore)]
|
||||
|
17
crates/web-sys/src/features/gen_IdbTransactionDurability.rs
Normal file
17
crates/web-sys/src/features/gen_IdbTransactionDurability.rs
Normal file
@ -0,0 +1,17 @@
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::all)]
|
||||
use wasm_bindgen::prelude::*;
|
||||
#[cfg(web_sys_unstable_apis)]
|
||||
#[wasm_bindgen]
|
||||
#[doc = "The `IdbTransactionDurability` enum."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbTransactionDurability`*"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
|
||||
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum IdbTransactionDurability {
|
||||
Default = "default",
|
||||
Strict = "strict",
|
||||
Relaxed = "relaxed",
|
||||
}
|
@ -9,7 +9,7 @@ use wasm_bindgen::prelude::*;
|
||||
pub enum IdbTransactionMode {
|
||||
Readonly = "readonly",
|
||||
Readwrite = "readwrite",
|
||||
Versionchange = "versionchange",
|
||||
Readwriteflush = "readwriteflush",
|
||||
Cleanup = "cleanup",
|
||||
Versionchange = "versionchange",
|
||||
}
|
||||
|
64
crates/web-sys/src/features/gen_IdbTransactionOptions.rs
Normal file
64
crates/web-sys/src/features/gen_IdbTransactionOptions.rs
Normal file
@ -0,0 +1,64 @@
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::all)]
|
||||
use super::*;
|
||||
use wasm_bindgen::prelude::*;
|
||||
#[cfg(web_sys_unstable_apis)]
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = IDBTransactionOptions)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[doc = "The `IdbTransactionOptions` dictionary."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbTransactionOptions`*"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
|
||||
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
|
||||
pub type IdbTransactionOptions;
|
||||
#[cfg(web_sys_unstable_apis)]
|
||||
#[cfg(feature = "IdbTransactionDurability")]
|
||||
#[doc = "Get the `durability` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbTransactionDurability`, `IdbTransactionOptions`*"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
|
||||
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
|
||||
#[wasm_bindgen(method, getter = "durability")]
|
||||
pub fn get_durability(this: &IdbTransactionOptions) -> Option<IdbTransactionDurability>;
|
||||
#[cfg(web_sys_unstable_apis)]
|
||||
#[cfg(feature = "IdbTransactionDurability")]
|
||||
#[doc = "Change the `durability` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbTransactionDurability`, `IdbTransactionOptions`*"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
|
||||
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
|
||||
#[wasm_bindgen(method, setter = "durability")]
|
||||
pub fn set_durability(this: &IdbTransactionOptions, val: IdbTransactionDurability);
|
||||
}
|
||||
#[cfg(web_sys_unstable_apis)]
|
||||
impl IdbTransactionOptions {
|
||||
#[doc = "Construct a new `IdbTransactionOptions`."]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbTransactionOptions`*"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
|
||||
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
|
||||
pub fn new() -> Self {
|
||||
#[allow(unused_mut)]
|
||||
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
|
||||
ret
|
||||
}
|
||||
#[cfg(web_sys_unstable_apis)]
|
||||
#[cfg(feature = "IdbTransactionDurability")]
|
||||
#[deprecated = "Use `set_durability()` instead."]
|
||||
pub fn durability(&mut self, val: IdbTransactionDurability) -> &mut Self {
|
||||
self.set_durability(val);
|
||||
self
|
||||
}
|
||||
}
|
||||
#[cfg(web_sys_unstable_apis)]
|
||||
impl Default for IdbTransactionOptions {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
@ -1922,6 +1922,14 @@ extern "C" {
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `Storage`, `Window`*"]
|
||||
pub fn local_storage(this: &Window) -> Result<Option<Storage>, JsValue>;
|
||||
#[cfg(feature = "IdbFactory")]
|
||||
# [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = indexedDB)]
|
||||
#[doc = "Getter for the `indexedDB` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/indexedDB)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `Window`*"]
|
||||
pub fn indexed_db(this: &Window) -> Result<Option<IdbFactory>, JsValue>;
|
||||
#[cfg(feature = "Performance")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = performance)]
|
||||
#[doc = "Getter for the `performance` field of this object."]
|
||||
@ -1944,14 +1952,6 @@ extern "C" {
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `Window`*"]
|
||||
pub fn is_secure_context(this: &Window) -> bool;
|
||||
#[cfg(feature = "IdbFactory")]
|
||||
# [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = indexedDB)]
|
||||
#[doc = "Getter for the `indexedDB` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/indexedDB)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `Window`*"]
|
||||
pub fn indexed_db(this: &Window) -> Result<Option<IdbFactory>, JsValue>;
|
||||
#[cfg(feature = "CacheStorage")]
|
||||
# [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = caches)]
|
||||
#[doc = "Getter for the `caches` field of this object."]
|
||||
|
@ -85,6 +85,14 @@ extern "C" {
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `Crypto`, `WorkerGlobalScope`*"]
|
||||
pub fn crypto(this: &WorkerGlobalScope) -> Result<Crypto, JsValue>;
|
||||
#[cfg(feature = "IdbFactory")]
|
||||
# [wasm_bindgen (structural , catch , method , getter , js_class = "WorkerGlobalScope" , js_name = indexedDB)]
|
||||
#[doc = "Getter for the `indexedDB` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/indexedDB)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `WorkerGlobalScope`*"]
|
||||
pub fn indexed_db(this: &WorkerGlobalScope) -> Result<Option<IdbFactory>, JsValue>;
|
||||
#[cfg(feature = "Performance")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "WorkerGlobalScope" , js_name = performance)]
|
||||
#[doc = "Getter for the `performance` field of this object."]
|
||||
@ -107,14 +115,6 @@ extern "C" {
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"]
|
||||
pub fn is_secure_context(this: &WorkerGlobalScope) -> bool;
|
||||
#[cfg(feature = "IdbFactory")]
|
||||
# [wasm_bindgen (structural , catch , method , getter , js_class = "WorkerGlobalScope" , js_name = indexedDB)]
|
||||
#[doc = "Getter for the `indexedDB` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/indexedDB)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `IdbFactory`, `WorkerGlobalScope`*"]
|
||||
pub fn indexed_db(this: &WorkerGlobalScope) -> Result<Option<IdbFactory>, JsValue>;
|
||||
#[cfg(feature = "CacheStorage")]
|
||||
# [wasm_bindgen (structural , catch , method , getter , js_class = "WorkerGlobalScope" , js_name = caches)]
|
||||
#[doc = "Getter for the `caches` field of this object."]
|
||||
|
@ -4828,6 +4828,13 @@ mod gen_IdbTransaction;
|
||||
#[allow(unused_imports)]
|
||||
pub use gen_IdbTransaction::*;
|
||||
|
||||
#[cfg(feature = "IdbTransactionDurability")]
|
||||
#[allow(non_snake_case)]
|
||||
mod gen_IdbTransactionDurability;
|
||||
#[cfg(feature = "IdbTransactionDurability")]
|
||||
#[allow(unused_imports)]
|
||||
pub use gen_IdbTransactionDurability::*;
|
||||
|
||||
#[cfg(feature = "IdbTransactionMode")]
|
||||
#[allow(non_snake_case)]
|
||||
mod gen_IdbTransactionMode;
|
||||
@ -4835,6 +4842,13 @@ mod gen_IdbTransactionMode;
|
||||
#[allow(unused_imports)]
|
||||
pub use gen_IdbTransactionMode::*;
|
||||
|
||||
#[cfg(feature = "IdbTransactionOptions")]
|
||||
#[allow(non_snake_case)]
|
||||
mod gen_IdbTransactionOptions;
|
||||
#[cfg(feature = "IdbTransactionOptions")]
|
||||
#[allow(unused_imports)]
|
||||
pub use gen_IdbTransactionOptions::*;
|
||||
|
||||
#[cfg(feature = "IdbVersionChangeEvent")]
|
||||
#[allow(non_snake_case)]
|
||||
mod gen_IdbVersionChangeEvent;
|
||||
|
314
crates/web-sys/webidls/enabled/IDB.webidl
vendored
Normal file
314
crates/web-sys/webidls/enabled/IDB.webidl
vendored
Normal file
@ -0,0 +1,314 @@
|
||||
// https://www.w3.org/TR/IndexedDB-2/
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBRequest : EventTarget {
|
||||
[Throws]
|
||||
readonly attribute any result;
|
||||
[Throws]
|
||||
readonly attribute DOMException? error;
|
||||
readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source;
|
||||
readonly attribute IDBTransaction? transaction;
|
||||
readonly attribute IDBRequestReadyState readyState;
|
||||
|
||||
// Event handlers:
|
||||
attribute EventHandler onsuccess;
|
||||
attribute EventHandler onerror;
|
||||
};
|
||||
|
||||
enum IDBRequestReadyState {
|
||||
"pending",
|
||||
"done"
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBOpenDBRequest : IDBRequest {
|
||||
// Event handlers:
|
||||
attribute EventHandler onblocked;
|
||||
attribute EventHandler onupgradeneeded;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
Constructor(DOMString type, optional IDBVersionChangeEventInit eventInitDict)]
|
||||
interface IDBVersionChangeEvent : Event {
|
||||
readonly attribute unsigned long long oldVersion;
|
||||
readonly attribute unsigned long long? newVersion;
|
||||
};
|
||||
|
||||
dictionary IDBVersionChangeEventInit : EventInit {
|
||||
unsigned long long oldVersion = 0;
|
||||
unsigned long long? newVersion = null;
|
||||
};
|
||||
|
||||
partial interface mixin WindowOrWorkerGlobalScope {
|
||||
// Breaking change: Should this throw or be optional?
|
||||
[Throws, SameObject] readonly attribute IDBFactory? indexedDB;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBFactory {
|
||||
[Throws, NewObject] IDBOpenDBRequest open(DOMString name,
|
||||
optional [EnforceRange] unsigned long long version);
|
||||
[Throws, NewObject] IDBOpenDBRequest deleteDatabase(DOMString name);
|
||||
|
||||
[Throws]
|
||||
short cmp(any first, any second);
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBDatabase : EventTarget {
|
||||
readonly attribute DOMString name;
|
||||
readonly attribute unsigned long long version;
|
||||
readonly attribute DOMStringList objectStoreNames;
|
||||
|
||||
[Throws, NewObject] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames,
|
||||
optional IDBTransactionMode mode = "readonly");
|
||||
undefined close();
|
||||
|
||||
[Throws, NewObject] IDBObjectStore createObjectStore(DOMString name,
|
||||
optional IDBObjectStoreParameters options);
|
||||
[Throws] undefined deleteObjectStore(DOMString name);
|
||||
|
||||
// Event handlers:
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler onclose;
|
||||
attribute EventHandler onerror;
|
||||
attribute EventHandler onversionchange;
|
||||
};
|
||||
|
||||
dictionary IDBObjectStoreParameters {
|
||||
(DOMString or sequence<DOMString>)? keyPath = null;
|
||||
boolean autoIncrement = false;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBObjectStore {
|
||||
[SetterThrows] attribute DOMString name;
|
||||
[Throws] readonly attribute any keyPath;
|
||||
readonly attribute DOMStringList indexNames;
|
||||
[SameObject] readonly attribute IDBTransaction transaction;
|
||||
readonly attribute boolean autoIncrement;
|
||||
|
||||
[Throws, NewObject] IDBRequest put(any value, optional any key);
|
||||
[Throws, NewObject] IDBRequest add(any value, optional any key);
|
||||
[Throws, NewObject] IDBRequest delete(any query);
|
||||
[Throws, NewObject] IDBRequest clear();
|
||||
[Throws, NewObject] IDBRequest get(any query);
|
||||
[Throws, NewObject] IDBRequest getKey(any query);
|
||||
[Throws, NewObject] IDBRequest getAll(optional any query,
|
||||
optional [EnforceRange] unsigned long count);
|
||||
[Throws, NewObject] IDBRequest getAllKeys(optional any query,
|
||||
optional [EnforceRange] unsigned long count);
|
||||
[Throws, NewObject] IDBRequest count(optional any query);
|
||||
|
||||
[Throws, NewObject] IDBRequest openCursor(optional any query,
|
||||
optional IDBCursorDirection direction = "next");
|
||||
[Throws, NewObject] IDBRequest openKeyCursor(optional any query,
|
||||
optional IDBCursorDirection direction = "next");
|
||||
|
||||
[Throws] IDBIndex index(DOMString name);
|
||||
|
||||
[Throws, NewObject] IDBIndex createIndex(DOMString name,
|
||||
(DOMString or sequence<DOMString>) keyPath,
|
||||
optional IDBIndexParameters options);
|
||||
[Throws] undefined deleteIndex(DOMString name);
|
||||
};
|
||||
|
||||
dictionary IDBIndexParameters {
|
||||
boolean unique = false;
|
||||
boolean multiEntry = false;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBIndex {
|
||||
[SetterThrows] attribute DOMString name;
|
||||
[SameObject] readonly attribute IDBObjectStore objectStore;
|
||||
[Throws] readonly attribute any keyPath;
|
||||
readonly attribute boolean multiEntry;
|
||||
readonly attribute boolean unique;
|
||||
|
||||
[Throws, NewObject] IDBRequest get(any query);
|
||||
[Throws, NewObject] IDBRequest getKey(any query);
|
||||
[Throws, NewObject] IDBRequest getAll(optional any query,
|
||||
optional [EnforceRange] unsigned long count);
|
||||
[Throws, NewObject] IDBRequest getAllKeys(optional any query,
|
||||
optional [EnforceRange] unsigned long count);
|
||||
[Throws, NewObject] IDBRequest count(optional any query);
|
||||
|
||||
[Throws, NewObject] IDBRequest openCursor(optional any query,
|
||||
optional IDBCursorDirection direction = "next");
|
||||
[Throws, NewObject] IDBRequest openKeyCursor(optional any query,
|
||||
optional IDBCursorDirection direction = "next");
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBKeyRange {
|
||||
[Throws] readonly attribute any lower;
|
||||
[Throws] readonly attribute any upper;
|
||||
readonly attribute boolean lowerOpen;
|
||||
readonly attribute boolean upperOpen;
|
||||
|
||||
// Static construction methods:
|
||||
[Throws, NewObject] static IDBKeyRange only(any value);
|
||||
[Throws, NewObject] static IDBKeyRange lowerBound(any lower, optional boolean open = false);
|
||||
[Throws, NewObject] static IDBKeyRange upperBound(any upper, optional boolean open = false);
|
||||
[Throws, NewObject] static IDBKeyRange bound(any lower,
|
||||
any upper,
|
||||
optional boolean lowerOpen = false,
|
||||
optional boolean upperOpen = false);
|
||||
|
||||
[Throws] boolean _includes(any key);
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBCursor {
|
||||
readonly attribute (IDBObjectStore or IDBIndex) source;
|
||||
readonly attribute IDBCursorDirection direction;
|
||||
[Throws] readonly attribute any key;
|
||||
[Throws] readonly attribute any primaryKey;
|
||||
|
||||
[Throws] undefined advance([EnforceRange] unsigned long count);
|
||||
[Throws] undefined continue(optional any key);
|
||||
[Throws] undefined continuePrimaryKey(any key, any primaryKey);
|
||||
|
||||
[Throws, NewObject] IDBRequest update(any value);
|
||||
[Throws, NewObject] IDBRequest delete();
|
||||
};
|
||||
|
||||
enum IDBCursorDirection {
|
||||
"next",
|
||||
"nextunique",
|
||||
"prev",
|
||||
"prevunique"
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBCursorWithValue : IDBCursor {
|
||||
[Throws] readonly attribute any value;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBTransaction : EventTarget {
|
||||
readonly attribute DOMStringList objectStoreNames;
|
||||
[Throws] readonly attribute IDBTransactionMode mode;
|
||||
[SameObject] readonly attribute IDBDatabase db;
|
||||
// TODO: remove optional?
|
||||
readonly attribute DOMException? error;
|
||||
|
||||
[Throws] IDBObjectStore objectStore(DOMString name);
|
||||
[Throws] undefined abort();
|
||||
|
||||
// Event handlers:
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler oncomplete;
|
||||
attribute EventHandler onerror;
|
||||
};
|
||||
|
||||
enum IDBTransactionMode {
|
||||
"readonly",
|
||||
"readwrite",
|
||||
"versionchange",
|
||||
// TODO: deprecated
|
||||
"readwriteflush",
|
||||
// TODO: deprecated
|
||||
"cleanup"
|
||||
};
|
||||
|
||||
/*
|
||||
** DEPRECATED
|
||||
*/
|
||||
|
||||
partial interface IDBFactory {
|
||||
[RustDeprecated, Throws, NewObject]
|
||||
IDBOpenDBRequest open(DOMString name, optional IDBOpenDBOptions options = {});
|
||||
[RustDeprecated, Throws, NewObject]
|
||||
IDBOpenDBRequest deleteDatabase(DOMString name, optional IDBOpenDBOptions options = {});
|
||||
};
|
||||
|
||||
partial dictionary IDBIndexParameters {
|
||||
[RustDeprecated] DOMString? locale = null;
|
||||
};
|
||||
|
||||
partial interface IDBIndex {
|
||||
[RustDeprecated] readonly attribute DOMString? locale;
|
||||
[RustDeprecated] readonly attribute boolean isAutoLocale;
|
||||
};
|
||||
|
||||
partial interface IDBCursor {
|
||||
[RustDeprecated] readonly attribute IDBRequest request;
|
||||
};
|
||||
|
||||
partial interface IDBTransaction {
|
||||
[RustDeprecated, Throws] undefined commit();
|
||||
};
|
||||
|
||||
partial interface IDBDatabase {
|
||||
[RustDeprecated] readonly attribute StorageType storage;
|
||||
[RustDeprecated, Throws] IDBRequest createMutableFile (DOMString name, optional DOMString type);
|
||||
};
|
||||
|
||||
[RustDeprecated] dictionary IDBOpenDBOptions {
|
||||
[EnforceRange] unsigned long long version;
|
||||
StorageType storage;
|
||||
};
|
||||
|
||||
[RustDeprecated] dictionary IDBFileMetadataParameters {
|
||||
boolean size = true;
|
||||
boolean lastModified = true;
|
||||
};
|
||||
|
||||
[RustDeprecated] interface IDBFileHandle : EventTarget {
|
||||
readonly attribute IDBMutableFile? mutableFile;
|
||||
readonly attribute IDBMutableFile? fileHandle;
|
||||
readonly attribute FileMode mode;
|
||||
readonly attribute boolean active;
|
||||
attribute unsigned long long? location;
|
||||
|
||||
[Throws]
|
||||
IDBFileRequest? getMetadata(optional IDBFileMetadataParameters parameters = {});
|
||||
[Throws]
|
||||
IDBFileRequest? readAsArrayBuffer(unsigned long long size);
|
||||
[Throws]
|
||||
IDBFileRequest? readAsText(unsigned long long size,
|
||||
optional DOMString? encoding = null);
|
||||
|
||||
[Throws]
|
||||
IDBFileRequest? write((DOMString or ArrayBuffer or ArrayBufferView or Blob) value);
|
||||
[Throws]
|
||||
IDBFileRequest? append((DOMString or ArrayBuffer or ArrayBufferView or Blob) value);
|
||||
[Throws]
|
||||
IDBFileRequest? truncate(optional unsigned long long size);
|
||||
[Throws]
|
||||
IDBFileRequest? flush();
|
||||
[Throws]
|
||||
undefined abort();
|
||||
|
||||
attribute EventHandler oncomplete;
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler onerror;
|
||||
};
|
||||
|
||||
[RustDeprecated] interface IDBFileRequest : DOMRequest {
|
||||
readonly attribute IDBFileHandle? fileHandle;
|
||||
readonly attribute IDBFileHandle? lockedFile;
|
||||
|
||||
attribute EventHandler onprogress;
|
||||
};
|
||||
|
||||
[RustDeprecated] interface IDBLocaleAwareKeyRange : IDBKeyRange {
|
||||
[Throws]
|
||||
static IDBLocaleAwareKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
|
||||
};
|
||||
|
||||
[RustDeprecated] interface IDBMutableFile : EventTarget {
|
||||
readonly attribute DOMString name;
|
||||
readonly attribute DOMString type;
|
||||
|
||||
readonly attribute IDBDatabase database;
|
||||
|
||||
[Throws] IDBFileHandle open(optional FileMode mode = "readonly");
|
||||
|
||||
[Throws] DOMRequest getFile();
|
||||
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler onerror;
|
||||
};
|
52
crates/web-sys/webidls/enabled/IDBCursor.webidl
vendored
52
crates/web-sys/webidls/enabled/IDBCursor.webidl
vendored
@ -1,52 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBCursorDirection
|
||||
*/
|
||||
|
||||
enum IDBCursorDirection {
|
||||
"next",
|
||||
"nextunique",
|
||||
"prev",
|
||||
"prevunique"
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBCursor {
|
||||
readonly attribute (IDBObjectStore or IDBIndex) source;
|
||||
|
||||
[BinaryName="getDirection"]
|
||||
readonly attribute IDBCursorDirection direction;
|
||||
|
||||
[Throws]
|
||||
readonly attribute any key;
|
||||
|
||||
[Throws]
|
||||
readonly attribute any primaryKey;
|
||||
|
||||
readonly attribute IDBRequest request;
|
||||
|
||||
[Throws]
|
||||
IDBRequest update (any value);
|
||||
|
||||
[Throws]
|
||||
undefined advance ([EnforceRange] unsigned long count);
|
||||
|
||||
[Throws]
|
||||
undefined continue (optional any key);
|
||||
|
||||
[Throws]
|
||||
undefined continuePrimaryKey(any key, any primaryKey);
|
||||
|
||||
[Throws]
|
||||
IDBRequest delete ();
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBCursorWithValue : IDBCursor {
|
||||
[Throws]
|
||||
readonly attribute any value;
|
||||
};
|
@ -1,44 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStoreParameters
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBDatabase : EventTarget {
|
||||
readonly attribute DOMString name;
|
||||
readonly attribute unsigned long long version;
|
||||
|
||||
readonly attribute DOMStringList objectStoreNames;
|
||||
|
||||
[Throws]
|
||||
IDBObjectStore createObjectStore (DOMString name, optional IDBObjectStoreParameters optionalParameters = {});
|
||||
|
||||
[Throws]
|
||||
undefined deleteObjectStore (DOMString name);
|
||||
|
||||
[Throws]
|
||||
IDBTransaction transaction ((DOMString or sequence<DOMString>) storeNames,
|
||||
optional IDBTransactionMode mode = "readonly");
|
||||
|
||||
undefined close ();
|
||||
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler onclose;
|
||||
attribute EventHandler onerror;
|
||||
attribute EventHandler onversionchange;
|
||||
};
|
||||
|
||||
partial interface IDBDatabase {
|
||||
[Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"]
|
||||
readonly attribute StorageType storage;
|
||||
|
||||
[Exposed=Window, Throws, Deprecated="IDBDatabaseCreateMutableFile"]
|
||||
IDBRequest createMutableFile (DOMString name, optional DOMString type);
|
||||
};
|
66
crates/web-sys/webidls/enabled/IDBFactory.webidl
vendored
66
crates/web-sys/webidls/enabled/IDBFactory.webidl
vendored
@ -1,66 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBFactory
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
// invalid widl
|
||||
// interface Principal;
|
||||
|
||||
dictionary IDBOpenDBOptions
|
||||
{
|
||||
[EnforceRange] unsigned long long version;
|
||||
StorageType storage;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface that defines the indexedDB property on a window. See
|
||||
* http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBFactory
|
||||
* for more information.
|
||||
*/
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBFactory {
|
||||
[Throws, NeedsCallerType]
|
||||
IDBOpenDBRequest
|
||||
open(DOMString name,
|
||||
[EnforceRange] unsigned long long version);
|
||||
|
||||
[Throws, NeedsCallerType]
|
||||
IDBOpenDBRequest
|
||||
open(DOMString name,
|
||||
optional IDBOpenDBOptions options = {});
|
||||
|
||||
[Throws, NeedsCallerType]
|
||||
IDBOpenDBRequest
|
||||
deleteDatabase(DOMString name,
|
||||
optional IDBOpenDBOptions options = {});
|
||||
|
||||
[Throws]
|
||||
short
|
||||
cmp(any first,
|
||||
any second);
|
||||
|
||||
[Throws, ChromeOnly, NeedsCallerType]
|
||||
IDBOpenDBRequest
|
||||
openForPrincipal(Principal principal,
|
||||
DOMString name,
|
||||
[EnforceRange] unsigned long long version);
|
||||
|
||||
[Throws, ChromeOnly, NeedsCallerType]
|
||||
IDBOpenDBRequest
|
||||
openForPrincipal(Principal principal,
|
||||
DOMString name,
|
||||
optional IDBOpenDBOptions options = {});
|
||||
|
||||
[Throws, ChromeOnly, NeedsCallerType]
|
||||
IDBOpenDBRequest
|
||||
deleteForPrincipal(Principal principal,
|
||||
DOMString name,
|
||||
optional IDBOpenDBOptions options = {});
|
||||
};
|
@ -1,43 +0,0 @@
|
||||
/* 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 obtaone at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
dictionary IDBFileMetadataParameters
|
||||
{
|
||||
boolean size = true;
|
||||
boolean lastModified = true;
|
||||
};
|
||||
|
||||
[Exposed=Window]
|
||||
interface IDBFileHandle : EventTarget
|
||||
{
|
||||
readonly attribute IDBMutableFile? mutableFile;
|
||||
// this is deprecated due to renaming in the spec
|
||||
readonly attribute IDBMutableFile? fileHandle; // now mutableFile
|
||||
readonly attribute FileMode mode;
|
||||
readonly attribute boolean active;
|
||||
attribute unsigned long long? location;
|
||||
|
||||
[Throws]
|
||||
IDBFileRequest? getMetadata(optional IDBFileMetadataParameters parameters = {});
|
||||
[Throws]
|
||||
IDBFileRequest? readAsArrayBuffer(unsigned long long size);
|
||||
[Throws]
|
||||
IDBFileRequest? readAsText(unsigned long long size,
|
||||
optional DOMString? encoding = null);
|
||||
|
||||
[Throws]
|
||||
IDBFileRequest? write((DOMString or ArrayBuffer or ArrayBufferView or Blob) value);
|
||||
[Throws]
|
||||
IDBFileRequest? append((DOMString or ArrayBuffer or ArrayBufferView or Blob) value);
|
||||
[Throws]
|
||||
IDBFileRequest? truncate(optional unsigned long long size);
|
||||
[Throws]
|
||||
IDBFileRequest? flush();
|
||||
[Throws]
|
||||
undefined abort();
|
||||
|
||||
attribute EventHandler oncomplete;
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler onerror;
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* 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 http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
[Exposed=Window]
|
||||
interface IDBFileRequest : DOMRequest {
|
||||
readonly attribute IDBFileHandle? fileHandle;
|
||||
// this is deprecated due to renaming in the spec
|
||||
readonly attribute IDBFileHandle? lockedFile; // now fileHandle
|
||||
|
||||
attribute EventHandler onprogress;
|
||||
};
|
65
crates/web-sys/webidls/enabled/IDBIndex.webidl
vendored
65
crates/web-sys/webidls/enabled/IDBIndex.webidl
vendored
@ -1,65 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBIndexParameters
|
||||
*/
|
||||
|
||||
dictionary IDBIndexParameters {
|
||||
boolean unique = false;
|
||||
boolean multiEntry = false;
|
||||
// <null>: Not locale-aware, uses normal JS sorting.
|
||||
// <string>: Always sorted based on the rules of the specified
|
||||
// locale (e.g. "en-US", etc.).
|
||||
// "auto": Sorted by the platform default, may change based on
|
||||
// user agent options.
|
||||
DOMString? locale = null;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBIndex {
|
||||
[SetterThrows]
|
||||
attribute DOMString name;
|
||||
|
||||
readonly attribute IDBObjectStore objectStore;
|
||||
|
||||
[Throws]
|
||||
readonly attribute any keyPath;
|
||||
|
||||
readonly attribute boolean multiEntry;
|
||||
readonly attribute boolean unique;
|
||||
|
||||
// <null>: Not locale-aware, uses normal JS sorting.
|
||||
// <string>: Sorted based on the rules of the specified locale.
|
||||
// Note: never returns "auto", only the current locale.
|
||||
[Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"]
|
||||
readonly attribute DOMString? locale;
|
||||
|
||||
[Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"]
|
||||
readonly attribute boolean isAutoLocale;
|
||||
|
||||
[Throws]
|
||||
IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next");
|
||||
|
||||
[Throws]
|
||||
IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next");
|
||||
|
||||
[Throws]
|
||||
IDBRequest get (any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest getKey (any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest count (optional any key);
|
||||
};
|
||||
|
||||
partial interface IDBIndex {
|
||||
[Throws]
|
||||
IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit);
|
||||
|
||||
[Throws]
|
||||
IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit);
|
||||
};
|
@ -1,41 +0,0 @@
|
||||
/* 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 http://mozilla.org/MPL/2.0/. */
|
||||
/*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBKeyRange {
|
||||
[Throws]
|
||||
readonly attribute any lower;
|
||||
[Throws]
|
||||
readonly attribute any upper;
|
||||
[Constant]
|
||||
readonly attribute boolean lowerOpen;
|
||||
[Constant]
|
||||
readonly attribute boolean upperOpen;
|
||||
[Throws]
|
||||
boolean _includes(any key);
|
||||
|
||||
|
||||
[NewObject, Throws]
|
||||
static IDBKeyRange only (any value);
|
||||
[NewObject, Throws]
|
||||
static IDBKeyRange lowerBound (any lower, optional boolean open = false);
|
||||
[NewObject, Throws]
|
||||
static IDBKeyRange upperBound (any upper, optional boolean open = false);
|
||||
[NewObject, Throws]
|
||||
static IDBKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"]
|
||||
interface IDBLocaleAwareKeyRange : IDBKeyRange {
|
||||
[NewObject, Throws]
|
||||
static IDBLocaleAwareKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
|
||||
};
|
@ -1,21 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
[Exposed=Window]
|
||||
interface IDBMutableFile : EventTarget {
|
||||
readonly attribute DOMString name;
|
||||
readonly attribute DOMString type;
|
||||
|
||||
readonly attribute IDBDatabase database;
|
||||
|
||||
[Throws, Deprecated="IDBMutableFileOpen"]
|
||||
IDBFileHandle open(optional FileMode mode = "readonly");
|
||||
|
||||
[Throws, UseCounter]
|
||||
DOMRequest getFile();
|
||||
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler onerror;
|
||||
};
|
@ -1,70 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStore
|
||||
*/
|
||||
|
||||
dictionary IDBObjectStoreParameters {
|
||||
(DOMString or sequence<DOMString>)? keyPath = null;
|
||||
boolean autoIncrement = false;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBObjectStore {
|
||||
[SetterThrows]
|
||||
attribute DOMString name;
|
||||
|
||||
[Throws]
|
||||
readonly attribute any keyPath;
|
||||
|
||||
readonly attribute DOMStringList indexNames;
|
||||
readonly attribute IDBTransaction transaction;
|
||||
readonly attribute boolean autoIncrement;
|
||||
|
||||
[Throws]
|
||||
IDBRequest put (any value, optional any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest add (any value, optional any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest delete (any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest get (any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest getKey (any key);
|
||||
|
||||
[Throws]
|
||||
IDBRequest clear ();
|
||||
|
||||
[Throws]
|
||||
IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next");
|
||||
|
||||
[Throws]
|
||||
IDBIndex createIndex (DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters optionalParameters = {});
|
||||
|
||||
[Throws]
|
||||
IDBIndex index (DOMString name);
|
||||
|
||||
[Throws]
|
||||
undefined deleteIndex (DOMString indexName);
|
||||
|
||||
[Throws]
|
||||
IDBRequest count (optional any key);
|
||||
};
|
||||
|
||||
partial interface IDBObjectStore {
|
||||
[Throws]
|
||||
IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit);
|
||||
|
||||
[Throws]
|
||||
IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit);
|
||||
|
||||
[Throws]
|
||||
IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next");
|
||||
};
|
@ -1,15 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBOpenDBRequest
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBOpenDBRequest : IDBRequest {
|
||||
attribute EventHandler onblocked;
|
||||
|
||||
attribute EventHandler onupgradeneeded;
|
||||
};
|
31
crates/web-sys/webidls/enabled/IDBRequest.webidl
vendored
31
crates/web-sys/webidls/enabled/IDBRequest.webidl
vendored
@ -1,31 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBRequest
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBRequestReadyState
|
||||
*/
|
||||
|
||||
enum IDBRequestReadyState {
|
||||
"pending",
|
||||
"done"
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBRequest : EventTarget {
|
||||
[Throws]
|
||||
readonly attribute any result;
|
||||
|
||||
[Throws]
|
||||
readonly attribute DOMException? error;
|
||||
|
||||
readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source;
|
||||
readonly attribute IDBTransaction? transaction;
|
||||
readonly attribute IDBRequestReadyState readyState;
|
||||
|
||||
attribute EventHandler onsuccess;
|
||||
|
||||
attribute EventHandler onerror;
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransaction
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransactionMode
|
||||
*/
|
||||
|
||||
enum IDBTransactionMode {
|
||||
"readonly",
|
||||
"readwrite",
|
||||
// The "readwriteflush" mode is only available when the
|
||||
// |IndexedDatabaseManager::ExperimentalFeaturesEnabled()| function returns
|
||||
// true. This mode is not yet part of the standard.
|
||||
"readwriteflush",
|
||||
"cleanup",
|
||||
"versionchange"
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBTransaction : EventTarget {
|
||||
[Throws]
|
||||
readonly attribute IDBTransactionMode mode;
|
||||
readonly attribute IDBDatabase db;
|
||||
|
||||
readonly attribute DOMException? error;
|
||||
|
||||
[Throws]
|
||||
IDBObjectStore objectStore (DOMString name);
|
||||
|
||||
[Throws]
|
||||
undefined commit();
|
||||
|
||||
[Throws]
|
||||
undefined abort();
|
||||
|
||||
attribute EventHandler onabort;
|
||||
attribute EventHandler oncomplete;
|
||||
attribute EventHandler onerror;
|
||||
};
|
||||
|
||||
// This seems to be custom
|
||||
partial interface IDBTransaction {
|
||||
readonly attribute DOMStringList objectStoreNames;
|
||||
};
|
@ -1,25 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBVersionChangeEvent
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
dictionary IDBVersionChangeEventInit : EventInit {
|
||||
unsigned long long oldVersion = 0;
|
||||
unsigned long long? newVersion = null;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface IDBVersionChangeEvent : Event {
|
||||
constructor(DOMString type,
|
||||
optional IDBVersionChangeEventInit eventInitDict = {});
|
||||
|
||||
readonly attribute unsigned long long oldVersion;
|
||||
readonly attribute unsigned long long? newVersion;
|
||||
};
|
@ -56,13 +56,6 @@ partial interface mixin WindowOrWorkerGlobalScope {
|
||||
readonly attribute boolean isSecureContext;
|
||||
};
|
||||
|
||||
// http://w3c.github.io/IndexedDB/#factory-interface
|
||||
partial interface mixin WindowOrWorkerGlobalScope {
|
||||
// readonly attribute IDBFactory indexedDB;
|
||||
[Throws]
|
||||
readonly attribute IDBFactory? indexedDB;
|
||||
};
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#self-caches
|
||||
partial interface mixin WindowOrWorkerGlobalScope {
|
||||
[Throws, Func="mozilla::dom::DOMPrefs::DOMCachesEnabled", SameObject]
|
||||
|
13
crates/web-sys/webidls/unstable/IDB.webidl
vendored
Normal file
13
crates/web-sys/webidls/unstable/IDB.webidl
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// https://www.w3.org/TR/2023/WD-IndexedDB-3-20231212/
|
||||
|
||||
interface mixin IDBDatabase {
|
||||
[Throws, NewObject] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames,
|
||||
optional IDBTransactionMode mode = "readonly",
|
||||
optional IDBTransactionOptions options = {});
|
||||
};
|
||||
|
||||
enum IDBTransactionDurability { "default", "strict", "relaxed" };
|
||||
|
||||
dictionary IDBTransactionOptions {
|
||||
IDBTransactionDurability durability = "default";
|
||||
};
|
@ -20,7 +20,7 @@ heck = "0.3"
|
||||
log = "0.4.1"
|
||||
proc-macro2 = "1.0"
|
||||
quote = '1.0'
|
||||
syn = { version = '2.0', features = ['full'] }
|
||||
syn = { version = '2.0', features = ['extra-traits', 'full'] }
|
||||
wasm-bindgen-backend = { version = "=0.2.92", path = "../backend" }
|
||||
weedle = { git = "https://github.com/rustwasm/weedle.git" }
|
||||
once_cell = "1.12"
|
||||
|
@ -165,6 +165,71 @@ pub(crate) static FIXED_INTERFACES: Lazy<
|
||||
),
|
||||
]),
|
||||
),
|
||||
(
|
||||
"IdbFactory",
|
||||
BTreeMap::from_iter([("open_with_options", "open_with_idb_open_db_options")]),
|
||||
),
|
||||
(
|
||||
"IdbDatabase",
|
||||
BTreeMap::from_iter([(
|
||||
"create_object_store_with_options",
|
||||
"create_object_store_with_optional_parameters",
|
||||
)]),
|
||||
),
|
||||
(
|
||||
"IdbObjectStore",
|
||||
BTreeMap::from_iter([
|
||||
("count_with_query", "count_with_key"),
|
||||
(
|
||||
"create_index_with_str_and_options",
|
||||
"create_index_with_str_and_optional_parameters",
|
||||
),
|
||||
(
|
||||
"create_index_with_str_sequence_and_options",
|
||||
"create_index_with_str_sequence_and_optional_parameters",
|
||||
),
|
||||
("open_cursor_with_query", "open_cursor_with_range"),
|
||||
(
|
||||
"open_cursor_with_query_and_direction",
|
||||
"open_cursor_with_range_and_direction",
|
||||
),
|
||||
("open_key_cursor_with_query", "open_key_cursor_with_range"),
|
||||
(
|
||||
"open_key_cursor_with_query_and_direction",
|
||||
"open_key_cursor_with_range_and_direction",
|
||||
),
|
||||
("get_all_with_query", "get_all_with_key"),
|
||||
("get_all_with_query_and_count", "get_all_with_key_and_limit"),
|
||||
("get_all_keys_with_query", "get_all_keys_with_key"),
|
||||
(
|
||||
"get_all_keys_with_query_and_count",
|
||||
"get_all_keys_with_key_and_limit",
|
||||
),
|
||||
]),
|
||||
),
|
||||
(
|
||||
"IdbIndex",
|
||||
BTreeMap::from_iter([
|
||||
("count_with_query", "count_with_key"),
|
||||
("open_cursor_with_query", "open_cursor_with_range"),
|
||||
(
|
||||
"open_cursor_with_query_and_direction",
|
||||
"open_cursor_with_range_and_direction",
|
||||
),
|
||||
("open_key_cursor_with_query", "open_key_cursor_with_range"),
|
||||
(
|
||||
"open_key_cursor_with_query_and_direction",
|
||||
"open_key_cursor_with_range_and_direction",
|
||||
),
|
||||
("get_all_with_query", "get_all_with_key"),
|
||||
("get_all_with_query_and_count", "get_all_with_key_and_limit"),
|
||||
("get_all_keys_with_query", "get_all_keys_with_key"),
|
||||
(
|
||||
"get_all_keys_with_query_and_count",
|
||||
"get_all_keys_with_key_and_limit",
|
||||
),
|
||||
]),
|
||||
),
|
||||
])
|
||||
});
|
||||
|
||||
|
@ -8,6 +8,7 @@ use wasm_bindgen_backend::util::leading_colon_path_ty;
|
||||
use wasm_bindgen_backend::util::{raw_ident, rust_ident};
|
||||
|
||||
use crate::constants::{BUILTIN_IDENTS, POLYFILL_INTERFACES};
|
||||
use crate::idl_type::IdlType;
|
||||
use crate::traverse::TraverseType;
|
||||
use crate::util::shared_ref;
|
||||
use crate::util::{get_cfg_features, mdn_doc, required_doc_string, snake_case_ident};
|
||||
@ -63,11 +64,14 @@ fn maybe_unstable_docs(unstable: bool) -> Option<proc_macro2::TokenStream> {
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_arguments(arguments: &[(Ident, Type)], variadic: bool) -> Vec<TokenStream> {
|
||||
fn generate_arguments(
|
||||
arguments: &[(Ident, IdlType<'_>, Type)],
|
||||
variadic: bool,
|
||||
) -> Vec<TokenStream> {
|
||||
arguments
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, (name, ty))| {
|
||||
.map(|(i, (name, _, ty))| {
|
||||
if variadic && i + 1 == arguments.len() {
|
||||
quote!( #name: &::js_sys::Array )
|
||||
} else {
|
||||
@ -194,6 +198,7 @@ impl Const {
|
||||
options: &Options,
|
||||
parent_name: &Ident,
|
||||
parent_js_name: &str,
|
||||
deprecated: &Option<Option<String>>,
|
||||
) -> TokenStream {
|
||||
let name = &self.name;
|
||||
let ty = &self.ty;
|
||||
@ -209,10 +214,16 @@ impl Const {
|
||||
&get_features_doc(options, parent_name.to_string()),
|
||||
);
|
||||
|
||||
let deprecated = deprecated.as_ref().map(|msg| match msg {
|
||||
Some(msg) => quote!( #[deprecated(note = #msg)] ),
|
||||
None => quote!( #[deprecated] ),
|
||||
});
|
||||
|
||||
quote! {
|
||||
#unstable_attr
|
||||
#doc_comment
|
||||
#unstable_docs
|
||||
#deprecated
|
||||
pub const #name: #ty = #value as #ty;
|
||||
}
|
||||
}
|
||||
@ -241,6 +252,7 @@ impl InterfaceAttribute {
|
||||
parent_name: &Ident,
|
||||
parent_js_name: &str,
|
||||
parents: &[Ident],
|
||||
parent_deprecated: &Option<Option<String>>,
|
||||
) -> TokenStream {
|
||||
let InterfaceAttribute {
|
||||
js_name,
|
||||
@ -321,10 +333,13 @@ impl InterfaceAttribute {
|
||||
};
|
||||
|
||||
let catch = if *catch { Some(quote!(catch,)) } else { None };
|
||||
let deprecated = deprecated.as_ref().map(|msg| match msg {
|
||||
Some(msg) => quote!( #[deprecated(note = #msg)] ),
|
||||
None => quote!( #[deprecated] ),
|
||||
});
|
||||
let deprecated = deprecated
|
||||
.as_ref()
|
||||
.or(parent_deprecated.as_ref())
|
||||
.map(|msg| match msg {
|
||||
Some(msg) => quote!( #[deprecated(note = #msg)] ),
|
||||
None => quote!( #[deprecated] ),
|
||||
});
|
||||
|
||||
let doc_comment = comment(
|
||||
format!(
|
||||
@ -364,11 +379,12 @@ pub enum InterfaceMethodKind {
|
||||
IndexingDeleter,
|
||||
}
|
||||
|
||||
pub struct InterfaceMethod {
|
||||
pub struct InterfaceMethod<'a> {
|
||||
pub name: Ident,
|
||||
pub js_name: String,
|
||||
pub deprecated: Option<Option<String>>,
|
||||
pub arguments: Vec<(Ident, Type)>,
|
||||
pub arguments: Vec<(Ident, IdlType<'a>, Type)>,
|
||||
pub variadic_type: Option<IdlType<'a>>,
|
||||
pub ret_ty: Option<Type>,
|
||||
pub kind: InterfaceMethodKind,
|
||||
pub is_static: bool,
|
||||
@ -378,19 +394,21 @@ pub struct InterfaceMethod {
|
||||
pub unstable: bool,
|
||||
}
|
||||
|
||||
impl InterfaceMethod {
|
||||
impl InterfaceMethod<'_> {
|
||||
fn generate(
|
||||
&self,
|
||||
options: &Options,
|
||||
parent_name: &Ident,
|
||||
parent_js_name: String,
|
||||
parents: &[Ident],
|
||||
parent_deprecated: &Option<Option<String>>,
|
||||
) -> TokenStream {
|
||||
let InterfaceMethod {
|
||||
name,
|
||||
js_name,
|
||||
deprecated,
|
||||
arguments,
|
||||
variadic_type: _,
|
||||
ret_ty,
|
||||
kind,
|
||||
is_static,
|
||||
@ -452,7 +470,7 @@ impl InterfaceMethod {
|
||||
|
||||
let mut features = BTreeSet::new();
|
||||
|
||||
for (_, ty) in arguments.iter() {
|
||||
for (_, _, ty) in arguments.iter() {
|
||||
add_features(&mut features, ty);
|
||||
}
|
||||
|
||||
@ -472,10 +490,13 @@ impl InterfaceMethod {
|
||||
|
||||
let doc_comment = comment(doc_comment, &required_doc_string(options, &features));
|
||||
|
||||
let deprecated = deprecated.as_ref().map(|msg| match msg {
|
||||
Some(msg) => quote!( #[deprecated(note = #msg)] ),
|
||||
None => quote!( #[deprecated] ),
|
||||
});
|
||||
let deprecated = deprecated
|
||||
.as_ref()
|
||||
.or(parent_deprecated.as_ref())
|
||||
.map(|msg| match msg {
|
||||
Some(msg) => quote!( #[deprecated(note = #msg)] ),
|
||||
None => quote!( #[deprecated] ),
|
||||
});
|
||||
|
||||
let ret = ret_ty.as_ref().map(|ret| quote!( #ret ));
|
||||
|
||||
@ -529,7 +550,7 @@ impl InterfaceMethod {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Interface {
|
||||
pub struct Interface<'a> {
|
||||
pub name: Ident,
|
||||
pub js_name: String,
|
||||
pub deprecated: Option<Option<String>>,
|
||||
@ -537,11 +558,11 @@ pub struct Interface {
|
||||
pub parents: Vec<Ident>,
|
||||
pub consts: Vec<Const>,
|
||||
pub attributes: Vec<InterfaceAttribute>,
|
||||
pub methods: Vec<InterfaceMethod>,
|
||||
pub methods: Vec<InterfaceMethod<'a>>,
|
||||
pub unstable: bool,
|
||||
}
|
||||
|
||||
impl Interface {
|
||||
impl Interface<'_> {
|
||||
pub fn generate(&self, options: &Options) -> TokenStream {
|
||||
let Interface {
|
||||
name,
|
||||
@ -563,11 +584,6 @@ impl Interface {
|
||||
&get_features_doc(options, name.to_string()),
|
||||
);
|
||||
|
||||
let deprecated = deprecated.as_ref().map(|msg| match msg {
|
||||
Some(msg) => quote!( #[deprecated(note = #msg)] ),
|
||||
None => quote!( #[deprecated] ),
|
||||
});
|
||||
|
||||
let is_type_of = if *has_interface {
|
||||
None
|
||||
} else {
|
||||
@ -587,7 +603,7 @@ impl Interface {
|
||||
|
||||
let consts = consts
|
||||
.iter()
|
||||
.map(|x| x.generate(options, name, js_name))
|
||||
.map(|x| x.generate(options, name, js_name, deprecated))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let consts = if consts.is_empty() {
|
||||
@ -596,21 +612,25 @@ impl Interface {
|
||||
Some(quote! {
|
||||
#unstable_attr
|
||||
impl #name {
|
||||
#(#deprecated #consts)*
|
||||
#(#consts)*
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
let attributes = attributes
|
||||
.iter()
|
||||
.map(|x| x.generate(options, name, js_name, parents))
|
||||
.map(|x| x.generate(options, name, js_name, parents, deprecated))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let methods = methods
|
||||
.iter()
|
||||
.map(|x| x.generate(options, name, js_name.to_string(), parents))
|
||||
.map(|x| x.generate(options, name, js_name.to_string(), parents, deprecated))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let deprecated = deprecated.as_ref().map(|msg| match msg {
|
||||
Some(msg) => quote!( #[deprecated(note = #msg)] ),
|
||||
None => quote!( #[deprecated] ),
|
||||
});
|
||||
let js_ident = raw_ident(js_name);
|
||||
|
||||
quote! {
|
||||
@ -636,8 +656,8 @@ impl Interface {
|
||||
#deprecated
|
||||
pub type #name;
|
||||
|
||||
#(#deprecated #attributes)*
|
||||
#(#deprecated #methods)*
|
||||
#(#attributes)*
|
||||
#(#methods)*
|
||||
}
|
||||
|
||||
#consts
|
||||
@ -781,6 +801,7 @@ pub struct Dictionary {
|
||||
pub js_name: String,
|
||||
pub fields: Vec<DictionaryField>,
|
||||
pub unstable: bool,
|
||||
pub deprecated: Option<Option<String>>,
|
||||
}
|
||||
|
||||
impl Dictionary {
|
||||
@ -790,10 +811,15 @@ impl Dictionary {
|
||||
js_name,
|
||||
fields,
|
||||
unstable,
|
||||
deprecated,
|
||||
} = self;
|
||||
|
||||
let unstable_attr = maybe_unstable_attr(*unstable);
|
||||
let unstable_docs = maybe_unstable_docs(*unstable);
|
||||
let deprecated = deprecated.as_ref().map(|msg| match msg {
|
||||
Some(msg) => quote!( #[deprecated(note = #msg)] ),
|
||||
None => quote!( #[deprecated] ),
|
||||
});
|
||||
|
||||
let js_name = raw_ident(js_name);
|
||||
|
||||
@ -859,6 +885,7 @@ impl Dictionary {
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#doc_comment
|
||||
#unstable_docs
|
||||
#deprecated
|
||||
pub type #name;
|
||||
|
||||
#(#field_shims)*
|
||||
@ -869,6 +896,7 @@ impl Dictionary {
|
||||
#cfg_features
|
||||
#ctor_doc_comment
|
||||
#unstable_docs
|
||||
#deprecated
|
||||
pub fn new(#(#required_args),*) -> Self {
|
||||
#[allow(unused_mut)]
|
||||
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
|
||||
@ -897,17 +925,17 @@ impl Dictionary {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Function {
|
||||
pub struct Function<'a> {
|
||||
pub name: Ident,
|
||||
pub js_name: String,
|
||||
pub arguments: Vec<(Ident, Type)>,
|
||||
pub arguments: Vec<(Ident, IdlType<'a>, Type)>,
|
||||
pub ret_ty: Option<Type>,
|
||||
pub catch: bool,
|
||||
pub variadic: bool,
|
||||
pub unstable: bool,
|
||||
}
|
||||
|
||||
impl Function {
|
||||
impl Function<'_> {
|
||||
fn generate(
|
||||
&self,
|
||||
options: &Options,
|
||||
@ -938,7 +966,7 @@ impl Function {
|
||||
|
||||
let mut features = BTreeSet::new();
|
||||
|
||||
for (_, ty) in arguments.iter() {
|
||||
for (_, _, ty) in arguments.iter() {
|
||||
add_features(&mut features, ty);
|
||||
}
|
||||
|
||||
@ -988,15 +1016,15 @@ impl Function {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Namespace {
|
||||
pub struct Namespace<'a> {
|
||||
pub name: Ident,
|
||||
pub js_name: String,
|
||||
pub consts: Vec<Const>,
|
||||
pub functions: Vec<Function>,
|
||||
pub functions: Vec<Function<'a>>,
|
||||
pub unstable: bool,
|
||||
}
|
||||
|
||||
impl Namespace {
|
||||
impl Namespace<'_> {
|
||||
pub fn generate(&self, options: &Options) -> TokenStream {
|
||||
let Namespace {
|
||||
name,
|
||||
@ -1027,7 +1055,7 @@ impl Namespace {
|
||||
|
||||
let consts = consts
|
||||
.iter()
|
||||
.map(|x| x.generate(options, name, js_name))
|
||||
.map(|x| x.generate(options, name, js_name, &None))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
quote! {
|
||||
|
@ -1,3 +1,5 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use proc_macro2::{Ident, Span};
|
||||
use wasm_bindgen_backend::util::{ident_ty, leading_colon_path_ty, raw_ident, rust_ident};
|
||||
use weedle::attribute::{ExtendedAttribute, ExtendedAttributeList};
|
||||
@ -29,9 +31,6 @@ pub(crate) enum IdlType<'a> {
|
||||
Object,
|
||||
Symbol,
|
||||
Error,
|
||||
Callback,
|
||||
Iterator,
|
||||
AsyncIterator,
|
||||
|
||||
ArrayBuffer,
|
||||
DataView,
|
||||
@ -69,14 +68,6 @@ pub(crate) enum IdlType<'a> {
|
||||
immutable: bool,
|
||||
},
|
||||
|
||||
Interface(&'a str),
|
||||
Dictionary(&'a str),
|
||||
Enum(&'a str),
|
||||
CallbackInterface {
|
||||
name: &'a str,
|
||||
single_function: bool,
|
||||
},
|
||||
|
||||
Nullable(Box<IdlType<'a>>),
|
||||
FrozenArray(Box<IdlType<'a>>),
|
||||
Sequence(Box<IdlType<'a>>),
|
||||
@ -87,7 +78,28 @@ pub(crate) enum IdlType<'a> {
|
||||
Any,
|
||||
Undefined,
|
||||
|
||||
UnknownInterface(&'a str),
|
||||
UnknownIdentifier(&'a str),
|
||||
|
||||
Identifier {
|
||||
name: &'a str,
|
||||
ty: IdentifierType<'a>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Debug)]
|
||||
pub(crate) enum IdentifierType<'a> {
|
||||
Callback,
|
||||
Iterator,
|
||||
AsyncIterator,
|
||||
Interface(&'a str),
|
||||
Dictionary(&'a str),
|
||||
Enum(&'a str),
|
||||
CallbackInterface {
|
||||
name: &'a str,
|
||||
single_function: bool,
|
||||
},
|
||||
// DOMTimeStamp
|
||||
UnsignedLongLong,
|
||||
}
|
||||
|
||||
pub(crate) trait ToIdlType<'a> {
|
||||
@ -321,25 +333,25 @@ impl<'a> ToIdlType<'a> for AttributedNonAnyType<'a> {
|
||||
|
||||
impl<'a> ToIdlType<'a> for Identifier<'a> {
|
||||
fn to_idl_type(&self, record: &FirstPassRecord<'a>) -> IdlType<'a> {
|
||||
if self.0 == "DOMTimeStamp" {
|
||||
let ty = if self.0 == "DOMTimeStamp" {
|
||||
// https://heycam.github.io/webidl/#DOMTimeStamp
|
||||
IdlType::UnsignedLongLong
|
||||
IdentifierType::UnsignedLongLong
|
||||
} else if let Some(idl_type) = record.typedefs.get(&self.0) {
|
||||
idl_type.to_idl_type(record)
|
||||
return idl_type.to_idl_type(record);
|
||||
} else if record.interfaces.contains_key(self.0) {
|
||||
IdlType::Interface(self.0)
|
||||
IdentifierType::Interface(self.0)
|
||||
} else if record.dictionaries.contains_key(self.0) {
|
||||
IdlType::Dictionary(self.0)
|
||||
IdentifierType::Dictionary(self.0)
|
||||
} else if record.enums.contains_key(self.0) {
|
||||
IdlType::Enum(self.0)
|
||||
IdentifierType::Enum(self.0)
|
||||
} else if record.callbacks.contains(self.0) {
|
||||
IdlType::Callback
|
||||
IdentifierType::Callback
|
||||
} else if record.iterators.contains(self.0) {
|
||||
IdlType::Iterator
|
||||
IdentifierType::Iterator
|
||||
} else if record.async_iterators.contains(self.0) {
|
||||
IdlType::AsyncIterator
|
||||
IdentifierType::AsyncIterator
|
||||
} else if let Some(data) = record.callback_interfaces.get(self.0) {
|
||||
IdlType::CallbackInterface {
|
||||
IdentifierType::CallbackInterface {
|
||||
name: self.0,
|
||||
single_function: data.single_function,
|
||||
}
|
||||
@ -350,11 +362,13 @@ impl<'a> ToIdlType<'a> for Identifier<'a> {
|
||||
//
|
||||
// namely this seems to be "legalese" for "this is a `Window`", so
|
||||
// let's translate it as such.
|
||||
IdlType::Interface("Window")
|
||||
IdentifierType::Interface("Window")
|
||||
} else {
|
||||
log::warn!("Unrecognized type: {}", self.0);
|
||||
IdlType::UnknownInterface(self.0)
|
||||
}
|
||||
return IdlType::UnknownIdentifier(self.0);
|
||||
};
|
||||
|
||||
IdlType::id(self.0, ty)
|
||||
}
|
||||
}
|
||||
|
||||
@ -421,6 +435,10 @@ pub enum TypeError {
|
||||
}
|
||||
|
||||
impl<'a> IdlType<'a> {
|
||||
fn id(name: &'a str, ty: IdentifierType<'a>) -> Self {
|
||||
IdlType::Identifier { name, ty }
|
||||
}
|
||||
|
||||
/// Generates a snake case type name.
|
||||
pub(crate) fn push_snake_case_name(&self, dst: &mut String) {
|
||||
match self {
|
||||
@ -439,9 +457,6 @@ impl<'a> IdlType<'a> {
|
||||
IdlType::Object => dst.push_str("object"),
|
||||
IdlType::Symbol => dst.push_str("symbol"),
|
||||
IdlType::Error => dst.push_str("error"),
|
||||
IdlType::Callback => dst.push_str("callback"),
|
||||
IdlType::Iterator => dst.push_str("iterator"),
|
||||
IdlType::AsyncIterator => dst.push_str("async_iterator"),
|
||||
|
||||
IdlType::ArrayBuffer => dst.push_str("array_buffer"),
|
||||
IdlType::DataView => dst.push_str("data_view"),
|
||||
@ -457,11 +472,7 @@ impl<'a> IdlType<'a> {
|
||||
IdlType::ArrayBufferView { .. } => dst.push_str("array_buffer_view"),
|
||||
IdlType::BufferSource { .. } => dst.push_str("buffer_source"),
|
||||
|
||||
IdlType::Interface(name) => dst.push_str(&snake_case_ident(name)),
|
||||
IdlType::UnknownInterface(name) => dst.push_str(&snake_case_ident(name)),
|
||||
IdlType::Dictionary(name) => dst.push_str(&snake_case_ident(name)),
|
||||
IdlType::Enum(name) => dst.push_str(&snake_case_ident(name)),
|
||||
IdlType::CallbackInterface { name, .. } => dst.push_str(&snake_case_ident(name)),
|
||||
IdlType::UnknownIdentifier(name) => dst.push_str(&snake_case_ident(name)),
|
||||
|
||||
IdlType::Nullable(idl_type) => {
|
||||
dst.push_str("opt_");
|
||||
@ -500,6 +511,21 @@ impl<'a> IdlType<'a> {
|
||||
|
||||
IdlType::Any => dst.push_str("any"),
|
||||
IdlType::Undefined => dst.push_str("undefined"),
|
||||
|
||||
IdlType::Identifier { ty, .. } => match ty {
|
||||
IdentifierType::Callback => dst.push_str("callback"),
|
||||
IdentifierType::Iterator => dst.push_str("iterator"),
|
||||
IdentifierType::AsyncIterator => dst.push_str("async_iterator"),
|
||||
IdentifierType::Interface(name) => dst.push_str(&snake_case_ident(name)),
|
||||
IdentifierType::Dictionary(name) => dst.push_str(&snake_case_ident(name)),
|
||||
IdentifierType::Enum(name) => dst.push_str(&snake_case_ident(name)),
|
||||
IdentifierType::CallbackInterface { name, .. } => {
|
||||
dst.push_str(&snake_case_ident(name))
|
||||
}
|
||||
IdentifierType::UnsignedLongLong => {
|
||||
IdlType::UnsignedLongLong.push_snake_case_name(dst)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -570,13 +596,6 @@ impl<'a> IdlType<'a> {
|
||||
IdlType::Float64Array { immutable } => Ok(Some(array("f64", pos, *immutable))),
|
||||
|
||||
IdlType::ArrayBufferView { .. } | IdlType::BufferSource { .. } => Ok(js_sys("Object")),
|
||||
IdlType::Interface(name)
|
||||
| IdlType::Dictionary(name)
|
||||
| IdlType::CallbackInterface { name, .. } => {
|
||||
let ty = ident_ty(rust_ident(camel_case_ident(name).as_str()));
|
||||
Ok(externref(ty))
|
||||
}
|
||||
IdlType::Enum(name) => Ok(Some(ident_ty(rust_ident(camel_case_ident(name).as_str())))),
|
||||
|
||||
IdlType::Nullable(idl_type) => {
|
||||
let inner = idl_type.to_syn_type(pos)?;
|
||||
@ -640,10 +659,15 @@ impl<'a> IdlType<'a> {
|
||||
// Such an enum, however, might have a relatively high
|
||||
// overhead in creating it from a JS value, but would be
|
||||
// cheap to convert from a variant back to a JS value.
|
||||
if idl_types
|
||||
.iter()
|
||||
.all(|idl_type| matches!(idl_type, IdlType::Interface(..)))
|
||||
{
|
||||
if idl_types.iter().all(|idl_type| {
|
||||
matches!(
|
||||
idl_type,
|
||||
IdlType::Identifier {
|
||||
ty: IdentifierType::Interface(..),
|
||||
..
|
||||
}
|
||||
)
|
||||
}) {
|
||||
IdlType::Object.to_syn_type(pos)
|
||||
} else {
|
||||
IdlType::Any.to_syn_type(pos)
|
||||
@ -652,10 +676,8 @@ impl<'a> IdlType<'a> {
|
||||
|
||||
IdlType::Any => Ok(js_value),
|
||||
IdlType::Undefined => Ok(None),
|
||||
IdlType::Callback => Ok(js_sys("Function")),
|
||||
IdlType::Iterator => Ok(js_sys("Iterator")),
|
||||
IdlType::AsyncIterator => Ok(js_sys("AsyncIterator")),
|
||||
IdlType::UnknownInterface(_) => Err(TypeError::CannotConvert),
|
||||
IdlType::Identifier { ty, .. } => ty.to_syn_type(pos),
|
||||
IdlType::UnknownIdentifier(_) => Err(TypeError::CannotConvert),
|
||||
}
|
||||
}
|
||||
|
||||
@ -739,9 +761,13 @@ impl<'a> IdlType<'a> {
|
||||
],
|
||||
IdlType::LongLong => vec![IdlType::Long, IdlType::Double],
|
||||
IdlType::UnsignedLongLong => vec![IdlType::UnsignedLong, IdlType::Double],
|
||||
IdlType::CallbackInterface {
|
||||
name,
|
||||
single_function: true,
|
||||
IdlType::Identifier {
|
||||
name: identifier,
|
||||
ty:
|
||||
IdentifierType::CallbackInterface {
|
||||
name,
|
||||
single_function: true,
|
||||
},
|
||||
} => {
|
||||
// According to the webidl spec [1] single-function callback
|
||||
// interfaces can also be replaced in arguments with simply a
|
||||
@ -749,44 +775,94 @@ impl<'a> IdlType<'a> {
|
||||
//
|
||||
// [1]: https://heycam.github.io/webidl/#es-user-objects
|
||||
vec![
|
||||
IdlType::Callback,
|
||||
IdlType::CallbackInterface {
|
||||
name,
|
||||
single_function: false,
|
||||
},
|
||||
IdlType::id(identifier, IdentifierType::Callback),
|
||||
IdlType::id(
|
||||
identifier,
|
||||
IdentifierType::CallbackInterface {
|
||||
name,
|
||||
single_function: false,
|
||||
},
|
||||
),
|
||||
]
|
||||
}
|
||||
idl_type => vec![idl_type.clone()],
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn orig(&self) -> Cow<'_, Self> {
|
||||
if let Self::Identifier { name, .. } = self {
|
||||
Cow::Owned(Self::UnknownIdentifier(name))
|
||||
} else {
|
||||
Cow::Borrowed(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> IdentifierType<'a> {
|
||||
/// Converts to syn type if possible.
|
||||
pub(crate) fn to_syn_type(&self, pos: TypePosition) -> Result<Option<syn::Type>, TypeError> {
|
||||
let externref = |ty| {
|
||||
Some(match pos {
|
||||
TypePosition::Argument => shared_ref(ty, false),
|
||||
TypePosition::Return => ty,
|
||||
})
|
||||
};
|
||||
let js_sys = |name: &str| {
|
||||
let path = vec![rust_ident("js_sys"), rust_ident(name)];
|
||||
let ty = leading_colon_path_ty(path);
|
||||
externref(ty)
|
||||
};
|
||||
match self {
|
||||
IdentifierType::Callback => Ok(js_sys("Function")),
|
||||
IdentifierType::Iterator => Ok(js_sys("Iterator")),
|
||||
IdentifierType::AsyncIterator => Ok(js_sys("AsyncIterator")),
|
||||
IdentifierType::Interface(name)
|
||||
| IdentifierType::Dictionary(name)
|
||||
| IdentifierType::CallbackInterface { name, .. } => {
|
||||
let ty = ident_ty(rust_ident(camel_case_ident(name).as_str()));
|
||||
Ok(externref(ty))
|
||||
}
|
||||
IdentifierType::Enum(name) => {
|
||||
Ok(Some(ident_ty(rust_ident(camel_case_ident(name).as_str()))))
|
||||
}
|
||||
IdentifierType::UnsignedLongLong => IdlType::UnsignedLongLong.to_syn_type(pos),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn idl_type_flatten_test() {
|
||||
use self::IdentifierType::*;
|
||||
use self::IdlType::*;
|
||||
|
||||
assert_eq!(
|
||||
Union(vec![
|
||||
Interface("Node"),
|
||||
Union(vec![Sequence(Box::new(Long),), Interface("Event"),]),
|
||||
IdlType::id("Node", Interface("Node")),
|
||||
Union(vec![
|
||||
Sequence(Box::new(Long),),
|
||||
IdlType::id("Event", Interface("Event"))
|
||||
]),
|
||||
Nullable(Box::new(Union(vec![
|
||||
Interface("XMLHttpRequest"),
|
||||
IdlType::id("XMLHttpRequest", Interface("XMLHttpRequest")),
|
||||
DomString,
|
||||
])),),
|
||||
Sequence(Box::new(Union(vec![
|
||||
Sequence(Box::new(Double),),
|
||||
Interface("NodeList"),
|
||||
IdlType::id("NodeList", Interface("NodeList")),
|
||||
])),),
|
||||
])
|
||||
.flatten(None),
|
||||
vec![
|
||||
Interface("Node"),
|
||||
IdlType::id("Node", Interface("Node")),
|
||||
Sequence(Box::new(Long)),
|
||||
Interface("Event"),
|
||||
Nullable(Box::new(Interface("XMLHttpRequest"))),
|
||||
IdlType::id("Event", Interface("Event")),
|
||||
Nullable(Box::new(IdlType::id(
|
||||
"XMLHttpRequest",
|
||||
Interface("XMLHttpRequest")
|
||||
))),
|
||||
Nullable(Box::new(DomString)),
|
||||
Sequence(Box::new(Sequence(Box::new(Double)))),
|
||||
Sequence(Box::new(Interface("NodeList"))),
|
||||
Sequence(Box::new(IdlType::id("NodeList", Interface("NodeList")))),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ use crate::util::{
|
||||
};
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use idl_type::IdlType;
|
||||
use idl_type::{IdentifierType, IdlType};
|
||||
use proc_macro2::{Ident, TokenStream};
|
||||
use quote::ToTokens;
|
||||
use sourcefile::SourceFile;
|
||||
@ -298,7 +298,17 @@ impl<'src> FirstPassRecord<'src> {
|
||||
|
||||
let mut fields = Vec::new();
|
||||
|
||||
if !self.append_dictionary_members(&js_name, &mut fields, unstable, unstable_types) {
|
||||
let deprecated = data
|
||||
.definition
|
||||
.and_then(|d| get_rust_deprecated(&d.attributes));
|
||||
|
||||
if !self.append_dictionary_members(
|
||||
&js_name,
|
||||
&mut fields,
|
||||
unstable,
|
||||
unstable_types,
|
||||
&deprecated,
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -307,6 +317,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
js_name,
|
||||
fields,
|
||||
unstable,
|
||||
deprecated,
|
||||
}
|
||||
.generate(options)
|
||||
.to_tokens(&mut program.tokens);
|
||||
@ -318,6 +329,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
dst: &mut Vec<DictionaryField>,
|
||||
unstable: bool,
|
||||
unstable_types: &HashSet<Identifier>,
|
||||
parent_deprecated: &Option<Option<String>>,
|
||||
) -> bool {
|
||||
let dict_data = &self.dictionaries[&dict];
|
||||
let definition = dict_data.definition.unwrap();
|
||||
@ -326,7 +338,13 @@ impl<'src> FirstPassRecord<'src> {
|
||||
// > such that inherited dictionary members are ordered before
|
||||
// > non-inherited members ...
|
||||
if let Some(parent) = &definition.inheritance {
|
||||
if !self.append_dictionary_members(parent.identifier.0, dst, unstable, unstable_types) {
|
||||
if !self.append_dictionary_members(
|
||||
parent.identifier.0,
|
||||
dst,
|
||||
unstable,
|
||||
unstable_types,
|
||||
parent_deprecated,
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -345,7 +363,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
.zip(iter::repeat(unstable || d.stability.is_unstable()))
|
||||
});
|
||||
for (member, unstable) in members.zip(iter::repeat(unstable)).chain(partials) {
|
||||
match self.dictionary_field(member, unstable, unstable_types) {
|
||||
match self.dictionary_field(member, unstable, unstable_types, parent_deprecated) {
|
||||
Some(f) => dst.push(f),
|
||||
None => {
|
||||
log::warn!(
|
||||
@ -372,6 +390,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
field: &'src DictionaryMember<'src>,
|
||||
unstable: bool,
|
||||
unstable_types: &HashSet<Identifier>,
|
||||
parent_deprecated: &Option<Option<String>>,
|
||||
) -> Option<DictionaryField> {
|
||||
let unstable_override = match unstable {
|
||||
true => true,
|
||||
@ -384,9 +403,15 @@ impl<'src> FirstPassRecord<'src> {
|
||||
idl_type::IdlType::Nullable(ty) => match **ty {
|
||||
idl_type::IdlType::Any => true,
|
||||
IdlType::FrozenArray(ref _idl_type) | IdlType::Sequence(ref _idl_type) => true,
|
||||
idl_type::IdlType::Union(ref types) => !types
|
||||
.iter()
|
||||
.all(|idl_type| matches!(idl_type, IdlType::Interface(..))),
|
||||
idl_type::IdlType::Union(ref types) => !types.iter().all(|idl_type| {
|
||||
matches!(
|
||||
idl_type,
|
||||
IdlType::Identifier {
|
||||
ty: IdentifierType::Interface(..),
|
||||
..
|
||||
}
|
||||
)
|
||||
}),
|
||||
_ => false,
|
||||
},
|
||||
_ => false,
|
||||
@ -447,7 +472,8 @@ impl<'src> FirstPassRecord<'src> {
|
||||
return_ty,
|
||||
is_js_value_ref_option_type,
|
||||
unstable: unstable_override,
|
||||
deprecated: get_rust_deprecated(&field.attributes),
|
||||
deprecated: get_rust_deprecated(&field.attributes)
|
||||
.or_else(|| parent_deprecated.clone()),
|
||||
})
|
||||
}
|
||||
|
||||
@ -508,11 +534,11 @@ impl<'src> FirstPassRecord<'src> {
|
||||
}
|
||||
|
||||
fn append_ns_operation(
|
||||
&self,
|
||||
functions: &mut Vec<Function>,
|
||||
js_name: &'src str,
|
||||
id: &OperationId<'src>,
|
||||
data: &OperationData<'src>,
|
||||
&'src self,
|
||||
functions: &mut Vec<Function<'src>>,
|
||||
js_name: &str,
|
||||
id: &'src OperationId<'src>,
|
||||
data: &'src OperationData<'src>,
|
||||
) {
|
||||
match id {
|
||||
OperationId::Operation(Some(_)) => {}
|
||||
@ -744,12 +770,12 @@ impl<'src> FirstPassRecord<'src> {
|
||||
}
|
||||
|
||||
fn member_operation(
|
||||
&self,
|
||||
&'src self,
|
||||
type_name: &str,
|
||||
methods: &mut Vec<InterfaceMethod>,
|
||||
methods: &mut Vec<InterfaceMethod<'src>>,
|
||||
data: &InterfaceData<'src>,
|
||||
id: &OperationId<'src>,
|
||||
op_data: &OperationData<'src>,
|
||||
id: &'src OperationId<'src>,
|
||||
op_data: &'src OperationData<'src>,
|
||||
unstable_types: &HashSet<Identifier>,
|
||||
) {
|
||||
let attrs = data.definition_attributes;
|
||||
@ -763,7 +789,18 @@ impl<'src> FirstPassRecord<'src> {
|
||||
unstable,
|
||||
unstable_types,
|
||||
) {
|
||||
methods.push(method);
|
||||
if !methods.iter().any(|old_method| {
|
||||
old_method.variadic == method.variadic
|
||||
&& old_method.js_name == method.js_name
|
||||
&& old_method.variadic_type == method.variadic_type
|
||||
&& old_method
|
||||
.arguments
|
||||
.iter()
|
||||
.map(|(_, idl, wb)| (idl.orig(), wb))
|
||||
.eq(method.arguments.iter().map(|(_, idl, wb)| (idl.orig(), wb)))
|
||||
}) {
|
||||
methods.push(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -792,12 +829,12 @@ impl<'src> FirstPassRecord<'src> {
|
||||
required: false,
|
||||
name: snake_case_ident(identifier),
|
||||
js_name: identifier.to_string(),
|
||||
ty: idl_type::IdlType::Callback
|
||||
ty: idl_type::IdentifierType::Callback
|
||||
.to_syn_type(pos)
|
||||
.unwrap()
|
||||
.unwrap(),
|
||||
return_ty: optional_return_ty(
|
||||
idl_type::IdlType::Callback
|
||||
idl_type::IdentifierType::Callback
|
||||
.to_syn_type(TypePosition::Return)
|
||||
.unwrap()
|
||||
.unwrap(),
|
||||
@ -821,6 +858,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
js_name,
|
||||
fields,
|
||||
unstable: false,
|
||||
deprecated: None,
|
||||
}
|
||||
.generate(options)
|
||||
.to_tokens(&mut program.tokens);
|
||||
|
@ -21,7 +21,7 @@ use crate::constants::{
|
||||
};
|
||||
use crate::first_pass::{FirstPassRecord, OperationData, OperationId, Signature};
|
||||
use crate::generator::{ConstValue, InterfaceMethod, InterfaceMethodKind};
|
||||
use crate::idl_type::{IdlType, ToIdlType};
|
||||
use crate::idl_type::{IdentifierType, IdlType, ToIdlType};
|
||||
use crate::Options;
|
||||
|
||||
/// For variadic operations an overload with a `js_sys::Array` argument is generated alongside with
|
||||
@ -220,8 +220,8 @@ impl<'src> FirstPassRecord<'src> {
|
||||
&self,
|
||||
type_name: Option<&str>,
|
||||
container_attrs: Option<&ExtendedAttributeList<'src>>,
|
||||
id: &OperationId<'src>,
|
||||
data: &OperationData<'src>,
|
||||
id: &'src OperationId<'src>,
|
||||
data: &'src OperationData<'src>,
|
||||
unstable: bool,
|
||||
unstable_types: &HashSet<Identifier>,
|
||||
) -> Vec<InterfaceMethod> {
|
||||
@ -308,7 +308,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
}
|
||||
}
|
||||
|
||||
let (name, kind, force_structural, force_throws) = match id {
|
||||
let (js_name, kind, force_structural, force_throws) = match id {
|
||||
// Constructors aren't annotated with `[Throws]` extended attributes
|
||||
// (how could they be, since they themselves are extended
|
||||
// attributes?) so we must conservatively assume that they can
|
||||
@ -355,7 +355,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
// possible.
|
||||
let ret_ty = signature.orig.ret.to_idl_type(self);
|
||||
|
||||
let mut rust_name = snake_case_ident(name);
|
||||
let mut rust_name = snake_case_ident(js_name);
|
||||
let mut first = true;
|
||||
for (i, arg) in signature.args.iter().enumerate() {
|
||||
// Find out if any other known signature either has the same
|
||||
@ -435,9 +435,9 @@ impl<'src> FirstPassRecord<'src> {
|
||||
.map(|arg| arg.variadic)
|
||||
.unwrap_or(false);
|
||||
|
||||
fn idl_arguments<'a>(
|
||||
args: impl Iterator<Item = (String, &'a IdlType<'a>)>,
|
||||
) -> Option<Vec<(Ident, syn::Type)>> {
|
||||
fn idl_arguments<'a: 'b, 'b>(
|
||||
args: impl Iterator<Item = (String, &'b IdlType<'a>)>,
|
||||
) -> Option<Vec<(Ident, IdlType<'a>, syn::Type)>> {
|
||||
let mut output = vec![];
|
||||
|
||||
for (name, idl_type) in args {
|
||||
@ -448,7 +448,11 @@ impl<'src> FirstPassRecord<'src> {
|
||||
}
|
||||
};
|
||||
|
||||
output.push((rust_ident(&snake_case_ident(&name[..])), ty));
|
||||
output.push((
|
||||
rust_ident(&snake_case_ident(&name[..])),
|
||||
idl_type.clone(),
|
||||
ty,
|
||||
));
|
||||
}
|
||||
|
||||
Some(output)
|
||||
@ -474,11 +478,22 @@ impl<'src> FirstPassRecord<'src> {
|
||||
|
||||
if let Some(arguments) = arguments {
|
||||
if let Ok(ret_ty) = ret_ty.to_syn_type(TypePosition::Return) {
|
||||
let mut rust_name = rust_name.clone();
|
||||
|
||||
if let Some(map) =
|
||||
type_name.and_then(|type_name| FIXED_INTERFACES.get(type_name))
|
||||
{
|
||||
if let Some(fixed) = map.get(rust_name.as_str()) {
|
||||
rust_name = fixed.to_string();
|
||||
}
|
||||
}
|
||||
|
||||
ret.push(InterfaceMethod {
|
||||
name: rust_ident(&rust_name),
|
||||
js_name: name.to_string(),
|
||||
js_name: js_name.to_string(),
|
||||
deprecated: deprecated.clone(),
|
||||
arguments,
|
||||
variadic_type: None,
|
||||
ret_ty,
|
||||
kind: kind.clone(),
|
||||
is_static,
|
||||
@ -506,11 +521,22 @@ impl<'src> FirstPassRecord<'src> {
|
||||
|
||||
if let Some(arguments) = arguments {
|
||||
if let Ok(ret_ty) = ret_ty.to_syn_type(TypePosition::Return) {
|
||||
let mut rust_name = format!("{}_{}", &rust_name, i);
|
||||
|
||||
if let Some(map) =
|
||||
type_name.and_then(|type_name| FIXED_INTERFACES.get(type_name))
|
||||
{
|
||||
if let Some(fixed) = map.get(rust_name.as_str()) {
|
||||
rust_name = fixed.to_string();
|
||||
}
|
||||
}
|
||||
|
||||
ret.push(InterfaceMethod {
|
||||
name: rust_ident(&format!("{}_{}", rust_name, i)),
|
||||
js_name: name.to_string(),
|
||||
name: rust_ident(&rust_name),
|
||||
js_name: js_name.to_string(),
|
||||
deprecated: deprecated.clone(),
|
||||
arguments,
|
||||
variadic_type: Some(last_idl_type.clone()),
|
||||
kind: kind.clone(),
|
||||
ret_ty,
|
||||
is_static,
|
||||
@ -524,14 +550,6 @@ impl<'src> FirstPassRecord<'src> {
|
||||
}
|
||||
}
|
||||
|
||||
for interface in &mut ret {
|
||||
if let Some(map) = type_name.and_then(|type_name| FIXED_INTERFACES.get(type_name)) {
|
||||
if let Some(fixed) = map.get(&interface.name.to_string().as_ref()) {
|
||||
interface.name = rust_ident(fixed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret
|
||||
}
|
||||
|
||||
@ -572,9 +590,10 @@ pub fn is_type_unstable(ty: &weedle::types::Type, unstable_types: &HashSet<Ident
|
||||
|
||||
fn is_idl_type_unstable(ty: &IdlType, unstable_types: &HashSet<Identifier>) -> bool {
|
||||
match ty {
|
||||
IdlType::Dictionary(name) | IdlType::Interface(name) => {
|
||||
unstable_types.contains(&Identifier(name))
|
||||
}
|
||||
IdlType::Identifier {
|
||||
ty: IdentifierType::Dictionary(name) | IdentifierType::Interface(name),
|
||||
..
|
||||
} => unstable_types.contains(&Identifier(name)),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user