Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

refactor(webapi): share generated interface descriptors

ldm0c1679b1b25c3
diff --git a/moli-renderer-v8/src/blob.rs b/moli-renderer-v8/src/blob.rs
index 27febbab6..8852d14df 100644
--- a/moli-renderer-v8/src/blob.rs
+++ b/moli-renderer-v8/src/blob.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use moli_file_api::{
BlobId, BlobLineEndings, BlobStore, blob_slice_relative_index, clamp_blob_long_long,
normalize_blob_line_endings_with_native_ending, normalize_blob_mime_type,
@@ -27,14 +28,14 @@ fn native_blob_line_ending() -> &'static str {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "Blob")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::Blob)]
struct BlobInstanceDeclaration<'scope> {
#[webapi(slot = BLOB_ID_SLOT)]
blob_id: v8::Local<'scope, v8::BigInt>,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Blob", enumerable)]
+#[webapi(interface = web_api_interfaces::Blob, enumerable)]
struct BlobPrototypeDeclaration {
#[webapi(accessor_property, getter = blob_size_attribute_getter_callback)]
size: (),
diff --git a/moli-renderer-v8/src/content_security_policy.rs b/moli-renderer-v8/src/content_security_policy.rs
index 93b7df1dc..cd619d355 100644
--- a/moli-renderer-v8/src/content_security_policy.rs
+++ b/moli-renderer-v8/src/content_security_policy.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::collections::BTreeMap;
use crate::context_bootstrap::{initialize_event_object, mark_event_trusted};
@@ -185,7 +186,7 @@ pub(crate) struct ContentSecurityPolicyViolationEventFields<'a> {
#[derive(WebApiObject)]
#[webapi(
- interface = "SecurityPolicyViolationEvent",
+ interface = web_api_interfaces::SecurityPolicyViolationEvent,
data_properties,
enumerable
)]
diff --git a/moli-renderer-v8/src/context_bootstrap.rs b/moli-renderer-v8/src/context_bootstrap.rs
index 2205898d7..348b135b2 100644
--- a/moli-renderer-v8/src/context_bootstrap.rs
+++ b/moli-renderer-v8/src/context_bootstrap.rs
@@ -477,6 +477,7 @@ pub(super) use super::{
v8str,
},
};
+use crate::web_api_interfaces;
use anyhow::{Result, anyhow};
pub(crate) use exposed_interfaces::{
ensure_intrinsic_interface_constructor, ensure_intrinsic_interface_prototype,
@@ -536,7 +537,7 @@ pub(crate) fn build_lightweight_popup_window_navigator_object<'s>(
fn find_constructor_spec(name: &str) -> Result<self::specs::ConstructorSpec> {
constructor_specs()
.into_iter()
- .find(|spec| spec.name == name)
+ .find(|spec| spec.interface.name() == name)
.ok_or_else(|| anyhow!("missing context bootstrap constructor spec `{name}`"))
}
@@ -593,12 +594,12 @@ pub(in crate::context_bootstrap) fn build_profiled_exposed_interface_template<'s
) -> Result<v8::Local<'s, v8::FunctionTemplate>> {
if profile == exposed_interfaces::TemplateBuildProfile::Window {
let template = build_constructor_template(scope, spec)?;
- if spec.name == "XMLHttpRequest" {
+ if spec.interface.name() == "XMLHttpRequest" {
crate::network_host::install_window_xml_http_request_template_bindings(scope, template);
}
return Ok(template);
}
- let template = match spec.name {
+ let template = match spec.interface.name() {
"StorageManager" => {
let template = navigator_runtime::build_storage_manager_worker_template(scope);
template.read_only_prototype();
@@ -612,13 +613,21 @@ pub(in crate::context_bootstrap) fn build_profiled_exposed_interface_template<'s
"AbortSignal" => {
let template = WorkerAbortSignalTemplateDeclaration::build(scope);
template.read_only_prototype();
- exposed_interfaces::install_interface_template_metadata(scope, template, spec.name);
+ exposed_interfaces::install_interface_template_metadata(
+ scope,
+ template,
+ spec.interface.name(),
+ );
template
}
"AbortController" => {
let template = WorkerAbortControllerTemplateDeclaration::build(scope);
template.read_only_prototype();
- exposed_interfaces::install_interface_template_metadata(scope, template, spec.name);
+ exposed_interfaces::install_interface_template_metadata(
+ scope,
+ template,
+ spec.interface.name(),
+ );
template
}
"EventSource" => build_constructor_template_with_callback(
@@ -629,7 +638,7 @@ pub(in crate::context_bootstrap) fn build_profiled_exposed_interface_template<'s
_ => build_constructor_template(scope, spec)?,
};
if profile == exposed_interfaces::TemplateBuildProfile::DedicatedWorker
- && spec.name == "FileSystemFileHandle"
+ && spec.interface.name() == "FileSystemFileHandle"
{
opfs::install_file_system_file_handle_sync_template_binding(scope, template);
}
@@ -687,7 +696,7 @@ pub(crate) fn install_worker_base64_runtime_state<'s>(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "AbortSignal", enumerable)]
+#[webapi(interface = web_api_interfaces::AbortSignal, enumerable)]
struct WorkerAbortSignalTemplateDeclaration {
#[webapi(
static_method = "abort",
@@ -754,7 +763,7 @@ struct WorkerAbortSignalTemplateDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "AbortController",
+ interface = web_api_interfaces::AbortController,
constructor_callback = crate::worker::abort::worker_abort_controller_constructor_callback,
constructor_length = 0,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/animation_runtime.rs b/moli-renderer-v8/src/context_bootstrap/animation_runtime.rs
index 2e56aeeb9..08aef780f 100644
--- a/moli-renderer-v8/src/context_bootstrap/animation_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/animation_runtime.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
use crate::native_bridge::node_runtime_and_handle_from_object;
@@ -33,7 +34,7 @@ struct AnimationPromiseEntryDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Animation", enumerable)]
+#[webapi(interface = web_api_interfaces::Animation, enumerable)]
struct AnimationPrototypeMethodsDeclaration {
#[webapi(
accessor_property,
@@ -56,7 +57,7 @@ struct AnimationPrototypeMethodsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Animation")]
+#[webapi(interface = web_api_interfaces::Animation)]
struct AnimationObjectDeclaration<'s> {
#[webapi(slot = ANIMATION_ID_SLOT, constructor_default = "")]
id: &'static str,
@@ -130,7 +131,7 @@ fn animation_id_setter_callback<'s>(
}
#[derive(WebApiObject)]
-#[webapi(interface = "KeyframeEffect")]
+#[webapi(interface = web_api_interfaces::KeyframeEffect)]
struct KeyframeEffectObjectDeclaration<'s> {
#[webapi(slot = KEYFRAME_EFFECT_TARGET_SLOT)]
target: v8::Local<'s, v8::Value>,
@@ -139,14 +140,14 @@ struct KeyframeEffectObjectDeclaration<'s> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "KeyframeEffect", enumerable)]
+#[webapi(interface = web_api_interfaces::KeyframeEffect, enumerable)]
struct KeyframeEffectPrototypeDeclaration {
#[webapi(method, length = 1, callback = keyframe_effect_set_keyframes_callback)]
set_keyframes: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Element", enumerable)]
+#[webapi(interface = web_api_interfaces::Element, enumerable)]
struct ElementAnimationPrototypeDeclaration {
#[webapi(method, length = 0, callback = element_animate_callback)]
animate: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs b/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs
index 989187eec..e36f7a2ff 100644
--- a/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs
+++ b/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs
@@ -69,6 +69,7 @@ use super::super::{
worker_host::worker_constructor_callback,
};
use super::prototype_bindings::install_constructor_template_bindings;
+use crate::web_api_interfaces;
use crate::{
blob, dom_parser, native_bridge::abort, network_host, observer_runtime, util::v8_string,
xml_serializer,
@@ -88,11 +89,14 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
.length(0)
.build(scope)
}
- ConstructorKind::Event => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("Event", event_constructor_callback),
- )
- .length(1)
- .build(scope),
+ ConstructorKind::Event => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::Event,
+ event_constructor_callback
+ ))
+ .length(1)
+ .build(scope)
+ }
ConstructorKind::UiEvent => {
build_event_subclass_template(scope, EventSubclassKind::UiEvent)
}
@@ -119,7 +123,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::ClipboardItem => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "ClipboardItem",
+ web_api_interfaces::ClipboardItem,
clipboard_item_constructor_callback
))
.length(1)
@@ -191,20 +195,23 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::DomException => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "DOMException",
+ web_api_interfaces::DOMException,
dom_exception_constructor_callback
))
.length(0)
.build(scope)
}
- ConstructorKind::DomError => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("DOMError", dom_error_constructor_callback),
- )
- .length(1)
- .build(scope),
+ ConstructorKind::DomError => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::DOMError,
+ dom_error_constructor_callback
+ ))
+ .length(1)
+ .build(scope)
+ }
ConstructorKind::QuotaExceededError => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "QuotaExceededError",
+ web_api_interfaces::QuotaExceededError,
quota_exceeded_error_constructor_callback
))
.length(0)
@@ -212,7 +219,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::CustomElementRegistry => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "CustomElementRegistry",
+ web_api_interfaces::CustomElementRegistry,
custom_elements_registry_constructor_callback
))
.length(0)
@@ -228,7 +235,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::XmlHttpRequest => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "XMLHttpRequest",
+ web_api_interfaces::XMLHttpRequest,
network_host::xhr_constructor_callback
))
.length(0)
@@ -236,7 +243,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::Headers => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "Headers",
+ web_api_interfaces::Headers,
network_host::headers_constructor_callback
))
.length(0)
@@ -244,7 +251,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::Request => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "Request",
+ web_api_interfaces::Request,
network_host::request_constructor_callback
))
.length(1)
@@ -252,7 +259,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::Response => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "Response",
+ web_api_interfaces::Response,
network_host::response_constructor_callback
))
.length(0)
@@ -260,7 +267,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::ProgressEvent => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "ProgressEvent",
+ web_api_interfaces::ProgressEvent,
network_host::progress_event_constructor_callback
))
.length(1)
@@ -268,7 +275,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::DomParser => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "DOMParser",
+ web_api_interfaces::DOMParser,
dom_parser::dom_parser_constructor_callback
))
.length(0)
@@ -276,7 +283,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::TextEncoder => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "TextEncoder",
+ web_api_interfaces::TextEncoder,
text_encoder_constructor_callback
))
.length(0)
@@ -284,7 +291,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::TextDecoder => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "TextDecoder",
+ web_api_interfaces::TextDecoder,
text_decoder_constructor_callback
))
.length(0)
@@ -357,14 +364,17 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
.length(1)
.build(scope)
}
- ConstructorKind::Blob => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("Blob", blob::blob_constructor_callback),
- )
- .length(0)
- .build(scope),
+ ConstructorKind::Blob => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::Blob,
+ blob::blob_constructor_callback
+ ))
+ .length(0)
+ .build(scope)
+ }
ConstructorKind::DataTransfer => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "DataTransfer",
+ web_api_interfaces::DataTransfer,
data_transfer_constructor_callback
))
.length(0)
@@ -373,7 +383,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
ConstructorKind::ImageData => {
let template =
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "ImageData",
+ web_api_interfaces::ImageData,
image_data_constructor_callback
))
.length(2)
@@ -384,7 +394,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::OffscreenCanvas => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "OffscreenCanvas",
+ web_api_interfaces::OffscreenCanvas,
offscreen_canvas_constructor_callback
))
.length(2)
@@ -392,7 +402,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::CanvasRenderingContext2D => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "CanvasRenderingContext2D",
+ web_api_interfaces::CanvasRenderingContext2D,
canvas_rendering_context_2d_constructor_callback
))
.length(0)
@@ -400,7 +410,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::OffscreenCanvasRenderingContext2D => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "OffscreenCanvasRenderingContext2D",
+ web_api_interfaces::OffscreenCanvasRenderingContext2D,
offscreen_canvas_rendering_context_2d_constructor_callback
))
.length(0)
@@ -408,7 +418,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::WebGLRenderingContext => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "WebGLRenderingContext",
+ web_api_interfaces::WebGLRenderingContext,
webgl_rendering_context_constructor_callback
))
.length(0)
@@ -416,7 +426,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::WebGlDebugRendererInfo => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "WEBGL_debug_renderer_info",
+ web_api_interfaces::WEBGLDebugRendererInfo,
webgl_debug_renderer_info_constructor_callback
))
.length(0)
@@ -424,25 +434,31 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::WebGlLoseContext => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "WEBGL_lose_context",
+ web_api_interfaces::WEBGLLoseContext,
webgl_lose_context_constructor_callback
))
.length(0)
.build(scope)
}
- ConstructorKind::File => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("File", file_constructor_callback),
- )
- .length(2)
- .build(scope),
- ConstructorKind::FileList => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("FileList", file_list_constructor_callback),
- )
- .length(0)
- .build(scope),
+ ConstructorKind::File => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::File,
+ file_constructor_callback
+ ))
+ .length(2)
+ .build(scope)
+ }
+ ConstructorKind::FileList => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::FileList,
+ file_list_constructor_callback
+ ))
+ .length(0)
+ .build(scope)
+ }
ConstructorKind::FileReader => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "FileReader",
+ web_api_interfaces::FileReader,
file_reader_constructor_callback
))
.length(0)
@@ -450,7 +466,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::FileReaderSync => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "FileReaderSync",
+ web_api_interfaces::FileReaderSync,
file_reader_sync_constructor_callback
))
.length(0)
@@ -458,7 +474,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::DomRectReadOnly => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "DOMRectReadOnly",
+ web_api_interfaces::DOMRectReadOnly,
super::super::dom_rect::dom_rect_readonly_constructor_callback
))
.length(0)
@@ -466,17 +482,20 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::DomRect => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "DOMRect",
+ web_api_interfaces::DOMRect,
super::super::dom_rect::dom_rect_constructor_callback
))
.length(0)
.build(scope)
}
- ConstructorKind::DomPoint => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("DOMPoint", dom_point_constructor_callback),
- )
- .length(0)
- .build(scope),
+ ConstructorKind::DomPoint => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::DOMPoint,
+ dom_point_constructor_callback
+ ))
+ .length(0)
+ .build(scope)
+ }
ConstructorKind::DomMatrix => {
v8::FunctionTemplate::builder(dom_matrix_constructor_callback)
.length(0)
@@ -484,7 +503,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::XmlSerializer => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "XMLSerializer",
+ web_api_interfaces::XMLSerializer,
xml_serializer::xml_serializer_constructor_callback
))
.length(0)
@@ -492,7 +511,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::AbortController => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "AbortController",
+ web_api_interfaces::AbortController,
abort::abort_controller_constructor_callback
))
.length(0)
@@ -500,7 +519,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::MessageChannel => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "MessageChannel",
+ web_api_interfaces::MessageChannel,
message_channel_constructor_callback
))
.length(0)
@@ -508,7 +527,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::MessagePort => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "MessagePort",
+ web_api_interfaces::MessagePort,
message_port_constructor_callback
))
.length(0)
@@ -523,7 +542,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::EventSource => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "EventSource",
+ web_api_interfaces::EventSource,
network_host::event_source_constructor_callback
))
.length(1)
@@ -531,7 +550,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::IdleDetector => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "IdleDetector",
+ web_api_interfaces::IdleDetector,
idle_detector_constructor_callback
))
.length(0)
@@ -539,20 +558,23 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::Notification => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "Notification",
+ web_api_interfaces::Notification,
notification_constructor_callback
))
.length(1)
.build(scope)
}
- ConstructorKind::WebSocket => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("WebSocket", websocket_constructor_callback),
- )
- .length(1)
- .build(scope),
+ ConstructorKind::WebSocket => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::WebSocket,
+ websocket_constructor_callback
+ ))
+ .length(1)
+ .build(scope)
+ }
ConstructorKind::RtcPeerConnection => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "RTCPeerConnection",
+ web_api_interfaces::RTCPeerConnection,
rtc_peer_connection_constructor_callback
))
.length(0)
@@ -560,7 +582,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::RtcIceCandidate => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "RTCIceCandidate",
+ web_api_interfaces::RTCIceCandidate,
rtc_ice_candidate_constructor_callback
))
.length(0)
@@ -568,7 +590,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::RtcSessionDescription => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "RTCSessionDescription",
+ web_api_interfaces::RTCSessionDescription,
rtc_session_description_constructor_callback
))
.length(1)
@@ -584,7 +606,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
.build(scope),
ConstructorKind::SpeechSynthesisUtterance => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "SpeechSynthesisUtterance",
+ web_api_interfaces::SpeechSynthesisUtterance,
speech_synthesis_utterance_constructor_callback
))
.length(0)
@@ -592,7 +614,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::WebSocketError => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "WebSocketError",
+ web_api_interfaces::WebSocketError,
websocket_error_constructor_callback
))
.length(0)
@@ -600,7 +622,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::WebSocketStream => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "WebSocketStream",
+ web_api_interfaces::WebSocketStream,
websocket_stream_constructor_callback
))
.length(1)
@@ -608,7 +630,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::ResizeObserver => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "ResizeObserver",
+ web_api_interfaces::ResizeObserver,
resize_observer_constructor_callback
))
.length(1)
@@ -616,7 +638,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::PerformanceObserver => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "PerformanceObserver",
+ web_api_interfaces::PerformanceObserver,
performance_observer_constructor_callback
))
.length(1)
@@ -634,7 +656,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
| ConstructorKind::TextTrackList
| ConstructorKind::TextTrackCueList => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "TextTrackCueList",
+ web_api_interfaces::TextTrackCueList,
media_error_constructor_callback
))
.length(0)
@@ -645,23 +667,26 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::TextTrackCue => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "TextTrackCue",
+ web_api_interfaces::TextTrackCue,
text_track_cue_constructor_callback
))
.length(0)
.build(scope)
}
- ConstructorKind::VTTCue => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("VTTCue", vtt_cue_constructor_callback),
- )
- .length(3)
- .build(scope),
+ ConstructorKind::VTTCue => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::VTTCue,
+ vtt_cue_constructor_callback
+ ))
+ .length(3)
+ .build(scope)
+ }
ConstructorKind::PerformanceObserverEntryList => {
v8::FunctionTemplate::builder(illegal_constructor_callback).build(scope)
}
ConstructorKind::PerformanceMark => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "PerformanceMark",
+ web_api_interfaces::PerformanceMark,
performance_mark_constructor_callback
))
.length(1)
@@ -688,27 +713,30 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::MediaSource => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "MediaSource",
+ web_api_interfaces::MediaSource,
media_source_constructor_callback
))
.length(0)
.build(scope)
}
- ConstructorKind::Animation => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("Animation", animation_constructor_callback),
- )
- .length(0)
- .build(scope),
+ ConstructorKind::Animation => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::Animation,
+ animation_constructor_callback
+ ))
+ .length(0)
+ .build(scope)
+ }
ConstructorKind::KeyframeEffect => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "KeyframeEffect",
+ web_api_interfaces::KeyframeEffect,
keyframe_effect_constructor_callback
))
.length(2)
.build(scope)
}
ConstructorKind::HtmlElement => {
- let Some(constructor_name) = v8_string(scope, spec.name) else {
+ let Some(constructor_name) = v8_string(scope, spec.interface.name()) else {
return Err(anyhow!("failed to allocate HTML element constructor name"));
};
v8::FunctionTemplate::builder(html_element_constructor_callback)
@@ -718,7 +746,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::Option => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "HTMLOptionElement",
+ web_api_interfaces::HTMLOptionElement,
option_constructor_callback
))
.length(0)
@@ -726,7 +754,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::MutationObserver => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "MutationObserver",
+ web_api_interfaces::MutationObserver,
observer_runtime::mutation_observer_constructor_callback
))
.length(1)
@@ -734,7 +762,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::IntersectionObserver => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "IntersectionObserver",
+ web_api_interfaces::IntersectionObserver,
observer_runtime::intersection_observer_constructor_callback
))
.length(1)
@@ -742,7 +770,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::IntersectionObserverEntry => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "IntersectionObserverEntry",
+ web_api_interfaces::IntersectionObserverEntry,
observer_runtime::intersection_observer_entry_constructor_callback
))
.length(1)
@@ -755,7 +783,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::Image => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "HTMLImageElement",
+ web_api_interfaces::HTMLImageElement,
image_constructor_callback
))
.length(2)
@@ -763,7 +791,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::Audio => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "HTMLAudioElement",
+ web_api_interfaces::HTMLAudioElement,
audio_constructor_callback
))
.length(1)
@@ -781,7 +809,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::CssStyleSheet => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "CSSStyleSheet",
+ web_api_interfaces::CSSStyleSheet,
css_style_sheet_constructor_callback
))
.length(0)
@@ -789,7 +817,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::CssKeywordValue => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "CSSKeywordValue",
+ web_api_interfaces::CSSKeywordValue,
css_keyword_value_constructor_callback
))
.length(1)
@@ -797,20 +825,23 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::CssUnitValue => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "CSSUnitValue",
+ web_api_interfaces::CSSUnitValue,
css_unit_value_constructor_callback
))
.length(2)
.build(scope)
}
- ConstructorKind::FontFace => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("FontFace", font_face_constructor_callback),
- )
- .length(2)
- .build(scope),
+ ConstructorKind::FontFace => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::FontFace,
+ font_face_constructor_callback
+ ))
+ .length(2)
+ .build(scope)
+ }
ConstructorKind::FontFaceSet => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "FontFaceSet",
+ web_api_interfaces::FontFaceSet,
font_face_set_constructor_callback
))
.length(0)
@@ -820,7 +851,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
ConstructorKind::AudioWorkletNode => build_audio_worklet_node_constructor_template(scope),
ConstructorKind::OfflineAudioContext => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "OfflineAudioContext",
+ web_api_interfaces::OfflineAudioContext,
offline_audio_context_constructor_callback
))
.length(3)
@@ -844,14 +875,17 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
ConstructorKind::Comment => v8::FunctionTemplate::builder(comment_constructor_callback)
.length(0)
.build(scope),
- ConstructorKind::Touch => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("Touch", touch_constructor_callback),
- )
- .length(1)
- .build(scope),
+ ConstructorKind::Touch => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::Touch,
+ touch_constructor_callback
+ ))
+ .length(1)
+ .build(scope)
+ }
ConstructorKind::EventTarget => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "EventTarget",
+ web_api_interfaces::EventTarget,
event_target_constructor_callback
))
.length(0)
@@ -859,20 +893,23 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
}
ConstructorKind::XPathEvaluator => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "XPathEvaluator",
+ web_api_interfaces::XPathEvaluator,
xpath_evaluator_constructor_callback
))
.length(0)
.build(scope)
}
- ConstructorKind::Worker => v8::FunctionTemplate::builder(
- moli_webapi_declare::web_api_constructor!("Worker", worker_constructor_callback),
- )
- .length(1)
- .build(scope),
+ ConstructorKind::Worker => {
+ v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
+ web_api_interfaces::Worker,
+ worker_constructor_callback
+ ))
+ .length(1)
+ .build(scope)
+ }
ConstructorKind::SharedWorker => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "SharedWorker",
+ web_api_interfaces::SharedWorker,
shared_worker_constructor_callback
))
.length(1)
@@ -889,7 +926,7 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(
.build(scope),
ConstructorKind::IndexedDbVersionChangeEvent => {
v8::FunctionTemplate::builder(moli_webapi_declare::web_api_constructor!(
- "IDBVersionChangeEvent",
+ web_api_interfaces::IDBVersionChangeEvent,
crate::context_bootstrap::indexed_db::idb_version_change_event_constructor_callback
))
.length(2)
@@ -915,8 +952,12 @@ fn finalize_constructor_template<'s>(
spec: ConstructorSpec,
template: v8::Local<'s, v8::FunctionTemplate>,
) -> Result<v8::Local<'s, v8::FunctionTemplate>> {
- let class_name = v8_string(scope, spec.name)
- .ok_or_else(|| anyhow!("failed to allocate context bootstrap class `{}`", spec.name))?;
+ let class_name = v8_string(scope, spec.interface.name()).ok_or_else(|| {
+ anyhow!(
+ "failed to allocate context bootstrap class `{}`",
+ spec.interface.name()
+ )
+ })?;
template.set_class_name(class_name);
// WebIDL interface objects expose a non-writable `prototype` property.
// V8 FunctionTemplate defaults to writable, so make the binding-level
@@ -927,7 +968,7 @@ fn finalize_constructor_template<'s>(
}
install_constructor_template_bindings(scope, template, spec);
- install_interface_template_metadata(scope, template, spec.name);
+ install_interface_template_metadata(scope, template, spec.interface.name());
Ok(template)
}
diff --git a/moli-renderer-v8/src/context_bootstrap/assets/global.rs b/moli-renderer-v8/src/context_bootstrap/assets/global.rs
index 275ed0e68..a11ccb70c 100644
--- a/moli-renderer-v8/src/context_bootstrap/assets/global.rs
+++ b/moli-renderer-v8/src/context_bootstrap/assets/global.rs
@@ -70,11 +70,19 @@ impl ContextBootstrapAssets {
if !constructor_spec_is_eager(*spec) {
continue;
}
- let id = registry
- .id_by_name(spec.name)
- .ok_or_else(|| anyhow!("missing constructor template metadata `{}`", spec.name))?;
+ let id = registry.id_by_name(spec.interface.name()).ok_or_else(|| {
+ anyhow!(
+ "missing constructor template metadata `{}`",
+ spec.interface.name()
+ )
+ })?;
let template = registry.get_or_build_template(scope, id)?;
- define_global_template_value(scope, global_template, spec.name, template.into())?;
+ define_global_template_value(
+ scope,
+ global_template,
+ spec.interface.name(),
+ template.into(),
+ )?;
}
if timing_enabled {
diff --git a/moli-renderer-v8/src/context_bootstrap/assets/prototype_bindings.rs b/moli-renderer-v8/src/context_bootstrap/assets/prototype_bindings.rs
index 1d812561a..638f3b996 100644
--- a/moli-renderer-v8/src/context_bootstrap/assets/prototype_bindings.rs
+++ b/moli-renderer-v8/src/context_bootstrap/assets/prototype_bindings.rs
@@ -71,6 +71,7 @@ use super::super::{
window_runtime::storage_bucket_persisted_callback,
window_runtime::storage_bucket_set_expires_callback,
};
+use crate::web_api_interfaces;
use crate::{
detached_css_style::install_css_style_declaration_template_bindings,
dom_parser::install_dom_parser_template_bindings, native_bridge::element, network_host,
@@ -79,7 +80,7 @@ use crate::{
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSStyleDeclaration", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSStyleDeclaration, enumerable)]
struct CssStyleDeclarationTemplateMethodsDeclaration {
#[webapi(
method = "getPropertyValue",
@@ -110,7 +111,7 @@ struct CssStyleDeclarationTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLDocument", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLDocument, enumerable)]
struct HtmlDocumentTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "location",
@@ -121,7 +122,7 @@ struct HtmlDocumentTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Animation", enumerable)]
+#[webapi(interface = web_api_interfaces::Animation, enumerable)]
struct AnimationTemplateAccessorsDeclaration {
#[webapi(accessor_property = "playState", getter = animation_play_state_getter)]
play_state: (),
@@ -165,7 +166,7 @@ struct AnimationTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLCanvasElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLCanvasElement, enumerable)]
struct HtmlCanvasElementTemplateMethodsDeclaration {
#[webapi(method = "getContext", length = 1, callback = element::canvas_get_context_callback)]
get_context: (),
@@ -182,7 +183,7 @@ struct HtmlCanvasElementTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "AudioBuffer", enumerable)]
+#[webapi(interface = web_api_interfaces::AudioBuffer, enumerable)]
struct AudioBufferTemplateMethodsDeclaration {
#[webapi(
method = "getChannelData",
@@ -193,7 +194,7 @@ struct AudioBufferTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Worker", enumerable)]
+#[webapi(interface = web_api_interfaces::Worker, enumerable)]
struct WorkerTemplateMethodsDeclaration {
#[webapi(
method = "postMessage",
@@ -211,7 +212,7 @@ struct WorkerTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DataTransfer", enumerable)]
+#[webapi(interface = web_api_interfaces::DataTransfer, enumerable)]
struct DataTransferTemplateMethodsDeclaration {
#[webapi(
method = "getData",
@@ -236,7 +237,7 @@ struct DataTransferTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DataTransferItem", enumerable)]
+#[webapi(interface = web_api_interfaces::DataTransferItem, enumerable)]
struct DataTransferItemTemplateMethodsDeclaration {
#[webapi(
method = "getAsFile",
@@ -261,7 +262,7 @@ struct DataTransferItemTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DataTransferItemList", enumerable)]
+#[webapi(interface = web_api_interfaces::DataTransferItemList, enumerable)]
struct DataTransferItemListTemplateMethodsDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
@@ -299,7 +300,7 @@ struct DataTransferItemListTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemFileEntry", enumerable)]
+#[webapi(interface = web_api_interfaces::FileSystemFileEntry, enumerable)]
struct FileSystemFileEntryTemplateMethodsDeclaration {
#[webapi(
method = "file",
@@ -310,7 +311,7 @@ struct FileSystemFileEntryTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemDirectoryEntry", enumerable)]
+#[webapi(interface = web_api_interfaces::FileSystemDirectoryEntry, enumerable)]
struct FileSystemDirectoryEntryTemplateMethodsDeclaration {
#[webapi(
method = "createReader",
@@ -321,7 +322,7 @@ struct FileSystemDirectoryEntryTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemDirectoryReader", enumerable)]
+#[webapi(interface = web_api_interfaces::FileSystemDirectoryReader, enumerable)]
struct FileSystemDirectoryReaderTemplateMethodsDeclaration {
#[webapi(
method = "readEntries",
@@ -332,7 +333,7 @@ struct FileSystemDirectoryReaderTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "StorageBucketManager", enumerable)]
+#[webapi(interface = web_api_interfaces::StorageBucketManager, enumerable)]
struct StorageBucketManagerTemplateMethodsDeclaration {
#[webapi(method = "open", length = 1, callback = storage_bucket_manager_open_callback)]
open: (),
@@ -349,7 +350,7 @@ struct StorageBucketManagerTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "StorageBucket", enumerable)]
+#[webapi(interface = web_api_interfaces::StorageBucket, enumerable)]
struct StorageBucketTemplateMethodsDeclaration {
#[webapi(accessor_property, getter = storage_bucket_name_getter_callback)]
name: (),
@@ -402,98 +403,140 @@ pub(super) fn install_constructor_template_bindings<'s>(
template: v8::Local<'s, v8::FunctionTemplate>,
spec: ConstructorSpec,
) {
- install_node_mixin_unscopables(scope, template, spec.name);
- install_constructor_constant_template_bindings(scope, template, spec.name);
- install_css_style_declaration_template_accessors(scope, template, spec.name);
- install_abort_template_bindings(scope, template, spec.name);
- install_attr_template_bindings(scope, template, spec.name);
- install_dom_rect_template_bindings(scope, template, spec.name);
- install_dom_exception_template_bindings(scope, template, spec.name);
- install_dom_implementation_template_bindings(scope, template, spec.name);
- install_custom_element_registry_template_bindings(scope, template, spec.name);
- install_text_codec_template_bindings(scope, template, spec.name);
- install_geometry_template_bindings(scope, template, spec.name);
- if spec.name == "ImageData" {
+ install_node_mixin_unscopables(scope, template, spec.interface.name());
+ install_constructor_constant_template_bindings(scope, template, spec.interface.name());
+ install_css_style_declaration_template_accessors(scope, template, spec.interface.name());
+ install_abort_template_bindings(scope, template, spec.interface.name());
+ install_attr_template_bindings(scope, template, spec.interface.name());
+ install_dom_rect_template_bindings(scope, template, spec.interface.name());
+ install_dom_exception_template_bindings(scope, template, spec.interface.name());
+ install_dom_implementation_template_bindings(scope, template, spec.interface.name());
+ install_custom_element_registry_template_bindings(scope, template, spec.interface.name());
+ install_text_codec_template_bindings(scope, template, spec.interface.name());
+ install_geometry_template_bindings(scope, template, spec.interface.name());
+ if spec.interface.name() == "ImageData" {
install_image_data_template_bindings(scope, template);
}
- if spec.name == "MediaQueryList" {
+ if spec.interface.name() == "MediaQueryList" {
install_media_query_list_template_bindings(scope, template);
}
- install_media_cue_template_bindings(scope, template, spec.name);
- install_media_source_template_bindings(scope, template, spec.name);
- install_message_port_template_bindings(scope, template, spec.name);
- if spec.name == "BroadcastChannel" {
+ install_media_cue_template_bindings(scope, template, spec.interface.name());
+ install_media_source_template_bindings(scope, template, spec.interface.name());
+ install_message_port_template_bindings(scope, template, spec.interface.name());
+ if spec.interface.name() == "BroadcastChannel" {
install_broadcast_channel_template_bindings(scope, template);
}
- if spec.name == "EventSource" {
+ if spec.interface.name() == "EventSource" {
network_host::install_event_source_bindings(scope, template);
}
- if spec.name == "IdleDetector" {
+ if spec.interface.name() == "IdleDetector" {
install_idle_detector_template_bindings(scope, template);
}
- if spec.name == "IdleDeadline" {
+ if spec.interface.name() == "IdleDeadline" {
crate::window_host::install_idle_deadline_template_bindings(scope, template);
}
- if spec.name == "Notification" {
+ if spec.interface.name() == "Notification" {
install_notification_template_bindings(scope, template);
}
- install_animation_template_bindings(scope, template, spec.name);
- crate::blob::install_blob_template_bindings(scope, template, spec.name);
- install_css_style_declaration_template_bindings(scope, template, spec.name);
+ install_animation_template_bindings(scope, template, spec.interface.name());
+ crate::blob::install_blob_template_bindings(scope, template, spec.interface.name());
+ install_css_style_declaration_template_bindings(scope, template, spec.interface.name());
install_event_template_bindings(scope, template, spec);
- install_media_file_template_bindings(scope, template, spec.name);
- install_observer_template_bindings(scope, template, spec.name);
+ install_media_file_template_bindings(scope, template, spec.interface.name());
+ install_observer_template_bindings(scope, template, spec.interface.name());
install_style_font_template_bindings(scope, template, spec);
- install_stream_template_bindings(scope, template, spec.name);
- crate::native_bridge::install_character_data_template_bindings(scope, template, spec.name);
- crate::native_bridge::install_node_template_bindings(scope, template, spec.name);
- crate::native_bridge::install_document_template_bindings(scope, template, spec.name);
- crate::native_bridge::install_collection_template_bindings(scope, template, spec.name);
- crate::native_bridge::install_traversal_template_bindings(scope, template, spec.name);
+ install_stream_template_bindings(scope, template, spec.interface.name());
+ crate::native_bridge::install_character_data_template_bindings(
+ scope,
+ template,
+ spec.interface.name(),
+ );
+ crate::native_bridge::install_node_template_bindings(scope, template, spec.interface.name());
+ crate::native_bridge::install_document_template_bindings(
+ scope,
+ template,
+ spec.interface.name(),
+ );
+ crate::native_bridge::install_collection_template_bindings(
+ scope,
+ template,
+ spec.interface.name(),
+ );
+ crate::native_bridge::install_traversal_template_bindings(
+ scope,
+ template,
+ spec.interface.name(),
+ );
crate::native_bridge::element::install_global_event_handler_template_bindings(
- scope, template, spec.name,
+ scope,
+ template,
+ spec.interface.name(),
+ );
+ crate::native_bridge::element::install_element_template_bindings(
+ scope,
+ template,
+ spec.interface.name(),
);
- crate::native_bridge::element::install_element_template_bindings(scope, template, spec.name);
crate::native_bridge::element::install_element_internals_template_bindings(
- scope, template, spec.name,
+ scope,
+ template,
+ spec.interface.name(),
+ );
+ crate::native_bridge::element::install_text_track_template_bindings(
+ scope,
+ template,
+ spec.interface.name(),
);
- crate::native_bridge::element::install_text_track_template_bindings(scope, template, spec.name);
crate::native_bridge::document::install_caret_position_template_bindings(
- scope, template, spec.name,
+ scope,
+ template,
+ spec.interface.name(),
);
crate::native_bridge::document::install_named_node_map_template_bindings(
- scope, template, spec.name,
+ scope,
+ template,
+ spec.interface.name(),
+ );
+ crate::native_bridge::document::install_xpath_template_bindings(
+ scope,
+ template,
+ spec.interface.name(),
);
- crate::native_bridge::document::install_xpath_template_bindings(scope, template, spec.name);
crate::observer_runtime::install_intersection_observer_template_accessors(
- scope, template, spec.name,
+ scope,
+ template,
+ spec.interface.name(),
+ );
+ crate::network_host::install_progress_event_template_bindings(
+ scope,
+ template,
+ spec.interface.name(),
);
- crate::network_host::install_progress_event_template_bindings(scope, template, spec.name);
- install_svg_template_bindings(scope, template, spec.name);
- install_opfs_constructor_template_bindings(scope, template, spec.name);
- install_css_typed_om_template_bindings(scope, template, spec.name);
- install_css_stylesheet_template_bindings(scope, template, spec.name);
- install_range_template_bindings(scope, template, spec.name);
- install_indexed_db_template_bindings(scope, template, spec.name);
- install_selection_template_bindings(scope, template, spec.name);
- install_file_api_template_bindings(scope, template, spec.name);
- install_dom_parser_template_bindings(scope, template, spec.name);
- install_performance_template_bindings(scope, template, spec.name);
- install_crypto_template_bindings(scope, template, spec.name);
- install_navigator_template_bindings(scope, template, spec.name);
- install_screen_template_bindings(scope, template, spec.name);
- install_visual_viewport_template_bindings(scope, template, spec.name);
- install_speech_synthesis_template_bindings(scope, template, spec.name);
- install_storage_access_template_bindings(scope, template, spec.name);
- install_touch_template_bindings(scope, template, spec.name);
- install_view_transition_template_bindings(scope, template, spec.name);
- install_web_audio_template_bindings(scope, template, spec.name);
- install_webrtc_template_bindings(scope, template, spec.name);
+ install_svg_template_bindings(scope, template, spec.interface.name());
+ install_opfs_constructor_template_bindings(scope, template, spec.interface.name());
+ install_css_typed_om_template_bindings(scope, template, spec.interface.name());
+ install_css_stylesheet_template_bindings(scope, template, spec.interface.name());
+ install_range_template_bindings(scope, template, spec.interface.name());
+ install_indexed_db_template_bindings(scope, template, spec.interface.name());
+ install_selection_template_bindings(scope, template, spec.interface.name());
+ install_file_api_template_bindings(scope, template, spec.interface.name());
+ install_dom_parser_template_bindings(scope, template, spec.interface.name());
+ install_performance_template_bindings(scope, template, spec.interface.name());
+ install_crypto_template_bindings(scope, template, spec.interface.name());
+ install_navigator_template_bindings(scope, template, spec.interface.name());
+ install_screen_template_bindings(scope, template, spec.interface.name());
+ install_visual_viewport_template_bindings(scope, template, spec.interface.name());
+ install_speech_synthesis_template_bindings(scope, template, spec.interface.name());
+ install_storage_access_template_bindings(scope, template, spec.interface.name());
+ install_touch_template_bindings(scope, template, spec.interface.name());
+ install_view_transition_template_bindings(scope, template, spec.interface.name());
+ install_web_audio_template_bindings(scope, template, spec.interface.name());
+ install_webrtc_template_bindings(scope, template, spec.interface.name());
crate::context_bootstrap::navigation_activation::install_navigation_activation_template_bindings(
- scope, template, spec.name,
+ scope, template, spec.interface.name(),
);
- match spec.name {
+ match spec.interface.name() {
"HTMLDocument" => {
let proto = template.prototype_template(scope);
HtmlDocumentTemplateAccessorsDeclaration::initialize_prototype_template(scope, proto);
diff --git a/moli-renderer-v8/src/context_bootstrap/bridge_descriptor/descriptors.rs b/moli-renderer-v8/src/context_bootstrap/bridge_descriptor/descriptors.rs
index b5fb567ef..ce526a3ad 100644
--- a/moli-renderer-v8/src/context_bootstrap/bridge_descriptor/descriptors.rs
+++ b/moli-renderer-v8/src/context_bootstrap/bridge_descriptor/descriptors.rs
@@ -1,13 +1,12 @@
use super::{BridgeDescriptor, InstallGroups, RuntimeInstallGroups, SpecializedTemplateInstaller};
+use crate::web_api_interfaces;
const fn descriptor(
- prototype_name: &'static str,
- parent_constructor: Option<&'static str>,
+ interface: moli_webapi_declare::WebApiInterfaceDescriptor,
install_groups: InstallGroups,
) -> BridgeDescriptor {
specialized_descriptor(
- prototype_name,
- parent_constructor,
+ interface,
install_groups,
SpecializedTemplateInstaller::None,
NONE_RUNTIME_INSTALL_GROUPS,
@@ -15,16 +14,13 @@ const fn descriptor(
}
const fn specialized_descriptor(
- prototype_name: &'static str,
- parent_constructor: Option<&'static str>,
+ interface: moli_webapi_declare::WebApiInterfaceDescriptor,
install_groups: InstallGroups,
specialized_template_installer: SpecializedTemplateInstaller,
runtime_install_groups: RuntimeInstallGroups,
) -> BridgeDescriptor {
BridgeDescriptor {
- prototype_name,
- constructor_name: prototype_name,
- parent_constructor,
+ interface,
install_groups,
specialized_template_installer,
runtime_install_groups,
@@ -84,66 +80,76 @@ const SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS: RuntimeInstallGroups = RuntimeInstall
};
const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
- descriptor("Node", Some("EventTarget"), BASE_GROUPS),
- descriptor("Document", Some("Node"), DOCUMENT_GROUPS),
- descriptor("HTMLDocument", Some("Document"), DOCUMENT_GROUPS),
- descriptor("XMLDocument", Some("Document"), DOCUMENT_GROUPS),
- descriptor("DocumentFragment", Some("Node"), MARKUP_CONTAINER_GROUPS),
- descriptor("DocumentType", Some("Node"), BASE_GROUPS),
- specialized_descriptor(
- "ShadowRoot",
- Some("DocumentFragment"),
+ descriptor(web_api_interfaces::Node::DESCRIPTOR, BASE_GROUPS),
+ descriptor(web_api_interfaces::Document::DESCRIPTOR, DOCUMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::HTMLDocument::DESCRIPTOR,
+ DOCUMENT_GROUPS,
+ ),
+ descriptor(web_api_interfaces::XMLDocument::DESCRIPTOR, DOCUMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::DocumentFragment::DESCRIPTOR,
+ MARKUP_CONTAINER_GROUPS,
+ ),
+ descriptor(web_api_interfaces::DocumentType::DESCRIPTOR, BASE_GROUPS),
+ specialized_descriptor(
+ web_api_interfaces::ShadowRoot::DESCRIPTOR,
MARKUP_CONTAINER_GROUPS,
SpecializedTemplateInstaller::ShadowRoot,
NONE_RUNTIME_INSTALL_GROUPS,
),
- descriptor("Element", Some("Node"), ELEMENT_GROUPS),
- descriptor("SVGElement", Some("Element"), ELEMENT_GROUPS),
- descriptor("SVGGraphicsElement", Some("SVGElement"), ELEMENT_GROUPS),
+ descriptor(web_api_interfaces::Element::DESCRIPTOR, ELEMENT_GROUPS),
+ descriptor(web_api_interfaces::SVGElement::DESCRIPTOR, ELEMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::SVGGraphicsElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
descriptor(
- "SVGGeometryElement",
- Some("SVGGraphicsElement"),
+ web_api_interfaces::SVGGeometryElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
- descriptor("SVGAElement", Some("SVGGraphicsElement"), ELEMENT_GROUPS),
+ descriptor(web_api_interfaces::SVGAElement::DESCRIPTOR, ELEMENT_GROUPS),
specialized_descriptor(
- "SVGCircleElement",
- Some("SVGGeometryElement"),
+ web_api_interfaces::SVGCircleElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS,
),
- descriptor("SVGDefsElement", Some("SVGGraphicsElement"), ELEMENT_GROUPS),
- descriptor("SVGDescElement", Some("SVGElement"), ELEMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::SVGDefsElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::SVGDescElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
specialized_descriptor(
- "SVGEllipseElement",
- Some("SVGGeometryElement"),
+ web_api_interfaces::SVGEllipseElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS,
),
descriptor(
- "SVGForeignObjectElement",
- Some("SVGGraphicsElement"),
+ web_api_interfaces::SVGForeignObjectElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
- descriptor("SVGGElement", Some("SVGGraphicsElement"), ELEMENT_GROUPS),
+ descriptor(web_api_interfaces::SVGGElement::DESCRIPTOR, ELEMENT_GROUPS),
descriptor(
- "SVGImageElement",
- Some("SVGGraphicsElement"),
+ web_api_interfaces::SVGImageElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
specialized_descriptor(
- "SVGLineElement",
- Some("SVGGeometryElement"),
+ web_api_interfaces::SVGLineElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS,
),
- descriptor("SVGGradientElement", Some("SVGElement"), ELEMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::SVGGradientElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
specialized_descriptor(
- "SVGLinearGradientElement",
- Some("SVGGradientElement"),
+ web_api_interfaces::SVGLinearGradientElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
RuntimeInstallGroups {
@@ -154,19 +160,26 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
svg_gradient_transform: true,
},
),
- descriptor("SVGMetadataElement", Some("SVGElement"), ELEMENT_GROUPS),
- descriptor("SVGScriptElement", Some("SVGElement"), ELEMENT_GROUPS),
- descriptor("SVGStyleElement", Some("SVGElement"), ELEMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::SVGMetadataElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::SVGScriptElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::SVGStyleElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
specialized_descriptor(
- "SVGPathElement",
- Some("SVGGeometryElement"),
+ web_api_interfaces::SVGPathElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "SVGPatternElement",
- Some("SVGElement"),
+ web_api_interfaces::SVGPatternElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
RuntimeInstallGroups {
@@ -178,22 +191,19 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
},
),
specialized_descriptor(
- "SVGPolygonElement",
- Some("SVGGeometryElement"),
+ web_api_interfaces::SVGPolygonElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "SVGPolylineElement",
- Some("SVGGeometryElement"),
+ web_api_interfaces::SVGPolylineElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "SVGRadialGradientElement",
- Some("SVGGradientElement"),
+ web_api_interfaces::SVGRadialGradientElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
RuntimeInstallGroups {
@@ -204,25 +214,24 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
svg_gradient_transform: true,
},
),
- descriptor("SVGSVGElement", Some("SVGGraphicsElement"), ELEMENT_GROUPS),
descriptor(
- "SVGSymbolElement",
- Some("SVGGraphicsElement"),
+ web_api_interfaces::SVGSVGElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
descriptor(
- "SVGTextContentElement",
- Some("SVGGraphicsElement"),
+ web_api_interfaces::SVGSymbolElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
descriptor(
- "SVGTextPositioningElement",
- Some("SVGTextContentElement"),
+ web_api_interfaces::SVGTextContentElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::SVGTextPositioningElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
specialized_descriptor(
- "SVGTextElement",
- Some("SVGTextPositioningElement"),
+ web_api_interfaces::SVGTextElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
RuntimeInstallGroups {
@@ -234,8 +243,7 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
},
),
specialized_descriptor(
- "SVGTSpanElement",
- Some("SVGTextPositioningElement"),
+ web_api_interfaces::SVGTSpanElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
RuntimeInstallGroups {
@@ -246,11 +254,16 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
svg_gradient_transform: false,
},
),
- descriptor("SVGTitleElement", Some("SVGElement"), ELEMENT_GROUPS),
- descriptor("SVGUseElement", Some("SVGGraphicsElement"), ELEMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::SVGTitleElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::SVGUseElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
specialized_descriptor(
- "SVGRectElement",
- Some("SVGGeometryElement"),
+ web_api_interfaces::SVGRectElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
RuntimeInstallGroups {
@@ -262,8 +275,7 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
},
),
specialized_descriptor(
- "HTMLElement",
- Some("Element"),
+ web_api_interfaces::HTMLElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
RuntimeInstallGroups {
@@ -275,65 +287,71 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
},
),
descriptor(
- "HTMLUnknownElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLUnknownElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
specialized_descriptor(
- "HTMLAnchorElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLAnchorElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlAnchorElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
- descriptor("HTMLAreaElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
- descriptor("HTMLBaseElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
- descriptor("HTMLHtmlElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
- descriptor("HTMLHeadElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::HTMLAreaElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLBaseElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLHtmlElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLHeadElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
specialized_descriptor(
- "HTMLBodyElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLBodyElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlBodyElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
- descriptor("HTMLBRElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::HTMLBRElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
specialized_descriptor(
- "HTMLMediaElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLMediaElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlMediaElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
descriptor(
- "HTMLPictureElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLPictureElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
specialized_descriptor(
- "HTMLAudioElement",
- Some("HTMLMediaElement"),
+ web_api_interfaces::HTMLAudioElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlAudioElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLButtonElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLButtonElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlButtonElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLDetailsElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLDetailsElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlDetailsElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLDialogElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLDialogElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlDialogElement,
RuntimeInstallGroups {
@@ -345,177 +363,173 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
},
),
specialized_descriptor(
- "HTMLCanvasElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLCanvasElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlCanvasElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
- descriptor("HTMLDataElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::HTMLDataElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
specialized_descriptor(
- "HTMLDataListElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLDataListElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlDataListElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
- descriptor("HTMLDivElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
descriptor(
- "HTMLDirectoryElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLDivElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLDirectoryElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLDListElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLEmbedElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
- descriptor("HTMLDListElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
- descriptor("HTMLEmbedElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
specialized_descriptor(
- "HTMLIFrameElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLIFrameElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlIFrameElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLImageElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLImageElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlImageElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
- descriptor("HTMLFontElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
- descriptor("HTMLFrameElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
descriptor(
- "HTMLFrameSetElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLFontElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLFrameElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
descriptor(
- "HTMLHeadingElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLFrameSetElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLHeadingElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLHRElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
- descriptor("HTMLHRElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
specialized_descriptor(
- "HTMLLIElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLLIElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlLiElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLOListElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLOListElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlOListElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLOptGroupElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLOptGroupElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlOptGroupElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLQuoteElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLQuoteElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlQuoteElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLScriptElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLScriptElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlScriptElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLStyleElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLStyleElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlStyleElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLTitleElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTitleElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlTitleElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLTemplateElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTemplateElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlTemplateElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLTableCellElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTableCellElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlTableCellElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLTimeElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTimeElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlTimeElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLInputElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLInputElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlInputElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLSelectElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLSelectElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlSelectElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLOptionElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLOptionElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlOptionElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLTrackElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTrackElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlTrackElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLTextAreaElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTextAreaElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlTextAreaElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLVideoElement",
- Some("HTMLMediaElement"),
+ web_api_interfaces::HTMLVideoElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlVideoElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLFieldSetElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLFieldSetElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlFieldSetElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLFormElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLFormElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
// Form elements cannot safely reuse the plain HTMLElement template. The runtime exposes
// form-specific surface such as branding, collection helpers, and readonly association
@@ -528,79 +542,83 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLLegendElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLLegendElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlLegendElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLLabelElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLLabelElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlLabelElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLLinkElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLLinkElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlLinkElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
- descriptor("HTMLMapElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
descriptor(
- "HTMLMarqueeElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLMapElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLMarqueeElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLMenuElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
- descriptor("HTMLMenuElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
specialized_descriptor(
- "HTMLMetaElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLMetaElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlMetaElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLMeterElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLMeterElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlMeterElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
- descriptor("HTMLModElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
+ descriptor(
+ web_api_interfaces::HTMLModElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
specialized_descriptor(
- "HTMLObjectElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLObjectElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlObjectElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLOutputElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLOutputElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlOutputElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
descriptor(
- "HTMLParagraphElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLParagraphElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLParamElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLPreElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
- descriptor("HTMLParamElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
- descriptor("HTMLPreElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
specialized_descriptor(
- "HTMLProgressElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLProgressElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlProgressElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLSlotElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLSlotElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
RuntimeInstallGroups {
@@ -612,53 +630,64 @@ const NODE_BRIDGE_DESCRIPTORS: &[BridgeDescriptor] = &[
},
),
descriptor(
- "HTMLSourceElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLSourceElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLSpanElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
- descriptor("HTMLSpanElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
descriptor(
- "HTMLTableCaptionElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTableCaptionElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
descriptor(
- "HTMLTableColElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTableColElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
specialized_descriptor(
- "HTMLTableElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTableElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlTableElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLTableRowElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTableRowElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlTableRowElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
specialized_descriptor(
- "HTMLTableSectionElement",
- Some("HTMLElement"),
+ web_api_interfaces::HTMLTableSectionElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
SpecializedTemplateInstaller::HtmlTableSectionElement,
NONE_RUNTIME_INSTALL_GROUPS,
),
- descriptor("HTMLTitleElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
- descriptor("HTMLUListElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
- descriptor("MathMLElement", Some("Element"), ELEMENT_GROUPS),
- descriptor("Text", Some("CharacterData"), CHARACTER_DATA_GROUPS),
- descriptor("Comment", Some("CharacterData"), CHARACTER_DATA_GROUPS),
descriptor(
- "ProcessingInstruction",
- Some("CharacterData"),
+ web_api_interfaces::HTMLTitleElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::HTMLUListElement::DESCRIPTOR,
+ HTML_ELEMENT_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::MathMLElement::DESCRIPTOR,
+ ELEMENT_GROUPS,
+ ),
+ descriptor(web_api_interfaces::Text::DESCRIPTOR, CHARACTER_DATA_GROUPS),
+ descriptor(
+ web_api_interfaces::Comment::DESCRIPTOR,
+ CHARACTER_DATA_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::ProcessingInstruction::DESCRIPTOR,
+ CHARACTER_DATA_GROUPS,
+ ),
+ descriptor(
+ web_api_interfaces::CDATASection::DESCRIPTOR,
CHARACTER_DATA_GROUPS,
),
- descriptor("CDATASection", Some("Text"), CHARACTER_DATA_GROUPS),
];
pub(crate) fn node_bridge_descriptors() -> &'static [BridgeDescriptor] {
@@ -668,7 +697,7 @@ pub(crate) fn node_bridge_descriptors() -> &'static [BridgeDescriptor] {
pub(crate) fn node_bridge_descriptor(name: &str) -> Option<&'static BridgeDescriptor> {
NODE_BRIDGE_DESCRIPTORS
.iter()
- .find(|descriptor| descriptor.prototype_name == name)
+ .find(|descriptor| descriptor.interface.name() == name)
}
#[cfg(test)]
diff --git a/moli-renderer-v8/src/context_bootstrap/bridge_descriptor/types.rs b/moli-renderer-v8/src/context_bootstrap/bridge_descriptor/types.rs
index 4a76f9997..f89ee9b3f 100644
--- a/moli-renderer-v8/src/context_bootstrap/bridge_descriptor/types.rs
+++ b/moli-renderer-v8/src/context_bootstrap/bridge_descriptor/types.rs
@@ -73,9 +73,7 @@ pub(crate) struct RuntimeInstallGroups {
#[derive(Clone, Copy, Debug)]
pub(crate) struct BridgeDescriptor {
- pub(crate) prototype_name: &'static str,
- pub(crate) constructor_name: &'static str,
- pub(crate) parent_constructor: Option<&'static str>,
+ pub(crate) interface: moli_webapi_declare::WebApiInterfaceDescriptor,
pub(crate) install_groups: InstallGroups,
pub(crate) specialized_template_installer: SpecializedTemplateInstaller,
pub(crate) runtime_install_groups: RuntimeInstallGroups,
diff --git a/moli-renderer-v8/src/context_bootstrap/broadcast_channel.rs b/moli-renderer-v8/src/context_bootstrap/broadcast_channel.rs
index d5a2e90e4..ab1c8d0a3 100644
--- a/moli-renderer-v8/src/context_bootstrap/broadcast_channel.rs
+++ b/moli-renderer-v8/src/context_bootstrap/broadcast_channel.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::{
broadcast_channel_runtime::{
BroadcastChannelEvent, BroadcastChannelOwner, BroadcastChannelStorageKey,
@@ -26,7 +27,7 @@ const BROADCAST_CHANNEL_ONMESSAGE_SLOT: &str = "__lmBroadcastChannelOnmessage";
const BROADCAST_CHANNEL_ONMESSAGEERROR_SLOT: &str = "__lmBroadcastChannelOnmessageerror";
#[derive(WebApiObject)]
-#[webapi(interface = "BroadcastChannel")]
+#[webapi(interface = web_api_interfaces::BroadcastChannel)]
struct BroadcastChannelObjectDeclaration<'scope> {
#[webapi(slot = BROADCAST_CHANNEL_ID_SLOT)]
channel_id: v8::Local<'scope, v8::Value>,
@@ -72,7 +73,7 @@ struct BroadcastChannelObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "BroadcastChannel", enumerable)]
+#[webapi(interface = web_api_interfaces::BroadcastChannel, enumerable)]
struct BroadcastChannelPrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/canvas.rs b/moli-renderer-v8/src/context_bootstrap/canvas.rs
index b55ad2594..49185bd56 100644
--- a/moli-renderer-v8/src/context_bootstrap/canvas.rs
+++ b/moli-renderer-v8/src/context_bootstrap/canvas.rs
@@ -2,6 +2,7 @@ use super::super::blob::build_blob_object;
use super::super::native_bridge::element;
use super::super::util::{throw_type_error, v8_string};
use super::shared::{global_constructor_object, global_constructor_prototype};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiFunctionTemplate;
use std::str::FromStr;
@@ -119,7 +120,7 @@ const WEBGL_SUPPORTED_EXTENSIONS: &[&str] = &[
];
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLCanvasElement", receiver = "HTMLCanvasElement")]
+#[webapi(interface = web_api_interfaces::HTMLCanvasElement, receiver)]
struct HtmlCanvasElementPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/canvas/constructors.rs b/moli-renderer-v8/src/context_bootstrap/canvas/constructors.rs
index cc9a4be6f..1982b6837 100644
--- a/moli-renderer-v8/src/context_bootstrap/canvas/constructors.rs
+++ b/moli-renderer-v8/src/context_bootstrap/canvas/constructors.rs
@@ -1,11 +1,12 @@
use super::helpers::init_canvas_like_context_object;
use super::offscreen::init_offscreen_canvas_object;
use super::*;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "WEBGL_debug_renderer_info")]
+#[webapi(interface = web_api_interfaces::WEBGLDebugRendererInfo)]
struct WebGlDebugRendererInfoObjectDeclaration {
#[webapi(data_property = "UNMASKED_VENDOR_WEBGL")]
unmasked_vendor_webgl: f64,
diff --git a/moli-renderer-v8/src/context_bootstrap/canvas/context2d.rs b/moli-renderer-v8/src/context_bootstrap/canvas/context2d.rs
index 8566352b4..3cd7557c4 100644
--- a/moli-renderer-v8/src/context_bootstrap/canvas/context2d.rs
+++ b/moli-renderer-v8/src/context_bootstrap/canvas/context2d.rs
@@ -10,6 +10,7 @@ use crate::context_bootstrap::image_data::{
};
use crate::native_bridge::element::image_selected_source;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_canvas::{
DEFAULT_FILL_STYLE, DEFAULT_FONT, DrawImageBlit, ScaleFilter, blit_draw_image_filtered,
@@ -38,14 +39,14 @@ pub(super) fn reset_canvas_context_state<'s>(
}
#[derive(WebApiObject)]
-#[webapi(interface = "TextMetrics")]
+#[webapi(interface = web_api_interfaces::TextMetrics)]
struct CanvasTextMetricsDeclaration {
#[webapi(slot = TEXT_METRICS_WIDTH_SLOT)]
width: f64,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextMetrics", enumerable)]
+#[webapi(interface = web_api_interfaces::TextMetrics, enumerable)]
struct TextMetricsPrototypeDeclaration {
#[webapi(accessor_property, getter = text_metrics_width_getter)]
width: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/canvas/image_bitmap.rs b/moli-renderer-v8/src/context_bootstrap/canvas/image_bitmap.rs
index 9d1539b4b..bacab8ed7 100644
--- a/moli-renderer-v8/src/context_bootstrap/canvas/image_bitmap.rs
+++ b/moli-renderer-v8/src/context_bootstrap/canvas/image_bitmap.rs
@@ -5,6 +5,7 @@ use crate::context_bootstrap::new_dom_exception_value;
use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, set_private_value,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
const IMAGE_BITMAP_WIDTH_SLOT: &str = "__moliImageBitmapWidth";
@@ -13,7 +14,7 @@ const IMAGE_BITMAP_HEIGHT_SLOT: &str = "__moliImageBitmapHeight";
const IMAGE_BITMAP_DIMENSION_SLOTS: &[&str] = &[IMAGE_BITMAP_WIDTH_SLOT, IMAGE_BITMAP_HEIGHT_SLOT];
#[derive(WebApiObject)]
-#[webapi(interface = "ImageBitmap")]
+#[webapi(interface = web_api_interfaces::ImageBitmap)]
struct ImageBitmapObjectDeclaration {
#[webapi(slot = IMAGE_BITMAP_WIDTH_SLOT)]
width: f64,
@@ -22,7 +23,7 @@ struct ImageBitmapObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "ImageBitmap", enumerable)]
+#[webapi(interface = web_api_interfaces::ImageBitmap, enumerable)]
struct ImageBitmapPrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/canvas/offscreen.rs b/moli-renderer-v8/src/context_bootstrap/canvas/offscreen.rs
index fb8f168dd..865420fc7 100644
--- a/moli-renderer-v8/src/context_bootstrap/canvas/offscreen.rs
+++ b/moli-renderer-v8/src/context_bootstrap/canvas/offscreen.rs
@@ -6,6 +6,7 @@ use super::*;
use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, set_private_value, v8str,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -13,7 +14,7 @@ const OFFSCREEN_CANVAS_CONTEXT_SLOT: &str = "__moliOffscreenCanvasContext";
const OFFSCREEN_CANVAS_CONTEXT_KIND_SLOT: &str = "__moliOffscreenCanvasContextKind";
#[derive(WebApiObject)]
-#[webapi(interface = "OffscreenCanvas")]
+#[webapi(interface = web_api_interfaces::OffscreenCanvas)]
struct OffscreenCanvasObjectDeclaration {
#[webapi(slot = OFFSCREEN_CANVAS_WIDTH_SLOT)]
width: f64,
@@ -22,7 +23,7 @@ struct OffscreenCanvasObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "OffscreenCanvas")]
+#[webapi(interface = web_api_interfaces::OffscreenCanvas)]
struct OffscreenCanvasPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/canvas/webgl.rs b/moli-renderer-v8/src/context_bootstrap/canvas/webgl.rs
index be2b82056..688e4104d 100644
--- a/moli-renderer-v8/src/context_bootstrap/canvas/webgl.rs
+++ b/moli-renderer-v8/src/context_bootstrap/canvas/webgl.rs
@@ -1,5 +1,6 @@
use super::objects::{build_webgl_debug_renderer_info_object, build_webgl_lose_context_object};
use super::*;
+use crate::web_api_interfaces;
use crate::{
util::{callback_data_item, get_private_value, set_private_value, v8_string, v8str},
webidl,
@@ -90,7 +91,7 @@ struct WebGl2GetInternalformatParameterArgs {
#[derive(WebApiObject)]
#[webapi(
allow_empty,
- interface = "WebGLBuffer",
+ interface = web_api_interfaces::WebGLBuffer,
fallback_to_string_tag = "WebGLBuffer"
)]
struct WebGlBufferHandleDeclaration {}
@@ -98,7 +99,7 @@ struct WebGlBufferHandleDeclaration {}
#[derive(WebApiObject)]
#[webapi(
allow_empty,
- interface = "WebGLProgram",
+ interface = web_api_interfaces::WebGLProgram,
fallback_to_string_tag = "WebGLProgram"
)]
struct WebGlProgramHandleDeclaration {}
@@ -106,7 +107,7 @@ struct WebGlProgramHandleDeclaration {}
#[derive(WebApiObject)]
#[webapi(
allow_empty,
- interface = "WebGLShader",
+ interface = web_api_interfaces::WebGLShader,
fallback_to_string_tag = "WebGLShader"
)]
struct WebGlShaderHandleDeclaration {}
@@ -114,7 +115,7 @@ struct WebGlShaderHandleDeclaration {}
#[derive(WebApiObject)]
#[webapi(
allow_empty,
- interface = "WebGLUniformLocation",
+ interface = web_api_interfaces::WebGLUniformLocation,
fallback_to_string_tag = "WebGLUniformLocation"
)]
struct WebGlUniformLocationHandleDeclaration {}
@@ -122,7 +123,7 @@ struct WebGlUniformLocationHandleDeclaration {}
#[derive(WebApiObject)]
#[webapi(
allow_empty,
- interface = "WebGLFramebuffer",
+ interface = web_api_interfaces::WebGLFramebuffer,
fallback_to_string_tag = "WebGLFramebuffer"
)]
struct WebGlFramebufferHandleDeclaration {}
@@ -130,13 +131,13 @@ struct WebGlFramebufferHandleDeclaration {}
#[derive(WebApiObject)]
#[webapi(
allow_empty,
- interface = "WebGLRenderbuffer",
+ interface = web_api_interfaces::WebGLRenderbuffer,
fallback_to_string_tag = "WebGLRenderbuffer"
)]
struct WebGlRenderbufferHandleDeclaration {}
#[derive(WebApiObject)]
-#[webapi(interface = "WebGL2RenderingContext")]
+#[webapi(interface = web_api_interfaces::WebGL2RenderingContext)]
struct WebGl2ContextObjectDeclaration {
#[webapi(slot = WEBGL2_DRAWING_BUFFER_COLOR_SPACE_SLOT)]
drawing_buffer_color_space: String,
@@ -789,7 +790,7 @@ pub(crate) fn webgl_get_shader_precision_format_callback(
#[derive(WebApiObject)]
#[webapi(
- interface = "WebGLShaderPrecisionFormat",
+ interface = web_api_interfaces::WebGLShaderPrecisionFormat,
prototype = "Object",
data_properties,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/constructors/custom_elements_registry.rs b/moli-renderer-v8/src/context_bootstrap/constructors/custom_elements_registry.rs
index 8c6f3c36a..c07f9462e 100644
--- a/moli-renderer-v8/src/context_bootstrap/constructors/custom_elements_registry.rs
+++ b/moli-renderer-v8/src/context_bootstrap/constructors/custom_elements_registry.rs
@@ -1,10 +1,11 @@
use super::*;
+use crate::web_api_interfaces;
use crate::webidl;
use anyhow::Result;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CustomElementRegistry", enumerable)]
+#[webapi(interface = web_api_interfaces::CustomElementRegistry, enumerable)]
struct CustomElementRegistryPrototypeMethodsDeclaration {
#[webapi(method, enumerable, length = 2, callback = custom_elements_define_callback)]
define: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/constructors/dom_exception.rs b/moli-renderer-v8/src/context_bootstrap/constructors/dom_exception.rs
index 6c7030574..69478b8d2 100644
--- a/moli-renderer-v8/src/context_bootstrap/constructors/dom_exception.rs
+++ b/moli-renderer-v8/src/context_bootstrap/constructors/dom_exception.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::{util::get_private_value, webidl};
use moli_web_errors::{DOM_EXCEPTION_CONSTANTS, dom_exception_legacy_code};
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject, WebApiTemplateValue};
@@ -55,7 +56,7 @@ struct QuotaExceededErrorConstructorArgs {
}
#[derive(WebApiObject)]
-#[webapi(interface = "DOMException")]
+#[webapi(interface = web_api_interfaces::DOMException)]
struct DomExceptionObjectDeclaration<'scope> {
#[webapi(slot = DOM_EXCEPTION_MESSAGE_SLOT)]
message: Option<v8::Local<'scope, v8::String>>,
@@ -66,7 +67,7 @@ struct DomExceptionObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "DOMError", fallback_to_string_tag = "DOMError")]
+#[webapi(interface = web_api_interfaces::DOMError, fallback_to_string_tag = "DOMError")]
struct DomErrorObjectDeclaration<'scope> {
#[webapi(slot = DOM_ERROR_NAME_SLOT)]
name: Option<v8::Local<'scope, v8::String>>,
@@ -76,7 +77,7 @@ struct DomErrorObjectDeclaration<'scope> {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "DOMException",
+ interface = web_api_interfaces::DOMException,
intrinsic_prototype_parent = v8::Intrinsic::ErrorPrototype
)]
struct DomExceptionPrototypeAccessorsDeclaration {
@@ -89,7 +90,7 @@ struct DomExceptionPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMError")]
+#[webapi(interface = web_api_interfaces::DOMError)]
struct DomErrorPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = dom_error_name_getter_callback, enumerable)]
name: (),
@@ -98,7 +99,7 @@ struct DomErrorPrototypeAccessorsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "QuotaExceededError")]
+#[webapi(interface = web_api_interfaces::QuotaExceededError)]
struct QuotaExceededErrorObjectDeclaration<'scope> {
#[webapi(slot = DOM_EXCEPTION_MESSAGE_SLOT)]
message: Option<v8::Local<'scope, v8::String>>,
@@ -113,7 +114,7 @@ struct QuotaExceededErrorObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "QuotaExceededError")]
+#[webapi(interface = web_api_interfaces::QuotaExceededError)]
struct QuotaExceededErrorPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = quota_exceeded_error_quota_getter_callback, enumerable)]
quota: (),
@@ -126,7 +127,7 @@ struct QuotaExceededErrorPrototypeAccessorsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "WebSocketError")]
+#[webapi(interface = web_api_interfaces::WebSocketError)]
struct WebSocketErrorObjectDeclaration<'scope> {
#[webapi(slot = DOM_EXCEPTION_MESSAGE_SLOT)]
message: Option<v8::Local<'scope, v8::String>>,
@@ -141,7 +142,7 @@ struct WebSocketErrorObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WebSocketError")]
+#[webapi(interface = web_api_interfaces::WebSocketError)]
struct WebSocketErrorPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = websocket_error_close_code_getter_callback, enumerable)]
close_code: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/constructors/dom_implementation.rs b/moli-renderer-v8/src/context_bootstrap/constructors/dom_implementation.rs
index 5de165638..c65cb7114 100644
--- a/moli-renderer-v8/src/context_bootstrap/constructors/dom_implementation.rs
+++ b/moli-renderer-v8/src/context_bootstrap/constructors/dom_implementation.rs
@@ -1,18 +1,19 @@
use super::*;
use crate::native_bridge::throw_dom_exception;
use crate::util::{get_private_object, get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(WebApiObject)]
-#[webapi(interface = "DOMImplementation")]
+#[webapi(interface = web_api_interfaces::DOMImplementation)]
struct DomImplementationSingletonDeclaration<'scope> {
#[webapi(slot = DOM_IMPLEMENTATION_OWNER_DOCUMENT_SLOT)]
owner_document: Option<v8::Local<'scope, v8::Object>>,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMImplementation")]
+#[webapi(interface = web_api_interfaces::DOMImplementation)]
struct DomImplementationPrototypeMethodsDeclaration {
#[webapi(method, enumerable, length = 0, callback = dom_implementation_has_feature_callback)]
has_feature: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/constructors/text_codecs.rs b/moli-renderer-v8/src/context_bootstrap/constructors/text_codecs.rs
index 3420cbc70..1de76ba78 100644
--- a/moli-renderer-v8/src/context_bootstrap/constructors/text_codecs.rs
+++ b/moli-renderer-v8/src/context_bootstrap/constructors/text_codecs.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::{
text_codec::TextDecodeError,
util::{callback_data_index_value, callback_data_item, get_private_value},
@@ -16,14 +17,14 @@ const TEXT_DECODER_FATAL_SLOT_INDEX: usize = 2;
const TEXT_DECODER_IGNORE_BOM_SLOT_INDEX: usize = 3;
#[derive(WebApiObject)]
-#[webapi(interface = "TextEncoder")]
+#[webapi(interface = web_api_interfaces::TextEncoder)]
struct TextEncoderObjectDeclaration {
#[webapi(slot = TEXT_ENCODER_ENCODING_SLOT)]
encoding: &'static str,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextEncoder", enumerable)]
+#[webapi(interface = web_api_interfaces::TextEncoder, enumerable)]
struct TextEncoderPrototypeDeclaration {
#[webapi(method, length = 0, callback = text_encoder_encode_callback)]
encode: (),
@@ -39,7 +40,7 @@ struct TextEncoderPrototypeDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "TextDecoder")]
+#[webapi(interface = web_api_interfaces::TextDecoder)]
struct TextDecoderObjectDeclaration {
#[webapi(slot = TEXT_DECODER_ENCODING_SLOT)]
encoding: String,
@@ -50,7 +51,7 @@ struct TextDecoderObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextDecoder", enumerable)]
+#[webapi(interface = web_api_interfaces::TextDecoder, enumerable)]
struct TextDecoderPrototypeDeclaration {
#[webapi(method, length = 0, callback = text_decoder_decode_callback)]
decode: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/crypto/install.rs b/moli-renderer-v8/src/context_bootstrap/crypto/install.rs
index 8b44d9b3b..557602ada 100644
--- a/moli-renderer-v8/src/context_bootstrap/crypto/install.rs
+++ b/moli-renderer-v8/src/context_bootstrap/crypto/install.rs
@@ -13,6 +13,7 @@ use super::*;
use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, set_private_value,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
const CRYPTO_SUBTLE_SLOT: &str = "__moliCryptoSubtle";
@@ -20,11 +21,11 @@ const CRYPTO_SUBTLE_AVAILABLE_SLOT: &str = "__moliCryptoSubtleAvailable";
const WINDOW_CRYPTO_SUBTLE_AVAILABLE_SLOT: &str = "__moliWindowCryptoSubtleAvailable";
#[derive(Default, WebApiObject)]
-#[webapi(allow_empty, interface = "Crypto")]
+#[webapi(allow_empty, interface = web_api_interfaces::Crypto)]
struct CryptoObjectDeclaration {}
#[derive(Default, WebApiObject)]
-#[webapi(allow_empty, interface = "SubtleCrypto")]
+#[webapi(allow_empty, interface = web_api_interfaces::SubtleCrypto)]
struct SubtleCryptoObjectDeclaration {}
#[derive(Default, WebApiObject)]
@@ -40,7 +41,7 @@ struct CryptoPrototypeAccessorsDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "Crypto")]
+#[webapi(interface = web_api_interfaces::Crypto)]
struct CryptoPrototypeOperationsDeclaration {
#[webapi(
method = "getRandomValues",
@@ -64,7 +65,7 @@ struct CryptoSecurePrototypeOperationsDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "SubtleCrypto")]
+#[webapi(interface = web_api_interfaces::SubtleCrypto)]
struct SubtleCryptoPrototypeOperationsDeclaration {
#[webapi(method, enumerable, length = 2, callback = crypto_subtle_digest_callback)]
digest: (),
@@ -95,7 +96,7 @@ struct SubtleCryptoPrototypeOperationsDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "SubtleCrypto")]
+#[webapi(interface = web_api_interfaces::SubtleCrypto)]
struct SubtleCryptoStaticOperationsDeclaration {
#[webapi(
static_method,
diff --git a/moli-renderer-v8/src/context_bootstrap/crypto/keys.rs b/moli-renderer-v8/src/context_bootstrap/crypto/keys.rs
index 39ca91071..c510c9db2 100644
--- a/moli-renderer-v8/src/context_bootstrap/crypto/keys.rs
+++ b/moli-renderer-v8/src/context_bootstrap/crypto/keys.rs
@@ -3,6 +3,7 @@ use crate::util::{
callback_data_index_value, get_private_value, global_constructor_object,
serialize_v8_iter_array, set_private_value,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(WebApiObject)]
@@ -139,7 +140,7 @@ const CRYPTO_KEY_USAGE_ORDER: &[&str] = &[
];
#[derive(WebApiObject)]
-#[webapi(interface = "CryptoKey", require_prototype, scope_lifetime = 'scope)]
+#[webapi(interface = web_api_interfaces::CryptoKey, require_prototype, scope_lifetime = 'scope)]
struct CryptoKeyObjectDeclaration<'scope, 'value> {
#[webapi(slot = CRYPTO_KEY_KIND_SLOT)]
key_type: &'value str,
@@ -158,7 +159,7 @@ struct CryptoKeyObjectDeclaration<'scope, 'value> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CryptoKey")]
+#[webapi(interface = web_api_interfaces::CryptoKey)]
struct CryptoKeyPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/events.rs b/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/events.rs
index a547620b3..0183cd8ba 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/events.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/events.rs
@@ -8,6 +8,7 @@ use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, global_constructor_prototype,
set_private_value,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiFunctionTemplate;
@@ -38,7 +39,7 @@ const FONT_FACE_SET_EVENT_HANDLERS: &[FontFaceSetEventHandler] = &[
];
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FontFaceSet")]
+#[webapi(interface = web_api_interfaces::FontFaceSet)]
struct FontFaceSetEventHandlerAccessorsDeclaration {
#[webapi(
accessor_property,
@@ -69,7 +70,7 @@ struct FontFaceSetEventHandlerAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FontFaceSetLoadEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::FontFaceSetLoadEvent, enumerable)]
struct FontFaceSetLoadEventPrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/font_face.rs b/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/font_face.rs
index 31abb66a9..e713601de 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/font_face.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/font_face.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::{
util::{callback_data_index_value, callback_data_item, get_private_value, set_private_value},
webidl,
@@ -6,7 +7,7 @@ use crate::{
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(WebApiObject)]
-#[webapi(interface = "FontFace")]
+#[webapi(interface = web_api_interfaces::FontFace)]
struct FontFaceObjectDeclaration<'s> {
#[webapi(slot = FONT_FACE_FAMILY_SLOT)]
family: String,
@@ -37,7 +38,7 @@ struct FontFaceObjectDeclaration<'s> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FontFace", receiver = "FontFace")]
+#[webapi(interface = web_api_interfaces::FontFace, receiver)]
struct FontFacePrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/storage.rs b/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/storage.rs
index bc2164a2c..117c5382c 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/storage.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_fontface_runtime/storage.rs
@@ -4,10 +4,11 @@ use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, serialize_v8_iter_array,
set_private_value,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(Default, WebApiObject)]
-#[webapi(interface = "FontFaceSet")]
+#[webapi(interface = web_api_interfaces::FontFaceSet)]
struct FontFaceSetObjectDeclaration {
#[webapi(slot = FONT_FACE_SET_FACES_SLOT, init = "array")]
faces: (),
@@ -24,7 +25,7 @@ struct FontFaceSetObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FontFaceSet")]
+#[webapi(interface = web_api_interfaces::FontFaceSet)]
struct FontFaceSetPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/css_runtime/highlights.rs b/moli-renderer-v8/src/context_bootstrap/css_runtime/highlights.rs
index ea3767172..242bca1a9 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_runtime/highlights.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_runtime/highlights.rs
@@ -3,6 +3,7 @@ use crate::util::{
call_script_visible_function, get_private_object,
materialize_hidden_function_template_prototype,
};
+use crate::web_api_interfaces;
use crate::webidl_iterator::webidl_collection_reflect_apply_intrinsic;
const HIGHLIGHT_ITERATOR_RECORDS_SLOT: &str = "__moliHighlightIteratorRecords";
@@ -31,7 +32,7 @@ struct HighlightIteratorResultDeclaration<'s> {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "Highlight Iterator",
+ interface = web_api_interfaces::HighlightIterator,
intrinsic_prototype_parent = v8::Intrinsic::SetIteratorPrototype,
prototype_to_string_tag = "Highlight Iterator",
readonly_prototype,
@@ -44,7 +45,7 @@ struct HighlightIteratorPrototypeDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "HighlightRegistry Iterator",
+ interface = web_api_interfaces::HighlightRegistryIterator,
intrinsic_prototype_parent = v8::Intrinsic::MapIteratorPrototype,
prototype_to_string_tag = "HighlightRegistry Iterator",
readonly_prototype,
@@ -136,7 +137,7 @@ pub(super) fn build_highlight_runtime_state<'s>(
};
let registry = v8::Local::<v8::Object>::try_from(value)
.map_err(|_| anyhow!("Highlight runtime did not return a registry object"))?;
- moli_webapi_declare::initialize_web_api_object(scope, registry, "HighlightRegistry")?;
+ web_api_interfaces::HighlightRegistry::DESCRIPTOR.initialize(scope, registry)?;
let highlight_constructor = highlight_constructor(scope, registry)?;
let registry_constructor = highlight_registry_constructor(scope, registry)?;
Ok(HighlightRuntimeState {
@@ -154,7 +155,7 @@ fn initialize_highlight_identity_callback<'s>(
let Ok(object) = v8::Local::<v8::Object>::try_from(args.get(0)) else {
return;
};
- if let Err(error) = moli_webapi_declare::initialize_web_api_object(scope, object, "Highlight") {
+ if let Err(error) = web_api_interfaces::Highlight::DESCRIPTOR.initialize(scope, object) {
throw_type_error(scope, &error.to_string());
}
}
@@ -197,7 +198,7 @@ fn highlight_iterator_factory_callback<'s>(
HighlightIteratorKind::Highlight => "Highlight Iterator",
HighlightIteratorKind::Registry => "HighlightRegistry Iterator",
};
- if moli_webapi_declare::initialize_web_api_object(scope, iterator, interface).is_err() {
+ if web_api_interfaces::initialize(scope, iterator, interface).is_err() {
return;
}
rv.set(iterator.into());
diff --git a/moli-renderer-v8/src/context_bootstrap/css_runtime/typed_om/map.rs b/moli-renderer-v8/src/context_bootstrap/css_runtime/typed_om/map.rs
index 1e6bd9bff..d3cf2284b 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_runtime/typed_om/map.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_runtime/typed_om/map.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::webidl_iterator::{
SnapshotWebIdlIteratorKind, invoke_webidl_collection_for_each_callback,
new_snapshot_webidl_iterator, prepare_webidl_collection_for_each_callback,
@@ -8,14 +9,14 @@ const ELEMENT_COMPUTED_STYLE_MAP_SLOT: &str = "__moliElementComputedStyleMap";
const STYLE_PROPERTY_MAP_STYLE_SLOT: &str = "__moliStylePropertyMapStyle";
#[derive(WebApiObject)]
-#[webapi(interface = "StylePropertyMapReadOnly")]
+#[webapi(interface = web_api_interfaces::StylePropertyMapReadOnly)]
struct ComputedStylePropertyMapDeclaration<'s> {
#[webapi(slot = STYLE_PROPERTY_MAP_STYLE_SLOT)]
style: v8::Local<'s, v8::Object>,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Element", enumerable)]
+#[webapi(interface = web_api_interfaces::Element, enumerable)]
struct ElementComputedStyleMapPrototypeDeclaration {
#[webapi(
method = "computedStyleMap",
@@ -26,7 +27,7 @@ struct ElementComputedStyleMapPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "StylePropertyMapReadOnly", enumerable)]
+#[webapi(interface = web_api_interfaces::StylePropertyMapReadOnly, enumerable)]
struct StylePropertyMapReadOnlyPrototypeDeclaration {
#[webapi(method, callback = style_property_map_get_callback, length = 1)]
get: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/css_runtime/typed_om/values.rs b/moli-renderer-v8/src/context_bootstrap/css_runtime/typed_om/values.rs
index 841ec20e6..bc98c0a83 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_runtime/typed_om/values.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_runtime/typed_om/values.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
const CSS_STYLE_VALUE_TEXT_SLOT: &str = "__moliCssStyleValueText";
const CSS_KEYWORD_VALUE_VALUE_SLOT: &str = "__moliCssKeywordValueValue";
@@ -12,21 +13,21 @@ const VALID_UNIT_NAMES: &[&str] = &[
];
#[derive(WebApiObject)]
-#[webapi(interface = "CSSStyleValue")]
+#[webapi(interface = web_api_interfaces::CSSStyleValue)]
struct CssStyleValueObjectDeclaration {
#[webapi(slot = CSS_STYLE_VALUE_TEXT_SLOT)]
text: String,
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSKeywordValue")]
+#[webapi(interface = web_api_interfaces::CSSKeywordValue)]
struct CssKeywordValueObjectDeclaration {
#[webapi(slot = CSS_KEYWORD_VALUE_VALUE_SLOT)]
value: String,
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSUnitValue")]
+#[webapi(interface = web_api_interfaces::CSSUnitValue)]
struct CssUnitValueObjectDeclaration {
#[webapi(slot = CSS_UNIT_VALUE_VALUE_SLOT)]
value: f64,
@@ -35,7 +36,7 @@ struct CssUnitValueObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSKeywordValue", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSKeywordValue, enumerable)]
struct CssKeywordValuePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -46,14 +47,14 @@ struct CssKeywordValuePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSStyleValue", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSStyleValue, enumerable)]
struct CssStyleValuePrototypeDeclaration {
#[webapi(method = "toString", callback = css_style_value_to_string_callback, length = 0)]
to_string: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSUnitValue", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSUnitValue, enumerable)]
struct CssUnitValuePrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/install.rs b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/install.rs
index 8c1a4c337..bf3887dff 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/install.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/install.rs
@@ -1,15 +1,16 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "CSSFontFeatureValuesMap")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::CSSFontFeatureValuesMap)]
struct CssFontFeatureValuesMapObjectDeclaration<'s> {
#[webapi(slot = CSS_FONT_FEATURE_VALUES_MAP_BACKING_SLOT)]
backing: v8::Local<'s, v8::Map>,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSFontFeatureValuesMap", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSFontFeatureValuesMap, enumerable)]
struct CssFontFeatureValuesMapPrototypeDeclaration {
#[webapi(accessor_property, getter = css_font_feature_values_map_size_getter_callback)]
size: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/rule_callbacks.rs b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/rule_callbacks.rs
index 48dcbff01..8d7d57c54 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/rule_callbacks.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/rule_callbacks.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
#[cfg(test)]
thread_local! {
@@ -257,7 +258,7 @@ pub(crate) fn build_css_generic_at_rule_object_from_stylo_rule_type<'s>(
declaration,
stylo_rule_type == CssRuleType::Keyframes,
);
- moli_webapi_declare::initialize_web_api_object(scope, object, prototype_name)
+ web_api_interfaces::initialize(scope, object, prototype_name)
.expect("CSS rule interface identity should initialize");
if let Some(prototype) = global_constructor_prototype(scope, prototype_name) {
let _ = object.set_prototype(scope, prototype.into());
@@ -551,7 +552,7 @@ pub(crate) fn build_css_rule_object_with_rule_context<'s>(
};
let object =
bind_css_at_rule_declaration(scope, declaration, rule_kind == CssAtRuleKind::Keyframes);
- moli_webapi_declare::initialize_web_api_object(scope, object, prototype_name)
+ web_api_interfaces::initialize(scope, object, prototype_name)
.expect("CSS rule interface identity should initialize");
if let Some(prototype) = global_constructor_prototype(scope, prototype_name) {
let _ = object.set_prototype(scope, prototype.into());
diff --git a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/specific_rules.rs b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/specific_rules.rs
index 430ad77de..81c828e35 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/specific_rules.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/specific_rules.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::webidl_iterator::{
MaplikeWebIdlIteratorMethod, call_maplike_webidl_for_each, new_maplike_webidl_iterator,
};
@@ -302,7 +303,8 @@ pub(crate) fn build_css_font_face_rule_object_from_stylo_view<'s>(
}
.bind(scope)
.expect("CSSFontFaceRule declaration should bind");
- moli_webapi_declare::initialize_web_api_object(scope, object, "CSSFontFaceRule")
+ web_api_interfaces::CSSFontFaceRule::DESCRIPTOR
+ .initialize(scope, object)
.expect("CSS rule interface identity should initialize");
if let Some(prototype) = global_constructor_prototype(scope, "CSSFontFaceRule") {
let _ = object.set_prototype(scope, prototype.into());
diff --git a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/types.rs b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/types.rs
index c88a9f4ab..741305e39 100644
--- a/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/types.rs
+++ b/moli-renderer-v8/src/context_bootstrap/css_stylesheet_runtime/types.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_selector::StyleRuleNamespaceContext;
use moli_webapi_declare::WebApiObject;
@@ -216,7 +217,7 @@ pub enum CssRulePdbDeclarationKind {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSRule")]
+#[webapi(interface = web_api_interfaces::CSSRule)]
pub struct CssRuleConstantsDeclaration {
#[webapi(constant = "UNKNOWN_RULE", value = CSS_RULE_UNKNOWN_RULE_TYPE)]
pub unknown_rule: (),
@@ -277,28 +278,28 @@ pub struct CssRuleConstantsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSStyleSheet")]
+#[webapi(interface = web_api_interfaces::CSSStyleSheet)]
pub struct CssStyleSheetDeclaration<'scope> {
#[webapi(slot = CSS_STYLE_SHEET_RULES_SLOT)]
pub rules: v8::Local<'scope, v8::Value>,
}
#[derive(WebApiObject)]
-#[webapi(interface = "StyleSheetList")]
+#[webapi(interface = web_api_interfaces::StyleSheetList)]
pub struct StyleSheetListDeclaration {
#[webapi(slot = STYLE_SHEET_LIST_LENGTH_SLOT, init = 0)]
pub length: (),
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSRuleList")]
+#[webapi(interface = web_api_interfaces::CSSRuleList)]
pub struct CssRuleListDeclaration {
#[webapi(slot = CSS_RULE_LIST_LENGTH_SLOT)]
pub length: u32,
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSRule")]
+#[webapi(interface = web_api_interfaces::CSSRule)]
pub struct CssAtRuleDeclaration<'scope> {
#[webapi(slot = CSS_RULE_DETACHED_SNAPSHOT_TEXT_SLOT)]
pub css_text: String,
@@ -311,7 +312,7 @@ pub struct CssAtRuleDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSMarginRule")]
+#[webapi(interface = web_api_interfaces::CSSMarginRule)]
pub struct CssMarginRuleDeclaration<'scope> {
#[webapi(slot = CSS_RULE_DETACHED_SNAPSHOT_TEXT_SLOT)]
pub css_text: String,
@@ -326,7 +327,7 @@ pub struct CssMarginRuleDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSKeyframeRule")]
+#[webapi(interface = web_api_interfaces::CSSKeyframeRule)]
pub struct CssKeyframeRuleDeclaration<'scope> {
#[webapi(slot = CSS_RULE_DETACHED_SNAPSHOT_TEXT_SLOT)]
pub css_text: String,
@@ -341,7 +342,7 @@ pub struct CssKeyframeRuleDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSFontFeatureValuesRule")]
+#[webapi(interface = web_api_interfaces::CSSFontFeatureValuesRule)]
pub struct CssFontFeatureValuesRuleDeclaration<'scope> {
#[webapi(slot = CSS_RULE_DETACHED_SNAPSHOT_TEXT_SLOT)]
pub css_text: String,
@@ -354,7 +355,7 @@ pub struct CssFontFeatureValuesRuleDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSPropertyRule")]
+#[webapi(interface = web_api_interfaces::CSSPropertyRule)]
pub struct CssPropertyRuleDeclaration<'scope> {
#[webapi(slot = CSS_RULE_DETACHED_SNAPSHOT_TEXT_SLOT)]
pub css_text: String,
@@ -375,7 +376,7 @@ pub struct CssPropertyRuleDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSStyleRule")]
+#[webapi(interface = web_api_interfaces::CSSStyleRule)]
pub struct CssStyleRuleDeclaration<'scope> {
#[webapi(slot = CSS_RULE_DETACHED_SNAPSHOT_TEXT_SLOT)]
pub css_text: String,
@@ -390,7 +391,7 @@ pub struct CssStyleRuleDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "CSSNestedDeclarations")]
+#[webapi(interface = web_api_interfaces::CSSNestedDeclarations)]
pub struct CssNestedDeclarationsRuleDeclaration<'scope> {
#[webapi(slot = CSS_RULE_DETACHED_SNAPSHOT_TEXT_SLOT)]
pub css_text: String,
@@ -403,7 +404,7 @@ pub struct CssNestedDeclarationsRuleDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "MediaList")]
+#[webapi(interface = web_api_interfaces::MediaList)]
pub struct MediaListDeclaration<'scope> {
#[webapi(slot = CSS_MEDIA_LIST_OWNER_RULE_SLOT)]
pub owner: v8::Local<'scope, v8::Object>,
@@ -412,7 +413,7 @@ pub struct MediaListDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "StyleSheet", enumerable)]
+#[webapi(interface = web_api_interfaces::StyleSheet, enumerable)]
pub struct StyleSheetBasePrototypeDeclaration {
#[webapi(accessor_property, getter = css_style_sheet_type_getter_callback)]
r#type: (),
@@ -439,7 +440,7 @@ pub struct StyleSheetBasePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSStyleSheet", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSStyleSheet, enumerable)]
pub struct CssStyleSheetPrototypeDeclaration {
#[webapi(accessor_property, getter = css_style_sheet_css_rules_getter_callback)]
pub css_rules: (),
@@ -462,7 +463,7 @@ pub struct CssStyleSheetPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "StyleSheetList", enumerable)]
+#[webapi(interface = web_api_interfaces::StyleSheetList, enumerable)]
pub struct StyleSheetListPrototypeDeclaration {
#[webapi(accessor_property, getter = style_sheet_list_length_getter_callback)]
pub length: (),
@@ -476,7 +477,7 @@ pub struct StyleSheetListPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSRuleList", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSRuleList, enumerable)]
pub struct CssRuleListPrototypeDeclaration {
#[webapi(accessor_property, getter = css_rule_list_length_getter_callback)]
pub length: (),
@@ -490,7 +491,7 @@ pub struct CssRuleListPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MediaList", enumerable)]
+#[webapi(interface = web_api_interfaces::MediaList, enumerable)]
pub struct MediaListPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -523,7 +524,7 @@ pub struct LinkStylePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSRule, enumerable)]
pub struct CssRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_rule_type_getter_callback)]
r#type: (),
@@ -540,7 +541,7 @@ pub struct CssRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSGroupingRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSGroupingRule, enumerable)]
pub struct CssGroupingRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_grouping_rule_css_rules_getter_callback)]
pub css_rules: (),
@@ -551,14 +552,14 @@ pub struct CssGroupingRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSConditionRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSConditionRule, enumerable)]
pub struct CssConditionRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_condition_rule_condition_text_getter_callback)]
pub condition_text: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSMediaRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSMediaRule, enumerable)]
pub struct CssMediaRulePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -571,14 +572,14 @@ pub struct CssMediaRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSSupportsRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSSupportsRule, enumerable)]
pub struct CssSupportsRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_supports_rule_matches_getter_callback)]
pub matches: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSContainerRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSContainerRule, enumerable)]
pub struct CssContainerRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_container_rule_container_name_getter_callback)]
pub container_name: (),
@@ -587,21 +588,21 @@ pub struct CssContainerRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSLayerBlockRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSLayerBlockRule, enumerable)]
pub struct CssLayerBlockRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_layer_block_rule_name_getter_callback)]
pub name: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSLayerStatementRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSLayerStatementRule, enumerable)]
pub struct CssLayerStatementRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_layer_statement_rule_name_list_getter_callback)]
pub name_list: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSScopeRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSScopeRule, enumerable)]
pub struct CssScopeRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_scope_rule_start_getter_callback)]
pub start: (),
@@ -610,7 +611,7 @@ pub struct CssScopeRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSImportRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSImportRule, enumerable)]
pub struct CssImportRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_import_rule_href_getter_callback)]
pub href: (),
@@ -629,7 +630,7 @@ pub struct CssImportRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSFontFaceRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSFontFaceRule, enumerable)]
pub struct CssFontFaceRulePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -640,7 +641,7 @@ pub struct CssFontFaceRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSMarginRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSMarginRule, enumerable)]
pub struct CssMarginRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_margin_rule_name_getter_callback)]
pub name: (),
@@ -653,7 +654,7 @@ pub struct CssMarginRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSFontFeatureValuesRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSFontFeatureValuesRule, enumerable)]
pub struct CssFontFeatureValuesRulePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -679,7 +680,7 @@ pub struct CssFontFeatureValuesRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSPropertyRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSPropertyRule, enumerable)]
pub struct CssPropertyRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_property_rule_name_getter_callback)]
pub name: (),
@@ -695,7 +696,7 @@ pub struct CssPropertyRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSPageRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSPageRule, enumerable)]
pub struct CssPageRulePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -712,7 +713,7 @@ pub struct CssPageRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSKeyframesRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSKeyframesRule, enumerable)]
pub struct CssKeyframesRulePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -738,7 +739,7 @@ pub struct CssKeyframesRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSKeyframeRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSKeyframeRule, enumerable)]
pub struct CssKeyframeRulePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -755,7 +756,7 @@ pub struct CssKeyframeRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSNamespaceRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSNamespaceRule, enumerable)]
pub struct CssNamespaceRulePrototypeDeclaration {
#[webapi(
accessor_property = "namespaceURI",
@@ -767,14 +768,14 @@ pub struct CssNamespaceRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSCounterStyleRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSCounterStyleRule, enumerable)]
pub struct CssCounterStyleRulePrototypeDeclaration {
#[webapi(accessor_property, getter = css_counter_style_rule_name_getter_callback)]
pub name: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSStyleRule", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSStyleRule, enumerable)]
pub struct CssStyleRulePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -793,7 +794,7 @@ pub struct CssStyleRulePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSNestedDeclarations", enumerable)]
+#[webapi(interface = web_api_interfaces::CSSNestedDeclarations, enumerable)]
pub struct CssNestedDeclarationsPrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/dom_rect.rs b/moli-renderer-v8/src/context_bootstrap/dom_rect.rs
index 730bea00e..c81fb7b2f 100644
--- a/moli-renderer-v8/src/context_bootstrap/dom_rect.rs
+++ b/moli-renderer-v8/src/context_bootstrap/dom_rect.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::{callback_data_index_value, get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -9,7 +10,7 @@ const DOM_RECT_WIDTH_SLOT: &str = "__moliDomRectWidth";
const DOM_RECT_HEIGHT_SLOT: &str = "__moliDomRectHeight";
#[derive(WebApiObject)]
-#[webapi(interface = "DOMRect")]
+#[webapi(interface = web_api_interfaces::DOMRect)]
struct DomRectObjectDeclaration {
#[webapi(slot = DOM_RECT_X_SLOT)]
x: f64,
@@ -22,7 +23,7 @@ struct DomRectObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "DOMRectReadOnly")]
+#[webapi(interface = web_api_interfaces::DOMRectReadOnly)]
struct DomRectReadOnlyObjectDeclaration {
#[webapi(slot = DOM_RECT_X_SLOT)]
x: f64,
@@ -35,7 +36,7 @@ struct DomRectReadOnlyObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMRectReadOnly")]
+#[webapi(interface = web_api_interfaces::DOMRectReadOnly)]
struct DomRectReadOnlyPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -98,7 +99,7 @@ struct DomRectReadOnlyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMRect")]
+#[webapi(interface = web_api_interfaces::DOMRect)]
struct DomRectPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -135,7 +136,7 @@ struct DomRectPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMRectReadOnly")]
+#[webapi(interface = web_api_interfaces::DOMRectReadOnly)]
struct DomRectReadOnlyConstructorDeclaration {
#[webapi(
static_method = "fromRect",
@@ -146,7 +147,7 @@ struct DomRectReadOnlyConstructorDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMRect")]
+#[webapi(interface = web_api_interfaces::DOMRect)]
struct DomRectConstructorDeclaration {
#[webapi(
static_method = "fromRect",
diff --git a/moli-renderer-v8/src/context_bootstrap/event_template.rs b/moli-renderer-v8/src/context_bootstrap/event_template.rs
index 6c2f33c52..e24e1edf6 100644
--- a/moli-renderer-v8/src/context_bootstrap/event_template.rs
+++ b/moli-renderer-v8/src/context_bootstrap/event_template.rs
@@ -25,6 +25,7 @@ use super::{
selection_surface::document_get_selection_callback,
specs::{ConstructorKind, ConstructorSpec},
};
+use crate::web_api_interfaces;
use crate::{native_bridge::document, window_host};
use moli_webapi_declare::WebApiFunctionTemplate;
@@ -36,7 +37,7 @@ pub(in crate::context_bootstrap) fn object_is_event_target<'s>(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Event", enumerable)]
+#[webapi(interface = web_api_interfaces::Event, enumerable)]
struct EventBaseTemplateMethodsDeclaration {
#[webapi(accessor_property = "type", getter = event_type_getter_function)]
event_type: (),
@@ -130,7 +131,7 @@ struct EventBaseTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CloseEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::CloseEvent, enumerable)]
struct CloseEventTemplateAccessorsDeclaration {
#[webapi(accessor_property = "wasClean", getter = close_event_was_clean_getter_function)]
was_clean: (),
@@ -143,28 +144,28 @@ struct CloseEventTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TrackEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::TrackEvent, enumerable)]
struct TrackEventTemplateAccessorsDeclaration {
#[webapi(accessor_property, getter = track_event_track_getter_function)]
track: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SubmitEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::SubmitEvent, enumerable)]
struct SubmitEventTemplateAccessorsDeclaration {
#[webapi(accessor_property, getter = submit_event_submitter_getter_function)]
submitter: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FormDataEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::FormDataEvent, enumerable)]
struct FormDataEventTemplateAccessorsDeclaration {
#[webapi(accessor_property = "formData", getter = form_data_event_form_data_getter_function)]
form_data: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "UIEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::UIEvent, enumerable)]
struct UiEventTemplateMethodsDeclaration {
#[webapi(method = "initUIEvent", length = 0, callback = ui_event_init_callback)]
init_ui_event: (),
@@ -177,7 +178,7 @@ struct UiEventTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FocusEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::FocusEvent, enumerable)]
struct FocusEventTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "relatedTarget",
@@ -187,14 +188,14 @@ struct FocusEventTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::TextEvent, enumerable)]
struct TextEventTemplateMethodsDeclaration {
#[webapi(method = "initTextEvent", length = 1, callback = text_event_init_callback)]
init_text_event: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CompositionEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::CompositionEvent, enumerable)]
struct CompositionEventTemplateMethodsDeclaration {
#[webapi(
method = "initCompositionEvent",
@@ -205,14 +206,14 @@ struct CompositionEventTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CustomEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::CustomEvent, enumerable)]
struct CustomEventTemplateMethodsDeclaration {
#[webapi(method = "initCustomEvent", length = 1, callback = custom_event_init_callback)]
init_custom_event: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "StorageEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::StorageEvent, enumerable)]
struct StorageEventTemplateMethodsDeclaration {
#[webapi(
method = "initStorageEvent",
@@ -223,7 +224,7 @@ struct StorageEventTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "KeyboardEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::KeyboardEvent, enumerable)]
struct KeyboardEventTemplateMethodsDeclaration {
#[webapi(method = "initKeyboardEvent", length = 7, callback = keyboard_event_init_callback)]
init_keyboard_event: (),
@@ -237,7 +238,7 @@ struct KeyboardEventTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MouseEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::MouseEvent, enumerable)]
struct MouseEventTemplateMethodsDeclaration {
#[webapi(
accessor_property = "relatedTarget",
@@ -256,7 +257,7 @@ struct MouseEventTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WheelEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::WheelEvent, enumerable)]
struct WheelEventTemplateConstantsDeclaration {
#[webapi(constant = "DOM_DELTA_PIXEL", value = 0u32)]
dom_delta_pixel: (),
@@ -269,7 +270,7 @@ struct WheelEventTemplateConstantsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "PointerEvent", enumerable)]
+#[webapi(interface = web_api_interfaces::PointerEvent, enumerable)]
struct PointerEventTemplateMethodsDeclaration {
#[webapi(
method = "getPredictedEvents",
@@ -280,7 +281,7 @@ struct PointerEventTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "EventTarget", enumerable, receiver = "EventTarget")]
+#[webapi(interface = web_api_interfaces::EventTarget, enumerable, receiver)]
struct EventTargetTemplateMethodsDeclaration {
#[webapi(
method = "addEventListener",
@@ -305,7 +306,7 @@ struct EventTargetTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentEventTemplateMethodsDeclaration {
#[webapi(method = "createEvent", length = 1, callback = document_create_event_callback)]
create_event: (),
@@ -335,7 +336,7 @@ pub(super) fn install_event_template_bindings<'s>(
install_event_base_bindings(scope, template);
}
- match spec.name {
+ match spec.interface.name() {
"UIEvent" => {
let proto = template.prototype_template(scope);
UiEventTemplateMethodsDeclaration::initialize_prototype_template(scope, proto);
diff --git a/moli-renderer-v8/src/context_bootstrap/events/base.rs b/moli-renderer-v8/src/context_bootstrap/events/base.rs
index 896740d05..36a32ec69 100644
--- a/moli-renderer-v8/src/context_bootstrap/events/base.rs
+++ b/moli-renderer-v8/src/context_bootstrap/events/base.rs
@@ -2,6 +2,7 @@ use super::init::read_event_init;
use super::*;
use crate::context_bootstrap::{current_performance_time_origin, dom_time_since_origin_millis};
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
@@ -31,7 +32,7 @@ struct InitializedEventHeaderDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "Event", data_properties, enumerable)]
+#[webapi(prototype = "Object", interface = web_api_interfaces::Event, data_properties, enumerable)]
struct InitializedEventStateDeclaration {
bubbles: bool,
cancelable: bool,
diff --git a/moli-renderer-v8/src/context_bootstrap/events/subclasses/constructor.rs b/moli-renderer-v8/src/context_bootstrap/events/subclasses/constructor.rs
index 74f4ad5fd..ad9220957 100644
--- a/moli-renderer-v8/src/context_bootstrap/events/subclasses/constructor.rs
+++ b/moli-renderer-v8/src/context_bootstrap/events/subclasses/constructor.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
fn event_subclass_kind_from_callback_data(
data: v8::Local<'_, v8::Value>,
@@ -168,7 +169,7 @@ fn event_subclass_constructor_callback<'s>(
}
}
- moli_webapi_declare::initialize_web_api_object(scope, event, kind.constructor_name())
+ web_api_interfaces::initialize(scope, event, kind.constructor_name())
.expect("event primary interface should initialize");
set_private_value(
scope,
diff --git a/moli-renderer-v8/src/context_bootstrap/events/subclasses/data.rs b/moli-renderer-v8/src/context_bootstrap/events/subclasses/data.rs
index f534c3d8f..f919c447d 100644
--- a/moli-renderer-v8/src/context_bootstrap/events/subclasses/data.rs
+++ b/moli-renderer-v8/src/context_bootstrap/events/subclasses/data.rs
@@ -14,6 +14,7 @@ use crate::native_bridge::element::scroll_to_url_fragment_or_top;
use crate::native_bridge::throw_dom_exception;
use crate::util::context_host_ptr_from_global_bridge;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
use url::Url;
@@ -73,7 +74,7 @@ struct NavigationInterceptOptionsMembers {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "NavigationPrecommitController")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::NavigationPrecommitController)]
struct PrecommitControllerDeclaration<'scope> {
#[webapi(slot = PRECOMMIT_CONTROLLER_EVENT_SLOT)]
event: v8::Local<'scope, v8::Object>,
@@ -98,7 +99,7 @@ struct PrecommitControllerDeclaration<'scope> {
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "NavigateEvent")]
+#[webapi(interface = web_api_interfaces::NavigateEvent)]
struct NavigateEventMethodsDeclaration {
#[webapi(
method,
diff --git a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs
index c0e4d8542..b425c75ee 100644
--- a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs
+++ b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs
@@ -278,10 +278,10 @@ impl ExposedInterfaceMetadataTable {
let mut by_name = HashMap::with_capacity(specs.len());
for (index, spec) in specs.iter().enumerate() {
let id = InterfaceId::from_index(index)?;
- if by_name.insert(spec.name, id).is_some() {
+ if by_name.insert(spec.interface.name(), id).is_some() {
return Err(anyhow!(
"duplicate exposed interface metadata name `{}`",
- spec.name
+ spec.interface.name()
));
}
}
@@ -289,18 +289,19 @@ impl ExposedInterfaceMetadataTable {
let mut entries = Vec::with_capacity(specs.len());
for (index, spec) in specs.iter().enumerate() {
let parent = spec
- .parent
+ .interface
+ .parent_name()
.map(|name| {
by_name.get(name).copied().ok_or_else(|| {
anyhow!(
"exposed interface `{}` references unknown parent `{name}`",
- spec.name
+ spec.interface.name()
)
})
})
.transpose()?;
- let is_storage = STORAGE_INTERFACE_NAMES.contains(&spec.name);
- let exposure = exposure_for_name(spec.name);
+ let is_storage = STORAGE_INTERFACE_NAMES.contains(&spec.interface.name());
+ let exposure = exposure_for_name(spec.interface.name());
let prototype_property = match spec.prototype_property() {
ConstructorPrototypeProperty::TemplateReadOnly => {
ResolvedPrototypeProperty::TemplateReadOnly
@@ -311,7 +312,7 @@ impl ExposedInterfaceMetadataTable {
let prototype = by_name.get(prototype_interface).copied().ok_or_else(|| {
anyhow!(
"exposed interface `{}` references unknown runtime prototype interface `{prototype_interface}`",
- spec.name
+ spec.interface.name()
)
})?;
ResolvedPrototypeProperty::RuntimeInstalled { prototype }
@@ -319,12 +320,12 @@ impl ExposedInterfaceMetadataTable {
};
entries.push(ExposedInterfaceMetadata {
id: InterfaceId::from_index(index)?,
- name: spec.name,
+ name: spec.interface.name(),
kind: spec.kind,
parent,
exposure,
secure_context_only: is_storage
- || SECURE_CONTEXT_ONLY_INTERFACE_NAMES.contains(&spec.name),
+ || SECURE_CONTEXT_ONLY_INTERFACE_NAMES.contains(&spec.interface.name()),
installation: installation_for_spec(*spec),
prototype_property,
});
@@ -357,9 +358,9 @@ impl ExposedInterfaceMetadataTable {
}
pub(super) fn installation_for_spec(spec: ConstructorSpec) -> GlobalInstallation {
- if NON_EXPOSED_INTERFACE_NAMES.contains(&spec.name) {
+ if NON_EXPOSED_INTERFACE_NAMES.contains(&spec.interface.name()) {
GlobalInstallation::NotExposed
- } else if EAGER_INTERFACE_NAMES.contains(&spec.name) {
+ } else if EAGER_INTERFACE_NAMES.contains(&spec.interface.name()) {
GlobalInstallation::Eager
} else {
GlobalInstallation::Lazy
@@ -431,11 +432,15 @@ fn validate_materialization_cycles(entries: &[ExposedInterfaceMetadata]) -> Resu
mod tests {
use super::*;
use crate::context_bootstrap::specs::ConstructorKind;
+ use crate::web_api_interfaces;
+ use moli_webapi_declare::WebApiInterfaceDescriptor;
- fn spec(name: &'static str, parent: Option<&'static str>) -> ConstructorSpec {
+ fn spec(
+ name: &'static str,
+ parent: Option<&'static moli_webapi_declare::WebApiInterfaceDescriptor>,
+ ) -> ConstructorSpec {
ConstructorSpec {
- name,
- parent,
+ interface: moli_webapi_declare::WebApiInterfaceDescriptor::new(name, parent),
kind: ConstructorKind::Illegal,
}
}
@@ -444,7 +449,10 @@ mod tests {
fn metadata_assigns_stable_ids_and_resolves_parents() {
let table = ExposedInterfaceMetadataTable::from_constructor_specs(&[
spec("Parent", None),
- spec("Child", Some("Parent")),
+ spec(
+ "Child",
+ Some(&const { WebApiInterfaceDescriptor::new("Parent", None) }),
+ ),
])
.expect("valid metadata");
let parent = table.metadata_by_name("Parent").expect("parent metadata");
@@ -528,13 +536,28 @@ mod tests {
#[test]
fn chromium_worker_exposure_exceptions_are_preserved() {
let table = ExposedInterfaceMetadataTable::from_constructor_specs(&[
- spec("Worker", Some("EventTarget")),
+ spec(
+ "Worker",
+ Some(&const { WebApiInterfaceDescriptor::new("EventTarget", None) }),
+ ),
spec("EventTarget", None),
- spec("ProgressEvent", Some("Event")),
+ spec(
+ "ProgressEvent",
+ Some(&const { WebApiInterfaceDescriptor::new("Event", None) }),
+ ),
spec("Event", None),
- spec("XMLHttpRequestEventTarget", Some("EventTarget")),
- spec("XMLHttpRequestUpload", Some("XMLHttpRequestEventTarget")),
- spec("XMLHttpRequest", Some("XMLHttpRequestEventTarget")),
+ spec(
+ "XMLHttpRequestEventTarget",
+ Some(&const { WebApiInterfaceDescriptor::new("EventTarget", None) }),
+ ),
+ spec(
+ "XMLHttpRequestUpload",
+ Some(&const { WebApiInterfaceDescriptor::new("XMLHttpRequestEventTarget", None) }),
+ ),
+ spec(
+ "XMLHttpRequest",
+ Some(&const { WebApiInterfaceDescriptor::new("XMLHttpRequestEventTarget", None) }),
+ ),
spec("FileReaderSync", None),
])
.expect("worker exposure metadata");
@@ -580,8 +603,7 @@ mod tests {
spec("Window", None),
spec("DOMError", None),
ConstructorSpec {
- name: "Audio",
- parent: None,
+ interface: web_api_interfaces::Audio::DESCRIPTOR,
kind: ConstructorKind::Audio,
},
spec("HTMLAudioElement", None),
@@ -629,14 +651,20 @@ mod tests {
assert!(
ExposedInterfaceMetadataTable::from_constructor_specs(&[spec(
"Child",
- Some("Missing"),
+ Some(&const { WebApiInterfaceDescriptor::new("Missing", None) }),
)])
.is_err()
);
assert!(
ExposedInterfaceMetadataTable::from_constructor_specs(&[
- spec("A", Some("B")),
- spec("B", Some("A")),
+ spec(
+ "A",
+ Some(&const { WebApiInterfaceDescriptor::new("B", None) })
+ ),
+ spec(
+ "B",
+ Some(&const { WebApiInterfaceDescriptor::new("A", None) })
+ ),
])
.is_err()
);
@@ -646,8 +674,7 @@ mod tests {
fn metadata_resolves_and_validates_runtime_prototype_dependencies() {
let table = ExposedInterfaceMetadataTable::from_constructor_specs(&[
ConstructorSpec {
- name: "Audio",
- parent: None,
+ interface: web_api_interfaces::Audio::DESCRIPTOR,
kind: ConstructorKind::Audio,
},
spec("HTMLAudioElement", None),
@@ -666,8 +693,7 @@ mod tests {
assert!(
ExposedInterfaceMetadataTable::from_constructor_specs(&[ConstructorSpec {
- name: "Audio",
- parent: None,
+ interface: web_api_interfaces::Audio::DESCRIPTOR,
kind: ConstructorKind::Audio,
}])
.is_err(),
@@ -676,11 +702,13 @@ mod tests {
assert!(
ExposedInterfaceMetadataTable::from_constructor_specs(&[
ConstructorSpec {
- name: "Audio",
- parent: None,
+ interface: web_api_interfaces::Audio::DESCRIPTOR,
kind: ConstructorKind::Audio,
},
- spec("HTMLAudioElement", Some("Audio")),
+ spec(
+ "HTMLAudioElement",
+ Some(&const { WebApiInterfaceDescriptor::new("Audio", None) })
+ ),
])
.is_err(),
"runtime prototype dependencies must participate in cycle validation"
diff --git a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/template_registry.rs b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/template_registry.rs
index c58a71ab6..6345c3798 100644
--- a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/template_registry.rs
+++ b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/template_registry.rs
@@ -61,7 +61,9 @@ impl ExposedInterfaceTemplateRegistry {
let metadata = ExposedInterfaceMetadataTable::from_constructor_specs(&specs)?;
moli_webapi_declare::register_web_api_interfaces(
scope,
- specs.iter().map(|spec| (spec.name, spec.parent)),
+ specs
+ .iter()
+ .map(|spec| (spec.interface.name(), spec.interface.parent_name())),
)?;
let templates = (0..metadata.len())
.map(|_| ExposedInterfaceTemplateEntry::new())
@@ -220,10 +222,10 @@ impl ExposedInterfaceTemplateRegistry {
metadata.name
)
})?;
- if spec.name != metadata.name {
+ if spec.interface.name() != metadata.name {
return Err(anyhow!(
"constructor spec `{}` does not match metadata `{}`",
- spec.name,
+ spec.interface.name(),
metadata.name
));
}
diff --git a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/tests.rs b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/tests.rs
index 5bb69c3ab..45d0f44dd 100644
--- a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/tests.rs
+++ b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/tests.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::cell::Cell;
use std::pin::pin;
@@ -158,8 +159,7 @@ fn insecure_window_filter_rejects_a_failed_interface_deletion() {
let context = v8::Context::new(scope, Default::default());
let scope = &mut v8::ContextScope::new(scope, context);
let specs = vec![ConstructorSpec {
- name: "StorageManager",
- parent: None,
+ interface: web_api_interfaces::StorageManager::DESCRIPTOR,
kind: ConstructorKind::StorageManager,
}];
super::template_registry::ExposedInterfaceTemplateRegistry::install(
diff --git a/moli-renderer-v8/src/context_bootstrap/file_api/data_transfer.rs b/moli-renderer-v8/src/context_bootstrap/file_api/data_transfer.rs
index 1468ebd2a..39c4b026b 100644
--- a/moli-renderer-v8/src/context_bootstrap/file_api/data_transfer.rs
+++ b/moli-renderer-v8/src/context_bootstrap/file_api/data_transfer.rs
@@ -3,6 +3,7 @@ use crate::blob;
use crate::native_bridge::throw_dom_exception;
use crate::runtime::{RendererDragData, RendererDraggedDirectory, RendererDraggedFile};
use crate::util::{get_private_object, get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_file_api::data_transfer::{
DataTransferItemSummary, child_entry_full_path, clear_data_removes_item,
@@ -43,7 +44,7 @@ pub(super) const FILE_SYSTEM_DIRECTORY_READER_ERROR_SLOT: &str =
"__lmFileSystemDirectoryReaderError";
#[derive(WebApiObject)]
-#[webapi(interface = "DataTransfer", require_prototype)]
+#[webapi(interface = web_api_interfaces::DataTransfer, require_prototype)]
struct DataTransferObjectDeclaration<'s> {
#[webapi(slot = DATA_TRANSFER_FILES_SLOT)]
files: v8::Local<'s, v8::Object>,
@@ -67,7 +68,7 @@ pub(crate) fn is_branded_data_transfer_object<'s>(
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "DataTransfer", require_prototype)]
+#[webapi(interface = web_api_interfaces::DataTransfer, require_prototype)]
struct DataTransferShellDeclaration {
#[webapi(slot = DATA_TRANSFER_FILES_SLOT, init = "null")]
files: (),
@@ -82,7 +83,7 @@ struct DataTransferShellDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DataTransfer")]
+#[webapi(interface = web_api_interfaces::DataTransfer)]
struct DataTransferPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = data_transfer_files_getter, enumerable)]
files: (),
@@ -107,7 +108,7 @@ struct DataTransferPrototypeAccessorsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "DataTransferItemList", require_prototype)]
+#[webapi(interface = web_api_interfaces::DataTransferItemList, require_prototype)]
struct DataTransferItemListObjectDeclaration<'s> {
#[webapi(
slot = DATA_TRANSFER_ITEM_LIST_ARRAY_SLOT,
@@ -124,14 +125,14 @@ struct DataTransferItemListObjectDeclaration<'s> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DataTransferItemList")]
+#[webapi(interface = web_api_interfaces::DataTransferItemList)]
struct DataTransferItemListPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = data_transfer_item_list_length_getter, enumerable)]
length: (),
}
#[derive(WebApiObject)]
-#[webapi(interface = "DataTransferItem", scope_lifetime = 's, require_prototype)]
+#[webapi(interface = web_api_interfaces::DataTransferItem, scope_lifetime = 's, require_prototype)]
struct DataTransferFileItemObjectDeclaration<'s, 'item_type> {
#[webapi(slot = DATA_TRANSFER_ITEM_KIND_SLOT, constructor_default = "file")]
kind: &'static str,
@@ -144,7 +145,7 @@ struct DataTransferFileItemObjectDeclaration<'s, 'item_type> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "DataTransferItem", require_prototype)]
+#[webapi(interface = web_api_interfaces::DataTransferItem, require_prototype)]
struct DataTransferDirectoryItemObjectDeclaration<'s> {
#[webapi(slot = DATA_TRANSFER_ITEM_KIND_SLOT, constructor_default = "file")]
kind: &'static str,
@@ -155,7 +156,7 @@ struct DataTransferDirectoryItemObjectDeclaration<'s> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "DataTransferItem", require_prototype)]
+#[webapi(interface = web_api_interfaces::DataTransferItem, require_prototype)]
struct DataTransferStringItemObjectDeclaration<'item_type, 'data> {
#[webapi(slot = DATA_TRANSFER_ITEM_KIND_SLOT, constructor_default = "string")]
kind: &'static str,
@@ -166,7 +167,7 @@ struct DataTransferStringItemObjectDeclaration<'item_type, 'data> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DataTransferItem")]
+#[webapi(interface = web_api_interfaces::DataTransferItem)]
struct DataTransferItemPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = data_transfer_item_kind_getter, enumerable)]
kind: (),
@@ -175,7 +176,7 @@ struct DataTransferItemPrototypeAccessorsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "FileSystem", require_prototype)]
+#[webapi(interface = web_api_interfaces::FileSystem, require_prototype)]
struct FileSystemObjectDeclaration<'s> {
#[webapi(data_property, constructor_default = "")]
name: &'static str,
@@ -185,7 +186,7 @@ struct FileSystemObjectDeclaration<'s> {
#[derive(WebApiObject)]
#[webapi(
- interface = "FileSystemFileEntry",
+ interface = web_api_interfaces::FileSystemFileEntry,
scope_lifetime = 's,
require_prototype
)]
@@ -206,7 +207,7 @@ struct FileSystemFileEntryObjectDeclaration<'s, 'full_path, 'name> {
#[derive(WebApiObject)]
#[webapi(
- interface = "FileSystemDirectoryEntry",
+ interface = web_api_interfaces::FileSystemDirectoryEntry,
scope_lifetime = 's,
require_prototype
)]
@@ -226,7 +227,7 @@ struct FileSystemDirectoryEntryObjectDeclaration<'s, 'full_path, 'name> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemEntry")]
+#[webapi(interface = web_api_interfaces::FileSystemEntry)]
struct FileSystemEntryPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = file_system_entry_filesystem_getter, enumerable)]
filesystem: (),
@@ -253,7 +254,7 @@ struct FileSystemEntryPrototypeAccessorsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "FileSystemDirectoryReader", require_prototype)]
+#[webapi(interface = web_api_interfaces::FileSystemDirectoryReader, require_prototype)]
struct FileSystemDirectoryReaderObjectDeclaration<'s> {
#[webapi(slot = FILE_SYSTEM_DIRECTORY_READER_ENTRIES_SLOT)]
entries: v8::Local<'s, v8::Array>,
diff --git a/moli-renderer-v8/src/context_bootstrap/file_api/file.rs b/moli-renderer-v8/src/context_bootstrap/file_api/file.rs
index 90470cf0b..bb6936b1b 100644
--- a/moli-renderer-v8/src/context_bootstrap/file_api/file.rs
+++ b/moli-renderer-v8/src/context_bootstrap/file_api/file.rs
@@ -2,6 +2,7 @@ use super::*;
use crate::blob;
use crate::dom::native::SelectedFile;
use crate::util::get_private_value;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_file_api::file::normalize_file_last_modified;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -10,7 +11,7 @@ const FILE_NAME_SLOT: &str = "__lmFileName";
const FILE_LAST_MODIFIED_SLOT: &str = "__lmFileLastModified";
#[derive(WebApiObject)]
-#[webapi(interface = "File")]
+#[webapi(interface = web_api_interfaces::File)]
struct FileMetadataDeclaration {
#[webapi(slot = FILE_NAME_SLOT)]
name: String,
@@ -19,7 +20,7 @@ struct FileMetadataDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "File")]
+#[webapi(interface = web_api_interfaces::File)]
struct FilePrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = file_name_attribute_getter_callback, enumerable)]
name: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/file_api/file_list.rs b/moli-renderer-v8/src/context_bootstrap/file_api/file_list.rs
index 3cb2271eb..c3dacf8e3 100644
--- a/moli-renderer-v8/src/context_bootstrap/file_api/file_list.rs
+++ b/moli-renderer-v8/src/context_bootstrap/file_api/file_list.rs
@@ -1,19 +1,20 @@
use super::*;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
const FILE_LIST_LENGTH_SLOT: &str = "__lmFileListLength";
#[derive(WebApiObject)]
-#[webapi(interface = "FileList", require_prototype)]
+#[webapi(interface = web_api_interfaces::FileList, require_prototype)]
struct FileListObjectDeclaration {
#[webapi(slot = FILE_LIST_LENGTH_SLOT)]
length: f64,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileList")]
+#[webapi(interface = web_api_interfaces::FileList)]
struct FileListPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = file_list_length_getter_callback, enumerable)]
length: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/file_api/file_reader/events.rs b/moli-renderer-v8/src/context_bootstrap/file_api/file_reader/events.rs
index 9ab1984ec..2a9f73501 100644
--- a/moli-renderer-v8/src/context_bootstrap/file_api/file_reader/events.rs
+++ b/moli-renderer-v8/src/context_bootstrap/file_api/file_reader/events.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "ProgressEvent", prototype = "Object",
+ interface = web_api_interfaces::ProgressEvent, prototype = "Object",
scope_lifetime = 'scope,
data_properties,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/file_api/file_reader/state.rs b/moli-renderer-v8/src/context_bootstrap/file_api/file_reader/state.rs
index 5a2224ba0..6cd24963a 100644
--- a/moli-renderer-v8/src/context_bootstrap/file_api/file_reader/state.rs
+++ b/moli-renderer-v8/src/context_bootstrap/file_api/file_reader/state.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
const FILE_READER_READY_STATE_SLOT: &str = "__lmFileReaderReadyState";
@@ -7,7 +8,7 @@ const FILE_READER_RESULT_SLOT: &str = "__lmFileReaderResult";
const FILE_READER_ERROR_SLOT: &str = "__lmFileReaderError";
#[derive(Default, WebApiObject)]
-#[webapi(interface = "FileReader")]
+#[webapi(interface = web_api_interfaces::FileReader)]
struct FileReaderObjectDeclaration {
#[webapi(slot = SIMPLE_EVENT_TARGET_SLOT, value = FILE_READER_LISTENERS_SLOT)]
event_target_slot: (),
@@ -59,7 +60,7 @@ struct FileReaderObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileReader")]
+#[webapi(interface = web_api_interfaces::FileReader)]
struct FileReaderPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/file_api/file_reader_sync.rs b/moli-renderer-v8/src/context_bootstrap/file_api/file_reader_sync.rs
index d84711132..f21dcbcd8 100644
--- a/moli-renderer-v8/src/context_bootstrap/file_api/file_reader_sync.rs
+++ b/moli-renderer-v8/src/context_bootstrap/file_api/file_reader_sync.rs
@@ -1,10 +1,11 @@
use super::*;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_file_api::{file_reader_binary_string, file_reader_data_url, file_reader_text};
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileReaderSync", enumerable)]
+#[webapi(interface = web_api_interfaces::FileReaderSync, enumerable)]
struct FileReaderSyncPrototypeDeclaration {
#[webapi(method, length = 1, callback = file_reader_sync_read_as_text_callback)]
read_as_text: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/file_api/install.rs b/moli-renderer-v8/src/context_bootstrap/file_api/install.rs
index 7b9222ea5..1d46cca3d 100644
--- a/moli-renderer-v8/src/context_bootstrap/file_api/install.rs
+++ b/moli-renderer-v8/src/context_bootstrap/file_api/install.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
use anyhow::Result;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileReader", enumerable)]
+#[webapi(interface = web_api_interfaces::FileReader, enumerable)]
struct FileReaderConstantsDeclaration {
#[webapi(constant = "EMPTY", value = 0u32)]
empty: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/form_data_runtime/iterators.rs b/moli-renderer-v8/src/context_bootstrap/form_data_runtime/iterators.rs
index 5bd16b1d8..b84476f70 100644
--- a/moli-renderer-v8/src/context_bootstrap/form_data_runtime/iterators.rs
+++ b/moli-renderer-v8/src/context_bootstrap/form_data_runtime/iterators.rs
@@ -4,6 +4,7 @@ use crate::util::{
get_private_object, get_private_value, materialize_hidden_function_template_prototype,
set_private_value,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
const FORM_DATA_ITERATOR_TARGET_SLOT: &str = "__moliFormDataIteratorTarget";
@@ -12,7 +13,7 @@ const FORM_DATA_ITERATOR_KIND_SLOT: &str = "__moliFormDataIteratorKind";
const FORM_DATA_ITERATOR_PROTOTYPE_SLOT: &str = "__moliFormDataIteratorPrototype";
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "FormData Iterator")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::FormDataIterator)]
struct FormDataIteratorDeclaration<'scope> {
#[webapi(slot = FORM_DATA_ITERATOR_TARGET_SLOT)]
target: v8::Local<'scope, v8::Object>,
@@ -24,7 +25,7 @@ struct FormDataIteratorDeclaration<'scope> {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "FormData Iterator",
+ interface = web_api_interfaces::FormDataIterator,
intrinsic_prototype_parent = v8::Intrinsic::IteratorPrototype,
prototype_to_string_tag = "FormData Iterator",
readonly_prototype,
diff --git a/moli-renderer-v8/src/context_bootstrap/form_data_runtime/storage.rs b/moli-renderer-v8/src/context_bootstrap/form_data_runtime/storage.rs
index 6dad02c40..510cacca7 100644
--- a/moli-renderer-v8/src/context_bootstrap/form_data_runtime/storage.rs
+++ b/moli-renderer-v8/src/context_bootstrap/form_data_runtime/storage.rs
@@ -1,10 +1,11 @@
use super::*;
use crate::util::{get_private_value, serialize_v8_array, set_private_value};
+use crate::web_api_interfaces;
use crate::{dom::native::SelectedFile, webidl};
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "FormData")]
+#[webapi(interface = web_api_interfaces::FormData)]
struct FormDataObjectDeclaration<'scope> {
#[webapi(slot = FORM_DATA_ENTRIES_SLOT)]
entries: v8::Local<'scope, v8::Array>,
diff --git a/moli-renderer-v8/src/context_bootstrap/form_data_runtime/template.rs b/moli-renderer-v8/src/context_bootstrap/form_data_runtime/template.rs
index 6eac62e87..35b8e8169 100644
--- a/moli-renderer-v8/src/context_bootstrap/form_data_runtime/template.rs
+++ b/moli-renderer-v8/src/context_bootstrap/form_data_runtime/template.rs
@@ -4,11 +4,12 @@ use super::callbacks::{
form_data_get_callback, form_data_has_callback, form_data_keys_callback,
form_data_set_callback, form_data_values_callback,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, v8};
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "FormData",
+ interface = web_api_interfaces::FormData,
constructor_callback = form_data_constructor_callback,
constructor_length = 0,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs b/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs
index fb6b6450d..2f38a5d82 100644
--- a/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/geometry_runtime.rs
@@ -1,6 +1,7 @@
use super::*;
use crate::native_bridge::throw_dom_exception;
use crate::util::{callback_data_index_value, get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_geometry::{
DOM_MATRIX_COMPONENT_COUNT, DomMatrixComponents, dom_matrix_components_from_values,
@@ -32,7 +33,7 @@ const DOM_MATRIX_M44_SLOT: &str = "__moliDomMatrixM44";
const DOM_MATRIX_TYPED_ARRAY_LENGTH: usize = DOM_MATRIX_COMPONENT_COUNT;
#[derive(WebApiObject)]
-#[webapi(interface = "DOMPoint", fallback_to_string_tag = "DOMPoint")]
+#[webapi(interface = web_api_interfaces::DOMPoint, fallback_to_string_tag = "DOMPoint")]
struct DomPointObjectDeclaration {
#[webapi(slot = DOM_POINT_X_SLOT)]
x: f64,
@@ -154,7 +155,7 @@ struct DomMatrixJsonDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMPoint")]
+#[webapi(interface = web_api_interfaces::DOMPoint)]
struct DomPointPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
@@ -191,21 +192,21 @@ struct DomPointPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMPoint")]
+#[webapi(interface = web_api_interfaces::DOMPoint)]
struct DomPointPrototypeMethodsDeclaration {
#[webapi(method = "toJSON", enumerable, callback = dom_point_to_json_callback)]
to_json: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMPoint")]
+#[webapi(interface = web_api_interfaces::DOMPoint)]
struct DomPointConstructorDeclaration {
#[webapi(static_method = "fromPoint", length = 0, callback = dom_point_from_point_callback)]
from_point: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMMatrixReadOnly")]
+#[webapi(interface = web_api_interfaces::DOMMatrixReadOnly)]
struct DomMatrixReadOnlyPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = dom_matrix_getter_callback, data = callback_data_index_value(scope, 0), enumerable)]
a: (),
@@ -258,7 +259,7 @@ struct DomMatrixReadOnlyPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMMatrixReadOnly")]
+#[webapi(interface = web_api_interfaces::DOMMatrixReadOnly)]
struct DomMatrixReadOnlyPrototypeMethodsDeclaration {
#[webapi(method = "toJSON", enumerable, callback = dom_matrix_to_json_callback)]
to_json: (),
@@ -316,7 +317,7 @@ struct DomMatrixReadOnlyPrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMMatrixReadOnly")]
+#[webapi(interface = web_api_interfaces::DOMMatrixReadOnly)]
struct DomMatrixReadOnlyConstructorDeclaration {
#[webapi(
static_method = "fromMatrix",
@@ -341,7 +342,7 @@ struct DomMatrixReadOnlyConstructorDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMMatrix")]
+#[webapi(interface = web_api_interfaces::DOMMatrix)]
struct DomMatrixPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = dom_matrix_getter_callback, setter = dom_matrix_setter_callback, data = callback_data_index_value(scope, 0), enumerable)]
a: (),
@@ -390,7 +391,7 @@ struct DomMatrixPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMMatrix")]
+#[webapi(interface = web_api_interfaces::DOMMatrix)]
struct DomMatrixPrototypeMethodsDeclaration {
#[webapi(method = "translateSelf", callback = dom_matrix_translate_self_callback)]
translate_self: (),
@@ -436,7 +437,7 @@ struct DomMatrixPrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMMatrix")]
+#[webapi(interface = web_api_interfaces::DOMMatrix)]
struct DomMatrixConstructorDeclaration {
#[webapi(
static_method = "fromMatrix",
diff --git a/moli-renderer-v8/src/context_bootstrap/idle_detection.rs b/moli-renderer-v8/src/context_bootstrap/idle_detection.rs
index d2d92af40..4bab9c037 100644
--- a/moli-renderer-v8/src/context_bootstrap/idle_detection.rs
+++ b/moli-renderer-v8/src/context_bootstrap/idle_detection.rs
@@ -1,6 +1,7 @@
use super::{
SIMPLE_EVENT_TARGET_SLOT, dispatch_simple_event_target_event, global_constructor_object,
};
+use crate::web_api_interfaces;
use crate::{
context_bootstrap::events::mark_event_trusted,
util::{
@@ -24,7 +25,7 @@ const ACTUAL_IDLE_STATE: crate::protocol_types::EmulatedIdleOverride =
};
#[derive(WebApiObject)]
-#[webapi(interface = "IdleDetector")]
+#[webapi(interface = web_api_interfaces::IdleDetector)]
struct IdleDetectorObjectDeclaration {
#[webapi(slot = IDLE_DETECTOR_STARTED_SLOT)]
started: bool,
@@ -43,7 +44,7 @@ struct IdleDetectorObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IdleDetector")]
+#[webapi(interface = web_api_interfaces::IdleDetector)]
struct IdleDetectorPrototypeDeclaration {
#[webapi(
accessor_property = "userState",
@@ -64,7 +65,7 @@ struct IdleDetectorPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IdleDetector", enumerable)]
+#[webapi(interface = web_api_interfaces::IdleDetector, enumerable)]
struct IdleDetectorConstructorDeclaration {
#[webapi(
static_method = "requestPermission",
diff --git a/moli-renderer-v8/src/context_bootstrap/image_data.rs b/moli-renderer-v8/src/context_bootstrap/image_data.rs
index c36fa2f1f..ba720fc37 100644
--- a/moli-renderer-v8/src/context_bootstrap/image_data.rs
+++ b/moli-renderer-v8/src/context_bootstrap/image_data.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::{callback_data_index_value, get_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_canvas::byte_len as rgba8_byte_len;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -12,7 +13,7 @@ const IMAGE_DATA_PIXEL_FORMAT_SLOT: &str = "__moliImageDataPixelFormat";
const IMAGE_DATA_DATA_SLOT: &str = "__moliImageDataData";
#[derive(WebApiObject)]
-#[webapi(interface = "ImageData")]
+#[webapi(interface = web_api_interfaces::ImageData)]
struct ImageDataObjectDeclaration<'s> {
#[webapi(slot = IMAGE_DATA_WIDTH_SLOT)]
width: u32,
@@ -27,7 +28,7 @@ struct ImageDataObjectDeclaration<'s> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ImageData")]
+#[webapi(interface = web_api_interfaces::ImageData)]
struct ImageDataPrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/cursors/surface.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/cursors/surface.rs
index 79cc57ce9..bee38ac0c 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/cursors/surface.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/cursors/surface.rs
@@ -1,10 +1,11 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
prototype = "Object",
- interface = "IDBCursor",
+ interface = web_api_interfaces::IDBCursor,
data_properties,
enumerable
)]
@@ -121,7 +122,7 @@ fn create_cursor_object_in_current_context<'s>(
} else {
"IDBCursorWithValue"
};
- moli_webapi_declare::initialize_web_api_object(scope, cursor, interface).ok()?;
+ web_api_interfaces::initialize(scope, cursor, interface).ok()?;
let storage_scope = indexed_db_typed_storage_scope(scope, request);
let owner = indexed_db_typed_execution_owner(scope, request)
.expect("IDBCursor should inherit typed owner from request");
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/env/dom_string_list.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/env/dom_string_list.rs
index 002de91b2..1f43bea34 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/env/dom_string_list.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/env/dom_string_list.rs
@@ -1,4 +1,5 @@
use crate::util::{get_private_object, throw_type_error};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{
DataPropertyDescriptorDeclaration, WebApiFunctionTemplate, WebApiObject,
@@ -7,7 +8,7 @@ use moli_webapi_declare::{
const DOM_STRING_LIST_VALUES_SLOT: &str = "moli.IndexedDb.DOMStringListValues";
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMStringList", enumerable)]
+#[webapi(interface = web_api_interfaces::DOMStringList, enumerable)]
struct DomStringListPrototypeDeclaration {
#[webapi(accessor_property, getter = dom_string_list_length_getter)]
length: (),
@@ -23,7 +24,7 @@ struct DomStringListPrototypeDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "DOMStringList", require_prototype)]
+#[webapi(interface = web_api_interfaces::DOMStringList, require_prototype)]
struct DomStringListObjectDeclaration<'s> {
#[webapi(slot = DOM_STRING_LIST_VALUES_SLOT)]
values: v8::Local<'s, v8::Array>,
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/keys/range/object.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/keys/range/object.rs
index 1369034f6..e75325e6e 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/keys/range/object.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/keys/range/object.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "IDBKeyRange",
+ interface = web_api_interfaces::IDBKeyRange,
require_prototype,
data_properties,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/database.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/database.rs
index 05d76fe5c..40fd91fda 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/database.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/database.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "IDBDatabase",
+ interface = web_api_interfaces::IDBDatabase,
require_prototype,
scope_lifetime = 'scope,
data_properties,
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/request.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/request.rs
index 747d63533..82c121640 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/request.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/request.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "IDBRequest")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::IDBRequest)]
struct IdbRequestObjectDeclaration<'scope> {
#[webapi(slot = INDEXED_DB_EVENT_LISTENERS_SLOT, init = "null_object")]
event_listeners: (),
@@ -30,7 +31,7 @@ struct IdbRequestObjectDeclaration<'scope> {
}
#[derive(Default, WebApiObject)]
-#[webapi(prototype = "Object", interface = "IDBOpenDBRequest")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::IDBOpenDBRequest)]
struct IdbOpenRequestHandlersDeclaration {
#[webapi(data_property, enumerable, init = "null")]
onupgradeneeded: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/transaction.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/transaction.rs
index 4f5ef347b..adcdd584b 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/transaction.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/creation/transaction.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "IDBTransaction",
+ interface = web_api_interfaces::IDBTransaction,
require_prototype,
data_properties,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/metadata/descriptors/sync.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/metadata/descriptors/sync.rs
index eb436f6e9..5feb1dcaf 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/metadata/descriptors/sync.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/metadata/descriptors/sync.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "IDBObjectStore",
+ interface = web_api_interfaces::IDBObjectStore,
scope_lifetime = 'scope,
data_properties,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/database.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/database.rs
index 75199abf4..11cd7fecb 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/database.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/database.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "IDBDatabase",
+ interface = web_api_interfaces::IDBDatabase,
scope_lifetime = 'scope,
data_properties,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/index.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/index.rs
index feef50283..f6fed4026 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/index.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/index.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "IDBIndex",
+ interface = web_api_interfaces::IDBIndex,
require_prototype,
scope_lifetime = 'scope,
data_properties,
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/object_store.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/object_store.rs
index e320ae402..c14d11f34 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/object_store.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/core/objects/surface/object_store.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "IDBObjectStore", require_prototype)]
+#[webapi(interface = web_api_interfaces::IDBObjectStore, require_prototype)]
struct IdbObjectStoreObjectDeclaration<'scope> {
#[webapi(data_property, enumerable)]
transaction: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/cursor_key_range.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/cursor_key_range.rs
index fe7cc0c74..bbd8c1906 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/cursor_key_range.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/cursor_key_range.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IDBCursor", enumerable)]
+#[webapi(interface = web_api_interfaces::IDBCursor, enumerable)]
struct IdbCursorPrototypeDeclaration {
#[webapi(method, length = 1, callback = idb_cursor_advance_callback)]
advance: (),
@@ -21,14 +22,14 @@ struct IdbCursorPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IDBKeyRange", enumerable)]
+#[webapi(interface = web_api_interfaces::IDBKeyRange, enumerable)]
struct IdbKeyRangePrototypeDeclaration {
#[webapi(method, length = 1, callback = idb_key_range_includes_callback)]
includes: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IDBKeyRange", enumerable)]
+#[webapi(interface = web_api_interfaces::IDBKeyRange, enumerable)]
struct IdbKeyRangeConstructorDeclaration {
#[webapi(static_method, length = 1, callback = idb_key_range_only_callback)]
only: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/database_transaction.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/database_transaction.rs
index 085bbd2d2..a8fdffc3a 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/database_transaction.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/database_transaction.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IDBDatabase", enumerable)]
+#[webapi(interface = web_api_interfaces::IDBDatabase, enumerable)]
struct IdbDatabasePrototypeDeclaration {
#[webapi(method, length = 2, callback = idb_database_create_object_store_callback)]
create_object_store: (),
@@ -15,7 +16,7 @@ struct IdbDatabasePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IDBTransaction", enumerable)]
+#[webapi(interface = web_api_interfaces::IDBTransaction, enumerable)]
struct IdbTransactionPrototypeDeclaration {
#[webapi(method, length = 1, callback = idb_transaction_object_store_callback)]
object_store: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/factory_request.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/factory_request.rs
index 794a7f1f7..8659ab52b 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/factory_request.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/factory_request.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IDBFactory", enumerable)]
+#[webapi(interface = web_api_interfaces::IDBFactory, enumerable)]
struct IdbFactoryPrototypeDeclaration {
#[webapi(method, length = 2, callback = idb_factory_open_callback)]
open: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/object_store_index/index.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/object_store_index/index.rs
index 0ba7abd91..008ff5349 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/object_store_index/index.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/object_store_index/index.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IDBIndex", enumerable)]
+#[webapi(interface = web_api_interfaces::IDBIndex, enumerable)]
struct IdbIndexPrototypeDeclaration {
#[webapi(method, length = 1, callback = idb_index_get_callback)]
get: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/object_store_index/object_store.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/object_store_index/object_store.rs
index 37a4f4a0d..a9fb4456f 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/object_store_index/object_store.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/install/constructors/object_store_index/object_store.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IDBObjectStore", enumerable)]
+#[webapi(interface = web_api_interfaces::IDBObjectStore, enumerable)]
struct IdbObjectStorePrototypeDeclaration {
#[webapi(method, length = 1, callback = idb_object_store_get_callback)]
get: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/indexed_db/runtime.rs b/moli-renderer-v8/src/context_bootstrap/indexed_db/runtime.rs
index 2fe370c41..f1af72387 100644
--- a/moli-renderer-v8/src/context_bootstrap/indexed_db/runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/indexed_db/runtime.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::{get_private_object, get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
use std::rc::Rc;
@@ -13,7 +14,7 @@ const INDEXED_DB_READWRITE_TRANSACTION_QUEUE_FIELD: &str =
"moli.IndexedDb.runtime.readwriteTransactionQueue";
#[derive(Default, WebApiObject)]
-#[webapi(interface = "IDBFactory", require_prototype)]
+#[webapi(interface = web_api_interfaces::IDBFactory, require_prototype)]
struct IndexedDbFactoryRuntimeDeclaration {
#[webapi(slot = INDEXED_DB_EVENT_LISTENERS_SLOT, init = "null_object")]
event_listeners: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/location_runtime/install.rs b/moli-renderer-v8/src/context_bootstrap/location_runtime/install.rs
index 2efd59f5f..20010dd0b 100644
--- a/moli-renderer-v8/src/context_bootstrap/location_runtime/install.rs
+++ b/moli-renderer-v8/src/context_bootstrap/location_runtime/install.rs
@@ -14,6 +14,7 @@ use super::slots::{location_href_slot, sync_location_object_fields};
use super::*;
use crate::context_bootstrap::exposed_interfaces::build_intrinsic_interface_instance;
use crate::util::{callback_data_index_value, callback_data_item};
+use crate::web_api_interfaces;
use anyhow::{Result, anyhow};
use moli_webapi_declare::WebApiObject;
@@ -32,7 +33,7 @@ enum LocationAttribute {
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "Location")]
+#[webapi(interface = web_api_interfaces::Location)]
struct LocationOwnSurfaceDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/media_cues.rs b/moli-renderer-v8/src/context_bootstrap/media_cues.rs
index 085691851..ef6a3be64 100644
--- a/moli-renderer-v8/src/context_bootstrap/media_cues.rs
+++ b/moli-renderer-v8/src/context_bootstrap/media_cues.rs
@@ -5,6 +5,7 @@ use crate::document_runtime::DomHandle;
use crate::native_bridge::JsContextHost;
use crate::native_bridge::throw_dom_exception;
use crate::util::{get_private_value, set_private_value, v8str};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -37,7 +38,7 @@ struct VttCueConstructorArgs {
}
#[derive(WebApiObject)]
-#[webapi(interface = "VTTCue")]
+#[webapi(interface = web_api_interfaces::VTTCue)]
struct VttCuePrivateStateDeclaration {
#[webapi(slot = TEXT_TRACK_CUE_START_TIME_SLOT)]
_start_time: f64,
@@ -83,7 +84,7 @@ struct VttCuePrivateStateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextTrackCue", enumerable)]
+#[webapi(interface = web_api_interfaces::TextTrackCue, enumerable)]
struct TextTrackCueTemplateDeclaration {
#[webapi(accessor_property, getter = text_track_cue_track_getter)]
track: (),
@@ -132,7 +133,7 @@ struct TextTrackCueTemplateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "VTTCue", enumerable)]
+#[webapi(interface = web_api_interfaces::VTTCue, enumerable)]
struct VttCueTemplateDeclaration {
#[webapi(
accessor_property,
@@ -193,7 +194,7 @@ struct VttCueTemplateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MediaError", enumerable)]
+#[webapi(interface = web_api_interfaces::MediaError, enumerable)]
struct MediaErrorConstantsDeclaration {
#[webapi(constant = "MEDIA_ERR_ABORTED", value = 1u32)]
media_err_aborted: (),
@@ -206,7 +207,7 @@ struct MediaErrorConstantsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MediaError", enumerable)]
+#[webapi(interface = web_api_interfaces::MediaError, enumerable)]
struct MediaErrorPrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/media_file_template.rs b/moli-renderer-v8/src/context_bootstrap/media_file_template.rs
index 72465c1a3..b8c60b9c4 100644
--- a/moli-renderer-v8/src/context_bootstrap/media_file_template.rs
+++ b/moli-renderer-v8/src/context_bootstrap/media_file_template.rs
@@ -52,11 +52,12 @@ use super::file_api::{
file_reader_read_as_data_url_callback, file_reader_read_as_text_callback,
file_reader_remove_event_listener_callback,
};
+use crate::web_api_interfaces;
use crate::{blob, util::callback_data_index_value, xml_serializer};
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Blob", enumerable)]
+#[webapi(interface = web_api_interfaces::Blob, enumerable)]
struct BlobTemplateMethodsDeclaration {
#[webapi(method, length = 0, callback = blob::blob_text_callback)]
text: (),
@@ -75,7 +76,7 @@ struct BlobTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "OffscreenCanvas", enumerable)]
+#[webapi(interface = web_api_interfaces::OffscreenCanvas, enumerable)]
struct OffscreenCanvasTemplateMethodsDeclaration {
#[webapi(method, length = 1, callback = offscreen_canvas_get_context_callback)]
get_context: (),
@@ -85,7 +86,7 @@ struct OffscreenCanvasTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileList", enumerable)]
+#[webapi(interface = web_api_interfaces::FileList, enumerable)]
struct FileListTemplateMethodsDeclaration {
#[webapi(method, length = 1, callback = file_list_item_callback)]
item: (),
@@ -98,7 +99,7 @@ struct FileListTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileReader", enumerable)]
+#[webapi(interface = web_api_interfaces::FileReader, enumerable)]
struct FileReaderTemplateMethodsDeclaration {
#[webapi(method, length = 1, callback = file_reader_read_as_text_callback)]
read_as_text: (),
@@ -135,7 +136,7 @@ struct FileReaderTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "XMLSerializer", enumerable)]
+#[webapi(interface = web_api_interfaces::XMLSerializer, enumerable)]
struct XmlSerializerTemplateMethodsDeclaration {
#[webapi(
method,
@@ -146,7 +147,7 @@ struct XmlSerializerTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CanvasRenderingContext2D", enumerable)]
+#[webapi(interface = web_api_interfaces::CanvasRenderingContext2D, enumerable)]
struct CanvasRenderingContext2dTemplateDeclaration {
#[webapi(
accessor_property = "fillStyle",
@@ -402,7 +403,7 @@ struct CanvasRenderingContext2dTemplateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CanvasGradient", enumerable)]
+#[webapi(interface = web_api_interfaces::CanvasGradient, enumerable)]
struct CanvasGradientTemplateMethodsDeclaration {
#[webapi(
method = "addColorStop",
@@ -413,7 +414,7 @@ struct CanvasGradientTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WebGLRenderingContext", enumerable)]
+#[webapi(interface = web_api_interfaces::WebGLRenderingContext, enumerable)]
struct WebGlRenderingContextTemplateMethodsDeclaration {
#[webapi(method = "viewport", length = 4, callback = webgl_viewport_callback)]
viewport: (),
@@ -611,7 +612,7 @@ struct WebGlRenderingContextTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WebGL2RenderingContext", enumerable)]
+#[webapi(interface = web_api_interfaces::WebGL2RenderingContext, enumerable)]
struct WebGl2RenderingContextTemplateDeclaration {
#[webapi(
method = "getSupportedExtensions",
@@ -653,7 +654,7 @@ struct WebGl2RenderingContextTemplateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WEBGL_lose_context", enumerable)]
+#[webapi(interface = web_api_interfaces::WEBGLLoseContext, enumerable)]
struct WebGlLoseContextTemplateMethodsDeclaration {
#[webapi(method = "loseContext", length = 0, callback = webgl_lose_context_noop_callback)]
lose_context: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/media_queries/evaluation.rs b/moli-renderer-v8/src/context_bootstrap/media_queries/evaluation.rs
index 92162bf7c..deca318e1 100644
--- a/moli-renderer-v8/src/context_bootstrap/media_queries/evaluation.rs
+++ b/moli-renderer-v8/src/context_bootstrap/media_queries/evaluation.rs
@@ -14,6 +14,7 @@ use crate::util::{
callback_data_index_value, callback_data_item, context_host_ptr_from_global_bridge,
get_private_value, set_private_value,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -30,7 +31,7 @@ fn current_window_style_viewport(
}
#[derive(WebApiObject)]
-#[webapi(interface = "MediaQueryList")]
+#[webapi(interface = web_api_interfaces::MediaQueryList)]
struct MediaQueryListObjectDeclaration {
#[webapi(slot = MEDIA_QUERY_LIST_MEDIA_SLOT)]
media: String,
@@ -41,7 +42,7 @@ struct MediaQueryListObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MediaQueryList")]
+#[webapi(interface = web_api_interfaces::MediaQueryList)]
struct MediaQueryListPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
@@ -67,11 +68,11 @@ struct MediaQueryListPrototypeAccessorsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Event", allow_empty)]
+#[webapi(interface = web_api_interfaces::Event, allow_empty)]
struct MediaQueryListChangeEventObjectDeclaration {}
#[derive(WebApiObject)]
-#[webapi(interface = "Event")]
+#[webapi(interface = web_api_interfaces::Event)]
struct MediaQueryListChangeEventPropertiesDeclaration {
#[webapi(data_property)]
media: String,
diff --git a/moli-renderer-v8/src/context_bootstrap/media_queries/events/simple_event_target/install.rs b/moli-renderer-v8/src/context_bootstrap/media_queries/events/simple_event_target/install.rs
index c5382b14e..96114ddcc 100644
--- a/moli-renderer-v8/src/context_bootstrap/media_queries/events/simple_event_target/install.rs
+++ b/moli-renderer-v8/src/context_bootstrap/media_queries/events/simple_event_target/install.rs
@@ -1,13 +1,14 @@
use super::*;
use crate::util::set_private_value;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "EventTarget",
+ interface = web_api_interfaces::EventTarget,
prototype = "Object",
enumerable,
- receiver = "EventTarget"
+ receiver
)]
struct SimpleEventTargetMethodsDeclaration<'scope> {
#[webapi(method, length = 2, callback = simple_event_target_add_event_listener_callback)]
diff --git a/moli-renderer-v8/src/context_bootstrap/media_source.rs b/moli-renderer-v8/src/context_bootstrap/media_source.rs
index 0df3cb077..a21d8797c 100644
--- a/moli-renderer-v8/src/context_bootstrap/media_source.rs
+++ b/moli-renderer-v8/src/context_bootstrap/media_source.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use crate::webidl;
use moli_web_mime::is_media_source_type_supported;
use moli_webapi_declare::WebApiFunctionTemplate;
@@ -10,7 +11,7 @@ struct MediaSourceIsTypeSupportedArgs {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "MediaSource")]
+#[webapi(interface = web_api_interfaces::MediaSource)]
struct MediaSourceTemplateDeclaration {
#[webapi(
static_method = "isTypeSupported",
diff --git a/moli-renderer-v8/src/context_bootstrap/message_ports/constructors.rs b/moli-renderer-v8/src/context_bootstrap/message_ports/constructors.rs
index a79c4c579..9fac86a0d 100644
--- a/moli-renderer-v8/src/context_bootstrap/message_ports/constructors.rs
+++ b/moli-renderer-v8/src/context_bootstrap/message_ports/constructors.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "MessageChannel")]
+#[webapi(interface = web_api_interfaces::MessageChannel)]
struct MessageChannelObjectDeclaration<'scope> {
#[webapi(slot = MESSAGE_CHANNEL_PORT1_SLOT)]
port1: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/message_ports/state.rs b/moli-renderer-v8/src/context_bootstrap/message_ports/state.rs
index 5d55e5428..d8cbcc576 100644
--- a/moli-renderer-v8/src/context_bootstrap/message_ports/state.rs
+++ b/moli-renderer-v8/src/context_bootstrap/message_ports/state.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::{
message_port_runtime::{MessagePortOwner, SharedMessagePortRegistry},
types::MessagePortId,
@@ -115,7 +116,7 @@ impl MessagePortRealmBinding {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "MessagePort")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::MessagePort)]
struct MessagePortObjectDeclaration<'scope> {
#[webapi(prototype)]
prototype: v8::Local<'scope, v8::Object>,
@@ -150,7 +151,7 @@ struct MessagePortObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MessagePort", enumerable)]
+#[webapi(interface = web_api_interfaces::MessagePort, enumerable)]
struct MessagePortPrototypeDeclaration {
#[webapi(method, length = 1, callback = message_port_post_message_callback)]
post_message: (),
@@ -190,7 +191,7 @@ struct MessagePortPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MessageChannel")]
+#[webapi(interface = web_api_interfaces::MessageChannel)]
struct MessageChannelPrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_activation.rs b/moli-renderer-v8/src/context_bootstrap/navigation_activation.rs
index f27c84234..bcff58a7d 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigation_activation.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigation_activation.rs
@@ -13,11 +13,12 @@ use super::navigation_window::{
use super::*;
use crate::native_bridge::{NavigationActivationSeed, NavigationHistorySerializedEntry};
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "NavigationActivation",
+ interface = web_api_interfaces::NavigationActivation,
own_to_string_tag = "NavigationActivation",
readonly_to_string_tag
)]
@@ -34,7 +35,7 @@ struct NavigationActivationObjectDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "NavigationTransition",
+ interface = web_api_interfaces::NavigationTransition,
own_to_string_tag = "NavigationTransition",
readonly_to_string_tag
)]
diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_bootstrap.rs b/moli-renderer-v8/src/context_bootstrap/navigation_bootstrap.rs
index c64a99303..b7ab37a8d 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigation_bootstrap.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigation_bootstrap.rs
@@ -20,11 +20,12 @@ use super::navigation_surface::{
use super::navigation_window::set_runtime_window_owner;
use super::*;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use anyhow::Result;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "Location", require_prototype)]
+#[webapi(interface = web_api_interfaces::Location, require_prototype)]
struct LocationRuntimeObjectDeclaration<'scope> {
#[webapi(slot = WINDOW_RUNTIME_OWNER_SLOT)]
owner: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_entry.rs b/moli-renderer-v8/src/context_bootstrap/navigation_entry.rs
index c61585090..f97711eca 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigation_entry.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigation_entry.rs
@@ -14,6 +14,7 @@ use super::navigation_window::{
};
use super::*;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_page_types::{NavigationHistoryEntryId, NavigationHistoryEntryKey};
use moli_webapi_declare::WebApiObject;
@@ -28,7 +29,7 @@ const NAVIGATION_ENTRY_SCROLL_Y_SLOT: &str = "__lmNavigationEntryScrollY";
#[derive(WebApiObject)]
#[webapi(
- interface = "NavigationHistoryEntry",
+ interface = web_api_interfaces::NavigationHistoryEntry,
own_to_string_tag = "NavigationHistoryEntry",
readonly_to_string_tag,
enumerable,
diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_events.rs b/moli-renderer-v8/src/context_bootstrap/navigation_events.rs
index 705a9f708..0d05f0037 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigation_events.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigation_events.rs
@@ -27,6 +27,7 @@ use super::*;
use crate::document_runtime::EventTargetHandle;
use crate::page_task_queue::RendererPageHashChangeData;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
const NAVIGATION_DESTINATION_STATE_SLOT: &str = "__lmNavigationDestinationState";
@@ -148,7 +149,7 @@ struct ActiveNavigateEventDataDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "NavigationDestination", prototype = "Object", enumerable)]
+#[webapi(interface = web_api_interfaces::NavigationDestination, prototype = "Object", enumerable)]
struct NavigationDestinationDeclaration<'scope> {
#[webapi(data_property)]
url: v8::Local<'scope, v8::String>,
@@ -167,7 +168,7 @@ struct NavigationDestinationDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "NavigationDestination", prototype = "Object", enumerable)]
+#[webapi(interface = web_api_interfaces::NavigationDestination, prototype = "Object", enumerable)]
struct NavigationEntryBackedDestinationDeclaration<'scope> {
#[webapi(data_property)]
url: v8::Local<'scope, v8::String>,
diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_surface/bindings.rs b/moli-renderer-v8/src/context_bootstrap/navigation_surface/bindings.rs
index 3465104f6..8b19a7c15 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigation_surface/bindings.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigation_surface/bindings.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "History", enumerable)]
+#[webapi(interface = web_api_interfaces::History, enumerable)]
struct HistoryTemplateMethodsDeclaration {
#[webapi(method, length = 0, callback = history_back_callback)]
back: (),
@@ -21,7 +22,7 @@ struct HistoryTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Navigation", enumerable)]
+#[webapi(interface = web_api_interfaces::Navigation, enumerable)]
struct NavigationTemplateMethodsDeclaration {
#[webapi(method, length = 2, callback = navigation_navigate_callback)]
navigate: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_surface/runtime.rs b/moli-renderer-v8/src/context_bootstrap/navigation_surface/runtime.rs
index 9562e829c..fbc3d562c 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigation_surface/runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigation_surface/runtime.rs
@@ -7,10 +7,11 @@ use super::accessors::{
use super::*;
use crate::native_bridge::NavigationHistoryEntrySeed;
use crate::util::get_private_value;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "History")]
+#[webapi(interface = web_api_interfaces::History)]
struct HistoryRuntimeObjectDeclaration<'scope> {
#[webapi(slot = HISTORY_STATE_SLOT)]
state: v8::Local<'scope, v8::Value>,
@@ -29,7 +30,7 @@ struct HistoryRuntimeObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Navigation")]
+#[webapi(interface = web_api_interfaces::Navigation)]
struct NavigationRuntimeObjectDeclaration<'scope> {
#[webapi(slot = NAVIGATION_CURRENT_ENTRY_SLOT)]
current_entry: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/clipboard.rs b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/clipboard.rs
index a4ea66e72..448ef3838 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/clipboard.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/clipboard.rs
@@ -1,4 +1,5 @@
use super::super::{SIMPLE_EVENT_TARGET_ORDERED_HANDLERS_SLOT, SIMPLE_EVENT_TARGET_SLOT};
+use crate::web_api_interfaces;
use crate::{
blob,
util::{get_private_value, set_private_value, throw_type_error, v8_string},
@@ -17,7 +18,7 @@ const CLIPBOARD_ITEM_TYPES_SLOT: &str = "__moliClipboardItemTypes";
const CLIPBOARD_ITEM_PRESENTATION_STYLE_SLOT: &str = "__moliClipboardItemPresentationStyle";
#[derive(Default, WebApiObject)]
-#[webapi(interface = "Clipboard")]
+#[webapi(interface = web_api_interfaces::Clipboard)]
struct ClipboardObjectDeclaration {
#[webapi(slot = SIMPLE_EVENT_TARGET_SLOT, value = CLIPBOARD_EVENT_LISTENERS_SLOT)]
event_target_slot: (),
@@ -33,7 +34,7 @@ struct ClipboardObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "Clipboard", enumerable)]
+#[webapi(interface = web_api_interfaces::Clipboard, enumerable)]
struct ClipboardPrototypeDeclaration {
#[webapi(method, length = 0, callback = clipboard_read_callback)]
read: (),
@@ -49,7 +50,7 @@ struct ClipboardPrototypeDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ClipboardItem")]
+#[webapi(interface = web_api_interfaces::ClipboardItem)]
struct ClipboardItemObjectDeclaration<'scope> {
#[webapi(slot = CLIPBOARD_ITEM_DATA_SLOT)]
data: v8::Local<'scope, v8::Object>,
@@ -65,7 +66,7 @@ struct ClipboardItemObjectDeclaration<'scope> {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "ClipboardItem", enumerable)]
+#[webapi(interface = web_api_interfaces::ClipboardItem, enumerable)]
struct ClipboardItemPrototypeDeclaration {
#[webapi(accessor_property, getter = clipboard_item_presentation_style_getter)]
presentation_style: (),
@@ -78,7 +79,7 @@ struct ClipboardItemPrototypeDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "ClipboardItem", enumerable)]
+#[webapi(interface = web_api_interfaces::ClipboardItem, enumerable)]
struct ClipboardItemConstructorDeclaration {
#[webapi(static_method, length = 1, callback = clipboard_item_supports_callback)]
supports: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/collections.rs b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/collections.rs
index 379436889..8cea56956 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/collections.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/collections.rs
@@ -1,4 +1,5 @@
use super::super::*;
+use crate::web_api_interfaces;
use crate::{
util::{get_private_value, throw_type_error},
webidl,
@@ -35,7 +36,7 @@ const PDF_MIME_TYPES: &[(&str, &str, &str)] = &[
const COLLECTION_LENGTH_SLOT: &str = "__moliNavigatorCollectionLength";
#[derive(WebApiObject)]
-#[webapi(interface = "MimeType")]
+#[webapi(interface = web_api_interfaces::MimeType)]
struct MimeTypeObjectDeclaration<'scope> {
#[webapi(data_property)]
r#type: v8::Local<'scope, v8::String>,
@@ -51,21 +52,21 @@ struct MimeTypeObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "MimeTypeArray")]
+#[webapi(interface = web_api_interfaces::MimeTypeArray)]
struct MimeTypeArrayObjectDeclaration {
#[webapi(slot = COLLECTION_LENGTH_SLOT)]
length: u32,
}
#[derive(WebApiObject)]
-#[webapi(interface = "PluginArray")]
+#[webapi(interface = web_api_interfaces::PluginArray)]
struct PluginArrayObjectDeclaration {
#[webapi(slot = COLLECTION_LENGTH_SLOT)]
length: u32,
}
#[derive(WebApiObject)]
-#[webapi(interface = "Plugin")]
+#[webapi(interface = web_api_interfaces::Plugin)]
struct PluginObjectDeclaration<'scope> {
#[webapi(slot = COLLECTION_LENGTH_SLOT)]
length: u32,
@@ -81,7 +82,7 @@ struct PluginObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MimeTypeArray", enumerable)]
+#[webapi(interface = web_api_interfaces::MimeTypeArray, enumerable)]
struct MimeTypeArrayPrototypeDeclaration {
#[webapi(accessor_property, getter = mime_type_array_length_getter)]
length: (),
@@ -100,7 +101,7 @@ struct MimeTypeArrayPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "PluginArray", enumerable)]
+#[webapi(interface = web_api_interfaces::PluginArray, enumerable)]
struct PluginArrayPrototypeDeclaration {
#[webapi(accessor_property, getter = plugin_array_length_getter)]
length: (),
@@ -122,7 +123,7 @@ struct PluginArrayPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Plugin", enumerable)]
+#[webapi(interface = web_api_interfaces::Plugin, enumerable)]
struct PluginPrototypeDeclaration {
#[webapi(accessor_property, getter = plugin_length_getter)]
length: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/geolocation.rs b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/geolocation.rs
index bd92653fd..6018e99ac 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/geolocation.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/geolocation.rs
@@ -1,4 +1,5 @@
use super::super::*;
+use crate::web_api_interfaces;
use crate::{
document_runtime::DomHandle,
host::HostTimerOwner,
@@ -23,7 +24,7 @@ const POSITION_UNAVAILABLE: u16 = 2;
const TIMEOUT: u16 = 3;
#[derive(WebApiObject)]
-#[webapi(interface = "Geolocation")]
+#[webapi(interface = web_api_interfaces::Geolocation)]
struct GeolocationObjectDeclaration {
#[webapi(slot = GEOLOCATION_SECURE_CONTEXT_SLOT)]
secure_context: bool,
@@ -33,7 +34,7 @@ struct GeolocationObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "Geolocation", enumerable)]
+#[webapi(interface = web_api_interfaces::Geolocation, enumerable)]
struct GeolocationPrototypeMethodsDeclaration {
#[webapi(method, length = 1, callback = geolocation_get_current_position_callback)]
get_current_position: (),
@@ -46,7 +47,7 @@ struct GeolocationPrototypeMethodsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "GeolocationPositionError")]
+#[webapi(interface = web_api_interfaces::GeolocationPositionError)]
struct GeolocationPositionErrorObjectDeclaration {
#[webapi(slot = GEOLOCATION_POSITION_ERROR_CODE_SLOT)]
code: u16,
@@ -56,7 +57,7 @@ struct GeolocationPositionErrorObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "GeolocationPositionError", enumerable)]
+#[webapi(interface = web_api_interfaces::GeolocationPositionError, enumerable)]
struct GeolocationPositionErrorPrototypeDeclaration {
#[webapi(accessor_property, getter = geolocation_position_error_code_getter_callback)]
code: (),
@@ -66,7 +67,7 @@ struct GeolocationPositionErrorPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "GeolocationPositionError", enumerable)]
+#[webapi(interface = web_api_interfaces::GeolocationPositionError, enumerable)]
struct GeolocationPositionErrorConstantsDeclaration {
#[webapi(constant = "PERMISSION_DENIED", value = 1u32)]
permission_denied: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/geolocation/position.rs b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/geolocation/position.rs
index 555a293f3..d1921a94a 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/geolocation/position.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/geolocation/position.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use moli_page_types::GeolocationPositionOverride;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -19,14 +20,14 @@ const COORDINATE_NAMES: &[&str] = &[
];
#[derive(WebApiObject)]
-#[webapi(interface = "GeolocationCoordinates")]
+#[webapi(interface = web_api_interfaces::GeolocationCoordinates)]
struct CoordinatesDeclaration<'s> {
#[webapi(slot = COORDINATES_SLOT)]
values: v8::Local<'s, v8::Array>,
}
#[derive(WebApiObject)]
-#[webapi(interface = "GeolocationPosition")]
+#[webapi(interface = web_api_interfaces::GeolocationPosition)]
struct PositionDeclaration<'s> {
#[webapi(slot = POSITION_COORDS_SLOT)]
coords: v8::Local<'s, v8::Object>,
@@ -35,7 +36,7 @@ struct PositionDeclaration<'s> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "GeolocationCoordinates", enumerable)]
+#[webapi(interface = web_api_interfaces::GeolocationCoordinates, enumerable)]
struct CoordinatesPrototype {
#[webapi(accessor_property, getter = coordinate_getter, data = callback_data_index_value(scope, 0))]
latitude: (),
@@ -56,7 +57,7 @@ struct CoordinatesPrototype {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "GeolocationPosition", enumerable)]
+#[webapi(interface = web_api_interfaces::GeolocationPosition, enumerable)]
struct PositionPrototype {
#[webapi(accessor_property, getter = position_getter, data = callback_data_index_value(scope, 0))]
coords: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/media_capabilities.rs b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/media_capabilities.rs
index 978ea2f9d..2b366a47d 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/media_capabilities.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/media_capabilities.rs
@@ -1,4 +1,5 @@
use super::super::*;
+use crate::web_api_interfaces;
use crate::{util::get_private_value, webidl};
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -6,7 +7,7 @@ const MEDIA_CAPABILITIES_SECURE_CONTEXT_SLOT: &str = "__moliMediaCapabilitiesSec
const MEDIA_CAPABILITIES_WORKER_SLOT: &str = "__moliMediaCapabilitiesWorker";
#[derive(WebApiObject)]
-#[webapi(interface = "MediaCapabilities")]
+#[webapi(interface = web_api_interfaces::MediaCapabilities)]
struct MediaCapabilitiesObjectDeclaration {
#[webapi(slot = MEDIA_CAPABILITIES_SECURE_CONTEXT_SLOT)]
secure_context: bool,
@@ -16,7 +17,7 @@ struct MediaCapabilitiesObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "MediaCapabilities", enumerable)]
+#[webapi(interface = web_api_interfaces::MediaCapabilities, enumerable)]
struct MediaCapabilitiesPrototypeDeclaration {
#[webapi(method, length = 1, callback = media_capabilities_decoding_info_callback)]
decoding_info: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/media_devices.rs b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/media_devices.rs
index 3d9a00365..1e931e865 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/media_devices.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/media_devices.rs
@@ -1,13 +1,14 @@
use super::super::window_runtime::navigator_media_devices_get_user_media_callback;
use super::super::*;
use crate::util::{get_private_value, set_private_value, throw_type_error};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
const MEDIA_DEVICES_LISTENERS_SLOT: &str = "__moliMediaDevicesListeners";
const MEDIA_DEVICES_ONDEVICECHANGE_SLOT: &str = "__moliMediaDevicesOndevicechange";
#[derive(Default, WebApiObject)]
-#[webapi(interface = "MediaDevices")]
+#[webapi(interface = web_api_interfaces::MediaDevices)]
struct MediaDevicesObjectDeclaration {
#[webapi(slot = SIMPLE_EVENT_TARGET_SLOT, value = MEDIA_DEVICES_LISTENERS_SLOT)]
event_target_slot: (),
@@ -20,7 +21,7 @@ struct MediaDevicesObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MediaDevices", enumerable)]
+#[webapi(interface = web_api_interfaces::MediaDevices, enumerable)]
struct MediaDevicesPrototypeDeclaration {
#[webapi(method, length = 0, callback = enumerate_devices_callback)]
enumerate_devices: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/navigator.rs b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/navigator.rs
index 8c01fed54..2d8186791 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/navigator.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/navigator.rs
@@ -36,6 +36,7 @@ use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, serialize_v8_array,
set_private_value, throw_type_error,
};
+use crate::web_api_interfaces;
use moli_browser_profile::{BrowserIdentityProfile, navigator_app_version};
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -106,25 +107,25 @@ pub(in crate::context_bootstrap) const SERVICE_WORKER_OWNER_TOKEN_SLOT: &str =
"__moliServiceWorkerOwner";
#[derive(Default, WebApiObject)]
-#[webapi(interface = "Permissions", allow_empty)]
+#[webapi(interface = web_api_interfaces::Permissions, allow_empty)]
struct PermissionsObjectDeclaration {}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "Permissions", enumerable)]
+#[webapi(interface = web_api_interfaces::Permissions, enumerable)]
struct PermissionsPrototypeMethodsDeclaration {
#[webapi(method, length = 1, callback = navigator_permissions_query_callback)]
query: (),
}
#[derive(WebApiObject)]
-#[webapi(interface = "Navigator")]
+#[webapi(interface = web_api_interfaces::Navigator)]
struct NavigatorObjectDeclaration<'scope> {
#[webapi(slot = NAVIGATOR_RUNTIME_DATA_SLOT)]
runtime_data: v8::Local<'scope, v8::Object>,
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "Navigator", enumerable)]
+#[webapi(interface = web_api_interfaces::Navigator, enumerable)]
struct NavigatorRuntimeDataPrototypeDeclaration {
#[webapi(accessor_property, getter = navigator_runtime_data_getter_callback, data = callback_data_index_value(scope, 0))]
user_agent: (),
@@ -197,7 +198,7 @@ struct NavigatorRuntimeDataPrototypeDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "Navigator")]
+#[webapi(interface = web_api_interfaces::Navigator)]
struct NavigatorPrototypeMethodsDeclaration {
#[webapi(method, enumerable, length = 0, callback = navigator_get_gamepads_callback)]
get_gamepads: (),
@@ -219,14 +220,14 @@ struct NavigatorPrototypeMethodsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "WorkerNavigator")]
+#[webapi(interface = web_api_interfaces::WorkerNavigator)]
struct WorkerNavigatorObjectDeclaration<'scope> {
#[webapi(slot = NAVIGATOR_RUNTIME_DATA_SLOT)]
runtime_data: v8::Local<'scope, v8::Object>,
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "WorkerNavigator", enumerable)]
+#[webapi(interface = web_api_interfaces::WorkerNavigator, enumerable)]
struct WorkerNavigatorRuntimeDataPrototypeDeclaration {
#[webapi(accessor_property, getter = navigator_runtime_data_getter_callback, data = callback_data_index_value(scope, 0))]
user_agent: (),
@@ -269,7 +270,7 @@ struct WorkerNavigatorRuntimeDataPrototypeDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "PermissionStatus", enumerable)]
+#[webapi(interface = web_api_interfaces::PermissionStatus, enumerable)]
struct PermissionStatusPrototypeDeclaration {
#[webapi(accessor_property, getter = permission_status_name_getter_callback)]
name: (),
@@ -279,8 +280,7 @@ struct PermissionStatusPrototypeDeclaration {
#[derive(Default, WebApiObject)]
#[webapi(
- interface = "NetworkInformation",
- parent = "EventTarget",
+ interface = web_api_interfaces::NetworkInformation,
prototype = "Object"
)]
struct NavigatorConnectionDeclaration {
@@ -323,11 +323,11 @@ struct NavigatorConnectionDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(allow_empty, interface = "StorageManager")]
+#[webapi(allow_empty, interface = web_api_interfaces::StorageManager)]
struct StorageManagerObjectDeclaration {}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "StorageManager", enumerable)]
+#[webapi(interface = web_api_interfaces::StorageManager, enumerable)]
struct StorageManagerTemplateMethodsDeclaration {
#[webapi(method, length = 0, callback = navigator_storage_persisted_callback)]
persisted: (),
@@ -343,7 +343,7 @@ struct StorageManagerTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "StorageManager", enumerable)]
+#[webapi(interface = web_api_interfaces::StorageManager, enumerable)]
struct StorageManagerWorkerTemplateMethodsDeclaration {
#[webapi(method, length = 0, callback = navigator_storage_persisted_callback)]
persisted: (),
@@ -377,11 +377,11 @@ pub(in crate::context_bootstrap) fn install_storage_manager_constructor_template
}
#[derive(WebApiObject)]
-#[webapi(allow_empty, interface = "StorageBucketManager")]
+#[webapi(allow_empty, interface = web_api_interfaces::StorageBucketManager)]
struct StorageBucketManagerObjectDeclaration {}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "NavigatorUAData", enumerable)]
+#[webapi(interface = web_api_interfaces::NavigatorUAData, enumerable)]
struct NavigatorUaDataPrototypeMethodsDeclaration {
#[webapi(method, name = "toJSON", length = 0, callback = navigator_ua_data_to_json_callback)]
to_json: (),
@@ -391,7 +391,7 @@ struct NavigatorUaDataPrototypeMethodsDeclaration {
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "ServiceWorkerContainer", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::ServiceWorkerContainer, prototype = "Object")]
struct ServiceWorkerContainerDeclaration {
#[webapi(slot = SIMPLE_EVENT_TARGET_SLOT, value = SERVICE_WORKER_CONTAINER_LISTENERS_SLOT)]
event_target_slot: (),
@@ -458,7 +458,7 @@ struct ServiceWorkerContainerDeclaration {
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "UserActivation")]
+#[webapi(interface = web_api_interfaces::UserActivation)]
struct UserActivationObjectDeclaration {
#[webapi(accessor_property, getter = navigator_user_activation_state_getter_callback, enumerable)]
is_active: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/screen.rs b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/screen.rs
index 6201a27f4..785b3ce86 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/screen.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/screen.rs
@@ -8,6 +8,7 @@ use crate::util::{
callback_data_index_value, callback_data_item, context_host_ptr_from_global_bridge,
get_private_value, set_private_value, throw_type_error,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -46,7 +47,7 @@ struct ScreenOrientationLockArgs {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Screen")]
+#[webapi(interface = web_api_interfaces::Screen)]
struct ScreenObjectDeclaration {
#[webapi(slot = SCREEN_WIDTH_SLOT)]
width: f64,
@@ -67,7 +68,7 @@ struct ScreenObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "Screen")]
+#[webapi(interface = web_api_interfaces::Screen)]
struct ScreenPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = screen_attribute_getter_callback, data = callback_data_index_value(scope, 0), enumerable)]
avail_width: (),
@@ -90,7 +91,7 @@ struct ScreenPrototypeAccessorsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ScreenOrientation")]
+#[webapi(interface = web_api_interfaces::ScreenOrientation)]
struct ScreenOrientationObjectDeclaration {
#[webapi(slot = SCREEN_ORIENTATION_TYPE_SLOT)]
orientation_type: &'static str,
@@ -101,7 +102,7 @@ struct ScreenOrientationObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "ScreenOrientation")]
+#[webapi(interface = web_api_interfaces::ScreenOrientation)]
struct ScreenOrientationPrototypeAccessorsDeclaration {
#[webapi(accessor_property, name = "type", getter = screen_orientation_attribute_getter_callback, data = callback_data_index_value(scope, 0), enumerable)]
orientation_type: (),
@@ -112,7 +113,7 @@ struct ScreenOrientationPrototypeAccessorsDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "ScreenOrientation")]
+#[webapi(interface = web_api_interfaces::ScreenOrientation)]
struct ScreenOrientationPrototypeMethodsDeclaration {
#[webapi(method, enumerable, length = 1, callback = screen_orientation_lock_callback)]
lock: (),
@@ -121,7 +122,7 @@ struct ScreenOrientationPrototypeMethodsDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "Screen", enumerable)]
+#[webapi(interface = web_api_interfaces::Screen, enumerable)]
struct ScreenEventTargetMethodsDeclaration {
#[webapi(method, length = 2, callback = screen_event_target_add_event_listener_callback)]
add_event_listener: (),
@@ -136,7 +137,7 @@ struct ScreenEventTargetMethodsDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "ScreenOrientation", enumerable)]
+#[webapi(interface = web_api_interfaces::ScreenOrientation, enumerable)]
struct ScreenOrientationEventTargetMethodsDeclaration {
#[webapi(
method,
diff --git a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/visual_viewport.rs b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/visual_viewport.rs
index 1275d1c5c..16234c105 100644
--- a/moli-renderer-v8/src/context_bootstrap/navigator_runtime/visual_viewport.rs
+++ b/moli-renderer-v8/src/context_bootstrap/navigator_runtime/visual_viewport.rs
@@ -2,6 +2,7 @@ use super::super::*;
use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, throw_type_error,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
const VISUAL_VIEWPORT_OFFSET_LEFT_SLOT: &str = "__moliVisualViewportOffsetLeft";
@@ -13,7 +14,7 @@ const VISUAL_VIEWPORT_HEIGHT_SLOT: &str = "__moliVisualViewportHeight";
const VISUAL_VIEWPORT_SCALE_SLOT: &str = "__moliVisualViewportScale";
#[derive(WebApiObject)]
-#[webapi(interface = "VisualViewport")]
+#[webapi(interface = web_api_interfaces::VisualViewport)]
struct VisualViewportObjectDeclaration {
#[webapi(slot = VISUAL_VIEWPORT_OFFSET_LEFT_SLOT)]
offset_left: f64,
@@ -32,7 +33,7 @@ struct VisualViewportObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "VisualViewport")]
+#[webapi(interface = web_api_interfaces::VisualViewport)]
struct VisualViewportPrototypeDeclaration {
#[webapi(accessor_property, getter = visual_viewport_attribute_getter_callback, data = callback_data_index_value(scope, 0), enumerable)]
offset_left: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/notification_runtime.rs b/moli-renderer-v8/src/context_bootstrap/notification_runtime.rs
index c1e878a64..d4a394d0a 100644
--- a/moli-renderer-v8/src/context_bootstrap/notification_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/notification_runtime.rs
@@ -3,6 +3,7 @@ use super::{
simple_event_target_add_event_listener_callback, simple_event_target_dispatch_event_callback,
simple_event_target_remove_event_listener_callback, structured_clone_value_for_storage,
};
+use crate::web_api_interfaces;
use crate::{
runtime::{
ServiceWorkerNotificationMetadata, ServiceWorkerNotificationSnapshot,
@@ -47,7 +48,7 @@ pub(crate) struct NotificationOptionsPayload {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Notification")]
+#[webapi(interface = web_api_interfaces::Notification)]
struct NotificationObjectDeclaration<'scope> {
#[webapi(slot = NOTIFICATION_TITLE_SLOT)]
title: String,
@@ -138,7 +139,7 @@ struct NotificationObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Notification")]
+#[webapi(interface = web_api_interfaces::Notification)]
struct NotificationPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -195,14 +196,14 @@ struct NotificationPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Notification", enumerable)]
+#[webapi(interface = web_api_interfaces::Notification, enumerable)]
struct NotificationConstructorDeclaration {
#[webapi(static_method, length = 0, callback = notification_request_permission_callback)]
request_permission: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Notification")]
+#[webapi(interface = web_api_interfaces::Notification)]
struct NotificationConstructorConstantsDeclaration {
#[webapi(constant = "maxActions", value = NOTIFICATION_MAX_ACTIONS)]
max_actions: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/observer_template.rs b/moli-renderer-v8/src/context_bootstrap/observer_template.rs
index d4f65c4fe..019ca1b8a 100644
--- a/moli-renderer-v8/src/context_bootstrap/observer_template.rs
+++ b/moli-renderer-v8/src/context_bootstrap/observer_template.rs
@@ -14,10 +14,11 @@ use super::resize_observer_runtime::{
resize_observer_take_records_callback, resize_observer_unobserve_callback,
};
use crate::observer_runtime;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MutationObserver", enumerable)]
+#[webapi(interface = web_api_interfaces::MutationObserver, enumerable)]
struct MutationObserverTemplateMethodsDeclaration {
#[webapi(method, length = 2, callback = observer_runtime::mutation_observer_observe_callback)]
observe: (),
@@ -38,7 +39,7 @@ struct MutationObserverTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IntersectionObserver", enumerable)]
+#[webapi(interface = web_api_interfaces::IntersectionObserver, enumerable)]
struct IntersectionObserverTemplateMethodsDeclaration {
#[webapi(
method,
@@ -70,7 +71,7 @@ struct IntersectionObserverTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "MediaQueryList", enumerable)]
+#[webapi(interface = web_api_interfaces::MediaQueryList, enumerable)]
struct MediaQueryListTemplateMethodsDeclaration {
#[webapi(method, length = 2, callback = media_query_list_add_event_listener_callback)]
add_event_listener: (),
@@ -93,7 +94,7 @@ struct MediaQueryListTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ResizeObserver", enumerable)]
+#[webapi(interface = web_api_interfaces::ResizeObserver, enumerable)]
struct ResizeObserverTemplateMethodsDeclaration {
#[webapi(method, length = 1, callback = resize_observer_observe_callback)]
observe: (),
@@ -109,7 +110,7 @@ struct ResizeObserverTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "PerformanceObserver", enumerable)]
+#[webapi(interface = web_api_interfaces::PerformanceObserver, enumerable)]
struct PerformanceObserverTemplateMethodsDeclaration {
#[webapi(method, length = 1, callback = performance_observer_observe_callback)]
observe: (),
@@ -122,7 +123,7 @@ struct PerformanceObserverTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "PerformanceObserverEntryList", enumerable)]
+#[webapi(interface = web_api_interfaces::PerformanceObserverEntryList, enumerable)]
struct PerformanceObserverEntryListTemplateMethodsDeclaration {
#[webapi(method, length = 0, callback = performance_entry_list_get_entries_callback)]
get_entries: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/opfs.rs b/moli-renderer-v8/src/context_bootstrap/opfs.rs
index 53d0dc496..a14181f3f 100644
--- a/moli-renderer-v8/src/context_bootstrap/opfs.rs
+++ b/moli-renderer-v8/src/context_bootstrap/opfs.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use moli_crypto::fill_secure_random;
use moli_storage_service::{
DirectoryEntry, EntryKind, FileSnapshotIdentity, Opfs, OpfsBucketKey, OpfsError, OpfsPath,
@@ -701,7 +702,7 @@ fn dispatch_opfs_quota_mutation_task<'s, T, Operation, Wrap>(
}
#[derive(WebApiObject)]
-#[webapi(interface = "FileSystemDirectoryHandle", require_prototype)]
+#[webapi(interface = web_api_interfaces::FileSystemDirectoryHandle, require_prototype)]
struct FileSystemDirectoryHandleObjectDeclaration {
#[webapi(slot = FILE_SYSTEM_HANDLE_STATE_SLOT)]
state_json: String,
@@ -710,7 +711,7 @@ struct FileSystemDirectoryHandleObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "FileSystemFileHandle", require_prototype)]
+#[webapi(interface = web_api_interfaces::FileSystemFileHandle, require_prototype)]
struct FileSystemFileHandleObjectDeclaration {
#[webapi(slot = FILE_SYSTEM_HANDLE_STATE_SLOT)]
state_json: String,
@@ -719,7 +720,7 @@ struct FileSystemFileHandleObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemHandle", enumerable)]
+#[webapi(interface = web_api_interfaces::FileSystemHandle, enumerable)]
struct FileSystemHandlePrototypeDeclaration {
#[webapi(accessor_property, getter = file_system_handle_kind_getter_callback)]
kind: (),
@@ -738,7 +739,7 @@ struct FileSystemHandlePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemDirectoryHandle", enumerable)]
+#[webapi(interface = web_api_interfaces::FileSystemDirectoryHandle, enumerable)]
struct FileSystemDirectoryHandlePrototypeDeclaration {
#[webapi(method, length = 1, callback = file_system_directory_get_file_handle_callback)]
get_file_handle: (),
@@ -761,7 +762,7 @@ struct FileSystemDirectoryHandlePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemFileHandle", enumerable)]
+#[webapi(interface = web_api_interfaces::FileSystemFileHandle, enumerable)]
struct FileSystemFileHandlePrototypeDeclaration {
#[webapi(method, length = 0, callback = file_system_file_create_writable_callback)]
create_writable: (),
@@ -772,7 +773,7 @@ struct FileSystemFileHandlePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemFileHandle", enumerable)]
+#[webapi(interface = web_api_interfaces::FileSystemFileHandle, enumerable)]
struct FileSystemFileHandleSyncPrototypeDeclaration {
#[webapi(
method,
@@ -783,14 +784,14 @@ struct FileSystemFileHandleSyncPrototypeDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "FileSystemWritableFileStream", require_prototype)]
+#[webapi(interface = web_api_interfaces::FileSystemWritableFileStream, require_prototype)]
struct FileSystemWritableFileStreamObjectDeclaration {
#[webapi(slot = FILE_SYSTEM_WRITABLE_MODE_SLOT)]
mode: String,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemWritableFileStream", enumerable)]
+#[webapi(interface = web_api_interfaces::FileSystemWritableFileStream, enumerable)]
struct FileSystemWritableFileStreamPrototypeDeclaration {
#[webapi(accessor_property, getter = file_system_writable_mode_getter_callback)]
mode: (),
@@ -817,7 +818,7 @@ struct FileSystemWritableSinkObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "FileSystemSyncAccessHandle", require_prototype)]
+#[webapi(interface = web_api_interfaces::FileSystemSyncAccessHandle, require_prototype)]
struct FileSystemSyncAccessHandleObjectDeclaration {
#[webapi(slot = FILE_SYSTEM_SYNC_ACCESS_STATE_SLOT)]
state_json: String,
@@ -826,7 +827,7 @@ struct FileSystemSyncAccessHandleObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FileSystemSyncAccessHandle", enumerable)]
+#[webapi(interface = web_api_interfaces::FileSystemSyncAccessHandle, enumerable)]
struct FileSystemSyncAccessHandlePrototypeDeclaration {
#[webapi(accessor_property, getter = file_system_sync_access_mode_getter_callback)]
mode: (),
@@ -847,7 +848,7 @@ struct FileSystemSyncAccessHandlePrototypeDeclaration {
#[derive(WebApiObject)]
#[webapi(
prototype = "Object",
- interface = "FileSystemDirectoryHandle AsyncIterator"
+ interface = web_api_interfaces::FileSystemDirectoryHandleAsyncIterator
)]
struct FileSystemDirectoryIteratorObjectDeclaration {
#[webapi(slot = FILE_SYSTEM_ITERATOR_ID_SLOT)]
@@ -856,7 +857,7 @@ struct FileSystemDirectoryIteratorObjectDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "FileSystemDirectoryHandle AsyncIterator",
+ interface = web_api_interfaces::FileSystemDirectoryHandleAsyncIterator,
intrinsic_prototype_parent = v8::Intrinsic::AsyncIteratorPrototype,
prototype_to_string_tag = "FileSystemDirectoryHandle AsyncIterator",
readonly_prototype,
diff --git a/moli-renderer-v8/src/context_bootstrap/performance_observer_runtime/delivery.rs b/moli-renderer-v8/src/context_bootstrap/performance_observer_runtime/delivery.rs
index 357097d7b..6045ef70d 100644
--- a/moli-renderer-v8/src/context_bootstrap/performance_observer_runtime/delivery.rs
+++ b/moli-renderer-v8/src/context_bootstrap/performance_observer_runtime/delivery.rs
@@ -7,11 +7,12 @@ use super::observer::{
};
use super::*;
use crate::host::report_event_callback_exception;
+use crate::web_api_interfaces;
use crate::window_webidl_callback::WindowWebIdlCallbackFunctionOutcome;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "PerformanceObserverEntryList")]
+#[webapi(interface = web_api_interfaces::PerformanceObserverEntryList)]
struct PerformanceObserverEntryListObjectDeclaration<'scope> {
#[webapi(slot = PERFORMANCE_ENTRY_LIST_ENTRIES_SLOT)]
entries: v8::Local<'scope, v8::Array>,
diff --git a/moli-renderer-v8/src/context_bootstrap/performance_observer_runtime/observer.rs b/moli-renderer-v8/src/context_bootstrap/performance_observer_runtime/observer.rs
index 54ae22518..b20d88654 100644
--- a/moli-renderer-v8/src/context_bootstrap/performance_observer_runtime/observer.rs
+++ b/moli-renderer-v8/src/context_bootstrap/performance_observer_runtime/observer.rs
@@ -5,11 +5,12 @@ use crate::observer_runtime::ObserverCallbackId;
use crate::util::{
define_v8_array_data_property, get_private_value, serialize_v8_iter_array, set_private_value,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "PerformanceObserver")]
+#[webapi(interface = web_api_interfaces::PerformanceObserver)]
struct PerformanceObserverObjectDeclaration<'s> {
#[webapi(slot = PERFORMANCE_OBSERVER_CALLBACK_ID_SLOT)]
callback_id: u32,
diff --git a/moli-renderer-v8/src/context_bootstrap/performance_runtime/entries.rs b/moli-renderer-v8/src/context_bootstrap/performance_runtime/entries.rs
index 7571791fa..d9775b0de 100644
--- a/moli-renderer-v8/src/context_bootstrap/performance_runtime/entries.rs
+++ b/moli-renderer-v8/src/context_bootstrap/performance_runtime/entries.rs
@@ -6,6 +6,7 @@ use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, set_private_value,
throw_type_error,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -25,7 +26,7 @@ struct PerformanceGetEntriesByNameArgs {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PerformanceEntry", scope_lifetime = 'scope)]
+#[webapi(interface = web_api_interfaces::PerformanceEntry, scope_lifetime = 'scope)]
struct PerformanceEntryObjectDeclaration<'scope, 'name, 'entry_type> {
#[webapi(slot = PERFORMANCE_ENTRY_NAME_SLOT)]
name: &'name str,
@@ -53,7 +54,7 @@ struct PerformanceEntryJsonSnapshotDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PerformanceResourceTiming")]
+#[webapi(interface = web_api_interfaces::PerformanceResourceTiming)]
struct PerformanceResourceTimingSlotDeclaration {
#[webapi(slot = PERFORMANCE_RESOURCE_INITIATOR_TYPE_SLOT)]
initiator_type: String,
@@ -208,7 +209,7 @@ impl PerformanceResourceTimingJsonSnapshotDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "PerformanceEntry", receiver = "PerformanceEntry")]
+#[webapi(interface = web_api_interfaces::PerformanceEntry, receiver)]
struct PerformanceEntryPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
@@ -241,7 +242,7 @@ struct PerformanceEntryPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "PerformanceEntry", enumerable, receiver = "PerformanceEntry")]
+#[webapi(interface = web_api_interfaces::PerformanceEntry, enumerable, receiver)]
struct PerformanceEntryPrototypeMethodsDeclaration {
#[webapi(
method,
@@ -266,8 +267,8 @@ struct PerformanceEntryDetailPrototypeAccessorsDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "PerformanceResourceTiming",
- receiver = "PerformanceResourceTiming"
+ interface = web_api_interfaces::PerformanceResourceTiming,
+ receiver
)]
struct PerformanceResourceTimingPrototypeAccessorsDeclaration {
#[webapi(
@@ -414,9 +415,9 @@ struct PerformanceResourceTimingPrototypeAccessorsDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "PerformanceResourceTiming",
+ interface = web_api_interfaces::PerformanceResourceTiming,
enumerable,
- receiver = "PerformanceResourceTiming"
+ receiver
)]
struct PerformanceResourceTimingPrototypeMethodsDeclaration {
#[webapi(
@@ -756,7 +757,7 @@ pub(super) fn create_performance_entry<'s>(
"resource" => "PerformanceResourceTiming",
_ => "PerformanceEntry",
};
- moli_webapi_declare::initialize_web_api_object(scope, entry, prototype_name)
+ web_api_interfaces::initialize(scope, entry, prototype_name)
.expect("PerformanceEntry primary interface should initialize");
if let Ok(prototype) =
crate::context_bootstrap::ensure_intrinsic_interface_prototype(scope, prototype_name)
diff --git a/moli-renderer-v8/src/context_bootstrap/performance_runtime/install.rs b/moli-renderer-v8/src/context_bootstrap/performance_runtime/install.rs
index 3912f2ded..922c04ef3 100644
--- a/moli-renderer-v8/src/context_bootstrap/performance_runtime/install.rs
+++ b/moli-renderer-v8/src/context_bootstrap/performance_runtime/install.rs
@@ -5,6 +5,7 @@ use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, serialize_v8_array,
set_private_value,
};
+use crate::web_api_interfaces;
use crate::webidl_iterator::{
SnapshotWebIdlIteratorKind, invoke_webidl_collection_for_each_callback,
new_snapshot_webidl_iterator, prepare_webidl_collection_for_each_callback,
@@ -58,7 +59,7 @@ pub(super) const LOAD_END_INDEX: usize = 3;
const LIFECYCLE_TIMESTAMP_COUNT: usize = 4;
#[derive(WebApiObject)]
-#[webapi(interface = "Performance")]
+#[webapi(interface = web_api_interfaces::Performance)]
struct PerformanceObjectDeclaration<'scope> {
#[webapi(slot = PERFORMANCE_TIME_ORIGIN_SLOT)]
time_origin: f64,
@@ -92,7 +93,7 @@ struct PerformanceObserverConstructorDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PerformanceNavigation")]
+#[webapi(interface = web_api_interfaces::PerformanceNavigation)]
struct PerformanceNavigationObjectDeclaration {
#[webapi(slot = PERFORMANCE_NAVIGATION_TYPE_SLOT)]
navigation_type: f64,
@@ -105,7 +106,7 @@ struct PerformanceNavigationObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "PerformanceNavigation")]
+#[webapi(interface = web_api_interfaces::PerformanceNavigation)]
struct PerformanceNavigationConstantsDeclaration {
#[webapi(constant = "TYPE_NAVIGATE", value = 0.0)]
type_navigate: (),
@@ -121,14 +122,14 @@ struct PerformanceNavigationConstantsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "EventCounts")]
+#[webapi(interface = web_api_interfaces::EventCounts)]
struct EventCountsObjectDeclaration {
#[webapi(slot = PERFORMANCE_EVENT_COUNTS_VALUES_SLOT)]
values: Vec<u32>,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Performance", enumerable)]
+#[webapi(interface = web_api_interfaces::Performance, enumerable)]
struct PerformancePrototypeMethodsDeclaration {
#[webapi(method, length = 0, callback = performance_now_callback)]
now: (),
@@ -159,7 +160,7 @@ struct PerformancePrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Performance", enumerable)]
+#[webapi(interface = web_api_interfaces::Performance, enumerable)]
struct PerformancePrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = super::memory::performance_memory_getter)]
memory: (),
@@ -194,7 +195,7 @@ struct PerformancePrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "PerformanceNavigation", enumerable)]
+#[webapi(interface = web_api_interfaces::PerformanceNavigation, enumerable)]
struct PerformanceNavigationPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
@@ -212,7 +213,7 @@ struct PerformanceNavigationPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "EventCounts", enumerable)]
+#[webapi(interface = web_api_interfaces::EventCounts, enumerable)]
struct EventCountsPrototypeMethodsDeclaration {
#[webapi(accessor_property, getter = event_counts_size_getter)]
size: (),
@@ -240,7 +241,7 @@ struct EventCountsPrototypeMethodsDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PerformanceTiming")]
+#[webapi(interface = web_api_interfaces::PerformanceTiming)]
struct PerformanceTimingObjectDeclaration {
#[webapi(data_property, enumerable)]
navigation_start: u64,
@@ -522,7 +523,7 @@ const PERFORMANCE_NAVIGATION_TIMING_ATTRIBUTE_SLOTS: &[&str] = &[
];
#[derive(WebApiObject)]
-#[webapi(interface = "PerformanceNavigationTiming")]
+#[webapi(interface = web_api_interfaces::PerformanceNavigationTiming)]
struct PerformanceNavigationTimingSlotDeclaration {
#[webapi(slot = NAV_INITIATOR_TYPE_SLOT, constructor_default = "navigation")]
initiator_type: &'static str,
@@ -583,7 +584,7 @@ struct PerformanceNavigationTimingSlotDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "PerformanceNavigationTiming", enumerable)]
+#[webapi(interface = web_api_interfaces::PerformanceNavigationTiming, enumerable)]
struct PerformanceNavigationTimingPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/performance_runtime/memory.rs b/moli-renderer-v8/src/context_bootstrap/performance_runtime/memory.rs
index 58138f2a4..140a268f6 100644
--- a/moli-renderer-v8/src/context_bootstrap/performance_runtime/memory.rs
+++ b/moli-renderer-v8/src/context_bootstrap/performance_runtime/memory.rs
@@ -3,6 +3,7 @@ use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, set_private_value,
throw_type_error,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
use std::time::{Duration, Instant};
@@ -30,7 +31,7 @@ struct MemoryInfoPrototypeDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "MemoryInfo")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::MemoryInfo)]
struct MemoryInfoObjectDeclaration<'scope> {
#[webapi(prototype)]
prototype: Option<v8::Local<'scope, v8::Object>>,
diff --git a/moli-renderer-v8/src/context_bootstrap/performance_runtime/resource_buffer.rs b/moli-renderer-v8/src/context_bootstrap/performance_runtime/resource_buffer.rs
index 7e553514d..fed43d385 100644
--- a/moli-renderer-v8/src/context_bootstrap/performance_runtime/resource_buffer.rs
+++ b/moli-renderer-v8/src/context_bootstrap/performance_runtime/resource_buffer.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::{
native_bridge::{JsContextHost, ResourceTimingBufferId},
util::{
@@ -18,7 +19,7 @@ struct SetResourceTimingBufferSizeArgs {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Performance", enumerable)]
+#[webapi(interface = web_api_interfaces::Performance, enumerable)]
struct PerformanceResourceTimingBufferMembersDeclaration {
#[webapi(method, length = 0, callback = clear_resource_timings_callback)]
clear_resource_timings: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/range/static_storage.rs b/moli-renderer-v8/src/context_bootstrap/range/static_storage.rs
index c104a23a3..62cfd52f7 100644
--- a/moli-renderer-v8/src/context_bootstrap/range/static_storage.rs
+++ b/moli-renderer-v8/src/context_bootstrap/range/static_storage.rs
@@ -1,10 +1,11 @@
use super::*;
use crate::native_bridge::RangeBoundarySide;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "AbstractRange")]
+#[webapi(interface = web_api_interfaces::AbstractRange)]
struct StaticRangeBoundaryStorageDeclaration<'scope> {
#[webapi(slot = STATIC_RANGE_START_CONTAINER_STORAGE_KEY)]
start_container: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/range_surface/install.rs b/moli-renderer-v8/src/context_bootstrap/range_surface/install.rs
index 3d0b078d8..a211ec7ce 100644
--- a/moli-renderer-v8/src/context_bootstrap/range_surface/install.rs
+++ b/moli-renderer-v8/src/context_bootstrap/range_surface/install.rs
@@ -16,17 +16,18 @@ use super::content::{
};
use super::geometry::{range_get_bounding_client_rect_callback, range_get_client_rects_callback};
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentRangePrototypeDeclaration {
#[webapi(method, length = 0, callback = document_create_range_callback)]
create_range: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Range", enumerable)]
+#[webapi(interface = web_api_interfaces::Range, enumerable)]
struct RangePrototypeMethodsDeclaration {
#[webapi(method, length = 2, callback = range_set_start_callback)]
set_start: (),
@@ -79,7 +80,7 @@ struct RangePrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "AbstractRange")]
+#[webapi(interface = web_api_interfaces::AbstractRange)]
struct AbstractRangePrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/range_surface/template.rs b/moli-renderer-v8/src/context_bootstrap/range_surface/template.rs
index bf89c5044..0ead740df 100644
--- a/moli-renderer-v8/src/context_bootstrap/range_surface/template.rs
+++ b/moli-renderer-v8/src/context_bootstrap/range_surface/template.rs
@@ -2,11 +2,12 @@ use super::{
RANGE_WRAPPER_INTERNAL_FIELD_COUNT,
construction::{range_constructor_callback, static_range_constructor_callback},
};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "AbstractRange",
+ interface = web_api_interfaces::AbstractRange,
constructor = "illegal",
constructor_length = 0
)]
@@ -14,7 +15,7 @@ struct AbstractRangeTemplateDeclaration {}
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "Range",
+ interface = web_api_interfaces::Range,
constructor_callback = range_constructor_callback,
constructor_length = 0
)]
@@ -34,7 +35,7 @@ struct RangeConstructorTemplateDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "StaticRange",
+ interface = web_api_interfaces::StaticRange,
constructor_callback = static_range_constructor_callback,
constructor_length = 1
)]
diff --git a/moli-renderer-v8/src/context_bootstrap/resize_observer_runtime.rs b/moli-renderer-v8/src/context_bootstrap/resize_observer_runtime.rs
index 03e55ff7f..d62305190 100644
--- a/moli-renderer-v8/src/context_bootstrap/resize_observer_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/resize_observer_runtime.rs
@@ -2,12 +2,13 @@ use super::*;
use crate::host::report_event_callback_exception;
use crate::observer_runtime::ObserverCallbackId;
use crate::util::{get_private_value, serialize_v8_iter_array, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use crate::window_webidl_callback::WindowWebIdlCallbackFunctionOutcome;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "ResizeObserver")]
+#[webapi(interface = web_api_interfaces::ResizeObserver)]
struct ResizeObserverObjectDeclaration<'s> {
#[webapi(slot = RESIZE_OBSERVER_CALLBACK_ID_SLOT)]
callback_id: u32,
@@ -26,7 +27,7 @@ struct ResizeObserverObjectDeclaration<'s> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ResizeObserverEntry", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::ResizeObserverEntry, prototype = "Object")]
struct ResizeObserverEntryDeclaration<'scope> {
#[webapi(data_property, enumerable)]
target: v8::Local<'scope, v8::Value>,
@@ -50,7 +51,7 @@ struct ResizeObserverObservedRecordDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ResizeObserverSize", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::ResizeObserverSize, prototype = "Object")]
struct ResizeObserverSizeDeclaration {
#[webapi(data_property, enumerable)]
inline_size: f64,
diff --git a/moli-renderer-v8/src/context_bootstrap/runtime_state.rs b/moli-renderer-v8/src/context_bootstrap/runtime_state.rs
index 12cd4d96e..f854e632b 100644
--- a/moli-renderer-v8/src/context_bootstrap/runtime_state.rs
+++ b/moli-renderer-v8/src/context_bootstrap/runtime_state.rs
@@ -21,6 +21,7 @@ use super::{
window_runtime::{build_legacy_storage_info_object, window_noop_callback},
window_template::install_window_named_properties_object,
};
+use crate::web_api_interfaces;
use crate::{
document_runtime::{DocumentRuntime, DomHandle},
native_bridge::{
@@ -418,7 +419,7 @@ struct ConsoleObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Window", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::Window, prototype = "Object")]
struct WindowBootstrapGlobalSlotsDeclaration<'scope> {
#[webapi(slot = WINDOW_CONSOLE_SLOT)]
console: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/selection/values.rs b/moli-renderer-v8/src/context_bootstrap/selection/values.rs
index 4f5fe9589..82d073cbc 100644
--- a/moli-renderer-v8/src/context_bootstrap/selection/values.rs
+++ b/moli-renderer-v8/src/context_bootstrap/selection/values.rs
@@ -11,13 +11,14 @@ use crate::native_bridge::{
callback_value_dom_handle,
};
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
const SELECTION_RECORD_INTERNAL_FIELD_INDEX: usize = 0;
const SELECTION_WRAPPER_INTERNAL_FIELD_COUNT: usize = 1;
#[derive(WebApiObject)]
-#[webapi(interface = "Selection")]
+#[webapi(interface = web_api_interfaces::Selection)]
struct SelectionObjectDeclaration {
#[webapi(slot = SELECTION_RANGE_SLOT, init = "null")]
range: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/selection_surface.rs b/moli-renderer-v8/src/context_bootstrap/selection_surface.rs
index 184f6304f..e07fca563 100644
--- a/moli-renderer-v8/src/context_bootstrap/selection_surface.rs
+++ b/moli-renderer-v8/src/context_bootstrap/selection_surface.rs
@@ -15,10 +15,11 @@ use super::selection_callbacks::{
};
use super::*;
use crate::util::{callback_data_index_value, get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Selection", enumerable)]
+#[webapi(interface = web_api_interfaces::Selection, enumerable)]
struct SelectionPrototypeMethodsDeclaration {
#[webapi(method, length = 1, callback = selection_get_range_at_callback)]
get_range_at: (),
@@ -57,7 +58,7 @@ struct SelectionPrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Selection")]
+#[webapi(interface = web_api_interfaces::Selection)]
struct SelectionPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/shared_installers/abort_statics.rs b/moli-renderer-v8/src/context_bootstrap/shared_installers/abort_statics.rs
index 99cbe1ad3..9320b7a05 100644
--- a/moli-renderer-v8/src/context_bootstrap/shared_installers/abort_statics.rs
+++ b/moli-renderer-v8/src/context_bootstrap/shared_installers/abort_statics.rs
@@ -1,8 +1,9 @@
use crate::native_bridge::abort;
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, v8};
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "AbortSignal")]
+#[webapi(interface = web_api_interfaces::AbortSignal)]
struct AbortSignalConstructorDeclaration {
#[webapi(
static_method = "abort",
@@ -28,7 +29,7 @@ struct AbortSignalConstructorDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "AbortSignal", enumerable)]
+#[webapi(interface = web_api_interfaces::AbortSignal, enumerable)]
struct AbortSignalPrototypeDeclaration {
#[webapi(
method,
@@ -76,7 +77,7 @@ struct AbortSignalPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "AbortController", enumerable)]
+#[webapi(interface = web_api_interfaces::AbortController, enumerable)]
struct AbortControllerPrototypeDeclaration {
#[webapi(method, length = 0, callback = abort::abort_controller_abort_callback)]
abort: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/shared_installers/attr.rs b/moli-renderer-v8/src/context_bootstrap/shared_installers/attr.rs
index cf58a97df..ce57dac1d 100644
--- a/moli-renderer-v8/src/context_bootstrap/shared_installers/attr.rs
+++ b/moli-renderer-v8/src/context_bootstrap/shared_installers/attr.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Attr")]
+#[webapi(interface = web_api_interfaces::Attr)]
struct AttrPrototypeDeclaration {
#[webapi(method = "toString", length = 0, callback = attr_to_string_callback)]
to_string: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/shared_installers/constants.rs b/moli-renderer-v8/src/context_bootstrap/shared_installers/constants.rs
index 90b74b6e9..6c9f8e608 100644
--- a/moli-renderer-v8/src/context_bootstrap/shared_installers/constants.rs
+++ b/moli-renderer-v8/src/context_bootstrap/shared_installers/constants.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(Default, WebApiObject)]
@@ -46,7 +47,7 @@ struct NodeFilterGlobalDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Node", enumerable)]
+#[webapi(interface = web_api_interfaces::Node, enumerable)]
struct NodeConstantsDeclaration {
#[webapi(constant = "ELEMENT_NODE", value = 1u32)]
_element_node: (),
@@ -90,7 +91,7 @@ struct NodeConstantsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTrackElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTrackElement, enumerable)]
struct HtmlTrackElementConstantsDeclaration {
#[webapi(constant = "NONE", value = 0u32)]
_none: (),
@@ -103,7 +104,7 @@ struct HtmlTrackElementConstantsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLMediaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLMediaElement, enumerable)]
struct MediaElementPrototypeConstantsDeclaration {
#[webapi(constant = "NETWORK_EMPTY", value = 0u32)]
_network_empty: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/shared_installers/css_style.rs b/moli-renderer-v8/src/context_bootstrap/shared_installers/css_style.rs
index 2bcef0d5a..bb989cbbc 100644
--- a/moli-renderer-v8/src/context_bootstrap/shared_installers/css_style.rs
+++ b/moli-renderer-v8/src/context_bootstrap/shared_installers/css_style.rs
@@ -1,9 +1,10 @@
use super::*;
use crate::native_bridge::element;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSStyleDeclaration")]
+#[webapi(interface = web_api_interfaces::CSSStyleDeclaration)]
struct CssStyleDeclarationPrototypeDeclaration {
#[webapi(accessor_property, enumerable, getter = element::style_length_getter_callback)]
length: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/shared_worker_host.rs b/moli-renderer-v8/src/context_bootstrap/shared_worker_host.rs
index bdd8a98be..3fe54c707 100644
--- a/moli-renderer-v8/src/context_bootstrap/shared_worker_host.rs
+++ b/moli-renderer-v8/src/context_bootstrap/shared_worker_host.rs
@@ -18,6 +18,7 @@ use super::{
worker_script_resource_url, worker_script_scheme_can_load,
},
};
+use crate::web_api_interfaces;
use crate::{
context_bootstrap::{SharedStorageBucketStore, WeakIndexedDbManager},
document_runtime::DomHandle,
@@ -50,7 +51,7 @@ const SHARED_WORKER_CLIENT_ID_SLOT: &str = "__moliSharedWorkerClientId";
const SHARED_WORKER_ONERROR_SLOT: &str = "__moliSharedWorkerOnError";
#[derive(WebApiObject)]
-#[webapi(interface = "SharedWorker")]
+#[webapi(interface = web_api_interfaces::SharedWorker)]
struct SharedWorkerObjectDeclaration<'scope> {
#[webapi(slot = SIMPLE_EVENT_TARGET_SLOT, value = SHARED_WORKER_LISTENERS_SLOT)]
event_target_slot: (),
@@ -94,7 +95,7 @@ struct SharedWorkerHostEventInitDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Event", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::Event, prototype = "Object")]
struct SharedWorkerHostEventFallbackDeclaration {
#[webapi(data_property, enumerable)]
r#type: String,
@@ -120,7 +121,7 @@ struct SharedWorkerHostErrorEventInitDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ErrorEvent", prototype = "Object", scope_lifetime = 'scope)]
+#[webapi(interface = web_api_interfaces::ErrorEvent, prototype = "Object", scope_lifetime = 'scope)]
struct SharedWorkerHostErrorEventFallbackDeclaration<'scope, 'text> {
#[webapi(data_property, enumerable)]
r#type: &'static str,
diff --git a/moli-renderer-v8/src/context_bootstrap/specs/registry.rs b/moli-renderer-v8/src/context_bootstrap/specs/registry.rs
index fe000ff68..9be7d50c7 100644
--- a/moli-renderer-v8/src/context_bootstrap/specs/registry.rs
+++ b/moli-renderer-v8/src/context_bootstrap/specs/registry.rs
@@ -1,1479 +1,1186 @@
use super::{ConstructorKind, ConstructorSpec};
use crate::context_bootstrap::bridge_descriptor::node_bridge_descriptors;
+use crate::web_api_interfaces;
use std::collections::HashSet;
const CONSTRUCTOR_SPECS_BEFORE_STREAMS: &[ConstructorSpec] = &[
ConstructorSpec {
- name: "NodeList",
- parent: None,
+ interface: web_api_interfaces::NodeList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "HTMLCollection",
- parent: None,
+ interface: web_api_interfaces::HTMLCollection::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "HTMLFormControlsCollection",
- parent: Some("HTMLCollection"),
+ interface: web_api_interfaces::HTMLFormControlsCollection::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "HTMLOptionsCollection",
- parent: Some("HTMLCollection"),
+ interface: web_api_interfaces::HTMLOptionsCollection::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "RadioNodeList",
- parent: Some("NodeList"),
+ interface: web_api_interfaces::RadioNodeList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "ValidityState",
- parent: None,
+ interface: web_api_interfaces::ValidityState::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DOMTokenList",
- parent: None,
+ interface: web_api_interfaces::DOMTokenList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DOMStringMap",
- parent: None,
+ interface: web_api_interfaces::DOMStringMap::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DOMStringList",
- parent: None,
+ interface: web_api_interfaces::DOMStringList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "PluginArray",
- parent: None,
+ interface: web_api_interfaces::PluginArray::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "MimeTypeArray",
- parent: None,
+ interface: web_api_interfaces::MimeTypeArray::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Plugin",
- parent: None,
+ interface: web_api_interfaces::Plugin::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "MimeType",
- parent: None,
+ interface: web_api_interfaces::MimeType::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CustomElementRegistry",
- parent: None,
+ interface: web_api_interfaces::CustomElementRegistry::DESCRIPTOR,
kind: ConstructorKind::CustomElementRegistry,
},
ConstructorSpec {
- name: "ElementInternals",
- parent: None,
+ interface: web_api_interfaces::ElementInternals::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CustomStateSet",
- parent: None,
+ interface: web_api_interfaces::CustomStateSet::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Attr",
- parent: Some("Node"),
+ interface: web_api_interfaces::Attr::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Option",
- parent: None,
+ interface: web_api_interfaces::Option::DESCRIPTOR,
kind: ConstructorKind::Option,
},
ConstructorSpec {
- name: "NamedNodeMap",
- parent: None,
+ interface: web_api_interfaces::NamedNodeMap::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGLength",
- parent: None,
+ interface: web_api_interfaces::SVGLength::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGNumber",
- parent: None,
+ interface: web_api_interfaces::SVGNumber::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGRect",
- parent: None,
+ interface: web_api_interfaces::SVGRect::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGAnimatedLength",
- parent: None,
+ interface: web_api_interfaces::SVGAnimatedLength::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGLengthList",
- parent: None,
+ interface: web_api_interfaces::SVGLengthList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGAnimatedLengthList",
- parent: None,
+ interface: web_api_interfaces::SVGAnimatedLengthList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGAnimatedNumber",
- parent: None,
+ interface: web_api_interfaces::SVGAnimatedNumber::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGNumberList",
- parent: None,
+ interface: web_api_interfaces::SVGNumberList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGAnimatedNumberList",
- parent: None,
+ interface: web_api_interfaces::SVGAnimatedNumberList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGAnimatedEnumeration",
- parent: None,
+ interface: web_api_interfaces::SVGAnimatedEnumeration::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGAnimatedTransformList",
- parent: None,
+ interface: web_api_interfaces::SVGAnimatedTransformList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGTransformList",
- parent: None,
+ interface: web_api_interfaces::SVGTransformList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGTransform",
- parent: None,
+ interface: web_api_interfaces::SVGTransform::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SVGMatrix",
- parent: None,
+ interface: web_api_interfaces::SVGMatrix::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CSSStyleDeclaration",
- parent: None,
+ interface: web_api_interfaces::CSSStyleDeclaration::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "StylePropertyMapReadOnly",
- parent: None,
+ interface: web_api_interfaces::StylePropertyMapReadOnly::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CSSStyleValue",
- parent: None,
+ interface: web_api_interfaces::CSSStyleValue::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CSSKeywordValue",
- parent: Some("CSSStyleValue"),
+ interface: web_api_interfaces::CSSKeywordValue::DESCRIPTOR,
kind: ConstructorKind::CssKeywordValue,
},
ConstructorSpec {
- name: "CSSNumericValue",
- parent: Some("CSSStyleValue"),
+ interface: web_api_interfaces::CSSNumericValue::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CSSUnitValue",
- parent: Some("CSSNumericValue"),
+ interface: web_api_interfaces::CSSUnitValue::DESCRIPTOR,
kind: ConstructorKind::CssUnitValue,
},
ConstructorSpec {
- name: "CSSStyleProperties",
- parent: Some("CSSStyleDeclaration"),
+ interface: web_api_interfaces::CSSStyleProperties::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CSSFontFaceDescriptors",
- parent: Some("CSSStyleDeclaration"),
+ interface: web_api_interfaces::CSSFontFaceDescriptors::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CSSPageDescriptors",
- parent: Some("CSSStyleDeclaration"),
+ interface: web_api_interfaces::CSSPageDescriptors::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CSSFontFeatureValuesMap",
- parent: None,
+ interface: web_api_interfaces::CSSFontFeatureValuesMap::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "HTMLAllCollection",
- parent: None,
+ interface: web_api_interfaces::HTMLAllCollection::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Event",
- parent: None,
+ interface: web_api_interfaces::Event::DESCRIPTOR,
kind: ConstructorKind::Event,
},
ConstructorSpec {
- name: "UIEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::UIEvent::DESCRIPTOR,
kind: ConstructorKind::UiEvent,
},
ConstructorSpec {
- name: "FocusEvent",
- parent: Some("UIEvent"),
+ interface: web_api_interfaces::FocusEvent::DESCRIPTOR,
kind: ConstructorKind::FocusEvent,
},
ConstructorSpec {
- name: "TextEvent",
- parent: Some("UIEvent"),
+ interface: web_api_interfaces::TextEvent::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CompositionEvent",
- parent: Some("UIEvent"),
+ interface: web_api_interfaces::CompositionEvent::DESCRIPTOR,
kind: ConstructorKind::CompositionEvent,
},
ConstructorSpec {
- name: "CustomEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::CustomEvent::DESCRIPTOR,
kind: ConstructorKind::CustomEvent,
},
ConstructorSpec {
- name: "MouseEvent",
- parent: Some("UIEvent"),
+ interface: web_api_interfaces::MouseEvent::DESCRIPTOR,
kind: ConstructorKind::MouseEvent,
},
ConstructorSpec {
- name: "CapturedMouseEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::CapturedMouseEvent::DESCRIPTOR,
kind: ConstructorKind::CapturedMouseEvent,
},
ConstructorSpec {
- name: "DragEvent",
- parent: Some("MouseEvent"),
+ interface: web_api_interfaces::DragEvent::DESCRIPTOR,
kind: ConstructorKind::DragEvent,
},
ConstructorSpec {
- name: "ClipboardEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::ClipboardEvent::DESCRIPTOR,
kind: ConstructorKind::ClipboardEvent,
},
ConstructorSpec {
- name: "KeyboardEvent",
- parent: Some("UIEvent"),
+ interface: web_api_interfaces::KeyboardEvent::DESCRIPTOR,
kind: ConstructorKind::KeyboardEvent,
},
ConstructorSpec {
- name: "InputEvent",
- parent: Some("UIEvent"),
+ interface: web_api_interfaces::InputEvent::DESCRIPTOR,
kind: ConstructorKind::InputEvent,
},
ConstructorSpec {
- name: "WheelEvent",
- parent: Some("MouseEvent"),
+ interface: web_api_interfaces::WheelEvent::DESCRIPTOR,
kind: ConstructorKind::WheelEvent,
},
ConstructorSpec {
- name: "PointerEvent",
- parent: Some("MouseEvent"),
+ interface: web_api_interfaces::PointerEvent::DESCRIPTOR,
kind: ConstructorKind::PointerEvent,
},
ConstructorSpec {
- name: "TouchEvent",
- parent: Some("UIEvent"),
+ interface: web_api_interfaces::TouchEvent::DESCRIPTOR,
kind: ConstructorKind::TouchEvent,
},
ConstructorSpec {
- name: "MessageEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::MessageEvent::DESCRIPTOR,
kind: ConstructorKind::MessageEvent,
},
ConstructorSpec {
- name: "StorageEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::StorageEvent::DESCRIPTOR,
kind: ConstructorKind::StorageEvent,
},
ConstructorSpec {
- name: "ErrorEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::ErrorEvent::DESCRIPTOR,
kind: ConstructorKind::ErrorEvent,
},
ConstructorSpec {
- name: "PromiseRejectionEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::PromiseRejectionEvent::DESCRIPTOR,
kind: ConstructorKind::PromiseRejectionEvent,
},
ConstructorSpec {
- name: "NavigationCurrentEntryChangeEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::NavigationCurrentEntryChangeEvent::DESCRIPTOR,
kind: ConstructorKind::NavigationCurrentEntryChangeEvent,
},
ConstructorSpec {
- name: "NavigateEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::NavigateEvent::DESCRIPTOR,
kind: ConstructorKind::NavigateEvent,
},
ConstructorSpec {
- name: "CloseEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::CloseEvent::DESCRIPTOR,
kind: ConstructorKind::CloseEvent,
},
ConstructorSpec {
- name: "SubmitEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::SubmitEvent::DESCRIPTOR,
kind: ConstructorKind::SubmitEvent,
},
ConstructorSpec {
- name: "FormDataEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::FormDataEvent::DESCRIPTOR,
kind: ConstructorKind::FormDataEvent,
},
ConstructorSpec {
- name: "PopStateEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::PopStateEvent::DESCRIPTOR,
kind: ConstructorKind::PopStateEvent,
},
ConstructorSpec {
- name: "PageTransitionEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::PageTransitionEvent::DESCRIPTOR,
kind: ConstructorKind::PageTransitionEvent,
},
ConstructorSpec {
- name: "BeforeUnloadEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::BeforeUnloadEvent::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "HashChangeEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::HashChangeEvent::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "MediaQueryListEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::MediaQueryListEvent::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SecurityPolicyViolationEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::SecurityPolicyViolationEvent::DESCRIPTOR,
kind: ConstructorKind::SecurityPolicyViolationEvent,
},
ConstructorSpec {
- name: "ToggleEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::ToggleEvent::DESCRIPTOR,
kind: ConstructorKind::ToggleEvent,
},
ConstructorSpec {
- name: "CommandEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::CommandEvent::DESCRIPTOR,
kind: ConstructorKind::CommandEvent,
},
ConstructorSpec {
- name: "InterestEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::InterestEvent::DESCRIPTOR,
kind: ConstructorKind::InterestEvent,
},
ConstructorSpec {
- name: "ContentVisibilityAutoStateChangeEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::ContentVisibilityAutoStateChangeEvent::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DOMException",
- parent: None,
+ interface: web_api_interfaces::DOMException::DESCRIPTOR,
kind: ConstructorKind::DomException,
},
ConstructorSpec {
- name: "DOMError",
- parent: None,
+ interface: web_api_interfaces::DOMError::DESCRIPTOR,
kind: ConstructorKind::DomError,
},
ConstructorSpec {
- name: "QuotaExceededError",
- parent: Some("DOMException"),
+ interface: web_api_interfaces::QuotaExceededError::DESCRIPTOR,
kind: ConstructorKind::QuotaExceededError,
},
ConstructorSpec {
- name: "AbortSignal",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::AbortSignal::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "AbortController",
- parent: None,
+ interface: web_api_interfaces::AbortController::DESCRIPTOR,
kind: ConstructorKind::AbortController,
},
ConstructorSpec {
- name: "BroadcastChannel",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::BroadcastChannel::DESCRIPTOR,
kind: ConstructorKind::BroadcastChannel,
},
ConstructorSpec {
- name: "EventSource",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::EventSource::DESCRIPTOR,
kind: ConstructorKind::EventSource,
},
ConstructorSpec {
- name: "IdleDetector",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::IdleDetector::DESCRIPTOR,
kind: ConstructorKind::IdleDetector,
},
ConstructorSpec {
- name: "Notification",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::Notification::DESCRIPTOR,
kind: ConstructorKind::Notification,
},
ConstructorSpec {
- name: "MessageChannel",
- parent: None,
+ interface: web_api_interfaces::MessageChannel::DESCRIPTOR,
kind: ConstructorKind::MessageChannel,
},
ConstructorSpec {
- name: "MessagePort",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::MessagePort::DESCRIPTOR,
kind: ConstructorKind::MessagePort,
},
ConstructorSpec {
- name: "Worker",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::Worker::DESCRIPTOR,
kind: ConstructorKind::Worker,
},
ConstructorSpec {
- name: "SharedWorker",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::SharedWorker::DESCRIPTOR,
kind: ConstructorKind::SharedWorker,
},
ConstructorSpec {
- name: "WorkerNavigator",
- parent: None,
+ interface: web_api_interfaces::WorkerNavigator::DESCRIPTOR,
kind: ConstructorKind::WorkerNavigator,
},
ConstructorSpec {
- name: "WorkerLocation",
- parent: None,
+ interface: web_api_interfaces::WorkerLocation::DESCRIPTOR,
kind: ConstructorKind::WorkerLocation,
},
ConstructorSpec {
- name: "WebSocket",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::WebSocket::DESCRIPTOR,
kind: ConstructorKind::WebSocket,
},
ConstructorSpec {
- name: "WebSocketError",
- parent: Some("DOMException"),
+ interface: web_api_interfaces::WebSocketError::DESCRIPTOR,
kind: ConstructorKind::WebSocketError,
},
ConstructorSpec {
- name: "WebSocketStream",
- parent: None,
+ interface: web_api_interfaces::WebSocketStream::DESCRIPTOR,
kind: ConstructorKind::WebSocketStream,
},
ConstructorSpec {
- name: "Performance",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::Performance::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "PerformanceTiming",
- parent: None,
+ interface: web_api_interfaces::PerformanceTiming::DESCRIPTOR,
kind: ConstructorKind::PerformanceTiming,
},
ConstructorSpec {
- name: "PerformanceNavigation",
- parent: None,
+ interface: web_api_interfaces::PerformanceNavigation::DESCRIPTOR,
kind: ConstructorKind::PerformanceNavigation,
},
ConstructorSpec {
- name: "Animation",
- parent: None,
+ interface: web_api_interfaces::Animation::DESCRIPTOR,
kind: ConstructorKind::Animation,
},
ConstructorSpec {
- name: "AnimationEffect",
- parent: None,
+ interface: web_api_interfaces::AnimationEffect::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "KeyframeEffect",
- parent: Some("AnimationEffect"),
+ interface: web_api_interfaces::KeyframeEffect::DESCRIPTOR,
kind: ConstructorKind::KeyframeEffect,
},
ConstructorSpec {
- name: "AnimationTimeline",
- parent: None,
+ interface: web_api_interfaces::AnimationTimeline::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DocumentTimeline",
- parent: Some("AnimationTimeline"),
+ interface: web_api_interfaces::DocumentTimeline::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "AnimationPlaybackEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::AnimationPlaybackEvent::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "ViewTransition",
- parent: None,
+ interface: web_api_interfaces::ViewTransition::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "ViewTransitionTypeSet",
- parent: None,
+ interface: web_api_interfaces::ViewTransitionTypeSet::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Crypto",
- parent: None,
+ interface: web_api_interfaces::Crypto::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SubtleCrypto",
- parent: None,
+ interface: web_api_interfaces::SubtleCrypto::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CryptoKey",
- parent: None,
+ interface: web_api_interfaces::CryptoKey::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "VisualViewport",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::VisualViewport::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Navigator",
- parent: None,
+ interface: web_api_interfaces::Navigator::DESCRIPTOR,
kind: ConstructorKind::Navigator,
},
ConstructorSpec {
- name: "Permissions",
- parent: None,
+ interface: web_api_interfaces::Permissions::DESCRIPTOR,
kind: ConstructorKind::Permissions,
},
ConstructorSpec {
- name: "PermissionStatus",
- parent: None,
+ interface: web_api_interfaces::PermissionStatus::DESCRIPTOR,
kind: ConstructorKind::PermissionStatus,
},
ConstructorSpec {
- name: "NavigatorUAData",
- parent: None,
+ interface: web_api_interfaces::NavigatorUAData::DESCRIPTOR,
kind: ConstructorKind::NavigatorUAData,
},
ConstructorSpec {
- name: "StorageManager",
- parent: None,
+ interface: web_api_interfaces::StorageManager::DESCRIPTOR,
kind: ConstructorKind::StorageManager,
},
ConstructorSpec {
- name: "StorageEstimate",
- parent: None,
+ interface: web_api_interfaces::StorageEstimate::DESCRIPTOR,
kind: ConstructorKind::StorageEstimate,
},
ConstructorSpec {
- name: "StorageAccessHandle",
- parent: None,
+ interface: web_api_interfaces::StorageAccessHandle::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "StorageBucketManager",
- parent: None,
+ interface: web_api_interfaces::StorageBucketManager::DESCRIPTOR,
kind: ConstructorKind::StorageBucketManager,
},
ConstructorSpec {
- name: "StorageBucket",
- parent: None,
+ interface: web_api_interfaces::StorageBucket::DESCRIPTOR,
kind: ConstructorKind::StorageBucket,
},
ConstructorSpec {
- name: "FileSystemHandle",
- parent: None,
+ interface: web_api_interfaces::FileSystemHandle::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileSystemFileHandle",
- parent: Some("FileSystemHandle"),
+ interface: web_api_interfaces::FileSystemFileHandle::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileSystemDirectoryHandle",
- parent: Some("FileSystemHandle"),
+ interface: web_api_interfaces::FileSystemDirectoryHandle::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileSystemWritableFileStream",
- parent: Some("WritableStream"),
+ interface: web_api_interfaces::FileSystemWritableFileStream::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileSystemSyncAccessHandle",
- parent: None,
+ interface: web_api_interfaces::FileSystemSyncAccessHandle::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "MediaDevices",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::MediaDevices::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Clipboard",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::Clipboard::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "ClipboardItem",
- parent: None,
+ interface: web_api_interfaces::ClipboardItem::DESCRIPTOR,
kind: ConstructorKind::ClipboardItem,
},
ConstructorSpec {
- name: "MediaCapabilities",
- parent: None,
+ interface: web_api_interfaces::MediaCapabilities::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Touch",
- parent: None,
+ interface: web_api_interfaces::Touch::DESCRIPTOR,
kind: ConstructorKind::Touch,
},
ConstructorSpec {
- name: "TouchList",
- parent: None,
+ interface: web_api_interfaces::TouchList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Screen",
- parent: None,
+ interface: web_api_interfaces::Screen::DESCRIPTOR,
kind: ConstructorKind::Screen,
},
ConstructorSpec {
- name: "ScreenOrientation",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::ScreenOrientation::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SpeechSynthesis",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::SpeechSynthesis::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "SpeechSynthesisUtterance",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::SpeechSynthesisUtterance::DESCRIPTOR,
kind: ConstructorKind::SpeechSynthesisUtterance,
},
ConstructorSpec {
- name: "SpeechSynthesisVoice",
- parent: None,
+ interface: web_api_interfaces::SpeechSynthesisVoice::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Selection",
- parent: None,
+ interface: web_api_interfaces::Selection::DESCRIPTOR,
kind: ConstructorKind::Selection,
},
ConstructorSpec {
- name: "History",
- parent: None,
+ interface: web_api_interfaces::History::DESCRIPTOR,
kind: ConstructorKind::History,
},
ConstructorSpec {
- name: "Location",
- parent: None,
+ interface: web_api_interfaces::Location::DESCRIPTOR,
kind: ConstructorKind::Location,
},
ConstructorSpec {
- name: "Navigation",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::Navigation::DESCRIPTOR,
kind: ConstructorKind::Navigation,
},
ConstructorSpec {
- name: "NavigationHistoryEntry",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::NavigationHistoryEntry::DESCRIPTOR,
kind: ConstructorKind::NavigationHistoryEntry,
},
ConstructorSpec {
- name: "NavigationActivation",
- parent: None,
+ interface: web_api_interfaces::NavigationActivation::DESCRIPTOR,
kind: ConstructorKind::NavigationActivation,
},
ConstructorSpec {
- name: "NavigationTransition",
- parent: None,
+ interface: web_api_interfaces::NavigationTransition::DESCRIPTOR,
kind: ConstructorKind::NavigationTransition,
},
ConstructorSpec {
- name: "MutationObserver",
- parent: None,
+ interface: web_api_interfaces::MutationObserver::DESCRIPTOR,
kind: ConstructorKind::MutationObserver,
},
ConstructorSpec {
- name: "MutationRecord",
- parent: None,
+ interface: web_api_interfaces::MutationRecord::DESCRIPTOR,
kind: ConstructorKind::MutationRecord,
},
ConstructorSpec {
- name: "IntersectionObserver",
- parent: None,
+ interface: web_api_interfaces::IntersectionObserver::DESCRIPTOR,
kind: ConstructorKind::IntersectionObserver,
},
ConstructorSpec {
- name: "IntersectionObserverEntry",
- parent: None,
+ interface: web_api_interfaces::IntersectionObserverEntry::DESCRIPTOR,
kind: ConstructorKind::IntersectionObserverEntry,
},
ConstructorSpec {
- name: "EventTarget",
- parent: None,
+ interface: web_api_interfaces::EventTarget::DESCRIPTOR,
kind: ConstructorKind::EventTarget,
},
ConstructorSpec {
- name: "IdleDeadline",
- parent: None,
+ interface: web_api_interfaces::IdleDeadline::DESCRIPTOR,
kind: ConstructorKind::IdleDeadline,
},
ConstructorSpec {
- name: "Window",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::Window::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CharacterData",
- parent: Some("Node"),
+ interface: web_api_interfaces::CharacterData::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DOMImplementation",
- parent: None,
+ interface: web_api_interfaces::DOMImplementation::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "NodeIterator",
- parent: None,
+ interface: web_api_interfaces::NodeIterator::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "TreeWalker",
- parent: None,
+ interface: web_api_interfaces::TreeWalker::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "XPathEvaluator",
- parent: None,
+ interface: web_api_interfaces::XPathEvaluator::DESCRIPTOR,
kind: ConstructorKind::XPathEvaluator,
},
ConstructorSpec {
- name: "XPathResult",
- parent: None,
+ interface: web_api_interfaces::XPathResult::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "StyleSheet",
- parent: None,
+ interface: web_api_interfaces::StyleSheet::DESCRIPTOR,
kind: ConstructorKind::StyleSheet,
},
ConstructorSpec {
- name: "StyleSheetList",
- parent: None,
+ interface: web_api_interfaces::StyleSheetList::DESCRIPTOR,
kind: ConstructorKind::StyleSheetList,
},
ConstructorSpec {
- name: "MediaList",
- parent: None,
+ interface: web_api_interfaces::MediaList::DESCRIPTOR,
kind: ConstructorKind::MediaList,
},
ConstructorSpec {
- name: "CSSRuleList",
- parent: None,
+ interface: web_api_interfaces::CSSRuleList::DESCRIPTOR,
kind: ConstructorKind::CssRuleList,
},
ConstructorSpec {
- name: "CSSRule",
- parent: None,
+ interface: web_api_interfaces::CSSRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSGroupingRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSGroupingRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSConditionRule",
- parent: Some("CSSGroupingRule"),
+ interface: web_api_interfaces::CSSConditionRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSMediaRule",
- parent: Some("CSSConditionRule"),
+ interface: web_api_interfaces::CSSMediaRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSSupportsRule",
- parent: Some("CSSConditionRule"),
+ interface: web_api_interfaces::CSSSupportsRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSContainerRule",
- parent: Some("CSSConditionRule"),
+ interface: web_api_interfaces::CSSContainerRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSLayerBlockRule",
- parent: Some("CSSGroupingRule"),
+ interface: web_api_interfaces::CSSLayerBlockRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSLayerStatementRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSLayerStatementRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSScopeRule",
- parent: Some("CSSGroupingRule"),
+ interface: web_api_interfaces::CSSScopeRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSImportRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSImportRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSFontFaceRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSFontFaceRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSFontFeatureValuesRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSFontFeatureValuesRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSPropertyRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSPropertyRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSKeyframesRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSKeyframesRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSKeyframeRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSKeyframeRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSPageRule",
- parent: Some("CSSGroupingRule"),
+ interface: web_api_interfaces::CSSPageRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSMarginRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSMarginRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSNamespaceRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSNamespaceRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSCounterStyleRule",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSCounterStyleRule::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSStyleRule",
- parent: Some("CSSGroupingRule"),
+ interface: web_api_interfaces::CSSStyleRule::DESCRIPTOR,
kind: ConstructorKind::CssStyleRule,
},
ConstructorSpec {
- name: "CSSNestedDeclarations",
- parent: Some("CSSRule"),
+ interface: web_api_interfaces::CSSNestedDeclarations::DESCRIPTOR,
kind: ConstructorKind::CssRule,
},
ConstructorSpec {
- name: "CSSStyleSheet",
- parent: Some("StyleSheet"),
+ interface: web_api_interfaces::CSSStyleSheet::DESCRIPTOR,
kind: ConstructorKind::CssStyleSheet,
},
ConstructorSpec {
- name: "FontFace",
- parent: None,
+ interface: web_api_interfaces::FontFace::DESCRIPTOR,
kind: ConstructorKind::FontFace,
},
ConstructorSpec {
- name: "FontFaceSet",
- parent: None,
+ interface: web_api_interfaces::FontFaceSet::DESCRIPTOR,
kind: ConstructorKind::FontFaceSet,
},
ConstructorSpec {
- name: "FontFaceSetLoadEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::FontFaceSetLoadEvent::DESCRIPTOR,
kind: ConstructorKind::FontFaceSetLoadEvent,
},
ConstructorSpec {
- name: "Audio",
- parent: None,
+ interface: web_api_interfaces::Audio::DESCRIPTOR,
kind: ConstructorKind::Audio,
},
ConstructorSpec {
- name: "Image",
- parent: None,
+ interface: web_api_interfaces::Image::DESCRIPTOR,
kind: ConstructorKind::Image,
},
ConstructorSpec {
- name: "XMLHttpRequestEventTarget",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::XMLHttpRequestEventTarget::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "XMLHttpRequestUpload",
- parent: Some("XMLHttpRequestEventTarget"),
+ interface: web_api_interfaces::XMLHttpRequestUpload::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "XMLHttpRequest",
- parent: Some("XMLHttpRequestEventTarget"),
+ interface: web_api_interfaces::XMLHttpRequest::DESCRIPTOR,
kind: ConstructorKind::XmlHttpRequest,
},
ConstructorSpec {
- name: "Headers",
- parent: None,
+ interface: web_api_interfaces::Headers::DESCRIPTOR,
kind: ConstructorKind::Headers,
},
ConstructorSpec {
- name: "Request",
- parent: None,
+ interface: web_api_interfaces::Request::DESCRIPTOR,
kind: ConstructorKind::Request,
},
ConstructorSpec {
- name: "Response",
- parent: None,
+ interface: web_api_interfaces::Response::DESCRIPTOR,
kind: ConstructorKind::Response,
},
ConstructorSpec {
- name: "ProgressEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::ProgressEvent::DESCRIPTOR,
kind: ConstructorKind::ProgressEvent,
},
ConstructorSpec {
- name: "DOMParser",
- parent: None,
+ interface: web_api_interfaces::DOMParser::DESCRIPTOR,
kind: ConstructorKind::DomParser,
},
ConstructorSpec {
- name: "TextEncoder",
- parent: None,
+ interface: web_api_interfaces::TextEncoder::DESCRIPTOR,
kind: ConstructorKind::TextEncoder,
},
ConstructorSpec {
- name: "TextDecoder",
- parent: None,
+ interface: web_api_interfaces::TextDecoder::DESCRIPTOR,
kind: ConstructorKind::TextDecoder,
},
];
const CONSTRUCTOR_SPECS_AFTER_STREAMS: &[ConstructorSpec] = &[
ConstructorSpec {
- name: "Geolocation",
- parent: None,
+ interface: web_api_interfaces::Geolocation::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "GeolocationPosition",
- parent: None,
+ interface: web_api_interfaces::GeolocationPosition::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "GeolocationCoordinates",
- parent: None,
+ interface: web_api_interfaces::GeolocationCoordinates::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "GeolocationPositionError",
- parent: None,
+ interface: web_api_interfaces::GeolocationPositionError::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Blob",
- parent: None,
+ interface: web_api_interfaces::Blob::DESCRIPTOR,
kind: ConstructorKind::Blob,
},
ConstructorSpec {
- name: "ImageData",
- parent: None,
+ interface: web_api_interfaces::ImageData::DESCRIPTOR,
kind: ConstructorKind::ImageData,
},
ConstructorSpec {
- name: "ImageBitmap",
- parent: None,
+ interface: web_api_interfaces::ImageBitmap::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "RTCPeerConnection",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::RTCPeerConnection::DESCRIPTOR,
kind: ConstructorKind::RtcPeerConnection,
},
ConstructorSpec {
- name: "RTCIceCandidate",
- parent: None,
+ interface: web_api_interfaces::RTCIceCandidate::DESCRIPTOR,
kind: ConstructorKind::RtcIceCandidate,
},
ConstructorSpec {
- name: "RTCSessionDescription",
- parent: None,
+ interface: web_api_interfaces::RTCSessionDescription::DESCRIPTOR,
kind: ConstructorKind::RtcSessionDescription,
},
ConstructorSpec {
- name: "RTCRtpReceiver",
- parent: None,
+ interface: web_api_interfaces::RTCRtpReceiver::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "RTCDataChannel",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::RTCDataChannel::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CanvasGradient",
- parent: None,
+ interface: web_api_interfaces::CanvasGradient::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "CanvasPattern",
- parent: None,
+ interface: web_api_interfaces::CanvasPattern::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "TextMetrics",
- parent: None,
+ interface: web_api_interfaces::TextMetrics::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "Path2D",
- parent: None,
+ interface: web_api_interfaces::Path2D::DESCRIPTOR,
kind: ConstructorKind::Unsupported,
},
ConstructorSpec {
- name: "OffscreenCanvas",
- parent: None,
+ interface: web_api_interfaces::OffscreenCanvas::DESCRIPTOR,
kind: ConstructorKind::OffscreenCanvas,
},
ConstructorSpec {
- name: "CanvasRenderingContext2D",
- parent: None,
+ interface: web_api_interfaces::CanvasRenderingContext2D::DESCRIPTOR,
kind: ConstructorKind::CanvasRenderingContext2D,
},
ConstructorSpec {
- name: "OffscreenCanvasRenderingContext2D",
- parent: None,
+ interface: web_api_interfaces::OffscreenCanvasRenderingContext2D::DESCRIPTOR,
kind: ConstructorKind::OffscreenCanvasRenderingContext2D,
},
ConstructorSpec {
- name: "WebGLRenderingContext",
- parent: None,
+ interface: web_api_interfaces::WebGLRenderingContext::DESCRIPTOR,
kind: ConstructorKind::WebGLRenderingContext,
},
ConstructorSpec {
- name: "WebGL2RenderingContext",
- parent: None,
+ interface: web_api_interfaces::WebGL2RenderingContext::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "WebGLObject",
- parent: None,
+ interface: web_api_interfaces::WebGLObject::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "WebGLBuffer",
- parent: Some("WebGLObject"),
+ interface: web_api_interfaces::WebGLBuffer::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "WebGLFramebuffer",
- parent: Some("WebGLObject"),
+ interface: web_api_interfaces::WebGLFramebuffer::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "WebGLProgram",
- parent: Some("WebGLObject"),
+ interface: web_api_interfaces::WebGLProgram::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "WebGLRenderbuffer",
- parent: Some("WebGLObject"),
+ interface: web_api_interfaces::WebGLRenderbuffer::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "WebGLShader",
- parent: Some("WebGLObject"),
+ interface: web_api_interfaces::WebGLShader::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "WebGLUniformLocation",
- parent: None,
+ interface: web_api_interfaces::WebGLUniformLocation::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "WEBGL_debug_renderer_info",
- parent: None,
+ interface: web_api_interfaces::WEBGLDebugRendererInfo::DESCRIPTOR,
kind: ConstructorKind::WebGlDebugRendererInfo,
},
ConstructorSpec {
- name: "WEBGL_lose_context",
- parent: None,
+ interface: web_api_interfaces::WEBGLLoseContext::DESCRIPTOR,
kind: ConstructorKind::WebGlLoseContext,
},
ConstructorSpec {
- name: "File",
- parent: Some("Blob"),
+ interface: web_api_interfaces::File::DESCRIPTOR,
kind: ConstructorKind::File,
},
ConstructorSpec {
- name: "DataTransfer",
- parent: None,
+ interface: web_api_interfaces::DataTransfer::DESCRIPTOR,
kind: ConstructorKind::DataTransfer,
},
ConstructorSpec {
- name: "DataTransferItem",
- parent: None,
+ interface: web_api_interfaces::DataTransferItem::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DataTransferItemList",
- parent: None,
+ interface: web_api_interfaces::DataTransferItemList::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileList",
- parent: None,
+ interface: web_api_interfaces::FileList::DESCRIPTOR,
kind: ConstructorKind::FileList,
},
ConstructorSpec {
- name: "FileSystem",
- parent: None,
+ interface: web_api_interfaces::FileSystem::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileSystemEntry",
- parent: None,
+ interface: web_api_interfaces::FileSystemEntry::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileSystemFileEntry",
- parent: Some("FileSystemEntry"),
+ interface: web_api_interfaces::FileSystemFileEntry::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileSystemDirectoryEntry",
- parent: Some("FileSystemEntry"),
+ interface: web_api_interfaces::FileSystemDirectoryEntry::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileSystemDirectoryReader",
- parent: None,
+ interface: web_api_interfaces::FileSystemDirectoryReader::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "FileReader",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::FileReader::DESCRIPTOR,
kind: ConstructorKind::FileReader,
},
ConstructorSpec {
- name: "FileReaderSync",
- parent: None,
+ interface: web_api_interfaces::FileReaderSync::DESCRIPTOR,
kind: ConstructorKind::FileReaderSync,
},
ConstructorSpec {
- name: "DOMRectReadOnly",
- parent: None,
+ interface: web_api_interfaces::DOMRectReadOnly::DESCRIPTOR,
kind: ConstructorKind::DomRectReadOnly,
},
ConstructorSpec {
- name: "DOMRect",
- parent: Some("DOMRectReadOnly"),
+ interface: web_api_interfaces::DOMRect::DESCRIPTOR,
kind: ConstructorKind::DomRect,
},
ConstructorSpec {
- name: "DOMPointReadOnly",
- parent: None,
+ interface: web_api_interfaces::DOMPointReadOnly::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DOMPoint",
- parent: Some("DOMPointReadOnly"),
+ interface: web_api_interfaces::DOMPoint::DESCRIPTOR,
kind: ConstructorKind::DomPoint,
},
ConstructorSpec {
- name: "CaretPosition",
- parent: None,
+ interface: web_api_interfaces::CaretPosition::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DOMQuad",
- parent: None,
+ interface: web_api_interfaces::DOMQuad::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
- name: "DOMMatrixReadOnly",
- parent: None,
+ interface: web_api_interfaces::DOMMatrixReadOnly::DESCRIPTOR,
kind: ConstructorKind::DomMatrix,
},
ConstructorSpec {
- name: "DOMMatrix",
- parent: Some("DOMMatrixReadOnly"),
+ interface: web_api_interfaces::DOMMatrix::DESCRIPTOR,
kind: ConstructorKind::DomMatrix,
},
ConstructorSpec {
- name: "XMLSerializer",
- parent: None,
+ interface: web_api_interfaces::XMLSerializer::DESCRIPTOR,
kind: ConstructorKind::XmlSerializer,
},
ConstructorSpec {
- name: "ResizeObserver",
- parent: None,
+ interface: web_api_interfaces::ResizeObserver::DESCRIPTOR,
kind: ConstructorKind::ResizeObserver,
},
ConstructorSpec {
- name: "PerformanceObserver",
- parent: None,
+ interface: web_api_interfaces::PerformanceObserver::DESCRIPTOR,
kind: ConstructorKind::PerformanceObserver,
},
ConstructorSpec {
- name: "PerformanceObserverEntryList",
- parent: None,
+ interface: web_api_interfaces::PerformanceObserverEntryList::DESCRIPTOR,
kind: ConstructorKind::PerformanceObserverEntryList,
},
ConstructorSpec {
- name: "PerformanceEntry",
- parent: None,
+ interface: web_api_interfaces::PerformanceEntry::DESCRIPTOR,
kind: ConstructorKind::PerformanceEntry,
},
ConstructorSpec {
- name: "PerformanceNavigationTiming",
- parent: Some("PerformanceEntry"),
+ interface: web_api_interfaces::PerformanceNavigationTiming::DESCRIPTOR,
kind: ConstructorKind::PerformanceNavigationTiming,
},
ConstructorSpec {
- name: "PerformanceMark",
- parent: Some("PerformanceEntry"),
+ interface: web_api_interfaces::PerformanceMark::DESCRIPTOR,
kind: ConstructorKind::PerformanceMark,
},
ConstructorSpec {
- name: "PerformanceMeasure",
- parent: Some("PerformanceEntry"),
+ interface: web_api_interfaces::PerformanceMeasure::DESCRIPTOR,
kind: ConstructorKind::PerformanceMeasure,
},
ConstructorSpec {
- name: "PerformanceResourceTiming",
- parent: Some("PerformanceEntry"),
+ interface: web_api_interfaces::PerformanceResourceTiming::DESCRIPTOR,
kind: ConstructorKind::PerformanceResourceTiming,
},
ConstructorSpec {
- name: "EventCounts",
- parent: None,
+ interface: web_api_interfaces::EventCounts::DESCRIPTOR,
kind: ConstructorKind::EventCounts,
},
ConstructorSpec {
- name: "MediaQueryList",
- parent: None,
+ interface: web_api_interfaces::MediaQueryList::DESCRIPTOR,
kind: ConstructorKind::MediaQueryList,
},
ConstructorSpec {
- name: "MediaSource",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::MediaSource::DESCRIPTOR,
kind: ConstructorKind::MediaSource,
},
ConstructorSpec {
- name: "MediaError",
- parent: None,
+ interface: web_api_interfaces::MediaError::DESCRIPTOR,
kind: ConstructorKind::MediaError,
},
ConstructorSpec {
- name: "TextTrack",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::TextTrack::DESCRIPTOR,
kind: ConstructorKind::TextTrack,
},
ConstructorSpec {
- name: "TextTrackList",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::TextTrackList::DESCRIPTOR,
kind: ConstructorKind::TextTrackList,
},
ConstructorSpec {
- name: "TextTrackCue",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::TextTrackCue::DESCRIPTOR,
kind: ConstructorKind::TextTrackCue,
},
ConstructorSpec {
- name: "TextTrackCueList",
- parent: None,
+ interface: web_api_interfaces::TextTrackCueList::DESCRIPTOR,
kind: ConstructorKind::TextTrackCueList,
},
ConstructorSpec {
- name: "TrackEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::TrackEvent::DESCRIPTOR,
kind: ConstructorKind::TrackEvent,
},
ConstructorSpec {
- name: "VTTCue",
- parent: Some("TextTrackCue"),
+ interface: web_api_interfaces::VTTCue::DESCRIPTOR,
kind: ConstructorKind::VTTCue,
},
ConstructorSpec {
- name: "AudioContext",
- parent: Some("BaseAudioContext"),
+ interface: web_api_interfaces::AudioContext::DESCRIPTOR,
kind: ConstructorKind::AudioContext,
},
ConstructorSpec {
- name: "AudioWorkletNode",
- parent: None,
+ interface: web_api_interfaces::AudioWorkletNode::DESCRIPTOR,
kind: ConstructorKind::AudioWorkletNode,
},
ConstructorSpec {
- name: "BaseAudioContext",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::BaseAudioContext::DESCRIPTOR,
kind: ConstructorKind::BaseAudioContext,
},
ConstructorSpec {
- name: "OfflineAudioContext",
- parent: Some("BaseAudioContext"),
+ interface: web_api_interfaces::OfflineAudioContext::DESCRIPTOR,
kind: ConstructorKind::OfflineAudioContext,
},
ConstructorSpec {
- name: "AudioDestinationNode",
- parent: None,
+ interface: web_api_interfaces::AudioDestinationNode::DESCRIPTOR,
kind: ConstructorKind::AudioDestinationNode,
},
ConstructorSpec {
- name: "OscillatorNode",
- parent: None,
+ interface: web_api_interfaces::OscillatorNode::DESCRIPTOR,
kind: ConstructorKind::OscillatorNode,
},
ConstructorSpec {
- name: "DynamicsCompressorNode",
- parent: None,
+ interface: web_api_interfaces::DynamicsCompressorNode::DESCRIPTOR,
kind: ConstructorKind::DynamicsCompressorNode,
},
ConstructorSpec {
- name: "AnalyserNode",
- parent: None,
+ interface: web_api_interfaces::AnalyserNode::DESCRIPTOR,
kind: ConstructorKind::AnalyserNode,
},
ConstructorSpec {
- name: "AudioParam",
- parent: None,
+ interface: web_api_interfaces::AudioParam::DESCRIPTOR,
kind: ConstructorKind::AudioParam,
},
ConstructorSpec {
- name: "BiquadFilterNode",
- parent: None,
+ interface: web_api_interfaces::BiquadFilterNode::DESCRIPTOR,
kind: ConstructorKind::BiquadFilterNode,
},
ConstructorSpec {
- name: "AudioBuffer",
- parent: None,
+ interface: web_api_interfaces::AudioBuffer::DESCRIPTOR,
kind: ConstructorKind::AudioBuffer,
},
ConstructorSpec {
- name: "AbstractRange",
- parent: None,
+ interface: web_api_interfaces::AbstractRange::DESCRIPTOR,
kind: ConstructorKind::AbstractRange,
},
ConstructorSpec {
- name: "Range",
- parent: Some("AbstractRange"),
+ interface: web_api_interfaces::Range::DESCRIPTOR,
kind: ConstructorKind::Range,
},
ConstructorSpec {
- name: "StaticRange",
- parent: Some("AbstractRange"),
+ interface: web_api_interfaces::StaticRange::DESCRIPTOR,
kind: ConstructorKind::StaticRange,
},
ConstructorSpec {
- name: "URL",
- parent: None,
+ interface: web_api_interfaces::URL::DESCRIPTOR,
kind: ConstructorKind::Url,
},
ConstructorSpec {
- name: "URLSearchParams",
- parent: None,
+ interface: web_api_interfaces::URLSearchParams::DESCRIPTOR,
kind: ConstructorKind::UrlSearchParams,
},
ConstructorSpec {
- name: "FormData",
- parent: None,
+ interface: web_api_interfaces::FormData::DESCRIPTOR,
kind: ConstructorKind::FormData,
},
ConstructorSpec {
- name: "IDBFactory",
- parent: None,
+ interface: web_api_interfaces::IDBFactory::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBRequest",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::IDBRequest::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBOpenDBRequest",
- parent: Some("IDBRequest"),
+ interface: web_api_interfaces::IDBOpenDBRequest::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBDatabase",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::IDBDatabase::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBTransaction",
- parent: Some("EventTarget"),
+ interface: web_api_interfaces::IDBTransaction::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBObjectStore",
- parent: None,
+ interface: web_api_interfaces::IDBObjectStore::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBIndex",
- parent: None,
+ interface: web_api_interfaces::IDBIndex::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBCursor",
- parent: None,
+ interface: web_api_interfaces::IDBCursor::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBCursorWithValue",
- parent: Some("IDBCursor"),
+ interface: web_api_interfaces::IDBCursorWithValue::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBKeyRange",
- parent: None,
+ interface: web_api_interfaces::IDBKeyRange::DESCRIPTOR,
kind: ConstructorKind::IndexedDb,
},
ConstructorSpec {
- name: "IDBVersionChangeEvent",
- parent: Some("Event"),
+ interface: web_api_interfaces::IDBVersionChangeEvent::DESCRIPTOR,
kind: ConstructorKind::IndexedDbVersionChangeEvent,
},
];
@@ -1489,12 +1196,11 @@ pub(in crate::context_bootstrap) fn constructor_specs() -> Vec<ConstructorSpec>
node_bridge_descriptors()
.iter()
.map(|descriptor| ConstructorSpec {
- name: descriptor.constructor_name,
- parent: descriptor.parent_constructor,
- kind: constructor_kind_for_bridge_descriptor(descriptor.constructor_name),
+ interface: descriptor.interface,
+ kind: constructor_kind_for_bridge_descriptor(descriptor.interface.name()),
}),
)
- .filter(|spec| seen.insert(spec.name))
+ .filter(|spec| seen.insert(spec.interface.name()))
.collect()
}
diff --git a/moli-renderer-v8/src/context_bootstrap/specs/types.rs b/moli-renderer-v8/src/context_bootstrap/specs/types.rs
index dcfbab49a..fb9e175ac 100644
--- a/moli-renderer-v8/src/context_bootstrap/specs/types.rs
+++ b/moli-renderer-v8/src/context_bootstrap/specs/types.rs
@@ -190,8 +190,7 @@ pub(in crate::context_bootstrap) enum ConstructorPrototypeProperty {
#[derive(Clone, Copy)]
pub(in crate::context_bootstrap) struct ConstructorSpec {
- pub(in crate::context_bootstrap) name: &'static str,
- pub(in crate::context_bootstrap) parent: Option<&'static str>,
+ pub(in crate::context_bootstrap) interface: moli_webapi_declare::WebApiInterfaceDescriptor,
pub(in crate::context_bootstrap) kind: ConstructorKind,
}
diff --git a/moli-renderer-v8/src/context_bootstrap/speech_synthesis.rs b/moli-renderer-v8/src/context_bootstrap/speech_synthesis.rs
index 01d3dace1..59173a1e0 100644
--- a/moli-renderer-v8/src/context_bootstrap/speech_synthesis.rs
+++ b/moli-renderer-v8/src/context_bootstrap/speech_synthesis.rs
@@ -6,6 +6,7 @@ use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, set_private_value,
throw_type_error,
};
+use crate::web_api_interfaces;
use anyhow::Result;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject, v8};
@@ -37,7 +38,7 @@ const SPEECH_VOICE_LOCAL_SERVICE_SLOT: &str = "__lmSpeechSynthesisVoiceLocalServ
const SPEECH_VOICE_DEFAULT_SLOT: &str = "__lmSpeechSynthesisVoiceDefault";
#[derive(Default, WebApiObject)]
-#[webapi(interface = "SpeechSynthesis")]
+#[webapi(interface = web_api_interfaces::SpeechSynthesis)]
struct SpeechSynthesisObjectDeclaration {
#[webapi(slot = SPEECH_SYNTHESIS_PENDING_SLOT, init = false)]
pending: (),
@@ -59,7 +60,7 @@ struct SpeechSynthesisObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "SpeechSynthesis", enumerable)]
+#[webapi(interface = web_api_interfaces::SpeechSynthesis, enumerable)]
struct SpeechSynthesisPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -106,7 +107,7 @@ struct SpeechSynthesisPrototypeDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SpeechSynthesisUtterance")]
+#[webapi(interface = web_api_interfaces::SpeechSynthesisUtterance)]
struct SpeechSynthesisUtteranceObjectDeclaration<'scope> {
#[webapi(slot = SPEECH_UTTERANCE_TEXT_SLOT)]
text: v8::Local<'scope, v8::String>,
@@ -155,7 +156,7 @@ struct SpeechSynthesisUtteranceObjectDeclaration<'scope> {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "SpeechSynthesisUtterance", enumerable)]
+#[webapi(interface = web_api_interfaces::SpeechSynthesisUtterance, enumerable)]
struct SpeechSynthesisUtterancePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -232,7 +233,7 @@ struct SpeechSynthesisUtterancePrototypeDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "SpeechSynthesisVoice", enumerable)]
+#[webapi(interface = web_api_interfaces::SpeechSynthesisVoice, enumerable)]
struct SpeechSynthesisVoicePrototypeDeclaration {
#[webapi(accessor_property = "voiceURI", getter = speech_voice_getter, data = callback_data_index_value(scope, 0))]
voice_uri: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/storage_access.rs b/moli-renderer-v8/src/context_bootstrap/storage_access.rs
index 0a5bbe7be..4172dadd2 100644
--- a/moli-renderer-v8/src/context_bootstrap/storage_access.rs
+++ b/moli-renderer-v8/src/context_bootstrap/storage_access.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use moli_storage_service::StorageBucketLocator;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -109,7 +110,7 @@ impl StorageAccessTypes {
}
#[derive(WebApiObject)]
-#[webapi(interface = "StorageAccessHandle", require_prototype)]
+#[webapi(interface = web_api_interfaces::StorageAccessHandle, require_prototype)]
struct StorageAccessHandleObjectDeclaration {
#[webapi(slot = STORAGE_ACCESS_HANDLE_GET_DIRECTORY_SLOT)]
get_directory: bool,
@@ -118,7 +119,7 @@ struct StorageAccessHandleObjectDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "StorageAccessHandle", enumerable)]
+#[webapi(interface = web_api_interfaces::StorageAccessHandle, enumerable)]
struct StorageAccessHandlePrototypeDeclaration {
#[webapi(
method,
diff --git a/moli-renderer-v8/src/context_bootstrap/stream_adapter/construction.rs b/moli-renderer-v8/src/context_bootstrap/stream_adapter/construction.rs
index b52eceb35..fc1be48ec 100644
--- a/moli-renderer-v8/src/context_bootstrap/stream_adapter/construction.rs
+++ b/moli-renderer-v8/src/context_bootstrap/stream_adapter/construction.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(Default, WebApiObject)]
-#[webapi(interface = "ReadableStream")]
+#[webapi(interface = web_api_interfaces::ReadableStream)]
struct ReadableStreamShellDeclaration {
#[webapi(slot = READABLE_STREAM_QUEUE_SLOT, init = "array")]
queue: (),
@@ -31,7 +32,7 @@ struct ReadableStreamShellDeclaration {
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "WritableStream")]
+#[webapi(interface = web_api_interfaces::WritableStream)]
struct WritableStreamShellDeclaration {
#[webapi(slot = WRITABLE_STREAM_LOCKED_SLOT, init = false)]
locked: (),
@@ -58,7 +59,7 @@ struct WritableStreamShellDeclaration {
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "TransformStream")]
+#[webapi(interface = web_api_interfaces::TransformStream)]
struct TransformStreamShellDeclaration {
#[webapi(slot = TRANSFORM_STREAM_READABLE_SLOT, init = "null")]
readable: (),
@@ -67,7 +68,7 @@ struct TransformStreamShellDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ReadableStream")]
+#[webapi(interface = web_api_interfaces::ReadableStream)]
struct ReadableStreamObjectDeclaration<'scope> {
#[webapi(slot = READABLE_STREAM_QUEUE_SLOT, init = "array")]
queue: (),
@@ -116,7 +117,7 @@ const READABLE_STREAM_START_PULL_AFTER_START_SLOT: &str = "__moliReadableStreamS
#[derive(WebApiObject)]
#[webapi(
- interface = "WritableStream",
+ interface = web_api_interfaces::WritableStream,
scope_lifetime = 'scope,
)]
struct WritableStreamObjectDeclaration<'scope, 'value> {
@@ -219,7 +220,7 @@ pub(in crate::context_bootstrap) fn initialize_transform_stream_object<'s>(
Some("text-decoder") => "TextDecoderStream",
_ => "TransformStream",
};
- moli_webapi_declare::initialize_web_api_object(scope, stream, interface)
+ web_api_interfaces::initialize(scope, stream, interface)
.expect("stream identity should initialize");
}
@@ -322,7 +323,8 @@ pub(in crate::context_bootstrap) fn initialize_webidl_transform_stream_object<'s
TransformStreamObjectDeclaration::new(readable, writable)
.initialize(scope, stream)
.expect("TransformStream declaration should initialize object");
- moli_webapi_declare::initialize_web_api_object(scope, stream, "TransformStream")
+ web_api_interfaces::TransformStream::DESCRIPTOR
+ .initialize(scope, stream)
.expect("TransformStream identity should initialize");
}
diff --git a/moli-renderer-v8/src/context_bootstrap/stream_adapter/readable_byte.rs b/moli-renderer-v8/src/context_bootstrap/stream_adapter/readable_byte.rs
index d1ee9d0c2..1a8e6c436 100644
--- a/moli-renderer-v8/src/context_bootstrap/stream_adapter/readable_byte.rs
+++ b/moli-renderer-v8/src/context_bootstrap/stream_adapter/readable_byte.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::{define_v8_array_data_property, set_null_prototype, v8str};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_streams::readable::byte_controller::{
ArrayBufferViewKind, ByobRequestPlan, ByteControllerSnapshot, ByteEnqueueContinuationPlan,
@@ -54,7 +55,7 @@ fn array_buffer_view_kind(value: v8::Local<'_, v8::Value>) -> Option<ArrayBuffer
}
#[derive(WebApiObject)]
-#[webapi(interface = "ReadableStreamBYOBRequest")]
+#[webapi(interface = web_api_interfaces::ReadableStreamBYOBRequest)]
struct ReadableStreamByobRequestObjectDeclaration<'scope> {
#[webapi(slot = READABLE_STREAM_BYOB_REQUEST_CONTROLLER_SLOT)]
controller: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/stream_objects/async_iterator.rs b/moli-renderer-v8/src/context_bootstrap/stream_objects/async_iterator.rs
index 7c827ab8e..eeec0f375 100644
--- a/moli-renderer-v8/src/context_bootstrap/stream_objects/async_iterator.rs
+++ b/moli-renderer-v8/src/context_bootstrap/stream_objects/async_iterator.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::materialize_hidden_function_template_prototype;
+use crate::web_api_interfaces;
use moli_streams::readable::iterator::{
IteratorLifecycle, IteratorNextOutcome, IteratorOperationKind, IteratorPumpPlan, IteratorState,
IteratorTransition,
@@ -15,7 +16,7 @@ const ITERATOR_OPERATION_RETURN: u32 = 1;
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "ReadableStream AsyncIterator",
+ interface = web_api_interfaces::ReadableStreamAsyncIterator,
intrinsic_prototype_parent = v8::Intrinsic::AsyncIteratorPrototype,
prototype_to_string_tag = "ReadableStream AsyncIterator",
readonly_prototype,
diff --git a/moli-renderer-v8/src/context_bootstrap/stream_objects/controller.rs b/moli-renderer-v8/src/context_bootstrap/stream_objects/controller.rs
index 3ee95c702..28a8ce91e 100644
--- a/moli-renderer-v8/src/context_bootstrap/stream_objects/controller.rs
+++ b/moli-renderer-v8/src/context_bootstrap/stream_objects/controller.rs
@@ -3,10 +3,11 @@ use crate::context_bootstrap::stream_adapter::{
EnqueueChunkError, enqueue_byte_chunk, maybe_pull_stream, prepare_readable_byte_stream_close,
readable_byte_stream_byob_request, readable_stream_is_byte_stream,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(WebApiObject)]
-#[webapi(interface = "ReadableStreamDefaultController")]
+#[webapi(interface = web_api_interfaces::ReadableStreamDefaultController)]
struct ReadableStreamControllerObjectDeclaration<'scope> {
#[webapi(slot = STREAM_CONTROLLER_STREAM_SLOT)]
stream: v8::Local<'scope, v8::Object>,
@@ -15,7 +16,7 @@ struct ReadableStreamControllerObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ReadableByteStreamController")]
+#[webapi(interface = web_api_interfaces::ReadableByteStreamController)]
struct ReadableByteStreamControllerObjectDeclaration<'scope> {
#[webapi(slot = STREAM_CONTROLLER_STREAM_SLOT)]
stream: v8::Local<'scope, v8::Object>,
@@ -24,7 +25,7 @@ struct ReadableByteStreamControllerObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "TransformStreamDefaultController")]
+#[webapi(interface = web_api_interfaces::TransformStreamDefaultController)]
struct TransformStreamControllerObjectDeclaration<'scope> {
#[webapi(slot = STREAM_CONTROLLER_STREAM_SLOT)]
stream: v8::Local<'scope, v8::Object>,
@@ -51,7 +52,7 @@ struct TransformStreamControllerObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "WritableStreamDefaultController")]
+#[webapi(interface = web_api_interfaces::WritableStreamDefaultController)]
struct WritableStreamControllerObjectDeclaration<'scope> {
#[webapi(slot = STREAM_CONTROLLER_STREAM_SLOT)]
stream: v8::Local<'scope, v8::Object>,
@@ -60,7 +61,7 @@ struct WritableStreamControllerObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ReadableStreamDefaultController", enumerable)]
+#[webapi(interface = web_api_interfaces::ReadableStreamDefaultController, enumerable)]
struct ReadableStreamDefaultControllerPrototypeDeclaration {
#[webapi(method, length = 0, callback = readable_stream_controller_enqueue_callback)]
enqueue: (),
@@ -73,7 +74,7 @@ struct ReadableStreamDefaultControllerPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ReadableByteStreamController", enumerable)]
+#[webapi(interface = web_api_interfaces::ReadableByteStreamController, enumerable)]
struct ReadableByteStreamControllerPrototypeDeclaration {
#[webapi(method, length = 1, callback = readable_stream_controller_enqueue_callback)]
enqueue: (),
@@ -88,7 +89,7 @@ struct ReadableByteStreamControllerPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TransformStreamDefaultController", enumerable)]
+#[webapi(interface = web_api_interfaces::TransformStreamDefaultController, enumerable)]
struct TransformStreamDefaultControllerPrototypeDeclaration {
#[webapi(method, length = 0, callback = readable_stream_controller_enqueue_callback)]
enqueue: (),
@@ -101,7 +102,7 @@ struct TransformStreamDefaultControllerPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WritableStreamDefaultController", enumerable)]
+#[webapi(interface = web_api_interfaces::WritableStreamDefaultController, enumerable)]
struct WritableStreamControllerPrototypeDeclaration {
#[webapi(accessor_property, getter = writable_stream_controller_signal_getter)]
signal: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/stream_objects/readable_reader.rs b/moli-renderer-v8/src/context_bootstrap/stream_objects/readable_reader.rs
index 66f2cfd8e..d5f772d58 100644
--- a/moli-renderer-v8/src/context_bootstrap/stream_objects/readable_reader.rs
+++ b/moli-renderer-v8/src/context_bootstrap/stream_objects/readable_reader.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::v8str;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_streams::readable::{
AcquireReaderPlan, ReadableKind, ReaderKind, ReaderReleaseSnapshot, ReleaseReaderPlan,
@@ -10,14 +11,14 @@ use moli_webapi_declare::WebApiObject;
const READER_LOCK_RELEASED_MESSAGE: &str = "ReadableStreamDefaultReader lock released";
#[derive(WebApiObject)]
-#[webapi(interface = "ReadableStreamDefaultReader")]
+#[webapi(interface = web_api_interfaces::ReadableStreamDefaultReader)]
struct ReadableStreamReaderObjectDeclaration<'scope> {
#[webapi(slot = READABLE_STREAM_READER_STREAM_SLOT)]
stream: v8::Local<'scope, v8::Object>,
}
#[derive(WebApiObject)]
-#[webapi(interface = "ReadableStreamBYOBReader")]
+#[webapi(interface = web_api_interfaces::ReadableStreamBYOBReader)]
struct ReadableStreamByobReaderObjectDeclaration<'scope> {
#[webapi(slot = READABLE_STREAM_READER_STREAM_SLOT)]
stream: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/stream_objects/writable_writer.rs b/moli-renderer-v8/src/context_bootstrap/stream_objects/writable_writer.rs
index c8573e6eb..35dd094dd 100644
--- a/moli-renderer-v8/src/context_bootstrap/stream_objects/writable_writer.rs
+++ b/moli-renderer-v8/src/context_bootstrap/stream_objects/writable_writer.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::v8str;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_streams::writable::{AcquireWriterPlan, DesiredSizePlan, WriterWriteEntryPlan};
use moli_webapi_declare::WebApiObject;
@@ -7,7 +8,7 @@ use moli_webapi_declare::WebApiObject;
const WRITER_LOCK_RELEASED_MESSAGE: &str = "WritableStreamDefaultWriter lock released";
#[derive(WebApiObject)]
-#[webapi(interface = "WritableStreamDefaultWriter")]
+#[webapi(interface = web_api_interfaces::WritableStreamDefaultWriter)]
struct WritableStreamWriterObjectDeclaration<'scope> {
#[webapi(slot = WRITABLE_STREAM_WRITER_STREAM_SLOT)]
stream: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/streams.rs b/moli-renderer-v8/src/context_bootstrap/streams.rs
index f769a773d..2b4106097 100644
--- a/moli-renderer-v8/src/context_bootstrap/streams.rs
+++ b/moli-renderer-v8/src/context_bootstrap/streams.rs
@@ -22,6 +22,7 @@ use super::stream_objects::{
writable_stream_writer_release_lock_callback, writable_stream_writer_write_callback,
};
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
mod compression;
@@ -58,136 +59,119 @@ struct StreamInterfaceSpec {
const STREAM_INTERFACE_SPECS: &[StreamInterfaceSpec] = &[
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "ReadableStream",
- parent: None,
+ interface: web_api_interfaces::ReadableStream::DESCRIPTOR,
kind: ConstructorKind::ReadableStream,
},
prototype_installer: StreamPrototypeInstaller::ReadableStream,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "ReadableStreamDefaultReader",
- parent: None,
+ interface: web_api_interfaces::ReadableStreamDefaultReader::DESCRIPTOR,
kind: ConstructorKind::ReadableStreamDefaultReader,
},
prototype_installer: StreamPrototypeInstaller::DefaultReader,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "ReadableStreamDefaultController",
- parent: None,
+ interface: web_api_interfaces::ReadableStreamDefaultController::DESCRIPTOR,
kind: ConstructorKind::ReadableStreamDefaultController,
},
prototype_installer: StreamPrototypeInstaller::Controller,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "WritableStream",
- parent: None,
+ interface: web_api_interfaces::WritableStream::DESCRIPTOR,
kind: ConstructorKind::WritableStream,
},
prototype_installer: StreamPrototypeInstaller::WritableStream,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "WritableStreamDefaultWriter",
- parent: None,
+ interface: web_api_interfaces::WritableStreamDefaultWriter::DESCRIPTOR,
kind: ConstructorKind::WritableStreamDefaultWriter,
},
prototype_installer: StreamPrototypeInstaller::DefaultWriter,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "WritableStreamDefaultController",
- parent: None,
+ interface: web_api_interfaces::WritableStreamDefaultController::DESCRIPTOR,
kind: ConstructorKind::WritableStreamDefaultController,
},
prototype_installer: StreamPrototypeInstaller::Controller,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "TransformStream",
- parent: None,
+ interface: web_api_interfaces::TransformStream::DESCRIPTOR,
kind: ConstructorKind::TransformStream,
},
prototype_installer: StreamPrototypeInstaller::TransformFamily,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "TransformStreamDefaultController",
- parent: None,
+ interface: web_api_interfaces::TransformStreamDefaultController::DESCRIPTOR,
kind: ConstructorKind::TransformStreamDefaultController,
},
prototype_installer: StreamPrototypeInstaller::Controller,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "TextEncoderStream",
- parent: None,
+ interface: web_api_interfaces::TextEncoderStream::DESCRIPTOR,
kind: ConstructorKind::TextEncoderStream,
},
prototype_installer: StreamPrototypeInstaller::TransformFamily,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "TextDecoderStream",
- parent: None,
+ interface: web_api_interfaces::TextDecoderStream::DESCRIPTOR,
kind: ConstructorKind::TextDecoderStream,
},
prototype_installer: StreamPrototypeInstaller::TransformFamily,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "ByteLengthQueuingStrategy",
- parent: None,
+ interface: web_api_interfaces::ByteLengthQueuingStrategy::DESCRIPTOR,
kind: ConstructorKind::ByteLengthQueuingStrategy,
},
prototype_installer: StreamPrototypeInstaller::QueuingStrategy,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "CountQueuingStrategy",
- parent: None,
+ interface: web_api_interfaces::CountQueuingStrategy::DESCRIPTOR,
kind: ConstructorKind::CountQueuingStrategy,
},
prototype_installer: StreamPrototypeInstaller::QueuingStrategy,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "CompressionStream",
- parent: None,
+ interface: web_api_interfaces::CompressionStream::DESCRIPTOR,
kind: ConstructorKind::CompressionStream,
},
prototype_installer: StreamPrototypeInstaller::Compression,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "DecompressionStream",
- parent: None,
+ interface: web_api_interfaces::DecompressionStream::DESCRIPTOR,
kind: ConstructorKind::DecompressionStream,
},
prototype_installer: StreamPrototypeInstaller::Compression,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "ReadableStreamBYOBReader",
- parent: None,
+ interface: web_api_interfaces::ReadableStreamBYOBReader::DESCRIPTOR,
kind: ConstructorKind::ReadableStreamByobReader,
},
prototype_installer: StreamPrototypeInstaller::ByobReader,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "ReadableStreamBYOBRequest",
- parent: None,
+ interface: web_api_interfaces::ReadableStreamBYOBRequest::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
prototype_installer: StreamPrototypeInstaller::ByobRequest,
},
StreamInterfaceSpec {
constructor: ConstructorSpec {
- name: "ReadableByteStreamController",
- parent: None,
+ interface: web_api_interfaces::ReadableByteStreamController::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
prototype_installer: StreamPrototypeInstaller::Controller,
@@ -203,7 +187,7 @@ pub(in crate::context_bootstrap) fn stream_constructor_specs()
pub(in crate::context_bootstrap) fn stream_interface_names() -> impl Iterator<Item = &'static str> {
STREAM_INTERFACE_SPECS
.iter()
- .map(|spec| spec.constructor.name)
+ .map(|spec| spec.constructor.interface.name())
}
pub(in crate::context_bootstrap) fn is_worker_exposed_stream_interface(name: &str) -> bool {
@@ -213,11 +197,11 @@ pub(in crate::context_bootstrap) fn is_worker_exposed_stream_interface(name: &st
fn stream_interface_spec(name: &str) -> Option<&'static StreamInterfaceSpec> {
STREAM_INTERFACE_SPECS
.iter()
- .find(|spec| spec.constructor.name == name)
+ .find(|spec| spec.constructor.interface.name() == name)
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ReadableStream", enumerable)]
+#[webapi(interface = web_api_interfaces::ReadableStream, enumerable)]
struct ReadableStreamPrototypeDeclaration {
#[webapi(method, length = 0, callback = readable_stream_get_reader_callback)]
get_reader: (),
@@ -238,7 +222,7 @@ struct ReadableStreamPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WritableStream", enumerable)]
+#[webapi(interface = web_api_interfaces::WritableStream, enumerable)]
struct WritableStreamPrototypeDeclaration {
#[webapi(method, length = 0, callback = writable_stream_get_writer_callback)]
get_writer: (),
@@ -251,7 +235,7 @@ struct WritableStreamPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ReadableStreamDefaultReader", enumerable)]
+#[webapi(interface = web_api_interfaces::ReadableStreamDefaultReader, enumerable)]
struct ReadableStreamDefaultReaderPrototypeDeclaration {
#[webapi(method, length = 0, callback = readable_stream_reader_read_callback)]
read: (),
@@ -264,7 +248,7 @@ struct ReadableStreamDefaultReaderPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ReadableStreamBYOBReader", enumerable)]
+#[webapi(interface = web_api_interfaces::ReadableStreamBYOBReader, enumerable)]
struct ReadableStreamByobReaderPrototypeDeclaration {
#[webapi(method, length = 1, callback = readable_stream_byob_reader_read_callback)]
read: (),
@@ -277,7 +261,7 @@ struct ReadableStreamByobReaderPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ReadableStreamBYOBRequest", enumerable)]
+#[webapi(interface = web_api_interfaces::ReadableStreamBYOBRequest, enumerable)]
struct ReadableStreamByobRequestPrototypeDeclaration {
#[webapi(accessor_property, getter = readable_stream_byob_request_view_getter)]
view: (),
@@ -292,7 +276,7 @@ struct ReadableStreamByobRequestPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WritableStreamDefaultWriter", enumerable)]
+#[webapi(interface = web_api_interfaces::WritableStreamDefaultWriter, enumerable)]
struct WritableStreamDefaultWriterPrototypeDeclaration {
#[webapi(method, length = 0, callback = writable_stream_writer_write_callback)]
write: (),
@@ -430,8 +414,8 @@ mod catalog_tests {
let registered_stream_names = crate::context_bootstrap::specs::constructor_specs()
.into_iter()
- .filter(|spec| is_worker_exposed_stream_interface(spec.name))
- .map(|spec| spec.name)
+ .filter(|spec| is_worker_exposed_stream_interface(spec.interface.name()))
+ .map(|spec| spec.interface.name())
.collect::<Vec<_>>();
assert_eq!(registered_stream_names, catalog_names);
}
diff --git a/moli-renderer-v8/src/context_bootstrap/streams/compression.rs b/moli-renderer-v8/src/context_bootstrap/streams/compression.rs
index 07bcbbf01..5e592c19d 100644
--- a/moli-renderer-v8/src/context_bootstrap/streams/compression.rs
+++ b/moli-renderer-v8/src/context_bootstrap/streams/compression.rs
@@ -6,6 +6,7 @@ use super::super::stream_adapter::{
EnqueueChunkError, maybe_pull_stream, value_buffer_source_bytes,
};
use super::*;
+use crate::web_api_interfaces;
use crate::{util::set_private_value, webidl};
use moli_v8_util::set_static_property;
@@ -73,7 +74,7 @@ pub(in crate::context_bootstrap) fn compression_stream_constructor_callback<
} else {
"CompressionStream"
};
- moli_webapi_declare::initialize_web_api_object(scope, args.this(), interface)
+ web_api_interfaces::initialize(scope, args.this(), interface)
.expect("compression stream identity should initialize");
rv.set(args.this().into());
}
@@ -197,7 +198,7 @@ fn endpoint_getter<'s, const DECOMPRESS: bool, const READABLE: bool>(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CompressionStream", enumerable)]
+#[webapi(interface = web_api_interfaces::CompressionStream, enumerable)]
struct CompressionPrototype {
#[webapi(accessor_property, getter = endpoint_getter::<false, true>)]
readable: (),
@@ -206,7 +207,7 @@ struct CompressionPrototype {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DecompressionStream", enumerable)]
+#[webapi(interface = web_api_interfaces::DecompressionStream, enumerable)]
struct DecompressionPrototype {
#[webapi(accessor_property, getter = endpoint_getter::<true, true>)]
readable: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/streams/constructors.rs b/moli-renderer-v8/src/context_bootstrap/streams/constructors.rs
index 0bc4cacb3..d45614156 100644
--- a/moli-renderer-v8/src/context_bootstrap/streams/constructors.rs
+++ b/moli-renderer-v8/src/context_bootstrap/streams/constructors.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::{
util::{get_private_value, set_private_value},
webidl,
@@ -13,14 +14,14 @@ const BYTE_LENGTH_QUEUING_STRATEGY_HIGH_WATER_MARK_SLOT: &str =
"__moliByteLengthQueuingStrategyHighWaterMark";
#[derive(WebApiObject)]
-#[webapi(interface = "TextEncoderStream")]
+#[webapi(interface = web_api_interfaces::TextEncoderStream)]
struct TextEncoderStreamObjectDeclaration {
#[webapi(data_property)]
encoding: &'static str,
}
#[derive(WebApiObject)]
-#[webapi(interface = "TextDecoderStream")]
+#[webapi(interface = web_api_interfaces::TextDecoderStream)]
struct TextDecoderStreamObjectDeclaration {
#[webapi(data_property)]
encoding: String,
@@ -31,21 +32,21 @@ struct TextDecoderStreamObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "CountQueuingStrategy")]
+#[webapi(interface = web_api_interfaces::CountQueuingStrategy)]
struct CountQueuingStrategyObjectDeclaration {
#[webapi(slot = COUNT_QUEUING_STRATEGY_HIGH_WATER_MARK_SLOT)]
high_water_mark: f64,
}
#[derive(WebApiObject)]
-#[webapi(interface = "ByteLengthQueuingStrategy")]
+#[webapi(interface = web_api_interfaces::ByteLengthQueuingStrategy)]
struct ByteLengthQueuingStrategyObjectDeclaration {
#[webapi(slot = BYTE_LENGTH_QUEUING_STRATEGY_HIGH_WATER_MARK_SLOT)]
high_water_mark: f64,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CountQueuingStrategy", enumerable)]
+#[webapi(interface = web_api_interfaces::CountQueuingStrategy, enumerable)]
struct CountQueuingStrategyPrototypeDeclaration {
#[webapi(accessor_property, getter = count_queuing_strategy_high_water_mark_getter)]
high_water_mark: (),
@@ -54,7 +55,7 @@ struct CountQueuingStrategyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ByteLengthQueuingStrategy", enumerable)]
+#[webapi(interface = web_api_interfaces::ByteLengthQueuingStrategy, enumerable)]
struct ByteLengthQueuingStrategyPrototypeDeclaration {
#[webapi(accessor_property, getter = byte_length_queuing_strategy_high_water_mark_getter)]
high_water_mark: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/streams/readable.rs b/moli-renderer-v8/src/context_bootstrap/streams/readable.rs
index 64102cdc8..ce9fc2a1f 100644
--- a/moli-renderer-v8/src/context_bootstrap/streams/readable.rs
+++ b/moli-renderer-v8/src/context_bootstrap/streams/readable.rs
@@ -8,13 +8,14 @@ use super::super::stream_adapter::{
};
use super::*;
use crate::context_bootstrap::stream_objects::readable_stream_async_iterator_prototype;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_streams::pipe::{PipeEntryObservation, PipeEntryPlan, PipeOptions};
use moli_streams::readable::{AcquireReaderPlan, CancelEntryPlan, ReadableKind, ReaderKind};
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "ReadableStream AsyncIterator")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::ReadableStreamAsyncIterator)]
struct ReadableStreamAsyncIteratorObjectDeclaration<'scope> {
#[webapi(slot = READABLE_STREAM_ITERATOR_READER_SLOT)]
reader: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/streams/writable.rs b/moli-renderer-v8/src/context_bootstrap/streams/writable.rs
index dbce62170..cfa4af8e7 100644
--- a/moli-renderer-v8/src/context_bootstrap/streams/writable.rs
+++ b/moli-renderer-v8/src/context_bootstrap/streams/writable.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::context_bootstrap::stream_adapter::{stream_slot_object, writable_stream_abort_promise};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_streams::writable::{AcquireWriterPlan, UnlockedCloseEntryPlan, UnlockedEntryPlan};
use moli_webapi_declare::WebApiFunctionTemplate;
@@ -170,7 +171,7 @@ fn set_rejected_writable_stream_type_error(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TransformStream", enumerable)]
+#[webapi(interface = web_api_interfaces::TransformStream, enumerable)]
struct TransformStreamPrototypeAttributesDeclaration {
#[webapi(accessor_property, getter = transform_stream_readable_getter_callback)]
readable: (),
@@ -180,7 +181,7 @@ struct TransformStreamPrototypeAttributesDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextEncoderStream", enumerable)]
+#[webapi(interface = web_api_interfaces::TextEncoderStream, enumerable)]
struct TextEncoderStreamPrototypeAttributesDeclaration {
#[webapi(accessor_property, getter = transform_stream_readable_getter_callback)]
readable: (),
@@ -190,7 +191,7 @@ struct TextEncoderStreamPrototypeAttributesDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextDecoderStream", enumerable)]
+#[webapi(interface = web_api_interfaces::TextDecoderStream, enumerable)]
struct TextDecoderStreamPrototypeAttributesDeclaration {
#[webapi(accessor_property, getter = transform_stream_readable_getter_callback)]
readable: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/style_font_template.rs b/moli-renderer-v8/src/context_bootstrap/style_font_template.rs
index 2cf8692b7..2b6c7b58c 100644
--- a/moli-renderer-v8/src/context_bootstrap/style_font_template.rs
+++ b/moli-renderer-v8/src/context_bootstrap/style_font_template.rs
@@ -12,17 +12,18 @@ use super::{
},
specs::ConstructorSpec,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FontFace", enumerable, receiver = "FontFace")]
+#[webapi(interface = web_api_interfaces::FontFace, enumerable, receiver)]
struct FontFaceTemplateMethodsDeclaration {
#[webapi(method, length = 0, callback = font_face_load_callback, returns_promise)]
load: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "FontFaceSet", enumerable)]
+#[webapi(interface = web_api_interfaces::FontFaceSet, enumerable)]
struct FontFaceSetTemplateMethodsDeclaration {
#[webapi(method, length = 1, callback = font_face_set_add_callback)]
add: (),
@@ -76,7 +77,7 @@ pub(super) fn install_style_font_template_bindings<'s>(
template: v8::Local<'s, v8::FunctionTemplate>,
spec: ConstructorSpec,
) {
- match spec.name {
+ match spec.interface.name() {
"FontFace" => {
let prototype = template.prototype_template(scope);
FontFaceTemplateMethodsDeclaration::initialize_prototype_template(scope, prototype);
diff --git a/moli-renderer-v8/src/context_bootstrap/svg_runtime/bindings.rs b/moli-renderer-v8/src/context_bootstrap/svg_runtime/bindings.rs
index 33f59d28b..ec110a308 100644
--- a/moli-renderer-v8/src/context_bootstrap/svg_runtime/bindings.rs
+++ b/moli-renderer-v8/src/context_bootstrap/svg_runtime/bindings.rs
@@ -1,10 +1,11 @@
use super::callbacks::*;
use super::*;
use crate::util::callback_data_index_value;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGLength", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGLength, enumerable)]
struct SvgLengthTemplateMethodsDeclaration {
#[webapi(constant = "SVG_LENGTHTYPE_UNKNOWN", value = SVG_LENGTH_TYPE_UNKNOWN)]
length_type_unknown: (),
@@ -58,7 +59,7 @@ struct SvgLengthTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGLengthList", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGLengthList, enumerable)]
struct SvgLengthListTemplateMethodsDeclaration {
#[webapi(method = "clear", length = 0, callback = svg_length_list_clear_callback)]
clear: (),
@@ -103,7 +104,7 @@ struct SvgLengthListTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGNumberList", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGNumberList, enumerable)]
struct SvgNumberListTemplateMethodsDeclaration {
#[webapi(method = "clear", length = 0, callback = svg_number_list_clear_callback)]
clear: (),
@@ -148,7 +149,7 @@ struct SvgNumberListTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGTransformList", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGTransformList, enumerable)]
struct SvgTransformListTemplateMethodsDeclaration {
#[webapi(method = "clear", length = 0, callback = svg_transform_list_clear_callback)]
clear: (),
@@ -207,7 +208,7 @@ struct SvgTransformListTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGTransform", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGTransform, enumerable)]
struct SvgTransformTemplateMethodsDeclaration {
#[webapi(
constant = "SVG_TRANSFORM_UNKNOWN",
@@ -260,7 +261,7 @@ struct SvgTransformTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGMatrix", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGMatrix, enumerable)]
struct SvgMatrixTemplateMethodsDeclaration {
#[webapi(method = "multiply", length = 1, callback = svg_matrix_multiply_callback)]
multiply: (),
@@ -305,7 +306,7 @@ struct SvgMatrixTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGGraphicsElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGGraphicsElement, enumerable)]
struct SvgGraphicsElementTemplateMethodsDeclaration {
#[webapi(method = "getBBox", length = 0, callback = svg_graphics_get_bbox_callback)]
get_bbox: (),
@@ -322,7 +323,7 @@ struct SvgGraphicsElementTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGGeometryElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGGeometryElement, enumerable)]
struct SvgGeometryElementTemplateMethodsDeclaration {
#[webapi(
method = "isPointInFill",
@@ -354,7 +355,7 @@ struct SvgGeometryElementTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGTextContentElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGTextContentElement, enumerable)]
struct SvgTextContentElementTemplateMethodsDeclaration {
#[webapi(constant = "LENGTHADJUST_UNKNOWN", value = SVG_LENGTH_ADJUST_UNKNOWN)]
length_adjust_unknown: (),
@@ -433,7 +434,7 @@ struct SvgTextContentElementTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGSVGElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGSVGElement, enumerable)]
struct SvgSvgElementTemplateMethodsDeclaration {
#[webapi(
method = "createSVGRect",
@@ -465,7 +466,7 @@ struct SvgSvgElementTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGLength", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGLength, enumerable)]
struct SvgLengthTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "unitType",
@@ -500,7 +501,7 @@ struct SvgLengthTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGAnimatedLength", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGAnimatedLength, enumerable)]
struct SvgAnimatedLengthTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "baseVal",
@@ -518,7 +519,7 @@ struct SvgAnimatedLengthTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGNumber", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGNumber, enumerable)]
struct SvgNumberTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "value",
@@ -529,7 +530,7 @@ struct SvgNumberTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGAnimatedLengthList", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGAnimatedLengthList, enumerable)]
struct SvgAnimatedLengthListTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "baseVal",
@@ -547,7 +548,7 @@ struct SvgAnimatedLengthListTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGAnimatedNumber", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGAnimatedNumber, enumerable)]
struct SvgAnimatedNumberTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "baseVal",
@@ -566,7 +567,7 @@ struct SvgAnimatedNumberTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGAnimatedNumberList", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGAnimatedNumberList, enumerable)]
struct SvgAnimatedNumberListTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "baseVal",
@@ -584,7 +585,7 @@ struct SvgAnimatedNumberListTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGAnimatedEnumeration", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGAnimatedEnumeration, enumerable)]
struct SvgAnimatedEnumerationTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "baseVal",
@@ -603,7 +604,7 @@ struct SvgAnimatedEnumerationTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGLengthList", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGLengthList, enumerable)]
struct SvgLengthListTemplateAccessorsDeclaration {
#[webapi(accessor_property = "length", getter = svg_length_list_length_getter)]
length: (),
@@ -616,7 +617,7 @@ struct SvgLengthListTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGNumberList", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGNumberList, enumerable)]
struct SvgNumberListTemplateAccessorsDeclaration {
#[webapi(accessor_property = "length", getter = svg_number_list_length_getter)]
length: (),
@@ -629,7 +630,7 @@ struct SvgNumberListTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGAnimatedTransformList", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGAnimatedTransformList, enumerable)]
struct SvgAnimatedTransformListTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "baseVal",
@@ -647,7 +648,7 @@ struct SvgAnimatedTransformListTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGTransformList", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGTransformList, enumerable)]
struct SvgTransformListTemplateAccessorsDeclaration {
#[webapi(accessor_property = "length", getter = svg_transform_list_length_getter)]
length: (),
@@ -660,7 +661,7 @@ struct SvgTransformListTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGTransform", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGTransform, enumerable)]
struct SvgTransformTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "type",
@@ -685,7 +686,7 @@ struct SvgTransformTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGMatrix", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGMatrix, enumerable)]
struct SvgMatrixTemplateAccessorsDeclaration {
#[webapi(
accessor_property = "a",
@@ -737,21 +738,21 @@ struct SvgMatrixTemplateAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGGraphicsElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGGraphicsElement, enumerable)]
struct SvgGraphicsElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "transform", getter = svg_graphics_transform_getter)]
transform: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGGeometryElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGGeometryElement, enumerable)]
struct SvgGeometryElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "pathLength", getter = svg_geometry_path_length_getter)]
path_length: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGTextContentElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGTextContentElement, enumerable)]
struct SvgTextContentElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "textLength", getter = svg_text_content_text_length_getter)]
text_length: (),
@@ -761,7 +762,7 @@ struct SvgTextContentElementPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGTextPositioningElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGTextPositioningElement, enumerable)]
struct SvgTextPositioningElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "x", getter = svg_text_positioning_list_getter, data = callback_data_index_value(scope, 0))]
x: (),
@@ -780,21 +781,21 @@ struct SvgTextPositioningElementPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGPatternElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGPatternElement, enumerable)]
struct SvgPatternElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "patternTransform", getter = svg_pattern_transform_getter)]
pattern_transform: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGGradientElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGGradientElement, enumerable)]
struct SvgGradientElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "gradientTransform", getter = svg_gradient_transform_getter)]
gradient_transform: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGRectElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGRectElement, enumerable)]
struct SvgRectElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "x", getter = svg_rect_animated_length_getter, data = callback_data_index_value(scope, 0))]
x: (),
@@ -816,7 +817,7 @@ struct SvgRectElementPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGCircleElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGCircleElement, enumerable)]
struct SvgCircleElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "cx", getter = svg_circle_animated_length_getter, data = callback_data_index_value(scope, 0))]
cx: (),
@@ -829,7 +830,7 @@ struct SvgCircleElementPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGEllipseElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGEllipseElement, enumerable)]
struct SvgEllipseElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "cx", getter = svg_ellipse_animated_length_getter, data = callback_data_index_value(scope, 0))]
cx: (),
@@ -845,7 +846,7 @@ struct SvgEllipseElementPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGLineElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGLineElement, enumerable)]
struct SvgLineElementPrototypeAccessorsDeclaration {
#[webapi(accessor_property = "x1", getter = svg_line_animated_length_getter, data = callback_data_index_value(scope, 0))]
x1: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/svg_runtime/builders.rs b/moli-renderer-v8/src/context_bootstrap/svg_runtime/builders.rs
index 9c133dc6a..390e16d6a 100644
--- a/moli-renderer-v8/src/context_bootstrap/svg_runtime/builders.rs
+++ b/moli-renderer-v8/src/context_bootstrap/svg_runtime/builders.rs
@@ -1,11 +1,12 @@
use super::callbacks::*;
use super::*;
use crate::util::serialize_v8_iter_array;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
#[webapi(
- interface = "SVGAnimatedNumber",
+ interface = web_api_interfaces::SVGAnimatedNumber,
own_to_string_tag = "SVGAnimatedNumber"
)]
struct SvgAnimatedNumberObjectDeclaration {
@@ -16,7 +17,7 @@ struct SvgAnimatedNumberObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SVGNumber", own_to_string_tag = "SVGNumber")]
+#[webapi(interface = web_api_interfaces::SVGNumber, own_to_string_tag = "SVGNumber")]
struct SvgNumberObjectDeclaration {
#[webapi(slot = SVG_NUMBER_VALUE_SLOT)]
value: f64,
@@ -24,7 +25,7 @@ struct SvgNumberObjectDeclaration {
#[derive(WebApiObject)]
#[webapi(
- interface = "SVGAnimatedEnumeration",
+ interface = web_api_interfaces::SVGAnimatedEnumeration,
own_to_string_tag = "SVGAnimatedEnumeration"
)]
struct SvgAnimatedEnumerationObjectDeclaration {
@@ -35,7 +36,7 @@ struct SvgAnimatedEnumerationObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SVGMatrix", own_to_string_tag = "SVGMatrix")]
+#[webapi(interface = web_api_interfaces::SVGMatrix, own_to_string_tag = "SVGMatrix")]
struct SvgMatrixObjectDeclaration {
#[webapi(slot = SVG_MATRIX_A_SLOT)]
a: f64,
@@ -83,7 +84,7 @@ struct SvgMatrixObjectDeclaration {
#[derive(WebApiObject)]
#[webapi(
- interface = "SVGAnimatedLength",
+ interface = web_api_interfaces::SVGAnimatedLength,
fallback_to_string_tag = "SVGAnimatedLength"
)]
struct SvgAnimatedLengthObjectDeclaration<'scope> {
@@ -94,7 +95,7 @@ struct SvgAnimatedLengthObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SVGLength", fallback_to_string_tag = "SVGLength")]
+#[webapi(interface = web_api_interfaces::SVGLength, fallback_to_string_tag = "SVGLength")]
struct SvgLengthObjectDeclaration {
#[webapi(slot = SVG_LENGTH_UNIT_TYPE_SLOT)]
unit_type: u32,
@@ -106,7 +107,7 @@ struct SvgLengthObjectDeclaration {
#[derive(WebApiObject)]
#[webapi(
- interface = "SVGAnimatedLengthList",
+ interface = web_api_interfaces::SVGAnimatedLengthList,
own_to_string_tag = "SVGAnimatedLengthList"
)]
struct SvgAnimatedLengthListObjectDeclaration<'scope> {
@@ -118,7 +119,7 @@ struct SvgAnimatedLengthListObjectDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "SVGAnimatedNumberList",
+ interface = web_api_interfaces::SVGAnimatedNumberList,
own_to_string_tag = "SVGAnimatedNumberList"
)]
struct SvgAnimatedNumberListObjectDeclaration<'scope> {
@@ -130,7 +131,7 @@ struct SvgAnimatedNumberListObjectDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "SVGAnimatedTransformList",
+ interface = web_api_interfaces::SVGAnimatedTransformList,
own_to_string_tag = "SVGAnimatedTransformList"
)]
struct SvgAnimatedTransformListObjectDeclaration<'scope> {
@@ -141,7 +142,7 @@ struct SvgAnimatedTransformListObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SVGLengthList", own_to_string_tag = "SVGLengthList")]
+#[webapi(interface = web_api_interfaces::SVGLengthList, own_to_string_tag = "SVGLengthList")]
struct SvgLengthListObjectDeclaration<'scope> {
#[webapi(slot = SVG_LENGTH_LIST_ITEMS_SLOT)]
items: Vec<v8::Local<'scope, v8::Value>>,
@@ -166,7 +167,7 @@ struct SvgLengthListObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SVGNumberList", own_to_string_tag = "SVGNumberList")]
+#[webapi(interface = web_api_interfaces::SVGNumberList, own_to_string_tag = "SVGNumberList")]
struct SvgNumberListObjectDeclaration<'scope> {
#[webapi(slot = SVG_NUMBER_LIST_ITEMS_SLOT)]
items: Vec<v8::Local<'scope, v8::Value>>,
@@ -191,7 +192,7 @@ struct SvgNumberListObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SVGTransformList", own_to_string_tag = "SVGTransformList")]
+#[webapi(interface = web_api_interfaces::SVGTransformList, own_to_string_tag = "SVGTransformList")]
struct SvgTransformListObjectDeclaration<'scope> {
#[webapi(slot = SVG_TRANSFORM_LIST_ITEMS_SLOT)]
items: Vec<v8::Local<'scope, v8::Value>>,
@@ -228,7 +229,7 @@ struct SvgTransformListObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SVGTransform", own_to_string_tag = "SVGTransform")]
+#[webapi(interface = web_api_interfaces::SVGTransform, own_to_string_tag = "SVGTransform")]
struct SvgTransformObjectDeclaration<'scope> {
#[webapi(slot = SVG_TRANSFORM_TYPE_SLOT)]
transform_type: u32,
diff --git a/moli-renderer-v8/src/context_bootstrap/svg_runtime/rect.rs b/moli-renderer-v8/src/context_bootstrap/svg_runtime/rect.rs
index c0c8ae783..674b85173 100644
--- a/moli-renderer-v8/src/context_bootstrap/svg_runtime/rect.rs
+++ b/moli-renderer-v8/src/context_bootstrap/svg_runtime/rect.rs
@@ -3,6 +3,7 @@
//! JSXGraph uses this method to detect SVG support. Returning a DOMRect would
//! pass that check but expose the wrong interface and double (not float) fields.
+use crate::web_api_interfaces;
use crate::{
native_bridge::node_runtime_and_handle_from_object_or_detached,
util::{callback_data_index_value, callback_data_item, get_private_value, set_private_value},
@@ -17,7 +18,7 @@ const HEIGHT: &str = "__moliSvgRectHeight";
const FIELDS: &[(&str, &str)] = &[("x", X), ("y", Y), ("width", WIDTH), ("height", HEIGHT)];
#[derive(WebApiObject)]
-#[webapi(interface = "SVGRect")]
+#[webapi(interface = web_api_interfaces::SVGRect)]
struct SvgRectObjectDeclaration {
#[webapi(slot = X)]
x: f64,
@@ -30,7 +31,7 @@ struct SvgRectObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGRect", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGRect, enumerable)]
struct SvgRectAccessorsDeclaration {
#[webapi(accessor_property, getter = get_field, setter = set_field,
data = callback_data_index_value(scope, 0))]
diff --git a/moli-renderer-v8/src/context_bootstrap/touch_runtime.rs b/moli-renderer-v8/src/context_bootstrap/touch_runtime.rs
index 4ecca4cd3..b4e4035fc 100644
--- a/moli-renderer-v8/src/context_bootstrap/touch_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/touch_runtime.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::{callback_data_index_value, get_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -27,7 +28,7 @@ const TOUCH_EVENT_CTRL_KEY_SLOT: &str = "__lmTouchEventCtrlKey";
const TOUCH_EVENT_SHIFT_KEY_SLOT: &str = "__lmTouchEventShiftKey";
#[derive(WebApiObject)]
-#[webapi(interface = "Touch")]
+#[webapi(interface = web_api_interfaces::Touch)]
struct TouchObjectDeclaration<'scope> {
#[webapi(slot = TOUCH_IDENTIFIER_SLOT)]
identifier: f64,
@@ -56,7 +57,7 @@ struct TouchObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Touch")]
+#[webapi(interface = web_api_interfaces::Touch)]
struct TouchPrototypeDeclaration {
#[webapi(accessor_property, getter = touch_getter, data = callback_data_index_value(scope, 0), enumerable)]
identifier: (),
@@ -85,14 +86,14 @@ struct TouchPrototypeDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "TouchList")]
+#[webapi(interface = web_api_interfaces::TouchList)]
struct TouchListObjectDeclaration {
#[webapi(slot = TOUCH_LIST_LENGTH_SLOT)]
length: u32,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TouchList", enumerable)]
+#[webapi(interface = web_api_interfaces::TouchList, enumerable)]
struct TouchListPrototypeDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
@@ -115,7 +116,7 @@ struct TouchUiEventInitDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "TouchEvent")]
+#[webapi(interface = web_api_interfaces::TouchEvent)]
struct TouchEventObjectDeclaration<'scope> {
#[webapi(slot = TOUCH_EVENT_TOUCHES_SLOT)]
touches: v8::Local<'scope, v8::Object>,
@@ -134,7 +135,7 @@ struct TouchEventObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TouchEvent")]
+#[webapi(interface = web_api_interfaces::TouchEvent)]
struct TouchEventPrototypeDeclaration {
#[webapi(accessor_property, getter = touch_event_getter, data = callback_data_index_value(scope, 0), enumerable)]
touches: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/trusted_types.rs b/moli-renderer-v8/src/context_bootstrap/trusted_types.rs
index 36a3dea94..1786f9a23 100644
--- a/moli-renderer-v8/src/context_bootstrap/trusted_types.rs
+++ b/moli-renderer-v8/src/context_bootstrap/trusted_types.rs
@@ -1,6 +1,7 @@
use super::*;
use crate::content_security_policy::TrustedTypesForScriptRequirements;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
@@ -28,7 +29,7 @@ const TRUSTED_TYPES_CREATE_SCRIPT_SLOT: &str = "__moliTrustedTypesCreateScript";
const TRUSTED_TYPES_CREATE_SCRIPT_URL_SLOT: &str = "__moliTrustedTypesCreateScriptURL";
#[derive(Default, WebApiObject)]
-#[webapi(prototype = "Object", interface = "TrustedTypePolicyFactory")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::TrustedTypePolicyFactory)]
struct TrustedTypesFactoryDeclaration {
#[webapi(method, callback = trusted_types_create_policy_callback, length = 2)]
create_policy: (),
@@ -59,7 +60,7 @@ struct TrustedTypePrototypeDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "TrustedTypePolicy")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::TrustedTypePolicy)]
struct TrustedTypePolicyDeclaration<'scope> {
#[webapi(data_property)]
name: v8::Local<'scope, v8::String>,
@@ -100,14 +101,18 @@ enum TrustedTypeKind {
}
impl TrustedTypeKind {
- fn constructor_name(self) -> &'static str {
+ fn interface(self) -> moli_webapi_declare::WebApiInterfaceDescriptor {
match self {
- Self::Html => "TrustedHTML",
- Self::Script => "TrustedScript",
- Self::ScriptUrl => "TrustedScriptURL",
+ Self::Html => web_api_interfaces::TrustedHTML::DESCRIPTOR,
+ Self::Script => web_api_interfaces::TrustedScript::DESCRIPTOR,
+ Self::ScriptUrl => web_api_interfaces::TrustedScriptURL::DESCRIPTOR,
}
}
+ fn constructor_name(self) -> &'static str {
+ self.interface().name()
+ }
+
fn create_method_name(self) -> &'static str {
match self {
Self::Html => "createHTML",
@@ -662,7 +667,7 @@ fn build_trusted_type_object<'s>(
TrustedTypeObjectDeclaration::new(value)
.initialize(scope, object)
.expect("TrustedType object declaration should initialize");
- moli_webapi_declare::initialize_web_api_object(scope, object, kind.constructor_name()).ok()?;
+ kind.interface().initialize(scope, object).ok()?;
let _ = object.set_prototype(scope, prototype.into());
Some(object)
}
diff --git a/moli-renderer-v8/src/context_bootstrap/url_form/attributes.rs b/moli-renderer-v8/src/context_bootstrap/url_form/attributes.rs
index e364d306f..9aa94239a 100644
--- a/moli-renderer-v8/src/context_bootstrap/url_form/attributes.rs
+++ b/moli-renderer-v8/src/context_bootstrap/url_form/attributes.rs
@@ -1,6 +1,7 @@
use super::helpers::{require_url_receiver, url_href_slot};
use super::*;
use crate::util::{callback_data_index_value, callback_data_item, get_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiFunctionTemplate;
@@ -40,7 +41,7 @@ impl UrlAttribute {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "URL", enumerable)]
+#[webapi(interface = web_api_interfaces::URL, enumerable)]
struct UrlPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/url_form/callbacks.rs b/moli-renderer-v8/src/context_bootstrap/url_form/callbacks.rs
index e803b979c..61455657a 100644
--- a/moli-renderer-v8/src/context_bootstrap/url_form/callbacks.rs
+++ b/moli-renderer-v8/src/context_bootstrap/url_form/callbacks.rs
@@ -4,11 +4,12 @@ use super::helpers::{
};
use super::*;
use crate::util::get_private_value;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "URL")]
+#[webapi(interface = web_api_interfaces::URL)]
struct UrlObjectDeclaration<'s> {
#[webapi(slot = URL_HREF_SLOT)]
href: String,
diff --git a/moli-renderer-v8/src/context_bootstrap/url_form/template.rs b/moli-renderer-v8/src/context_bootstrap/url_form/template.rs
index 49b22700e..553fea365 100644
--- a/moli-renderer-v8/src/context_bootstrap/url_form/template.rs
+++ b/moli-renderer-v8/src/context_bootstrap/url_form/template.rs
@@ -4,11 +4,12 @@ use super::callbacks::{
url_parse_callback, url_revoke_object_url_callback, url_to_json_callback,
url_to_string_callback,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, v8};
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "URL",
+ interface = web_api_interfaces::URL,
constructor_callback = url_constructor_callback,
constructor_length = 1,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime.rs b/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime.rs
index a19aec44e..a719bf1fd 100644
--- a/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime.rs
@@ -4,6 +4,7 @@ use super::url_form::{
};
use super::*;
use crate::util::{get_private_object, get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
mod callbacks;
@@ -18,7 +19,7 @@ pub(crate) use storage::url_search_params_request_body;
pub(super) use template::build_url_search_params_constructor_template;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "URLSearchParams", enumerable)]
+#[webapi(interface = web_api_interfaces::URLSearchParams, enumerable)]
struct UrlSearchParamsPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = callbacks::url_search_params_size_getter_callback, enumerable)]
size: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/iterators.rs b/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/iterators.rs
index 9df647439..3eec31af7 100644
--- a/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/iterators.rs
+++ b/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/iterators.rs
@@ -4,6 +4,7 @@ use crate::util::{
get_private_object, get_private_value, materialize_hidden_function_template_prototype,
set_private_value,
};
+use crate::web_api_interfaces;
use moli_url::search_params::{
SearchParamsIteratorKind, SearchParamsIteratorValue, search_params_iterator_step,
};
@@ -15,7 +16,7 @@ const URL_SEARCH_PARAMS_ITERATOR_KIND_SLOT: &str = "__moliUrlSearchParamsIterato
const URL_SEARCH_PARAMS_ITERATOR_PROTOTYPE_SLOT: &str = "__moliUrlSearchParamsIteratorPrototype";
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "URLSearchParams Iterator")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::URLSearchParamsIterator)]
struct UrlSearchParamsIteratorDeclaration<'scope> {
#[webapi(slot = URL_SEARCH_PARAMS_ITERATOR_TARGET_SLOT)]
target: v8::Local<'scope, v8::Object>,
@@ -27,7 +28,7 @@ struct UrlSearchParamsIteratorDeclaration<'scope> {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "URLSearchParams Iterator",
+ interface = web_api_interfaces::URLSearchParamsIterator,
intrinsic_prototype_parent = v8::Intrinsic::IteratorPrototype,
prototype_to_string_tag = "URLSearchParams Iterator",
readonly_prototype,
diff --git a/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/storage.rs b/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/storage.rs
index 00f4ae551..0621d4385 100644
--- a/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/storage.rs
+++ b/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/storage.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
use moli_url::search_params::{SearchParamPair, SearchParams, serialize_search_params_pairs};
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "URLSearchParams")]
+#[webapi(interface = web_api_interfaces::URLSearchParams)]
struct UrlSearchParamsObjectDeclaration<'s> {
#[webapi(slot = URL_SEARCH_PARAMS_OWNER_SLOT)]
owner: v8::Local<'s, v8::Value>,
diff --git a/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/template.rs b/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/template.rs
index a6bd1fb4c..38327f0ef 100644
--- a/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/template.rs
+++ b/moli-renderer-v8/src/context_bootstrap/url_search_params_runtime/template.rs
@@ -7,11 +7,12 @@ use super::callbacks::{
url_search_params_sort_callback, url_search_params_to_string_callback,
url_search_params_values_callback,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, v8};
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "URLSearchParams",
+ interface = web_api_interfaces::URLSearchParams,
constructor_callback = url_search_params_constructor_callback,
constructor_length = 0,
enumerable
diff --git a/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/bindings.rs b/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/bindings.rs
index 8c8e1c7a6..9b8e060b2 100644
--- a/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/bindings.rs
+++ b/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/bindings.rs
@@ -13,10 +13,11 @@ use super::{
view_transition_type_set_values_callback,
},
};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentViewTransitionTemplateDeclaration {
#[webapi(
method = "startViewTransition",
@@ -33,7 +34,7 @@ struct DocumentViewTransitionTemplateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ViewTransition", enumerable)]
+#[webapi(interface = web_api_interfaces::ViewTransition, enumerable)]
struct ViewTransitionTemplateDeclaration {
#[webapi(method = "skipTransition", length = 0, callback = view_transition_skip_callback)]
skip_transition: (),
@@ -58,7 +59,7 @@ struct ViewTransitionTemplateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ViewTransitionTypeSet", enumerable)]
+#[webapi(interface = web_api_interfaces::ViewTransitionTypeSet, enumerable)]
struct ViewTransitionTypeSetTemplateDeclaration {
#[webapi(accessor_property, getter = view_transition_type_set_size_getter)]
size: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/lifecycle.rs b/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/lifecycle.rs
index 0e99f8dcc..96be92323 100644
--- a/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/lifecycle.rs
+++ b/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/lifecycle.rs
@@ -1,5 +1,6 @@
use super::type_set::new_view_transition_type_set;
use super::*;
+use crate::web_api_interfaces;
use crate::{
util::{get_private_value, set_private_value},
window_webidl_callback::{
@@ -28,7 +29,7 @@ const CALLBACK_SUCCEEDED: &str = "succeeded";
const CALLBACK_FAILED: &str = "failed";
#[derive(WebApiObject)]
-#[webapi(interface = "ViewTransition")]
+#[webapi(interface = web_api_interfaces::ViewTransition)]
struct ViewTransitionObjectDeclaration<'s> {
#[webapi(slot = VIEW_TRANSITION_DOCUMENT_SLOT)]
document: v8::Local<'s, v8::Object>,
diff --git a/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/type_set.rs b/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/type_set.rs
index 6f4d10aae..24225e3eb 100644
--- a/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/type_set.rs
+++ b/moli-renderer-v8/src/context_bootstrap/view_transition_runtime/type_set.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::{
util::{get_private_value, global_constructor_prototype, set_private_value},
webidl,
@@ -24,7 +25,9 @@ pub(super) fn new_view_transition_type_set<'s>(
if object.set_prototype(scope, prototype.into()) != Some(true) {
return None;
}
- moli_webapi_declare::initialize_web_api_object(scope, object, "ViewTransitionTypeSet").ok()?;
+ web_api_interfaces::ViewTransitionTypeSet::DESCRIPTOR
+ .initialize(scope, object)
+ .ok()?;
set_private_value(
scope,
object,
diff --git a/moli-renderer-v8/src/context_bootstrap/web_audio_runtime.rs b/moli-renderer-v8/src/context_bootstrap/web_audio_runtime.rs
index ded8499b6..8107a3543 100644
--- a/moli-renderer-v8/src/context_bootstrap/web_audio_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/web_audio_runtime.rs
@@ -9,6 +9,7 @@ use crate::util::{
array_push_value, call_object_method, get_private_value, object_string_property,
set_private_value, set_symbol_to_string_tag,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -40,7 +41,7 @@ const DYNAMICS_COMPRESSOR_REDUCTION_SLOT: &str = "__moliDynamicsCompressorReduct
const ANALYSER_FFT_SIZE_SLOT: &str = "__moliAnalyserFftSize";
#[derive(WebApiObject)]
-#[webapi(interface = "AudioContext")]
+#[webapi(interface = web_api_interfaces::AudioContext)]
struct AudioContextObjectDeclaration<'scope> {
#[webapi(data_property = "currentTime")]
current_time: f64,
@@ -63,7 +64,7 @@ struct AudioContextObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "AudioWorklet")]
+#[webapi(interface = web_api_interfaces::AudioWorklet)]
struct AudioWorkletObjectDeclaration<'scope> {
#[webapi(slot = AUDIO_WORKLET_CONTEXT_SLOT)]
context: v8::Local<'scope, v8::Object>,
@@ -72,7 +73,7 @@ struct AudioWorkletObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "AudioWorkletNode")]
+#[webapi(interface = web_api_interfaces::AudioWorkletNode)]
struct AudioWorkletNodeObjectDeclaration<'scope> {
#[webapi(data_property)]
context: v8::Local<'scope, v8::Object>,
@@ -128,7 +129,7 @@ struct AudioWorkletProcessorConstructMessageDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "OfflineAudioContext")]
+#[webapi(interface = web_api_interfaces::OfflineAudioContext)]
struct OfflineAudioContextObjectDeclaration<'scope> {
#[webapi(data_property = "currentTime")]
current_time: f64,
@@ -165,7 +166,7 @@ struct OfflineAudioContextObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "OscillatorNode")]
+#[webapi(interface = web_api_interfaces::OscillatorNode)]
struct OscillatorNodeObjectDeclaration<'scope> {
#[webapi(data_property = "type")]
kind: &'static str,
@@ -182,7 +183,7 @@ struct OscillatorNodeObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "DynamicsCompressorNode")]
+#[webapi(interface = web_api_interfaces::DynamicsCompressorNode)]
struct DynamicsCompressorNodeObjectDeclaration<'scope> {
#[webapi(data_property)]
threshold: v8::Local<'scope, v8::Object>,
@@ -203,14 +204,14 @@ struct DynamicsCompressorNodeObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DynamicsCompressorNode", enumerable)]
+#[webapi(interface = web_api_interfaces::DynamicsCompressorNode, enumerable)]
struct DynamicsCompressorNodePrototypeDeclaration {
#[webapi(accessor_property, getter = dynamics_compressor_reduction_getter_callback)]
reduction: (),
}
#[derive(WebApiObject)]
-#[webapi(interface = "AnalyserNode")]
+#[webapi(interface = web_api_interfaces::AnalyserNode)]
struct AnalyserNodeObjectDeclaration {
#[webapi(slot = ANALYSER_FFT_SIZE_SLOT)]
fft_size: f64,
@@ -227,7 +228,7 @@ struct AnalyserNodeObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "AnalyserNode", enumerable)]
+#[webapi(interface = web_api_interfaces::AnalyserNode, enumerable)]
struct AnalyserNodePrototypeDeclaration {
#[webapi(accessor_property = "fftSize", getter = analyser_fft_size_getter_callback, setter = analyser_fft_size_setter_callback)]
fft_size: (),
@@ -254,10 +255,8 @@ struct OfflineAudioCompletePayloadDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "OfflineAudioCompletionEvent",
- prototype = "Object",
- parent = "Event"
-)]
+ interface = web_api_interfaces::OfflineAudioCompletionEvent,
+ prototype = "Object",)]
struct OfflineAudioCompletionEventDeclaration<'scope> {
#[webapi(data_property = "type")]
event_type: &'static str,
@@ -266,11 +265,11 @@ struct OfflineAudioCompletionEventDeclaration<'scope> {
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "AudioDestinationNode", allow_empty)]
+#[webapi(interface = web_api_interfaces::AudioDestinationNode, allow_empty)]
struct AudioDestinationNodeObjectDeclaration {}
#[derive(WebApiObject)]
-#[webapi(interface = "AudioBuffer")]
+#[webapi(interface = web_api_interfaces::AudioBuffer)]
struct AudioBufferObjectDeclaration<'scope> {
#[webapi(data_property)]
length: f64,
@@ -390,7 +389,7 @@ struct AnalyserFftSizeArgs {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "AudioContext",
+ interface = web_api_interfaces::AudioContext,
constructor_callback = audio_context_constructor_callback,
constructor_length = 0,
enumerable
@@ -402,7 +401,7 @@ struct AudioContextTemplateDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "AudioWorkletNode",
+ interface = web_api_interfaces::AudioWorkletNode,
constructor_callback = audio_worklet_node_constructor_callback,
constructor_length = 2,
enumerable
@@ -415,7 +414,7 @@ struct AudioWorkletNodeTemplateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "BaseAudioContext", enumerable)]
+#[webapi(interface = web_api_interfaces::BaseAudioContext, enumerable)]
struct BaseAudioContextPrototypeDeclaration {
#[webapi(method = "createBiquadFilter", length = 0, callback = biquad::create_biquad_filter)]
create_biquad_filter: (),
@@ -443,7 +442,7 @@ struct BaseAudioContextPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "OfflineAudioContext", enumerable)]
+#[webapi(interface = web_api_interfaces::OfflineAudioContext, enumerable)]
struct OfflineAudioContextPrototypeDeclaration {
#[webapi(
method = "startRendering",
diff --git a/moli-renderer-v8/src/context_bootstrap/web_audio_runtime/audio_param.rs b/moli-renderer-v8/src/context_bootstrap/web_audio_runtime/audio_param.rs
index 5e860b9d3..461176d74 100644
--- a/moli-renderer-v8/src/context_bootstrap/web_audio_runtime/audio_param.rs
+++ b/moli-renderer-v8/src/context_bootstrap/web_audio_runtime/audio_param.rs
@@ -1,11 +1,12 @@
use super::*;
+use crate::web_api_interfaces;
const DEFAULT_VALUE: &str = "__moliAudioParamDefaultValue";
const MIN_VALUE: &str = "__moliAudioParamMinValue";
const MAX_VALUE: &str = "__moliAudioParamMaxValue";
#[derive(WebApiObject)]
-#[webapi(interface = "AudioParam")]
+#[webapi(interface = web_api_interfaces::AudioParam)]
struct AudioParamObjectDeclaration {
#[webapi(data_property)]
value: f64,
@@ -20,7 +21,7 @@ struct AudioParamObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "AudioParam", enumerable)]
+#[webapi(interface = web_api_interfaces::AudioParam, enumerable)]
struct AudioParamPrototypeDeclaration {
#[webapi(accessor_property, getter = default_value)]
default_value: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/web_audio_runtime/biquad.rs b/moli-renderer-v8/src/context_bootstrap/web_audio_runtime/biquad.rs
index 1897ed7dd..5e47d4a69 100644
--- a/moli-renderer-v8/src/context_bootstrap/web_audio_runtime/biquad.rs
+++ b/moli-renderer-v8/src/context_bootstrap/web_audio_runtime/biquad.rs
@@ -1,9 +1,10 @@
use super::*;
+use crate::web_api_interfaces;
const BIQUAD_FREQUENCY_SLOT: &str = "__moliBiquadFrequency";
#[derive(WebApiObject)]
-#[webapi(interface = "BiquadFilterNode")]
+#[webapi(interface = web_api_interfaces::BiquadFilterNode)]
struct BiquadFilterNodeObjectDeclaration<'scope> {
#[webapi(data_property = "type")]
kind: &'static str,
@@ -24,7 +25,7 @@ struct BiquadFilterNodeObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "BiquadFilterNode", enumerable)]
+#[webapi(interface = web_api_interfaces::BiquadFilterNode, enumerable)]
struct BiquadFilterNodePrototypeDeclaration {
#[webapi(method, length = 3, callback = get_frequency_response)]
get_frequency_response: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/web_storage/install.rs b/moli-renderer-v8/src/context_bootstrap/web_storage/install.rs
index f5e02a462..e257361d5 100644
--- a/moli-renderer-v8/src/context_bootstrap/web_storage/install.rs
+++ b/moli-renderer-v8/src/context_bootstrap/web_storage/install.rs
@@ -17,6 +17,7 @@ use super::interceptors::{
};
use super::*;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(Default, WebApiObject)]
@@ -60,7 +61,7 @@ struct StorageConstructorGlobalDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Storage", constructor = "illegal", constructor_length = 0)]
+#[webapi(interface = web_api_interfaces::Storage, constructor = "illegal", constructor_length = 0)]
struct StorageConstructorTemplateDeclaration {}
pub(in crate::context_bootstrap) fn install_storage_runtime_state<'s>(
@@ -132,7 +133,7 @@ fn install_named_storage_runtime_state<'s>(
if let Some(prototype) = prototype {
let _ = storage.set_prototype(scope, prototype.into());
}
- moli_webapi_declare::initialize_web_api_object(scope, storage, "Storage")?;
+ web_api_interfaces::Storage::DESCRIPTOR.initialize(scope, storage)?;
set_private_value(scope, global, slot_name, storage.into());
Ok(storage)
}
diff --git a/moli-renderer-v8/src/context_bootstrap/webrtc.rs b/moli-renderer-v8/src/context_bootstrap/webrtc.rs
index a0107ac5b..660b48e68 100644
--- a/moli-renderer-v8/src/context_bootstrap/webrtc.rs
+++ b/moli-renderer-v8/src/context_bootstrap/webrtc.rs
@@ -2,6 +2,7 @@ use super::*;
use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, set_private_value,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
mod ice_candidate;
@@ -64,7 +65,7 @@ const RTC_DATA_CHANNEL_VALUE_SLOTS: &[&str] = &[
];
#[derive(WebApiObject)]
-#[webapi(interface = "RTCPeerConnection")]
+#[webapi(interface = web_api_interfaces::RTCPeerConnection)]
struct RtcPeerConnectionObjectDeclaration<'scope> {
#[webapi(slot = RTC_PEER_CONNECTION_CONFIGURATION_SLOT)]
configuration: v8::Local<'scope, v8::Object>,
@@ -91,7 +92,7 @@ struct RtcPeerConnectionObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "RTCDataChannel")]
+#[webapi(interface = web_api_interfaces::RTCDataChannel)]
struct RtcDataChannelObjectDeclaration<'scope> {
#[webapi(slot = RTC_DATA_CHANNEL_LABEL_SLOT)]
label: v8::Local<'scope, v8::String>,
@@ -129,7 +130,7 @@ struct RtcSessionDescriptionInitDeclaration<'scope> {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "RTCPeerConnection", enumerable)]
+#[webapi(interface = web_api_interfaces::RTCPeerConnection, enumerable)]
struct RtcPeerConnectionPrototypeDeclaration {
#[webapi(accessor_property, getter = rtc_peer_connection_state_getter, data = callback_data_index_value(scope, 0))]
signaling_state: (),
@@ -160,14 +161,14 @@ struct RtcPeerConnectionPrototypeDeclaration {
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "RTCRtpReceiver")]
+#[webapi(interface = web_api_interfaces::RTCRtpReceiver)]
struct RtcRtpReceiverConstructorDeclaration {
#[webapi(static_method = "getCapabilities", enumerable, length = 1, callback = rtc_rtp_receiver_get_capabilities_callback)]
get_capabilities: (),
}
#[derive(Default, WebApiFunctionTemplate)]
-#[webapi(name = "RTCDataChannel", enumerable)]
+#[webapi(interface = web_api_interfaces::RTCDataChannel, enumerable)]
struct RtcDataChannelPrototypeDeclaration {
#[webapi(accessor_property, getter = rtc_data_channel_value_getter, data = callback_data_index_value(scope, 0))]
label: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/webrtc/ice_candidate.rs b/moli-renderer-v8/src/context_bootstrap/webrtc/ice_candidate.rs
index d4d545e9a..62f99226a 100644
--- a/moli-renderer-v8/src/context_bootstrap/webrtc/ice_candidate.rs
+++ b/moli-renderer-v8/src/context_bootstrap/webrtc/ice_candidate.rs
@@ -1,4 +1,5 @@
use super::ice_candidate_parser::parse_ice_candidate;
+use crate::web_api_interfaces;
use crate::{
util::{
apply_webidl_constructor_prototype_fallback, callback_data_index_value, get_private_value,
@@ -11,14 +12,14 @@ use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
const CANDIDATE_VALUES_SLOT: &str = "__moliRtcIceCandidateValues";
#[derive(WebApiObject)]
-#[webapi(interface = "RTCIceCandidate")]
+#[webapi(interface = web_api_interfaces::RTCIceCandidate)]
struct IceCandidateObjectDeclaration<'scope> {
#[webapi(slot = CANDIDATE_VALUES_SLOT)]
values: v8::Local<'scope, v8::Array>,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "RTCIceCandidate", enumerable)]
+#[webapi(interface = web_api_interfaces::RTCIceCandidate, enumerable)]
struct IceCandidatePrototypeDeclaration {
#[webapi(accessor_property, getter = candidate_attribute_getter, data = callback_data_index_value(scope, 0))]
candidate: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/webrtc/session_description.rs b/moli-renderer-v8/src/context_bootstrap/webrtc/session_description.rs
index e948dca93..1b1a7fed8 100644
--- a/moli-renderer-v8/src/context_bootstrap/webrtc/session_description.rs
+++ b/moli-renderer-v8/src/context_bootstrap/webrtc/session_description.rs
@@ -1,4 +1,5 @@
use super::RtcSessionDescriptionInitDeclaration;
+use crate::web_api_interfaces;
use crate::{
util::{
apply_webidl_constructor_prototype_fallback, callback_data_index_value, callback_data_item,
@@ -13,7 +14,7 @@ const DESCRIPTION_SDP_SLOT: &str = "__moliRtcSessionDescriptionSdp";
const DESCRIPTION_SLOTS: &[&str] = &[DESCRIPTION_TYPE_SLOT, DESCRIPTION_SDP_SLOT];
#[derive(WebApiObject)]
-#[webapi(interface = "RTCSessionDescription")]
+#[webapi(interface = web_api_interfaces::RTCSessionDescription)]
struct SessionDescriptionObjectDeclaration<'scope> {
#[webapi(slot = DESCRIPTION_TYPE_SLOT)]
r#type: v8::Local<'scope, v8::String>,
@@ -22,7 +23,7 @@ struct SessionDescriptionObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "RTCSessionDescription", enumerable)]
+#[webapi(interface = web_api_interfaces::RTCSessionDescription, enumerable)]
struct SessionDescriptionPrototypeDeclaration {
#[webapi(accessor_property, getter = description_attribute_getter, data = callback_data_index_value(scope, 0))]
r#type: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/websocket/accessors.rs b/moli-renderer-v8/src/context_bootstrap/websocket/accessors.rs
index 4490c764d..35d94623e 100644
--- a/moli-renderer-v8/src/context_bootstrap/websocket/accessors.rs
+++ b/moli-renderer-v8/src/context_bootstrap/websocket/accessors.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiFunctionTemplate;
use std::str::FromStr;
@@ -29,7 +30,7 @@ const WEBSOCKET_EVENT_HANDLERS: &[WebSocketEventHandler] = &[
];
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WebSocket")]
+#[webapi(interface = web_api_interfaces::WebSocket)]
struct WebSocketEventHandlerAccessorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/context_bootstrap/websocket/bindings.rs b/moli-renderer-v8/src/context_bootstrap/websocket/bindings.rs
index 7ae0743df..72c59f844 100644
--- a/moli-renderer-v8/src/context_bootstrap/websocket/bindings.rs
+++ b/moli-renderer-v8/src/context_bootstrap/websocket/bindings.rs
@@ -10,10 +10,11 @@ use super::methods::{
websocket_close_callback, websocket_send_callback, websocket_stream_close_callback,
};
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WebSocket", enumerable)]
+#[webapi(interface = web_api_interfaces::WebSocket, enumerable)]
struct WebSocketTemplateMethodsDeclaration {
#[webapi(constant = "CONNECTING", value = CONNECTING)]
connecting: (),
@@ -35,14 +36,14 @@ struct WebSocketTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WebSocketStream", enumerable)]
+#[webapi(interface = web_api_interfaces::WebSocketStream, enumerable)]
struct WebSocketStreamTemplateMethodsDeclaration {
#[webapi(method, length = 0, callback = websocket_stream_close_callback)]
close: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WebSocket")]
+#[webapi(interface = web_api_interfaces::WebSocket)]
struct WebSocketPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = websocket_url_getter_function, enumerable)]
url: (),
@@ -79,7 +80,7 @@ struct WebSocketPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "WebSocketStream")]
+#[webapi(interface = web_api_interfaces::WebSocketStream)]
struct WebSocketStreamPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = websocket_stream_url_getter_function, enumerable)]
url: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/websocket/constructor.rs b/moli-renderer-v8/src/context_bootstrap/websocket/constructor.rs
index 48aca1196..044c5fce7 100644
--- a/moli-renderer-v8/src/context_bootstrap/websocket/constructor.rs
+++ b/moli-renderer-v8/src/context_bootstrap/websocket/constructor.rs
@@ -8,6 +8,7 @@ use super::realm::{effective_websocket_document_scope, websocket_constructor_rel
use super::stream::{new_websocket_stream_promise, reject_websocket_stream_abort};
use super::*;
use crate::context_bootstrap::constructors::initialize_websocket_error;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
use moli_websocket::{normalize_websocket_close_info, websocket_url_is_potentially_trustworthy};
@@ -15,7 +16,7 @@ use moli_websocket::{normalize_websocket_close_info, websocket_url_is_potentiall
const WEBSOCKET_STREAM_ABORT_LISTENER_STREAM_SLOT: &str = "__moliWebSocketStreamAbortStream";
#[derive(WebApiObject)]
-#[webapi(interface = "WebSocket")]
+#[webapi(interface = web_api_interfaces::WebSocket)]
struct WebSocketObjectDeclaration {
#[webapi(slot = WEBSOCKET_URL_SLOT)]
url: String,
@@ -68,7 +69,7 @@ struct WebSocketObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "WebSocketStream")]
+#[webapi(interface = web_api_interfaces::WebSocketStream)]
struct WebSocketStreamObjectDeclaration<'scope> {
#[webapi(slot = WEBSOCKET_STREAM_URL_SLOT)]
url: v8::Local<'scope, v8::String>,
@@ -87,7 +88,7 @@ struct WebSocketStreamObjectDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "WebSocketStream")]
+#[webapi(interface = web_api_interfaces::WebSocketStream)]
struct WebSocketStreamRegisteredSocketDeclaration {
#[webapi(slot = WEBSOCKET_ID_SLOT)]
socket_id: f64,
diff --git a/moli-renderer-v8/src/context_bootstrap/websocket/events.rs b/moli-renderer-v8/src/context_bootstrap/websocket/events.rs
index 27f2148d0..0cd5b722d 100644
--- a/moli-renderer-v8/src/context_bootstrap/websocket/events.rs
+++ b/moli-renderer-v8/src/context_bootstrap/websocket/events.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "Event", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::Event, prototype = "Object")]
struct WebSocketSimpleEventFallbackDeclaration {
#[webapi(data_property, enumerable)]
r#type: String,
diff --git a/moli-renderer-v8/src/context_bootstrap/window_runtime/navigator.rs b/moli-renderer-v8/src/context_bootstrap/window_runtime/navigator.rs
index abc5d7ba6..43e2423bd 100644
--- a/moli-renderer-v8/src/context_bootstrap/window_runtime/navigator.rs
+++ b/moli-renderer-v8/src/context_bootstrap/window_runtime/navigator.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use moli_browser_profile::BrowserIdentityProfile;
use moli_webapi_declare::{ObjectLiteralDeclaration, WebApiObject};
@@ -70,7 +71,7 @@ const NAVIGATOR_UA_DATA_USER_AGENT_SLOT: &str = "__moliNavigatorUADataUserAgent"
#[derive(Default, WebApiObject)]
#[webapi(
prototype = "Object",
- interface = "CacheStorage",
+ interface = web_api_interfaces::CacheStorage,
own_to_string_tag = "CacheStorage"
)]
struct StorageBucketCacheStorageObjectDeclaration {
@@ -107,7 +108,7 @@ struct StorageBucketCacheStorageObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "Cache", own_to_string_tag = "Cache")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::Cache, own_to_string_tag = "Cache")]
struct StorageBucketCacheObjectDeclaration {
#[webapi(slot = STORAGE_BUCKET_CACHE_NAME_SLOT)]
cache_name: String,
@@ -126,7 +127,7 @@ struct StorageBucketCacheObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PermissionStatus")]
+#[webapi(interface = web_api_interfaces::PermissionStatus)]
struct PermissionStatusObjectDeclaration {
#[webapi(slot = PERMISSION_STATUS_NAME_SLOT)]
name: String,
@@ -166,7 +167,7 @@ struct NavigatorUaBrandEntryDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "NavigatorUAData")]
+#[webapi(interface = web_api_interfaces::NavigatorUAData)]
struct NavigatorUaDataObjectDeclaration {
#[webapi(slot = NAVIGATOR_UA_DATA_USER_AGENT_SLOT)]
user_agent: String,
@@ -256,7 +257,7 @@ struct StorageUsageDetailsObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "BatteryManager", data_properties)]
+#[webapi(prototype = "Object", interface = web_api_interfaces::BatteryManager, data_properties)]
struct NavigatorBatteryStatusObjectDeclaration {
#[webapi(data_property, enumerable)]
charging: bool,
@@ -290,7 +291,7 @@ struct NavigatorBatteryStatusObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(allow_empty, interface = "StorageBucket")]
+#[webapi(allow_empty, interface = web_api_interfaces::StorageBucket)]
struct StorageBucketObjectDeclaration {}
#[derive(Debug)]
diff --git a/moli-renderer-v8/src/context_bootstrap/window_runtime/navigator/legacy_storage_quota.rs b/moli-renderer-v8/src/context_bootstrap/window_runtime/navigator/legacy_storage_quota.rs
index 078c43b4d..9e430c461 100644
--- a/moli-renderer-v8/src/context_bootstrap/window_runtime/navigator/legacy_storage_quota.rs
+++ b/moli-renderer-v8/src/context_bootstrap/window_runtime/navigator/legacy_storage_quota.rs
@@ -7,6 +7,7 @@
//! Quota state is intentionally synthetic; scheduling, owner authorization,
//! task completion, and retry policy do not live in this module.
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
use moli_webidl_callback::WebIdlCallbackFunction;
@@ -30,7 +31,7 @@ const TEMPORARY_STORAGE_TYPE: f64 = 0.0;
const PERSISTENT_STORAGE_TYPE: f64 = 1.0;
#[derive(Default, WebApiObject)]
-#[webapi(prototype = "Object", interface = "DeprecatedStorageQuota")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::DeprecatedStorageQuota)]
struct LegacyStorageQuotaObjectDeclaration {
#[webapi(
method,
@@ -50,7 +51,7 @@ struct LegacyStorageQuotaObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "DeprecatedStorageInfo")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::DeprecatedStorageInfo)]
struct LegacyStorageInfoObjectDeclaration {
#[webapi(data_property = "TEMPORARY", enumerable)]
temporary: f64,
diff --git a/moli-renderer-v8/src/context_bootstrap/window_runtime/service_worker.rs b/moli-renderer-v8/src/context_bootstrap/window_runtime/service_worker.rs
index 04749e8f4..94f7de057 100644
--- a/moli-renderer-v8/src/context_bootstrap/window_runtime/service_worker.rs
+++ b/moli-renderer-v8/src/context_bootstrap/window_runtime/service_worker.rs
@@ -9,6 +9,7 @@ use crate::service_worker_runtime::{
ServiceWorkerRegistrationError, ServiceWorkerUpdateViaCache,
};
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use crate::worker::WorkerScriptKind;
use moli_webapi_declare::{ObjectLiteralDeclaration, WebApiObject, WebApiObjectDeclaration};
@@ -39,7 +40,7 @@ const SERVICE_WORKER_CONTAINER_REGISTRATIONS_SLOT: &str =
const SERVICE_WORKER_CONTAINER_CONTROLLER_SLOT: &str = "__moliServiceWorkerContainerController";
#[derive(WebApiObject)]
-#[webapi(interface = "ServiceWorkerRegistration")]
+#[webapi(interface = web_api_interfaces::ServiceWorkerRegistration)]
struct ServiceWorkerRegistrationObjectDeclaration<'scope> {
#[webapi(data_property, readonly)]
scope: String,
@@ -116,7 +117,7 @@ struct ServiceWorkerNavigationPreloadStateDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PushSubscriptionOptions", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::PushSubscriptionOptions, prototype = "Object")]
struct ServiceWorkerPushSubscriptionOptionsDeclaration<'scope> {
#[webapi(data_property = "userVisibleOnly", readonly)]
user_visible_only: bool,
@@ -126,7 +127,7 @@ struct ServiceWorkerPushSubscriptionOptionsDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SyncManager")]
+#[webapi(interface = web_api_interfaces::SyncManager)]
struct ServiceWorkerSyncManagerDeclaration {
#[webapi(
method = "register",
@@ -144,7 +145,7 @@ struct ServiceWorkerSyncManagerDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PeriodicSyncManager")]
+#[webapi(interface = web_api_interfaces::PeriodicSyncManager)]
struct ServiceWorkerPeriodicSyncManagerDeclaration {
#[webapi(
method = "register",
@@ -169,7 +170,7 @@ struct ServiceWorkerPeriodicSyncManagerDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PushManager")]
+#[webapi(interface = web_api_interfaces::PushManager)]
struct ServiceWorkerPushManagerDeclaration {
#[webapi(
method = "subscribe",
@@ -194,7 +195,7 @@ struct ServiceWorkerPushManagerDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "NavigationPreloadManager")]
+#[webapi(interface = web_api_interfaces::NavigationPreloadManager)]
struct ServiceWorkerNavigationPreloadManagerDeclaration {
#[webapi(
method,
@@ -226,7 +227,7 @@ struct ServiceWorkerNavigationPreloadManagerDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PushSubscription")]
+#[webapi(interface = web_api_interfaces::PushSubscription)]
struct ServiceWorkerPushSubscriptionDeclaration<'scope> {
#[webapi(data_property, readonly)]
endpoint: String,
@@ -249,7 +250,7 @@ struct ServiceWorkerPushSubscriptionDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ServiceWorker")]
+#[webapi(interface = web_api_interfaces::ServiceWorker)]
struct ServiceWorkerObjectDeclaration {
#[webapi(data_property = "scriptURL", readonly)]
script_url: String,
@@ -296,7 +297,7 @@ struct ServiceWorkerMessageEventInitDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Event", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::Event, prototype = "Object")]
struct ServiceWorkerSimpleEventDeclaration<'scope> {
#[webapi(data_property = "type", enumerable)]
event_type: v8::Local<'scope, v8::String>,
diff --git a/moli-renderer-v8/src/context_bootstrap/window_template.rs b/moli-renderer-v8/src/context_bootstrap/window_template.rs
index 2877070e9..9c909d00a 100644
--- a/moli-renderer-v8/src/context_bootstrap/window_template.rs
+++ b/moli-renderer-v8/src/context_bootstrap/window_template.rs
@@ -12,6 +12,7 @@ use super::{
window_events::*,
window_runtime::*,
};
+use crate::web_api_interfaces;
use crate::{
network_host,
queue_microtask::window_queue_microtask_callback,
@@ -22,7 +23,7 @@ use anyhow::{Result, anyhow};
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Window", enumerable)]
+#[webapi(interface = web_api_interfaces::Window, enumerable)]
struct WindowEarlyTemplateMethodsDeclaration {
#[webapi(method, length = 1, callback = window_host::window_set_timeout_callback)]
set_timeout: (),
@@ -82,7 +83,7 @@ struct WindowEarlyTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Window", enumerable)]
+#[webapi(interface = web_api_interfaces::Window, enumerable)]
struct WindowObsoleteTemplateMethodsDeclaration {
#[webapi(method, length = 0, callback = window_obsolete_noop_callback)]
capture_events: (),
@@ -92,7 +93,7 @@ struct WindowObsoleteTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Window", enumerable)]
+#[webapi(interface = web_api_interfaces::Window, enumerable)]
struct WindowPostNetworkTemplateMethodsDeclaration {
#[webapi(
method = "createImageBitmap",
@@ -158,21 +159,21 @@ struct WindowPostNetworkTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Window", enumerable)]
+#[webapi(interface = web_api_interfaces::Window, enumerable)]
struct WindowSelectionTemplateMethodsDeclaration {
#[webapi(method, length = 0, callback = window_get_selection_callback)]
get_selection: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Window", enumerable)]
+#[webapi(interface = web_api_interfaces::Window, enumerable)]
struct WindowMediaTemplateMethodsDeclaration {
#[webapi(method, length = 1, callback = window_match_media_callback)]
match_media: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Window", enumerable)]
+#[webapi(interface = web_api_interfaces::Window, enumerable)]
struct WindowIdentityAccessorsDeclaration {
#[webapi(accessor_property, getter = window_window_getter)]
window: (),
@@ -236,7 +237,7 @@ struct WindowIdentityAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Window", enumerable)]
+#[webapi(interface = web_api_interfaces::Window, enumerable)]
struct WindowPostRuntimeAccessorsDeclaration {
#[webapi(accessor_property, getter = window_opener_getter)]
opener: (),
@@ -307,7 +308,7 @@ struct WindowPostRuntimeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Window", enumerable)]
+#[webapi(interface = web_api_interfaces::Window, enumerable)]
struct WindowStorageAccessorsDeclaration {
#[webapi(accessor_property, getter = window_local_storage_getter)]
local_storage: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/worker_host/constructor.rs b/moli-renderer-v8/src/context_bootstrap/worker_host/constructor.rs
index 4fce90bbb..481bafee5 100644
--- a/moli-renderer-v8/src/context_bootstrap/worker_host/constructor.rs
+++ b/moli-renderer-v8/src/context_bootstrap/worker_host/constructor.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
struct WorkerOptionsMembers {
worker_type: WorkerScriptKind,
@@ -46,7 +47,7 @@ const WORKER_EVENT_HANDLERS: &[WorkerEventHandler] = &[
];
#[derive(WebApiObject)]
-#[webapi(interface = "Worker")]
+#[webapi(interface = web_api_interfaces::Worker)]
struct WorkerObjectDeclaration {
#[webapi(slot = SIMPLE_EVENT_TARGET_SLOT, value = WORKER_LISTENERS_SLOT)]
event_target_slot: (),
diff --git a/moli-renderer-v8/src/context_bootstrap/worker_host/dispatch.rs b/moli-renderer-v8/src/context_bootstrap/worker_host/dispatch.rs
index 31fbeb38a..02cedc30f 100644
--- a/moli-renderer-v8/src/context_bootstrap/worker_host/dispatch.rs
+++ b/moli-renderer-v8/src/context_bootstrap/worker_host/dispatch.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::pin::pin;
use moli_webapi_declare::WebApiObject;
@@ -21,7 +22,7 @@ struct WorkerHostEventInitDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Event", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::Event, prototype = "Object")]
struct WorkerHostEventFallbackDeclaration {
#[webapi(data_property, enumerable)]
r#type: String,
@@ -39,7 +40,7 @@ struct WorkerHostMessageEventInitDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "MessageEvent", prototype = "Object", scope_lifetime = 'scope)]
+#[webapi(interface = web_api_interfaces::MessageEvent, prototype = "Object", scope_lifetime = 'scope)]
struct WorkerHostMessageEventFallbackDeclaration<'scope, 'event> {
#[webapi(data_property, enumerable)]
data: v8::Local<'scope, v8::Value>,
@@ -67,7 +68,7 @@ struct WorkerHostErrorEventInitDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ErrorEvent", prototype = "Object", scope_lifetime = 'scope)]
+#[webapi(interface = web_api_interfaces::ErrorEvent, prototype = "Object", scope_lifetime = 'scope)]
struct WorkerHostErrorEventFallbackDeclaration<'scope, 'text> {
#[webapi(data_property, enumerable)]
r#type: &'static str,
diff --git a/moli-renderer-v8/src/context_bootstrap/worker_location_runtime.rs b/moli-renderer-v8/src/context_bootstrap/worker_location_runtime.rs
index 4fde3c647..b3c2a1258 100644
--- a/moli-renderer-v8/src/context_bootstrap/worker_location_runtime.rs
+++ b/moli-renderer-v8/src/context_bootstrap/worker_location_runtime.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::{callback_data_index_value, callback_data_item, get_private_object};
+use crate::web_api_interfaces;
use anyhow::{Result, anyhow};
use moli_webapi_declare::WebApiObject;
@@ -9,7 +10,7 @@ const WORKER_LOCATION_PROPERTIES: &[&str] = &[
];
#[derive(WebApiObject)]
-#[webapi(interface = "WorkerLocation")]
+#[webapi(interface = web_api_interfaces::WorkerLocation)]
struct WorkerLocationObjectDeclaration<'scope> {
#[webapi(slot = WORKER_LOCATION_DATA_SLOT)]
data: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/custom_elements/registry_install.rs b/moli-renderer-v8/src/custom_elements/registry_install.rs
index 8f9e6c617..ea23323e5 100644
--- a/moli-renderer-v8/src/custom_elements/registry_install.rs
+++ b/moli-renderer-v8/src/custom_elements/registry_install.rs
@@ -1,4 +1,5 @@
use super::registry_runtime::CUSTOM_ELEMENTS_REGISTRY_CHILD_HANDLE_SLOT;
+use crate::web_api_interfaces;
use crate::{
context_bootstrap::{WindowLazySurface, rematerialize_window_lazy_surface_if_cached},
document_runtime::DomHandle,
@@ -8,7 +9,7 @@ use anyhow::Result;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "CustomElementRegistry", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::CustomElementRegistry, prototype = "Object")]
struct CustomElementsRegistryDeclaration<'scope> {
#[webapi(prototype)]
prototype: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/detached_css_style.rs b/moli-renderer-v8/src/detached_css_style.rs
index c86f45964..7a25108f3 100644
--- a/moli-renderer-v8/src/detached_css_style.rs
+++ b/moli-renderer-v8/src/detached_css_style.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::{
cell::RefCell,
collections::{HashMap, HashSet},
@@ -145,7 +146,7 @@ pub(crate) fn set_lightweight_css_style_stylo_declaration_block_id<'s>(
#[derive(WebApiObject)]
#[webapi(
- interface = "CSSStyleProperties",
+ interface = web_api_interfaces::CSSStyleProperties,
own_to_string_tag = "CSSStyleProperties"
)]
struct LightweightCssStylePropertiesDeclaration<'scope> {
@@ -157,7 +158,7 @@ struct LightweightCssStylePropertiesDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "CSSFontFaceDescriptors",
+ interface = web_api_interfaces::CSSFontFaceDescriptors,
own_to_string_tag = "CSSFontFaceDescriptors"
)]
struct LightweightCssFontFaceDescriptorsDeclaration<'scope> {
@@ -169,7 +170,7 @@ struct LightweightCssFontFaceDescriptorsDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "CSSPageDescriptors",
+ interface = web_api_interfaces::CSSPageDescriptors,
own_to_string_tag = "CSSPageDescriptors"
)]
struct LightweightCssPageDescriptorsDeclaration<'scope> {
@@ -180,7 +181,7 @@ struct LightweightCssPageDescriptorsDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CSSStyleProperties")]
+#[webapi(interface = web_api_interfaces::CSSStyleProperties)]
struct LightweightCssStylePrototypeDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/dom_parser.rs b/moli-renderer-v8/src/dom_parser.rs
index 786ed868b..cac39f12d 100644
--- a/moli-renderer-v8/src/dom_parser.rs
+++ b/moli-renderer-v8/src/dom_parser.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use moli_web_mime::{is_dom_parser_xml_mime, is_html_document_mime};
use moli_webapi_declare::WebApiFunctionTemplate;
use url::Url;
@@ -91,7 +92,7 @@ fn dom_parser_source_arg<'s>(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMParser", enumerable)]
+#[webapi(interface = web_api_interfaces::DOMParser, enumerable)]
struct DomParserPrototypeMethodsDeclaration {
#[webapi(method, length = 2, callback = dom_parser_parse_from_string_callback)]
parse_from_string: (),
diff --git a/moli-renderer-v8/src/lib.rs b/moli-renderer-v8/src/lib.rs
index e8fc5a3d8..5d0dc491e 100644
--- a/moli-renderer-v8/src/lib.rs
+++ b/moli-renderer-v8/src/lib.rs
@@ -381,3 +381,5 @@ pub mod renderer {
RendererTopLevelNavigationDispatch, is_on_js_local_executor,
};
}
+
+mod web_api_interfaces;
diff --git a/moli-renderer-v8/src/native_bridge/abort.rs b/moli-renderer-v8/src/native_bridge/abort.rs
index 49b18a012..31a7ce5dc 100644
--- a/moli-renderer-v8/src/native_bridge/abort.rs
+++ b/moli-renderer-v8/src/native_bridge/abort.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::collections::{HashMap, HashSet};
use super::super::document_runtime::EventTargetHandle;
@@ -95,7 +96,7 @@ struct AbortLinkedMessagePortListener {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "AbortSignal")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::AbortSignal)]
struct AbortSignalObjectDeclaration<'scope> {
#[webapi(prototype)]
prototype: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/native_bridge/bindings.rs b/moli-renderer-v8/src/native_bridge/bindings.rs
index ac143bd5d..7229499f2 100644
--- a/moli-renderer-v8/src/native_bridge/bindings.rs
+++ b/moli-renderer-v8/src/native_bridge/bindings.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::{collections::HashMap, ffi::c_void};
use anyhow::{Result, anyhow};
@@ -139,8 +140,10 @@ impl NativeBridgeBindings {
let mut node_wrapper_templates = HashMap::new();
for descriptor in node_bridge_descriptors() {
let template = build_node_wrapper_template(scope, descriptor);
- node_wrapper_templates
- .insert(descriptor.prototype_name, v8::Global::new(scope, template));
+ node_wrapper_templates.insert(
+ descriptor.interface.name(),
+ v8::Global::new(scope, template),
+ );
}
let bridge_template = build_native_bridge_template(scope);
@@ -277,7 +280,7 @@ impl NativeBridgeBindings {
"`{prototype_name}` wrapper must expose its reflector identity field"
);
}
- moli_webapi_declare::initialize_web_api_object(scope, wrapper, prototype_name)
+ web_api_interfaces::initialize(scope, wrapper, prototype_name)
.expect("native wrapper identity should initialize");
set_named_constructor_prototype(scope, wrapper, prototype_name);
self.sync_wrapper_owner_realm_prototype(scope, host_ptr, &handle, wrapper);
diff --git a/moli-renderer-v8/src/native_bridge/collections.rs b/moli-renderer-v8/src/native_bridge/collections.rs
index eba9754d6..465c5aa51 100644
--- a/moli-renderer-v8/src/native_bridge/collections.rs
+++ b/moli-renderer-v8/src/native_bridge/collections.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::ffi::c_void;
use crate::dom::{forms::InputType, native::Node};
@@ -84,7 +85,7 @@ pub(in crate::native_bridge) fn initialize_collection_identity<'s>(
kind: CollectionKind,
) {
let interface = collection_interface_name(kind);
- moli_webapi_declare::initialize_web_api_object(scope, object, interface)
+ web_api_interfaces::initialize(scope, object, interface)
.expect("native collection identity should initialize");
}
diff --git a/moli-renderer-v8/src/native_bridge/collections/builders.rs b/moli-renderer-v8/src/native_bridge/collections/builders.rs
index 2129a475f..10a0a9db4 100644
--- a/moli-renderer-v8/src/native_bridge/collections/builders.rs
+++ b/moli-renderer-v8/src/native_bridge/collections/builders.rs
@@ -1,6 +1,7 @@
use super::*;
use crate::native_bridge::element::element_attribute_for_object;
use crate::util::throw_type_error;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
pub(in crate::native_bridge) const STATIC_COLLECTION_LENGTH_SLOT: &str =
@@ -11,7 +12,7 @@ pub(in crate::native_bridge::collections) const STATIC_HANDLE_COLLECTION_ID_INTE
const STATIC_HANDLE_NODE_LIST_EAGER_LIMIT: usize = 1_000;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLOptionsCollection", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLOptionsCollection, enumerable)]
struct OptionsCollectionPrototypeDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
@@ -41,7 +42,7 @@ struct OptionsCollectionPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "RadioNodeList", enumerable)]
+#[webapi(interface = web_api_interfaces::RadioNodeList, enumerable)]
struct RadioNodeListPrototypeDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
@@ -58,7 +59,7 @@ struct RadioNodeListPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLCollection")]
+#[webapi(interface = web_api_interfaces::HTMLCollection)]
struct HtmlCollectionPrototypeMembersDeclaration {
#[webapi(
accessor_property,
@@ -91,7 +92,7 @@ struct HtmlCollectionPrototypeMembersDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "NodeList")]
+#[webapi(interface = web_api_interfaces::NodeList)]
struct NodeListPrototypeMembersDeclaration {
#[webapi(accessor_property, enumerable, getter = node_list_length_getter)]
length: (),
@@ -131,7 +132,7 @@ struct NodeListPrototypeMembersDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLFormControlsCollection")]
+#[webapi(interface = web_api_interfaces::HTMLFormControlsCollection)]
struct FormControlsCollectionPrototypeDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
@@ -141,7 +142,7 @@ struct FormControlsCollectionPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLAllCollection")]
+#[webapi(interface = web_api_interfaces::HTMLAllCollection)]
struct HtmlAllCollectionPrototypeDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
diff --git a/moli-renderer-v8/src/native_bridge/context_host/popups.rs b/moli-renderer-v8/src/native_bridge/context_host/popups.rs
index 314494b58..503a85707 100644
--- a/moli-renderer-v8/src/native_bridge/context_host/popups.rs
+++ b/moli-renderer-v8/src/native_bridge/context_host/popups.rs
@@ -1,6 +1,7 @@
use super::{
JsContextHost, NavigationHistoryEntrySeed, child_frame_runtime::WINDOW_EVENT_HANDLER_PROPERTIES,
};
+use crate::web_api_interfaces;
use crate::{
content_security_policy::content_security_policy_forces_opaque_origin,
context_bootstrap::{
@@ -142,13 +143,13 @@ struct LightweightPopupDocumentStreamMethodsDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Event", prototype = "Object", data_properties, enumerable)]
+#[webapi(interface = web_api_interfaces::Event, prototype = "Object", data_properties, enumerable)]
struct LightweightPopupEventDeclaration<'scope> {
r#type: v8::Local<'scope, v8::String>,
}
#[derive(WebApiObject)]
-#[webapi(interface = "PopStateEvent", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::PopStateEvent, prototype = "Object")]
struct LightweightPopupPopStateEventDeclaration<'scope> {
#[webapi(data_property)]
state: v8::Local<'scope, v8::Value>,
diff --git a/moli-renderer-v8/src/native_bridge/document.rs b/moli-renderer-v8/src/native_bridge/document.rs
index 627369f2f..d81794542 100644
--- a/moli-renderer-v8/src/native_bridge/document.rs
+++ b/moli-renderer-v8/src/native_bridge/document.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use crate::{
custom_elements,
dom::native::{DocumentTitleSetterTarget, Node},
@@ -301,7 +302,7 @@ pub(crate) const XHTML_NS: &str = "http://www.w3.org/1999/xhtml";
pub(crate) const SVG_NS: &str = "http://www.w3.org/2000/svg";
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentMetadataPrototypeDeclaration {
#[webapi(accessor_property = "URL", getter = document_url_getter_function)]
url: (),
@@ -324,12 +325,12 @@ struct DocumentMetadataPrototypeDeclaration {
getter = document_last_modified_getter_function
)]
last_modified: (),
- #[webapi(accessor_property, getter = document_referrer_getter_function, receiver = "Document")]
+ #[webapi(accessor_property, getter = document_referrer_getter_function, receiver = web_api_interfaces::Document::is_instance)]
referrer: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentStructurePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -355,7 +356,7 @@ struct DocumentStructurePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentViewPrototypeDeclaration {
#[webapi(
accessor_property = "defaultView",
@@ -365,7 +366,7 @@ struct DocumentViewPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentFocusPrototypeDeclaration {
#[webapi(
accessor_property = "activeElement",
@@ -375,7 +376,7 @@ struct DocumentFocusPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentStatePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -412,7 +413,7 @@ struct DocumentStatePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentCollectionAccessorsPrototypeDeclaration {
#[webapi(accessor_property, getter = document_forms_getter_function)]
forms: (),
@@ -433,7 +434,7 @@ struct DocumentCollectionAccessorsPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document")]
+#[webapi(interface = web_api_interfaces::Document)]
struct DocumentCollectionQueryPrototypeDeclaration {
#[webapi(
method,
@@ -462,7 +463,7 @@ struct DocumentCollectionQueryPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentObsoleteMethodsPrototypeDeclaration {
#[webapi(method, length = 0, callback = document_obsolete_noop_callback)]
clear: (),
@@ -473,7 +474,7 @@ struct DocumentObsoleteMethodsPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DocumentFragment")]
+#[webapi(interface = web_api_interfaces::DocumentFragment)]
struct DocumentFragmentCollectionQueryPrototypeDeclaration {
#[webapi(method, length = 1, callback = node_get_element_by_id_callback)]
get_element_by_id: (),
@@ -1399,14 +1400,14 @@ pub(crate) fn install_document_template_bindings<'s>(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document")]
+#[webapi(interface = web_api_interfaces::Document)]
struct DocumentGetElementByIdTemplateDeclaration {
#[webapi(method = "getElementById", length = 1, callback = node_get_element_by_id_callback)]
get_element_by_id: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document", enumerable)]
+#[webapi(interface = web_api_interfaces::Document, enumerable)]
struct DocumentPrototypeMethodsDeclaration {
#[webapi(method = "createElement", length = 1, callback = node_create_element_callback)]
create_element: (),
diff --git a/moli-renderer-v8/src/native_bridge/document/attributes/attr_object/instance/builder.rs b/moli-renderer-v8/src/native_bridge/document/attributes/attr_object/instance/builder.rs
index 17d13df22..5ea2fcabc 100644
--- a/moli-renderer-v8/src/native_bridge/document/attributes/attr_object/instance/builder.rs
+++ b/moli-renderer-v8/src/native_bridge/document/attributes/attr_object/instance/builder.rs
@@ -1,6 +1,7 @@
use super::install::install_attr_instance_properties;
use super::*;
use crate::util::set_null_prototype;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
@@ -17,7 +18,7 @@ struct AttrStateDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Attr")]
+#[webapi(interface = web_api_interfaces::Attr)]
struct AttrObjectDeclaration<'scope> {
#[webapi(slot = ATTR_STATE_SLOT)]
state: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/native_bridge/document/attributes/attr_object/instance/install.rs b/moli-renderer-v8/src/native_bridge/document/attributes/attr_object/instance/install.rs
index e5bde3e83..f96fc7154 100644
--- a/moli-renderer-v8/src/native_bridge/document/attributes/attr_object/instance/install.rs
+++ b/moli-renderer-v8/src/native_bridge/document/attributes/attr_object/instance/install.rs
@@ -11,10 +11,11 @@ use crate::definitions::{
define_native_data_property as define_attr_instance_native_data_property,
define_native_data_property_with_setter as define_attr_instance_native_data_property_with_setter,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "Attr")]
+#[webapi(interface = web_api_interfaces::Attr)]
struct AttrInstanceMethodsDeclaration {
#[webapi(method, length = 0, callback = attr_instance_is_same_node_callback)]
is_same_node: (),
diff --git a/moli-renderer-v8/src/native_bridge/document/attributes/named_node_map.rs b/moli-renderer-v8/src/native_bridge/document/attributes/named_node_map.rs
index 78e78c9f7..7e8714327 100644
--- a/moli-renderer-v8/src/native_bridge/document/attributes/named_node_map.rs
+++ b/moli-renderer-v8/src/native_bridge/document/attributes/named_node_map.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
mod cache;
@@ -17,7 +18,7 @@ pub(in crate::native_bridge::document) use methods::{
named_node_map_set_named_item_ns_method_callback,
};
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "NamedNodeMap", enumerable)]
+#[webapi(interface = web_api_interfaces::NamedNodeMap, enumerable)]
struct NamedNodeMapPrototypeDeclaration {
#[webapi(accessor_property, getter = named_node_map_length_getter_callback)]
length: (),
diff --git a/moli-renderer-v8/src/native_bridge/document/detached_install/accessors/iframe_window.rs b/moli-renderer-v8/src/native_bridge/document/detached_install/accessors/iframe_window.rs
index f7812c7da..27de69593 100644
--- a/moli-renderer-v8/src/native_bridge/document/detached_install/accessors/iframe_window.rs
+++ b/moli-renderer-v8/src/native_bridge/document/detached_install/accessors/iframe_window.rs
@@ -1,4 +1,5 @@
use crate::util::v8str;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
use url::Url;
@@ -10,7 +11,7 @@ use super::iframe_window_messaging::install_detached_iframe_window_messaging;
#[derive(WebApiObject)]
#[webapi(
- interface = "Window",
+ interface = web_api_interfaces::Window,
prototype = "Object",
own_to_string_tag = "Window"
)]
diff --git a/moli-renderer-v8/src/native_bridge/document/detached_objects/builders/documents.rs b/moli-renderer-v8/src/native_bridge/document/detached_objects/builders/documents.rs
index df2698cb8..aa4d08720 100644
--- a/moli-renderer-v8/src/native_bridge/document/detached_objects/builders/documents.rs
+++ b/moli-renderer-v8/src/native_bridge/document/detached_objects/builders/documents.rs
@@ -1,6 +1,7 @@
use super::*;
use crate::dom::native::DomHost;
use crate::util::context_host_ptr_from_global_bridge;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
use url::Url;
@@ -50,12 +51,8 @@ fn new_detached_document_object<'s>(
DetachedDocumentObjectDeclaration::new(prototype, to_string_tag, v8::null(scope).into())
.bind(scope)
.ok()?;
- moli_webapi_declare::initialize_web_api_object(
- scope,
- document,
- detached_document_constructor_name(kind),
- )
- .ok()?;
+ web_api_interfaces::initialize(scope, document, detached_document_constructor_name(kind))
+ .ok()?;
Some(document)
}
diff --git a/moli-renderer-v8/src/native_bridge/document/detached_objects/builders/elements.rs b/moli-renderer-v8/src/native_bridge/document/detached_objects/builders/elements.rs
index 44a53e9d9..b4719c58d 100644
--- a/moli-renderer-v8/src/native_bridge/document/detached_objects/builders/elements.rs
+++ b/moli-renderer-v8/src/native_bridge/document/detached_objects/builders/elements.rs
@@ -3,6 +3,7 @@ use crate::util::{
call_global_bridge_method, context_host_ptr_from_global_bridge, get_private_value,
set_private_value, v8str,
};
+use crate::web_api_interfaces;
use crate::{
context_bootstrap::ensure_intrinsic_interface_prototype,
custom_elements,
@@ -493,7 +494,7 @@ pub(in crate::native_bridge::document) fn build_detached_element_object<'s>(
new_detached_object_with_prototype(scope, "__detachedElementPrototype", to_string_tag)?
};
let interface = to_string_tag.unwrap_or("Element");
- moli_webapi_declare::initialize_web_api_object(scope, object, interface).ok()?;
+ web_api_interfaces::initialize(scope, object, interface).ok()?;
let state = new_detached_state_object(scope, "element", 1, &node_name)?;
let _ = state.set(
scope,
diff --git a/moli-renderer-v8/src/native_bridge/document/detached_objects/collections.rs b/moli-renderer-v8/src/native_bridge/document/detached_objects/collections.rs
index 6a593e4fc..3c5d4d7af 100644
--- a/moli-renderer-v8/src/native_bridge/document/detached_objects/collections.rs
+++ b/moli-renderer-v8/src/native_bridge/document/detached_objects/collections.rs
@@ -10,6 +10,7 @@ use crate::util::{
context_host_ptr_from_global_bridge, get_private_value, serialize_v8_iter_array,
set_private_value,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{ObjectLiteralDeclaration, WebApiObject};
@@ -23,7 +24,7 @@ struct DetachedCollectionItemsAndNamedDataDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "HTMLAllCollection")]
+#[webapi(interface = web_api_interfaces::HTMLAllCollection)]
struct DetachedDocumentAllCollectionDeclaration<'scope> {
/// Declaration-only input shared by `item` and `namedItem`.
///
@@ -46,7 +47,7 @@ struct DetachedDocumentAllCollectionDeclaration<'scope> {
/// All fixed members come from the shared `NodeList` prototype. The wrapper
/// only carries its indexed values and private collection brand/length state.
#[derive(WebApiObject)]
-#[webapi(interface = "NodeList", require_prototype, allow_empty)]
+#[webapi(interface = web_api_interfaces::NodeList, require_prototype, allow_empty)]
struct DetachedNodeListDeclaration {}
/// Declares the detached `HTMLCollection` wrapper surface.
@@ -55,7 +56,7 @@ struct DetachedNodeListDeclaration {}
/// reusable interface template. Only indexed/named snapshot entries remain
/// own properties.
#[derive(WebApiObject)]
-#[webapi(interface = "HTMLCollection", require_prototype, allow_empty)]
+#[webapi(interface = web_api_interfaces::HTMLCollection, require_prototype, allow_empty)]
struct DetachedHtmlCollectionDeclaration {}
#[derive(webidl::WebIdlArgs)]
diff --git a/moli-renderer-v8/src/native_bridge/document/detached_objects/method_forwarders.rs b/moli-renderer-v8/src/native_bridge/document/detached_objects/method_forwarders.rs
index da633c886..5f09bcc16 100644
--- a/moli-renderer-v8/src/native_bridge/document/detached_objects/method_forwarders.rs
+++ b/moli-renderer-v8/src/native_bridge/document/detached_objects/method_forwarders.rs
@@ -4,6 +4,7 @@ use crate::dom_parser::map_live_value_to_foreign;
use crate::util::{
context_host_ptr_from_global_bridge, get_private_object, get_private_value, set_private_value,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
@@ -15,7 +16,7 @@ const DETACHED_NODE_ITERATOR_NODES_SLOT: &str = "__moliDetachedNodeIteratorNodes
const DETACHED_NODE_ITERATOR_INDEX_SLOT: &str = "__moliDetachedNodeIteratorIndex";
#[derive(WebApiObject)]
-#[webapi(interface = "NodeIterator")]
+#[webapi(interface = web_api_interfaces::NodeIterator)]
struct DetachedNodeIteratorDeclaration<'scope> {
#[webapi(slot = DETACHED_NODE_ITERATOR_NODES_SLOT)]
nodes: v8::Local<'scope, v8::Array>,
@@ -28,7 +29,7 @@ struct DetachedNodeIteratorDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "DOMImplementation", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::DOMImplementation, prototype = "Object")]
struct DetachedDomImplementationDeclaration<'scope> {
#[webapi(slot = DOM_IMPLEMENTATION_OWNER_DOCUMENT_SLOT)]
owner_document: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/native_bridge/document/detached_objects/prototypes.rs b/moli-renderer-v8/src/native_bridge/document/detached_objects/prototypes.rs
index 2f7eaaa6d..17ba094e1 100644
--- a/moli-renderer-v8/src/native_bridge/document/detached_objects/prototypes.rs
+++ b/moli-renderer-v8/src/native_bridge/document/detached_objects/prototypes.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
@@ -136,7 +137,7 @@ pub(in crate::native_bridge::document) fn new_detached_object_with_prototype<'s>
.bind(scope)
.ok()?;
if let Some(interface) = to_string_tag {
- moli_webapi_declare::initialize_web_api_object(scope, object, interface).ok()?;
+ web_api_interfaces::initialize(scope, object, interface).ok()?;
}
Some(object)
}
diff --git a/moli-renderer-v8/src/native_bridge/document/hit_test.rs b/moli-renderer-v8/src/native_bridge/document/hit_test.rs
index b93b7acde..64c274705 100644
--- a/moli-renderer-v8/src/native_bridge/document/hit_test.rs
+++ b/moli-renderer-v8/src/native_bridge/document/hit_test.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::collections::HashSet;
use super::super::element::{
@@ -21,7 +22,7 @@ const CARET_POSITION_RECT_WIDTH_SLOT: &str = "__moliCaretPositionRectWidth";
const CARET_POSITION_RECT_HEIGHT_SLOT: &str = "__moliCaretPositionRectHeight";
#[derive(WebApiObject)]
-#[webapi(interface = "CaretPosition")]
+#[webapi(interface = web_api_interfaces::CaretPosition)]
struct CaretPositionDeclaration<'scope> {
#[webapi(slot = CARET_POSITION_OFFSET_NODE_SLOT)]
offset_node: v8::Local<'scope, v8::Object>,
@@ -38,7 +39,7 @@ struct CaretPositionDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CaretPosition", enumerable)]
+#[webapi(interface = web_api_interfaces::CaretPosition, enumerable)]
struct CaretPositionPrototypeDeclaration {
#[webapi(accessor_property, getter = caret_position_offset_node_getter)]
offset_node: (),
diff --git a/moli-renderer-v8/src/native_bridge/document/live_collections/all/builder.rs b/moli-renderer-v8/src/native_bridge/document/live_collections/all/builder.rs
index 79d482968..808bccb99 100644
--- a/moli-renderer-v8/src/native_bridge/document/live_collections/all/builder.rs
+++ b/moli-renderer-v8/src/native_bridge/document/live_collections/all/builder.rs
@@ -1,6 +1,7 @@
use crate::document_runtime::DomHandle;
use crate::native_bridge::collections;
use crate::util::v8str;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
use super::super::super::super::JsContextHost;
@@ -19,7 +20,7 @@ struct DocumentAllCollectionDataDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "HTMLAllCollection")]
+#[webapi(interface = web_api_interfaces::HTMLAllCollection)]
struct DocumentAllCollectionSurfaceDeclaration<'scope> {
/// Declaration-only input shared by `item` and `namedItem`.
///
diff --git a/moli-renderer-v8/src/native_bridge/document/queries/xpath/callbacks.rs b/moli-renderer-v8/src/native_bridge/document/queries/xpath/callbacks.rs
index 6927fc8f0..adf0e1f45 100644
--- a/moli-renderer-v8/src/native_bridge/document/queries/xpath/callbacks.rs
+++ b/moli-renderer-v8/src/native_bridge/document/queries/xpath/callbacks.rs
@@ -7,11 +7,12 @@ use crate::native_bridge::{
document::{detached_node_type, detached_tree_root_object},
node_runtime_and_handle_from_object,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "XPathEvaluator", enumerable)]
+#[webapi(interface = web_api_interfaces::XPathEvaluator, enumerable)]
struct XPathEvaluatorPrototypeDeclaration {
#[webapi(method, length = 2, callback = xpath_evaluator_evaluate_callback)]
evaluate: (),
diff --git a/moli-renderer-v8/src/native_bridge/document/queries/xpath/result.rs b/moli-renderer-v8/src/native_bridge/document/queries/xpath/result.rs
index b280395bd..9038f5f21 100644
--- a/moli-renderer-v8/src/native_bridge/document/queries/xpath/result.rs
+++ b/moli-renderer-v8/src/native_bridge/document/queries/xpath/result.rs
@@ -2,6 +2,7 @@ use super::super::*;
use super::types::*;
use crate::native_bridge::document::detached_tree_query_version;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
use moli_xpath::SnapshotValue;
@@ -27,7 +28,7 @@ struct XPathResultSnapshotItemArgs {
}
#[derive(WebApiObject)]
-#[webapi(interface = "XPathResult")]
+#[webapi(interface = web_api_interfaces::XPathResult)]
struct XPathResultBaseDeclaration<'scope> {
#[webapi(slot = XPATH_RESULT_TYPE_SLOT)]
result_type: u32,
@@ -48,7 +49,7 @@ struct XPathResultBaseDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "XPathResult", enumerable)]
+#[webapi(interface = web_api_interfaces::XPathResult, enumerable)]
struct XPathResultPrototypeDeclaration {
#[webapi(accessor_property, getter = xpath_result_result_type_getter_callback)]
result_type: (),
@@ -71,7 +72,7 @@ struct XPathResultPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "XPathResult")]
+#[webapi(interface = web_api_interfaces::XPathResult)]
struct XPathResultConstantsDeclaration {
#[webapi(constant = "ANY_TYPE", value = XPATH_ANY_TYPE)]
any_type: (),
diff --git a/moli-renderer-v8/src/native_bridge/element.rs b/moli-renderer-v8/src/native_bridge/element.rs
index 823c1cb65..12023e1e6 100644
--- a/moli-renderer-v8/src/native_bridge/element.rs
+++ b/moli-renderer-v8/src/native_bridge/element.rs
@@ -18,6 +18,7 @@ use super::node::{
throw_incompatible_setter_receiver,
};
use crate::document_runtime::DomHandle;
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiTemplateValue};
mod activation;
@@ -338,7 +339,7 @@ pub(crate) use forms::{
use rendered_state::{node_check_visibility_callback, node_current_css_zoom_getter_function};
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLFormElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLFormElement, enumerable)]
struct HtmlFormElementTemplateMethodsDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
@@ -359,7 +360,7 @@ struct HtmlFormElementTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLSelectElement")]
+#[webapi(interface = web_api_interfaces::HTMLSelectElement)]
struct HtmlSelectElementIndexedPropertiesDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
@@ -660,7 +661,7 @@ use url_attributes::{
};
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Element")]
+#[webapi(interface = web_api_interfaces::Element)]
struct ElementPrototypeReflectionDeclaration {
#[webapi(
accessor_property,
@@ -799,7 +800,7 @@ struct ElementPrototypeReflectionDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Element")]
+#[webapi(interface = web_api_interfaces::Element)]
struct ElementPrototypeQueryAndAttributeMethodsDeclaration {
#[webapi(
method,
@@ -897,7 +898,7 @@ struct ElementPrototypeQueryAndAttributeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Element", enumerable)]
+#[webapi(interface = web_api_interfaces::Element, enumerable)]
struct ExtendedElementPrototypeMethodsDeclaration {
#[webapi(method, length = 1, callback = node_get_attribute_node_callback)]
get_attribute_node: (),
@@ -936,7 +937,7 @@ struct ExtendedElementPrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Element")]
+#[webapi(interface = web_api_interfaces::Element)]
struct ElementGeometryPrototypeDeclaration {
#[webapi(
accessor_property = "currentCSSZoom",
@@ -997,19 +998,19 @@ struct ElementGeometryPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLElement")]
+#[webapi(interface = web_api_interfaces::HTMLElement)]
struct HtmlElementGeometryPrototypeDeclaration {
#[webapi(
accessor_property = "offsetWidth",
enumerable,
- receiver = "HTMLElement",
+ receiver = web_api_interfaces::HTMLElement::is_instance,
getter = node_offset_width_getter_function
)]
offset_width: (),
#[webapi(
accessor_property = "offsetHeight",
enumerable,
- receiver = "HTMLElement",
+ receiver = web_api_interfaces::HTMLElement::is_instance,
getter = node_offset_height_getter_function
)]
offset_height: (),
@@ -1034,7 +1035,7 @@ struct HtmlElementGeometryPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Element", enumerable)]
+#[webapi(interface = web_api_interfaces::Element, enumerable)]
struct ElementAriaStringReflectionDeclaration {
#[webapi(
accessor_property,
@@ -1326,7 +1327,7 @@ struct ElementAriaStringReflectionDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Element", enumerable)]
+#[webapi(interface = web_api_interfaces::Element, enumerable)]
struct ElementAriaElementReflectionDeclaration {
#[webapi(
accessor_property = "ariaActiveDescendantElement",
@@ -1387,7 +1388,7 @@ struct ElementAriaElementReflectionDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Document")]
+#[webapi(interface = web_api_interfaces::Document)]
struct DocumentCustomElementRegistryPrototypeDeclaration {
#[webapi(
accessor_property = "customElementRegistry",
@@ -1398,7 +1399,7 @@ struct DocumentCustomElementRegistryPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Element")]
+#[webapi(interface = web_api_interfaces::Element)]
struct ElementStylePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -1410,7 +1411,7 @@ struct ElementStylePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLElement", receiver = "HTMLElement")]
+#[webapi(interface = web_api_interfaces::HTMLElement, receiver)]
struct HtmlElementStandardPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -1546,7 +1547,7 @@ struct HtmlElementStandardPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLElement")]
+#[webapi(interface = web_api_interfaces::HTMLElement)]
struct HtmlElementActionPrototypeDeclaration {
#[webapi(method, length = 0, enumerable, callback = node_focus_callback)]
focus: (),
@@ -1611,7 +1612,7 @@ struct HtmlOrForeignElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLElement")]
+#[webapi(interface = web_api_interfaces::HTMLElement)]
struct HtmlElementPopoverPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -1686,7 +1687,7 @@ const HTML_COMPACT_REFLECTION_INTERFACES: &[&str] = &[
];
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLLIElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLLIElement, enumerable)]
struct HtmlLiElementValuePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -1704,7 +1705,7 @@ struct HtmlLiElementValuePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLOListElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLOListElement, enumerable)]
struct HtmlOListElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -1727,7 +1728,7 @@ struct HtmlOListElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLUListElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLUListElement, enumerable)]
struct HtmlUListElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -1762,7 +1763,7 @@ struct HtmlBodyOrFrameSetEventHandlersPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLBodyElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLBodyElement, enumerable)]
struct HtmlBodyElementLegacyPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -1804,7 +1805,7 @@ struct HtmlBodyElementLegacyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLHRElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLHRElement, enumerable)]
struct HtmlHrElementLegacyPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -1836,7 +1837,7 @@ struct HtmlHrElementLegacyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLFontElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLFontElement, enumerable)]
struct HtmlFontElementLegacyPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -1855,7 +1856,7 @@ struct HtmlFontElementLegacyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLMarqueeElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLMarqueeElement, enumerable)]
struct HtmlMarqueeElementLegacyPrototypeDeclaration {
#[webapi(
accessor_property = "loop",
@@ -1913,7 +1914,7 @@ struct HtmlMarqueeElementLegacyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableElement")]
+#[webapi(interface = web_api_interfaces::HTMLTableElement)]
struct HtmlTableElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -3414,7 +3415,7 @@ fn object_content_window_getter_function<'s>(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLScriptElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLScriptElement, enumerable)]
struct HtmlScriptElementPrototypeDeclaration {
#[webapi(
accessor_property = "innerText",
@@ -3513,7 +3514,7 @@ struct HtmlScriptElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGScriptElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGScriptElement, enumerable)]
struct SvgScriptElementPrototypeDeclaration {
#[webapi(
accessor_property = "type",
@@ -3530,7 +3531,7 @@ struct SvgScriptElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLAnchorElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLAnchorElement, enumerable)]
struct HtmlAnchorElementUrlPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -3597,7 +3598,7 @@ struct HtmlAnchorElementUrlPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLAreaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLAreaElement, enumerable)]
struct HtmlAreaElementUrlPrototypeDeclaration {
#[webapi(method = "toString", length = 0, callback = area_to_string_callback)]
to_string: (),
@@ -3666,7 +3667,7 @@ struct HtmlAreaElementUrlPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLImageElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLImageElement, enumerable)]
struct HtmlImageElementUrlPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -3800,7 +3801,7 @@ struct HtmlImageElementUrlPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLSourceElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLSourceElement, enumerable)]
struct HtmlSourceElementUrlPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -3850,7 +3851,7 @@ struct HtmlSourceElementUrlPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLEmbedElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLEmbedElement, enumerable)]
struct HtmlEmbedElementUrlPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -3882,7 +3883,7 @@ struct HtmlEmbedElementUrlPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLFrameElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLFrameElement, enumerable)]
struct HtmlFrameElementLegacyPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -3928,7 +3929,7 @@ struct HtmlFrameElementLegacyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLIFrameElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLIFrameElement, enumerable)]
struct HtmlIFrameElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4040,19 +4041,19 @@ struct HtmlIFrameElementPrototypeDeclaration {
#[webapi(
accessor_property,
getter = frame_owner_content_document_getter_function,
- receiver = "HTMLIFrameElement"
+ receiver = web_api_interfaces::HTMLIFrameElement::is_instance
)]
content_document: (),
#[webapi(
accessor_property,
getter = frame_owner_content_window_getter_function,
- receiver = "HTMLIFrameElement"
+ receiver = web_api_interfaces::HTMLIFrameElement::is_instance
)]
content_window: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLBaseElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLBaseElement, enumerable)]
struct HtmlBaseElementUrlPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4063,7 +4064,7 @@ struct HtmlBaseElementUrlPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLLinkElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLLinkElement, enumerable)]
struct HtmlLinkElementUrlPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4129,7 +4130,7 @@ struct HtmlLinkElementUrlPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLStyleElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLStyleElement, enumerable)]
struct HtmlStyleElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4160,7 +4161,7 @@ struct HtmlStyleElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "SVGStyleElement", enumerable)]
+#[webapi(interface = web_api_interfaces::SVGStyleElement, enumerable)]
struct SvgStyleElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4311,7 +4312,7 @@ fn svg_style_disabled_setter_function<'s>(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLDetailsElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLDetailsElement, enumerable)]
struct HtmlDetailsElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4322,7 +4323,7 @@ struct HtmlDetailsElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLDialogElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLDialogElement, enumerable)]
struct HtmlDialogElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4345,7 +4346,7 @@ struct HtmlDialogElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLMetaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLMetaElement, enumerable)]
struct HtmlMetaElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4362,7 +4363,7 @@ struct HtmlMetaElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLMetaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLMetaElement, enumerable)]
struct HtmlMetaElementMediaPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4374,7 +4375,7 @@ struct HtmlMetaElementMediaPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLAnchorElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLAnchorElement, enumerable)]
struct HtmlAnchorElementTargetPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4385,7 +4386,7 @@ struct HtmlAnchorElementTargetPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLAreaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLAreaElement, enumerable)]
struct HtmlAreaElementTargetPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4396,7 +4397,7 @@ struct HtmlAreaElementTargetPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLAreaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLAreaElement, enumerable)]
struct HtmlAreaElementReferrerPolicyPrototypeDeclaration {
#[webapi(
accessor_property = "referrerPolicy",
@@ -4408,7 +4409,7 @@ struct HtmlAreaElementReferrerPolicyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLAreaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLAreaElement, enumerable)]
struct HtmlAreaElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4454,7 +4455,7 @@ struct HtmlAreaElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLBaseElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLBaseElement, enumerable)]
struct HtmlBaseElementTargetPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4465,7 +4466,7 @@ struct HtmlBaseElementTargetPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLLinkElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLLinkElement, enumerable)]
struct HtmlLinkElementTargetPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4588,7 +4589,7 @@ struct LabelableElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLFieldSetElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLFieldSetElement, enumerable)]
struct HtmlFieldSetElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4603,21 +4604,21 @@ struct HtmlFieldSetElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLDataListElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLDataListElement, enumerable)]
struct HtmlDataListElementPrototypeDeclaration {
#[webapi(accessor_property, getter = datalist_options_getter_function)]
options: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLLegendElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLLegendElement, enumerable)]
struct HtmlLegendElementPrototypeDeclaration {
#[webapi(accessor_property, getter = legend_form_getter_function)]
form: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLButtonElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLButtonElement, enumerable)]
struct HtmlButtonElementValuePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4694,7 +4695,7 @@ struct HtmlButtonElementValuePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLInputElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLInputElement, enumerable)]
struct HtmlInputElementValuePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4900,7 +4901,7 @@ struct HtmlInputElementValuePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLOutputElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLOutputElement, enumerable)]
struct HtmlOutputElementValuePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4919,7 +4920,7 @@ struct HtmlOutputElementValuePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLMeterElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLMeterElement, enumerable)]
struct HtmlMeterElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4960,7 +4961,7 @@ struct HtmlMeterElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLProgressElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLProgressElement, enumerable)]
struct HtmlProgressElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -4979,7 +4980,7 @@ struct HtmlProgressElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTextAreaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTextAreaElement, enumerable)]
struct HtmlTextAreaElementValuePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5060,7 +5061,7 @@ struct HtmlTextAreaElementValuePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLOptionElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLOptionElement, enumerable)]
struct HtmlOptionElementValuePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5071,7 +5072,7 @@ struct HtmlOptionElementValuePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLOptionElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLOptionElement, enumerable)]
struct HtmlOptionElementStatePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5098,7 +5099,7 @@ struct HtmlOptionElementStatePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLOptGroupElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLOptGroupElement, enumerable)]
struct HtmlOptGroupElementDisabledPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5109,7 +5110,7 @@ struct HtmlOptGroupElementDisabledPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLOptGroupElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLOptGroupElement, enumerable)]
struct HtmlOptGroupElementLabelPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5121,7 +5122,7 @@ struct HtmlOptGroupElementLabelPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLOptionElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLOptionElement, enumerable)]
struct HtmlOptionElementLabelPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5132,7 +5133,7 @@ struct HtmlOptionElementLabelPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTrackElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTrackElement, enumerable)]
struct HtmlTrackElementPrototypeDeclaration {
#[webapi(
accessor_property = "default",
@@ -5172,7 +5173,7 @@ struct HtmlTrackElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLDataElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLDataElement, enumerable)]
struct HtmlDataElementValuePrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5184,7 +5185,7 @@ struct HtmlDataElementValuePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLParamElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLParamElement, enumerable)]
struct HtmlParamElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5210,7 +5211,7 @@ struct HtmlParamElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLObjectElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLObjectElement, enumerable)]
struct HtmlObjectElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5322,7 +5323,7 @@ struct HtmlObjectElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLHtmlElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLHtmlElement, enumerable)]
struct HtmlHtmlElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5334,7 +5335,7 @@ struct HtmlHtmlElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLMediaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLMediaElement, enumerable)]
struct HtmlMediaElementPrototypeDeclaration {
#[webapi(accessor_property, getter = media_error_getter_function)]
error: (),
@@ -5427,7 +5428,7 @@ struct HtmlMediaElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLVideoElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLVideoElement, enumerable)]
struct HtmlVideoElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5460,7 +5461,7 @@ struct HtmlVideoElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLQuoteElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLQuoteElement, enumerable)]
struct HtmlQuoteElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5472,7 +5473,7 @@ struct HtmlQuoteElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLModElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLModElement, enumerable)]
struct HtmlModElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5491,7 +5492,7 @@ struct HtmlModElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTimeElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTimeElement, enumerable)]
struct HtmlTimeElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5503,7 +5504,7 @@ struct HtmlTimeElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLPreElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLPreElement, enumerable)]
struct HtmlPreElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5514,7 +5515,7 @@ struct HtmlPreElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLBRElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLBRElement, enumerable)]
struct HtmlBrElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5526,7 +5527,7 @@ struct HtmlBrElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLAnchorElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLAnchorElement, enumerable)]
struct HtmlAnchorElementPrototypeDeclaration {
#[webapi(
accessor_property = "referrerPolicy",
@@ -5601,7 +5602,7 @@ struct HtmlAnchorElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTitleElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTitleElement, enumerable)]
struct HtmlTitleElementTextPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5612,7 +5613,7 @@ struct HtmlTitleElementTextPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLOptionElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLOptionElement, enumerable)]
struct HtmlOptionElementTextPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5623,7 +5624,7 @@ struct HtmlOptionElementTextPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLLabelElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLLabelElement, enumerable)]
struct HtmlLabelElementPrototypeDeclaration {
#[webapi(
accessor_property = "htmlFor",
@@ -5638,7 +5639,7 @@ struct HtmlLabelElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLFormElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLFormElement, enumerable)]
struct HtmlFormElementPrototypeAccessorsDeclaration {
#[webapi(
accessor_property,
@@ -5701,7 +5702,7 @@ struct HtmlFormElementPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLMediaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLMediaElement, enumerable)]
struct HtmlMediaElementPrototypeMethodsDeclaration {
#[webapi(method, length = 0, callback = media_play_callback)]
play: (),
@@ -5716,14 +5717,14 @@ struct HtmlMediaElementPrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLImageElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLImageElement, enumerable)]
struct HtmlImageElementPrototypeMethodsDeclaration {
#[webapi(method, length = 0, callback = image_decode_callback)]
decode: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLInputElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLInputElement, enumerable)]
struct HtmlInputElementPrototypeMethodsDeclaration {
#[webapi(
accessor_property,
@@ -5774,7 +5775,7 @@ struct TextControlSelectionPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTextAreaElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTextAreaElement, enumerable)]
struct HtmlTextAreaElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5785,7 +5786,7 @@ struct HtmlTextAreaElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLSelectElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLSelectElement, enumerable)]
struct HtmlSelectElementPrototypeMethodsDeclaration {
#[webapi(
accessor_property,
@@ -5872,7 +5873,7 @@ struct FormControlValidationPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableSectionElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTableSectionElement, enumerable)]
struct HtmlTableSectionElementPrototypeMethodsDeclaration {
#[webapi(method, length = 0, callback = table_section_insert_row_callback)]
insert_row: (),
@@ -5881,14 +5882,14 @@ struct HtmlTableSectionElementPrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableSectionElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTableSectionElement, enumerable)]
struct HtmlTableSectionElementPrototypeDeclaration {
#[webapi(accessor_property, getter = table_section_rows_getter_function)]
rows: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableSectionElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTableSectionElement, enumerable)]
struct HtmlTableSectionElementLegacyPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -5914,7 +5915,7 @@ struct HtmlTableSectionElementLegacyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableRowElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTableRowElement, enumerable)]
struct HtmlTableRowElementPrototypeMethodsDeclaration {
#[webapi(method, length = 0, callback = table_row_insert_cell_callback)]
insert_cell: (),
@@ -5923,7 +5924,7 @@ struct HtmlTableRowElementPrototypeMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableRowElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTableRowElement, enumerable)]
struct HtmlTableRowElementPrototypeDeclaration {
#[webapi(accessor_property, getter = table_row_index_getter_function)]
row_index: (),
@@ -5934,7 +5935,7 @@ struct HtmlTableRowElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableRowElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTableRowElement, enumerable)]
struct HtmlTableRowElementLegacyPrototypeDeclaration {
#[webapi(
accessor_property = "bgColor",
@@ -5967,7 +5968,7 @@ struct HtmlTableRowElementLegacyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableColElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTableColElement, enumerable)]
struct HtmlTableColElementLegacyPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -6006,7 +6007,7 @@ struct HtmlTableColElementLegacyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableCellElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTableCellElement, enumerable)]
struct HtmlTableCellElementLegacyPrototypeDeclaration {
#[webapi(
accessor_property = "bgColor",
@@ -6087,7 +6088,7 @@ struct HtmlTableCellElementLegacyPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTableCellElement", enumerable)]
+#[webapi(interface = web_api_interfaces::HTMLTableCellElement, enumerable)]
struct HtmlTableCellElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -6106,7 +6107,7 @@ struct HtmlTableCellElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ShadowRoot")]
+#[webapi(interface = web_api_interfaces::ShadowRoot)]
struct ShadowRootPrototypeReflectionDeclaration {
#[webapi(accessor_property, enumerable, getter = shadow_root_host_getter_function)]
host: (),
@@ -6188,14 +6189,14 @@ struct ShadowRootPrototypeReflectionDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Text")]
+#[webapi(interface = web_api_interfaces::Text)]
struct TextPrototypeReflectionDeclaration {
#[webapi(accessor_property = "assignedSlot", enumerable, getter = slot_assigned_slot_getter_function)]
assigned_slot: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLSlotElement")]
+#[webapi(interface = web_api_interfaces::HTMLSlotElement)]
struct HtmlSlotElementPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -6213,7 +6214,7 @@ struct HtmlSlotElementPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "HTMLTemplateElement")]
+#[webapi(interface = web_api_interfaces::HTMLTemplateElement)]
struct HtmlTemplateElementPrototypeDeclaration {
#[webapi(accessor_property, enumerable, getter = template_content_getter_function)]
content: (),
diff --git a/moli-renderer-v8/src/native_bridge/element/class_list/template.rs b/moli-renderer-v8/src/native_bridge/element/class_list/template.rs
index 709fd0a8a..eb2056b26 100644
--- a/moli-renderer-v8/src/native_bridge/element/class_list/template.rs
+++ b/moli-renderer-v8/src/native_bridge/element/class_list/template.rs
@@ -1,8 +1,9 @@
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMTokenList", enumerable)]
+#[webapi(interface = web_api_interfaces::DOMTokenList, enumerable)]
struct DomTokenListTemplateMethodsDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoEntries,
@@ -64,7 +65,7 @@ struct DomTokenListTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DOMTokenList")]
+#[webapi(interface = web_api_interfaces::DOMTokenList)]
struct DomTokenListAttributeDescriptorsDeclaration {
#[webapi(
accessor_property,
diff --git a/moli-renderer-v8/src/native_bridge/element/forms/validation.rs b/moli-renderer-v8/src/native_bridge/element/forms/validation.rs
index 5e7db795b..3f325257a 100644
--- a/moli-renderer-v8/src/native_bridge/element/forms/validation.rs
+++ b/moli-renderer-v8/src/native_bridge/element/forms/validation.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use v8::RegExpCreationFlags;
use crate::custom_elements::is_form_associated_custom_element_handle;
@@ -29,7 +30,7 @@ struct SetCustomValidityArgs {
type ControlValidity = FormControlValidity;
#[derive(WebApiObject)]
-#[webapi(interface = "ValidityState", data_properties, enumerable)]
+#[webapi(interface = web_api_interfaces::ValidityState, data_properties, enumerable)]
struct ValidityStateDeclaration {
value_missing: bool,
type_mismatch: bool,
diff --git a/moli-renderer-v8/src/native_bridge/element/media/text_tracks.rs b/moli-renderer-v8/src/native_bridge/element/media/text_tracks.rs
index b4f7e2c33..740cacc4a 100644
--- a/moli-renderer-v8/src/native_bridge/element/media/text_tracks.rs
+++ b/moli-renderer-v8/src/native_bridge/element/media/text_tracks.rs
@@ -14,6 +14,7 @@ use crate::util::{
node_wrapper_from_handle, serialize_v8_array, set_private_value, throw_type_error, v8_string,
v8str,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
use super::super::super::node::node_runtime_and_handle_from_object_or_detached;
@@ -48,14 +49,14 @@ const TRACK_READY_STATE_LOADED: u32 = 2;
const TRACK_READY_STATE_ERROR: u32 = 3;
#[derive(WebApiObject)]
-#[webapi(interface = "TextTrackCueList")]
+#[webapi(interface = web_api_interfaces::TextTrackCueList)]
struct TextTrackCueListObjectDeclaration<'scope> {
#[webapi(slot = TEXT_TRACK_LIST_ITEMS_SLOT)]
items: Vec<v8::Local<'scope, v8::Value>>,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextTrackCueList", enumerable)]
+#[webapi(interface = web_api_interfaces::TextTrackCueList, enumerable)]
struct TextTrackCueListTemplateDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
@@ -76,7 +77,7 @@ struct TextTrackCueListTemplateDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "TextTrackList")]
+#[webapi(interface = web_api_interfaces::TextTrackList)]
struct TextTrackListObjectDeclaration<'scope> {
#[webapi(slot = TEXT_TRACK_LIST_ITEMS_SLOT)]
items: Vec<v8::Local<'scope, v8::Value>>,
@@ -89,7 +90,7 @@ struct TextTrackListObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextTrackList", enumerable)]
+#[webapi(interface = web_api_interfaces::TextTrackList, enumerable)]
struct TextTrackListTemplateDeclaration {
#[webapi(
intrinsic_data_property = v8::Intrinsic::ArrayProtoValues,
@@ -124,7 +125,7 @@ struct TextTrackListTemplateDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "TextTrack")]
+#[webapi(interface = web_api_interfaces::TextTrack)]
struct TextTrackObjectDeclaration {
#[webapi(slot = TEXT_TRACK_KIND_SLOT)]
kind: String,
@@ -152,7 +153,7 @@ struct TextTrackObjectDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TextTrack", enumerable)]
+#[webapi(interface = web_api_interfaces::TextTrack, enumerable)]
struct TextTrackTemplateDeclaration {
#[webapi(accessor_property, getter = text_track_kind_getter)]
kind: (),
diff --git a/moli-renderer-v8/src/native_bridge/element/shadow_dom/internals.rs b/moli-renderer-v8/src/native_bridge/element/shadow_dom/internals.rs
index 85afef726..53a5f3048 100644
--- a/moli-renderer-v8/src/native_bridge/element/shadow_dom/internals.rs
+++ b/moli-renderer-v8/src/native_bridge/element/shadow_dom/internals.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use crate::{
context_bootstrap::exposed_interfaces::ensure_intrinsic_interface_prototype,
custom_elements,
@@ -39,7 +40,7 @@ const ELEMENT_INTERNALS_FORM_VALUE_SLOT: &str = "__moliElementInternalsFormValue
const ELEMENT_INTERNALS_VALIDITY_SLOT: &str = "__moliElementInternalsValidity";
const ELEMENT_INTERNALS_VALIDATION_MESSAGE_SLOT: &str = "__moliElementInternalsValidationMessage";
#[derive(WebApiObject)]
-#[webapi(interface = "ElementInternals")]
+#[webapi(interface = web_api_interfaces::ElementInternals)]
struct ElementInternalsDeclaration<'scope> {
#[webapi(slot = ELEMENT_INTERNALS_TARGET_SLOT)]
target: v8::Local<'scope, v8::Object>,
@@ -47,7 +48,7 @@ struct ElementInternalsDeclaration<'scope> {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "ElementInternals",
+ interface = web_api_interfaces::ElementInternals,
enumerable,
prototype_to_string_tag = "ElementInternals"
)]
@@ -59,7 +60,7 @@ struct ElementInternalsCorePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ElementInternals", enumerable)]
+#[webapi(interface = web_api_interfaces::ElementInternals, enumerable)]
struct ElementInternalsAccessibilityPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -407,7 +408,7 @@ struct ElementInternalsAccessibilityPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ElementInternals", enumerable)]
+#[webapi(interface = web_api_interfaces::ElementInternals, enumerable)]
struct ElementInternalsFormPrototypeDeclaration {
#[webapi(method, length = 1, callback = element_internals_set_form_value_callback)]
set_form_value: (),
@@ -430,7 +431,7 @@ struct ElementInternalsFormPrototypeDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ValidityState", data_properties, enumerable)]
+#[webapi(interface = web_api_interfaces::ValidityState, data_properties, enumerable)]
struct ValidityStateDeclaration {
value_missing: bool,
type_mismatch: bool,
@@ -446,7 +447,7 @@ struct ValidityStateDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ValidityState", data_properties, enumerable)]
+#[webapi(interface = web_api_interfaces::ValidityState, data_properties, enumerable)]
struct ValidityStateFlagsUpdateDeclaration {
value_missing: bool,
type_mismatch: bool,
@@ -461,20 +462,20 @@ struct ValidityStateFlagsUpdateDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ValidityState", data_properties, enumerable)]
+#[webapi(interface = web_api_interfaces::ValidityState, data_properties, enumerable)]
struct ValidityStateValidUpdateDeclaration {
valid: bool,
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "CustomStateSet")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::CustomStateSet)]
struct CustomStateSetObjectDeclaration<'s> {
#[webapi(slot = CUSTOM_STATE_SET_BACKING_SLOT)]
backing: v8::Local<'s, v8::Set>,
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CustomStateSet", enumerable)]
+#[webapi(interface = web_api_interfaces::CustomStateSet, enumerable)]
struct CustomStateSetPrototypeDeclaration {
#[webapi(accessor_property, getter = custom_state_set_size_getter)]
size: (),
diff --git a/moli-renderer-v8/src/native_bridge/node.rs b/moli-renderer-v8/src/native_bridge/node.rs
index 0fd1ef349..6396edb1b 100644
--- a/moli-renderer-v8/src/native_bridge/node.rs
+++ b/moli-renderer-v8/src/native_bridge/node.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use crate::{
context_bootstrap,
dom::native::{DocumentType, Node, NodeType},
@@ -37,7 +38,7 @@ pub(super) use self::mutation::*;
pub(super) use self::tree::*;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Node", enumerable)]
+#[webapi(interface = web_api_interfaces::Node, enumerable)]
struct NodePrototypeReflectionDeclaration {
#[webapi(accessor_property = "nodeType", getter = node_node_type_getter_function)]
node_type: (),
@@ -158,7 +159,7 @@ struct NonDocumentTypeChildNodePrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "DocumentType", enumerable)]
+#[webapi(interface = web_api_interfaces::DocumentType, enumerable)]
struct DocumentTypePrototypeDeclaration {
#[webapi(accessor_property, getter = document_type_name_getter_function)]
name: (),
diff --git a/moli-renderer-v8/src/native_bridge/node/character_data/prototype.rs b/moli-renderer-v8/src/native_bridge/node/character_data/prototype.rs
index 9258cfaf7..6a893e729 100644
--- a/moli-renderer-v8/src/native_bridge/node/character_data/prototype.rs
+++ b/moli-renderer-v8/src/native_bridge/node/character_data/prototype.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use crate::{
native_bridge::{document, node::node_runtime_and_handle_from_args},
webidl,
@@ -7,7 +8,7 @@ use moli_webapi_declare::WebApiFunctionTemplate;
use super::*;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "CharacterData", enumerable)]
+#[webapi(interface = web_api_interfaces::CharacterData, enumerable)]
struct CharacterDataPrototypeDeclaration {
#[webapi(
accessor_property,
@@ -30,7 +31,7 @@ struct CharacterDataPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Text", enumerable)]
+#[webapi(interface = web_api_interfaces::Text, enumerable)]
struct TextPrototypeDeclaration {
#[webapi(accessor_property, getter = text_whole_text_getter_callback)]
whole_text: (),
@@ -39,7 +40,7 @@ struct TextPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ProcessingInstruction", enumerable)]
+#[webapi(interface = web_api_interfaces::ProcessingInstruction, enumerable)]
struct ProcessingInstructionPrototypeDeclaration {
#[webapi(accessor_property, getter = processing_instruction_target_getter_callback)]
target: (),
diff --git a/moli-renderer-v8/src/native_bridge/traversal/wrappers.rs b/moli-renderer-v8/src/native_bridge/traversal/wrappers.rs
index 2be35de2a..9ed6703da 100644
--- a/moli-renderer-v8/src/native_bridge/traversal/wrappers.rs
+++ b/moli-renderer-v8/src/native_bridge/traversal/wrappers.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::ffi::c_void;
use crate::{
@@ -22,7 +23,7 @@ use crate::native_bridge::bindings::set_named_constructor_prototype;
use crate::webidl::WebIdlCallbackInterface;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "NodeIterator", enumerable)]
+#[webapi(interface = web_api_interfaces::NodeIterator, enumerable)]
struct NodeIteratorPrototypeDeclaration {
#[webapi(accessor_property, getter = node_iterator_root_getter)]
root: (),
@@ -43,7 +44,7 @@ struct NodeIteratorPrototypeDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "TreeWalker", enumerable)]
+#[webapi(interface = web_api_interfaces::TreeWalker, enumerable)]
struct TreeWalkerPrototypeDeclaration {
#[webapi(accessor_property, getter = tree_walker_root_getter)]
root: (),
diff --git a/moli-renderer-v8/src/network_host/bindings.rs b/moli-renderer-v8/src/network_host/bindings.rs
index 977939384..103e25d4f 100644
--- a/moli-renderer-v8/src/network_host/bindings.rs
+++ b/moli-renderer-v8/src/network_host/bindings.rs
@@ -1,8 +1,9 @@
use super::fetch::window_fetch_callback;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Window", enumerable)]
+#[webapi(interface = web_api_interfaces::Window, enumerable)]
struct WindowNetworkTemplateMethodsDeclaration {
#[webapi(method = "fetch", length = 1, callback = window_fetch_callback)]
fetch: (),
diff --git a/moli-renderer-v8/src/network_host/event_source/bindings.rs b/moli-renderer-v8/src/network_host/event_source/bindings.rs
index 19ca5d3cc..29ff05f3f 100644
--- a/moli-renderer-v8/src/network_host/event_source/bindings.rs
+++ b/moli-renderer-v8/src/network_host/event_source/bindings.rs
@@ -1,9 +1,10 @@
use super::*;
use crate::context_bootstrap::mark_event_trusted;
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
#[derive(WebApiObject)]
-#[webapi(interface = "EventSource")]
+#[webapi(interface = web_api_interfaces::EventSource)]
struct EventSourceObjectDeclaration<'scope> {
#[webapi(slot = EVENT_SOURCE_URL_SLOT)]
url: v8::Local<'scope, v8::String>,
@@ -46,7 +47,7 @@ struct EventSourceObjectDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "EventSource", enumerable)]
+#[webapi(interface = web_api_interfaces::EventSource, enumerable)]
struct EventSourceTemplateDeclaration {
#[webapi(constant = "CONNECTING", value = EVENT_SOURCE_CONNECTING)]
connecting: (),
@@ -62,7 +63,7 @@ struct EventSourceTemplateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "EventSource")]
+#[webapi(interface = web_api_interfaces::EventSource)]
struct EventSourceAccessorsDeclaration {
#[webapi(accessor_property, getter = event_source_url_getter, enumerable)]
url: (),
diff --git a/moli-renderer-v8/src/network_host/fetch_surface.rs b/moli-renderer-v8/src/network_host/fetch_surface.rs
index 04fc2e17a..158853f9a 100644
--- a/moli-renderer-v8/src/network_host/fetch_surface.rs
+++ b/moli-renderer-v8/src/network_host/fetch_surface.rs
@@ -7,6 +7,7 @@ use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, set_private_value,
throw_range_error,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
@@ -46,7 +47,7 @@ pub(crate) const RESPONSE_BODY_SLOT: &str = "__lmResponseBody";
pub(crate) const RESPONSE_BODY_USED_SLOT: &str = "__lmResponseBodyUsed";
#[derive(WebApiObject)]
-#[webapi(interface = "Response", prototype = "Response")]
+#[webapi(interface = web_api_interfaces::Response, prototype = "Response")]
struct ResponseCloneShellDeclaration<'scope> {
#[webapi(slot = RESPONSE_BODY_USED_SLOT, init = false)]
body_used: (),
@@ -63,7 +64,7 @@ struct ResponseInitObjectDeclaration<'scope> {
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "Response")]
+#[webapi(interface = web_api_interfaces::Response)]
struct ResponseErrorStateDeclaration {
#[webapi(slot = RESPONSE_TYPE_SLOT, init = string("error"))]
response_type: (),
@@ -74,14 +75,14 @@ struct ResponseErrorStateDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Request", enumerable)]
+#[webapi(interface = web_api_interfaces::Request, enumerable)]
struct RequestTemplateMethodsDeclaration {
#[webapi(method = "clone", length = 0, callback = request_clone_callback)]
clone: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Response", enumerable)]
+#[webapi(interface = web_api_interfaces::Response, enumerable)]
struct ResponseTemplateMethodsDeclaration {
#[webapi(static_method = "error", length = 0, callback = response_static_error_callback)]
error: (),
@@ -101,7 +102,7 @@ struct ResponseTemplateMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Request", enumerable)]
+#[webapi(interface = web_api_interfaces::Request, enumerable)]
struct RequestSlotAccessorsDeclaration {
#[webapi(accessor_property, getter = request_slot_attribute_getter_callback, data = callback_data_index_value(scope, 0))]
method: (),
@@ -142,7 +143,7 @@ struct RequestSlotAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Response", enumerable)]
+#[webapi(interface = web_api_interfaces::Response, enumerable)]
struct ResponseSlotAccessorsDeclaration {
#[webapi(accessor_property, name = "type", getter = response_slot_attribute_getter_callback, data = callback_data_index_value(scope, 18))]
response_type: (),
@@ -168,7 +169,8 @@ pub(in crate::network_host) fn mark_request_object<'s>(
scope: &mut v8::PinScope<'s, '_>,
object: v8::Local<'s, v8::Object>,
) {
- moli_webapi_declare::initialize_web_api_object(scope, object, "Request")
+ web_api_interfaces::Request::DESCRIPTOR
+ .initialize(scope, object)
.expect("Request brand declaration should initialize");
}
@@ -293,7 +295,8 @@ pub(in crate::network_host) fn mark_response_object<'s>(
scope: &mut v8::PinScope<'s, '_>,
object: v8::Local<'s, v8::Object>,
) {
- moli_webapi_declare::initialize_web_api_object(scope, object, "Response")
+ web_api_interfaces::Response::DESCRIPTOR
+ .initialize(scope, object)
.expect("Response brand declaration should initialize");
}
diff --git a/moli-renderer-v8/src/network_host/headers/methods.rs b/moli-renderer-v8/src/network_host/headers/methods.rs
index 1f9746eaf..c8ccb1c73 100644
--- a/moli-renderer-v8/src/network_host/headers/methods.rs
+++ b/moli-renderer-v8/src/network_host/headers/methods.rs
@@ -3,6 +3,7 @@ mod iteration;
mod mutation;
use super::*;
+use crate::web_api_interfaces;
pub(super) use self::access::{
headers_get_callback, headers_get_set_cookie_callback, headers_has_callback,
@@ -28,7 +29,7 @@ pub(super) fn require_headers_receiver<'s>(
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "Headers")]
+#[webapi(interface = web_api_interfaces::Headers)]
struct HeadersObjectMethodsDeclaration {
#[webapi(method, enumerable, length = 1, callback = headers_get_callback)]
get: (),
@@ -55,7 +56,7 @@ struct HeadersObjectMethodsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "Headers", enumerable)]
+#[webapi(interface = web_api_interfaces::Headers, enumerable)]
struct HeadersPrototypeMethodsDeclaration {
#[webapi(method, length = 1, callback = headers_get_callback)]
get: (),
diff --git a/moli-renderer-v8/src/network_host/headers/methods/iteration.rs b/moli-renderer-v8/src/network_host/headers/methods/iteration.rs
index 97211927c..76d197fa8 100644
--- a/moli-renderer-v8/src/network_host/headers/methods/iteration.rs
+++ b/moli-renderer-v8/src/network_host/headers/methods/iteration.rs
@@ -1,5 +1,6 @@
use super::super::store::headers_entries;
use super::*;
+use crate::web_api_interfaces;
use crate::{
callback_invocation::invoke_synchronous_webidl_callback_function,
util::{
@@ -42,7 +43,7 @@ struct HeadersIteratorResultDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "Headers Iterator")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::HeadersIterator)]
struct HeadersIteratorDeclaration<'scope> {
#[webapi(slot = HEADERS_ITERATOR_TARGET_SLOT)]
target: v8::Local<'scope, v8::Object>,
@@ -54,7 +55,7 @@ struct HeadersIteratorDeclaration<'scope> {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "Headers Iterator",
+ interface = web_api_interfaces::HeadersIterator,
intrinsic_prototype_parent = v8::Intrinsic::IteratorPrototype,
prototype_to_string_tag = "Headers Iterator",
readonly_prototype,
diff --git a/moli-renderer-v8/src/network_host/headers/store/projection.rs b/moli-renderer-v8/src/network_host/headers/store/projection.rs
index 173711e81..511b5ec5d 100644
--- a/moli-renderer-v8/src/network_host/headers/store/projection.rs
+++ b/moli-renderer-v8/src/network_host/headers/store/projection.rs
@@ -3,10 +3,11 @@ use super::entries::{
HEADERS_ENTRIES_SLOT, HEADERS_GUARD_SLOT, HEADERS_IMMUTABLE_SLOT, HeadersGuard,
headers_entries, headers_entries_json, normalized_header_name_or_throw,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "Headers", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::Headers, prototype = "Object")]
struct HeadersStorageDeclaration {
#[webapi(slot = HEADERS_ENTRIES_SLOT)]
entries: String,
diff --git a/moli-renderer-v8/src/network_host/request/bindings.rs b/moli-renderer-v8/src/network_host/request/bindings.rs
index cc5d98af8..4560bbc30 100644
--- a/moli-renderer-v8/src/network_host/request/bindings.rs
+++ b/moli-renderer-v8/src/network_host/request/bindings.rs
@@ -5,11 +5,12 @@ use self::init::{
};
use super::input::request_headers_guard_for_mode;
use super::*;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "Request")]
+#[webapi(interface = web_api_interfaces::Request)]
struct RequestInstanceDeclaration<'scope> {
#[webapi(slot = REQUEST_METHOD_SLOT)]
method: String,
diff --git a/moli-renderer-v8/src/network_host/response/bindings.rs b/moli-renderer-v8/src/network_host/response/bindings.rs
index 3d3945ad9..7c324962b 100644
--- a/moli-renderer-v8/src/network_host/response/bindings.rs
+++ b/moli-renderer-v8/src/network_host/response/bindings.rs
@@ -5,11 +5,12 @@ use self::init::{install_response_body_stream, install_response_headers, respons
use super::super::fetch_surface::{RESPONSE_BODY_USED_SLOT, mark_response_object};
use super::*;
use crate::util::throw_range_error;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
#[derive(WebApiObject)]
-#[webapi(interface = "Response")]
+#[webapi(interface = web_api_interfaces::Response)]
struct ResponseInstanceDeclaration {
#[webapi(slot = RESPONSE_STATUS_SLOT)]
status: f64,
diff --git a/moli-renderer-v8/src/network_host/xhr.rs b/moli-renderer-v8/src/network_host/xhr.rs
index 93ed01edb..f40b48c86 100644
--- a/moli-renderer-v8/src/network_host/xhr.rs
+++ b/moli-renderer-v8/src/network_host/xhr.rs
@@ -12,11 +12,12 @@ use crate::context_bootstrap::{
};
use crate::native_bridge::throw_dom_exception;
use crate::util::{get_private_value, set_private_value};
+use crate::web_api_interfaces;
use crate::worker::WORKER_STATE_SLOT;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "ProgressEvent")]
+#[webapi(interface = web_api_interfaces::ProgressEvent)]
struct ProgressEventPrototypeDeclaration {
#[webapi(
accessor_property = "lengthComputable",
diff --git a/moli-renderer-v8/src/network_host/xhr/bindings/constants.rs b/moli-renderer-v8/src/network_host/xhr/bindings/constants.rs
index 52079c7c2..f3beac8c6 100644
--- a/moli-renderer-v8/src/network_host/xhr/bindings/constants.rs
+++ b/moli-renderer-v8/src/network_host/xhr/bindings/constants.rs
@@ -3,11 +3,12 @@ use crate::context_bootstrap::simple_object_event_set_ordered_handler;
use crate::util::{
callback_data_index_value, callback_data_item, get_private_value, set_private_value,
};
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "XMLHttpRequest", enumerable)]
+#[webapi(interface = web_api_interfaces::XMLHttpRequest, enumerable)]
struct XmlHttpRequestConstantsDeclaration {
#[webapi(constant = "UNSENT", value = 0u32)]
_unsent: (),
@@ -22,7 +23,7 @@ struct XmlHttpRequestConstantsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "XMLHttpRequest", enumerable)]
+#[webapi(interface = web_api_interfaces::XMLHttpRequest, enumerable)]
struct XmlHttpRequestPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = xhr_number_getter, data = callback_data_index_value(scope, 0))]
ready_state: (),
@@ -69,14 +70,14 @@ struct XmlHttpRequestPrototypeAccessorsDeclaration {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "XMLHttpRequest", enumerable)]
+#[webapi(interface = web_api_interfaces::XMLHttpRequest, enumerable)]
struct XmlHttpRequestResponseXmlAccessorDeclaration {
#[webapi(accessor_property = "responseXML", getter = xhr_response_xml_getter, data = callback_data_index_value(scope, 7))]
response_xml: (),
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "XMLHttpRequestEventTarget", enumerable)]
+#[webapi(interface = web_api_interfaces::XMLHttpRequestEventTarget, enumerable)]
struct XmlHttpRequestEventTargetPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = xhr_value_getter, setter = xhr_value_setter, data = callback_data_index_value(scope, 12))]
onload: (),
diff --git a/moli-renderer-v8/src/network_host/xhr/bindings/progress_event.rs b/moli-renderer-v8/src/network_host/xhr/bindings/progress_event.rs
index 379b0bc76..649b7ab56 100644
--- a/moli-renderer-v8/src/network_host/xhr/bindings/progress_event.rs
+++ b/moli-renderer-v8/src/network_host/xhr/bindings/progress_event.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::get_private_value;
+use crate::web_api_interfaces;
use crate::webidl;
use moli_webapi_declare::WebApiObject;
@@ -8,7 +9,7 @@ const PROGRESS_EVENT_LOADED_SLOT: &str = "__lmProgressEventLoaded";
const PROGRESS_EVENT_TOTAL_SLOT: &str = "__lmProgressEventTotal";
#[derive(WebApiObject)]
-#[webapi(interface = "ProgressEvent")]
+#[webapi(interface = web_api_interfaces::ProgressEvent)]
struct ProgressEventStateDeclaration {
#[webapi(slot = PROGRESS_EVENT_LENGTH_COMPUTABLE_SLOT)]
length_computable: bool,
diff --git a/moli-renderer-v8/src/network_host/xhr/bindings/prototype.rs b/moli-renderer-v8/src/network_host/xhr/bindings/prototype.rs
index 79c7bafcf..3178290a9 100644
--- a/moli-renderer-v8/src/network_host/xhr/bindings/prototype.rs
+++ b/moli-renderer-v8/src/network_host/xhr/bindings/prototype.rs
@@ -1,10 +1,11 @@
use super::abort::xhr_abort_callback;
use super::open::xhr_open_callback;
use super::*;
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiFunctionTemplate;
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "XMLHttpRequest", enumerable)]
+#[webapi(interface = web_api_interfaces::XMLHttpRequest, enumerable)]
struct XmlHttpRequestTemplateMethodsDeclaration {
#[webapi(method = "open", length = 2, callback = xhr_open_callback)]
open: (),
diff --git a/moli-renderer-v8/src/network_host/xhr/instance_state.rs b/moli-renderer-v8/src/network_host/xhr/instance_state.rs
index b68904e04..a8e432412 100644
--- a/moli-renderer-v8/src/network_host/xhr/instance_state.rs
+++ b/moli-renderer-v8/src/network_host/xhr/instance_state.rs
@@ -1,5 +1,6 @@
use super::*;
use crate::util::{get_private_value, global_constructor_prototype, set_private_value};
+use crate::web_api_interfaces;
use moli_webapi_declare::WebApiObject;
pub(crate) const XHR_METHOD_SLOT: &str = "__lmMethod";
@@ -125,7 +126,7 @@ struct XmlHttpRequestStateDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "XMLHttpRequestUpload", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::XMLHttpRequestUpload, prototype = "Object")]
struct XmlHttpRequestUploadDeclaration<'scope> {
#[webapi(prototype)]
prototype: Option<v8::Local<'scope, v8::Object>>,
diff --git a/moli-renderer-v8/src/observer_runtime/mod.rs b/moli-renderer-v8/src/observer_runtime/mod.rs
index caecd3d65..fd3daaf23 100644
--- a/moli-renderer-v8/src/observer_runtime/mod.rs
+++ b/moli-renderer-v8/src/observer_runtime/mod.rs
@@ -17,6 +17,7 @@ pub(crate) use dom_access::{
retire_execution_context_owner,
};
+use crate::web_api_interfaces;
use std::{
cmp::Ordering,
collections::{HashMap, HashSet},
@@ -82,7 +83,7 @@ const ROOTLESS_IO_VERTICAL_GEOMETRY_PROPERTIES: [&str; 18] = [
];
#[derive(WebApiObject)]
-#[webapi(interface = "MutationRecord", data_properties, enumerable)]
+#[webapi(interface = web_api_interfaces::MutationRecord, data_properties, enumerable)]
struct MutationRecordDeclaration<'scope> {
target: v8::Local<'scope, v8::Value>,
#[webapi(data_property = "type")]
@@ -97,7 +98,7 @@ struct MutationRecordDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "IntersectionObserverEntry")]
+#[webapi(interface = web_api_interfaces::IntersectionObserverEntry)]
struct IntersectionObserverEntryDeclaration<'scope> {
#[webapi(slot = "__moliIntersectionEntryTarget")]
target: v8::Local<'scope, v8::Value>,
@@ -118,7 +119,7 @@ struct IntersectionObserverEntryDeclaration<'scope> {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IntersectionObserver", enumerable)]
+#[webapi(interface = web_api_interfaces::IntersectionObserver, enumerable)]
struct IntersectionObserverPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = intersection_observer_attribute_getter_callback, data = callback_data_index_value(scope, 0))]
root: (),
@@ -136,9 +137,9 @@ struct IntersectionObserverPrototypeAccessorsDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "IntersectionObserverEntry",
+ interface = web_api_interfaces::IntersectionObserverEntry,
enumerable,
- receiver = "IntersectionObserverEntry"
+ receiver
)]
struct IntersectionObserverEntryPrototypeAccessorsDeclaration {
#[webapi(accessor_property, getter = intersection_observer_entry_attribute_getter_callback, data = callback_data_index_value(scope, 0))]
diff --git a/moli-renderer-v8/src/web_api_interfaces.rs b/moli-renderer-v8/src/web_api_interfaces.rs
new file mode 100644
index 000000000..2b451a1a2
--- /dev/null
+++ b/moli-renderer-v8/src/web_api_interfaces.rs
@@ -0,0 +1,521 @@
+//! The native interface catalog, independent of which constructors a realm exposes.
+//! Constructor specs and bridge installation add behavior to these identities;
+//! they do not repeat interface names or inheritance.
+
+use moli_webapi_declare::{BindError, WebApiInterfaceDescriptor};
+
+macro_rules! interfaces {
+ ($($name:ident $(= $js_name:literal)? $(: $parent:path)?;)+) => {
+ moli_webapi_declare::declare_web_api_interfaces! {
+ $(pub(crate) $name $(= $js_name)? $(: $parent)?;)+
+ }
+
+ pub(crate) fn descriptor(name: &str) -> std::option::Option<WebApiInterfaceDescriptor> {
+ match name {
+ $(<$name>::NAME => Some(<$name>::DESCRIPTOR),)+
+ _ => None,
+ }
+ }
+ };
+}
+
+interfaces! {
+ AbortController;
+ AbortSignal: EventTarget;
+ AbstractRange;
+ AnalyserNode;
+ Animation;
+ AnimationEffect;
+ AnimationPlaybackEvent: Event;
+ AnimationTimeline;
+ Attr: Node;
+ Audio;
+ AudioBuffer;
+ AudioContext: BaseAudioContext;
+ AudioDestinationNode;
+ AudioParam;
+ AudioWorklet;
+ AudioWorkletNode;
+ BaseAudioContext: EventTarget;
+ BatteryManager;
+ BeforeUnloadEvent: Event;
+ BiquadFilterNode;
+ Blob;
+ BroadcastChannel: EventTarget;
+ ByteLengthQueuingStrategy;
+ CDATASection: Text;
+ CSSConditionRule: CSSGroupingRule;
+ CSSContainerRule: CSSConditionRule;
+ CSSCounterStyleRule: CSSRule;
+ CSSFontFaceDescriptors: CSSStyleDeclaration;
+ CSSFontFaceRule: CSSRule;
+ CSSFontFeatureValuesMap;
+ CSSFontFeatureValuesMapIterator = "CSSFontFeatureValuesMap Iterator";
+ CSSFontFeatureValuesRule: CSSRule;
+ CSSGroupingRule: CSSRule;
+ CSSImportRule: CSSRule;
+ CSSKeyframeRule: CSSRule;
+ CSSKeyframesRule: CSSRule;
+ CSSKeywordValue: CSSStyleValue;
+ CSSLayerBlockRule: CSSGroupingRule;
+ CSSLayerStatementRule: CSSRule;
+ CSSMarginRule: CSSRule;
+ CSSMediaRule: CSSConditionRule;
+ CSSNamespaceRule: CSSRule;
+ CSSNestedDeclarations: CSSRule;
+ CSSNumericValue: CSSStyleValue;
+ CSSPageDescriptors: CSSStyleDeclaration;
+ CSSPageRule: CSSGroupingRule;
+ CSSPropertyRule: CSSRule;
+ CSSRule;
+ CSSRuleList;
+ CSSScopeRule: CSSGroupingRule;
+ CSSStyleDeclaration;
+ CSSStyleProperties: CSSStyleDeclaration;
+ CSSStyleRule: CSSGroupingRule;
+ CSSStyleSheet: StyleSheet;
+ CSSStyleValue;
+ CSSSupportsRule: CSSConditionRule;
+ CSSUnitValue: CSSNumericValue;
+ Cache;
+ CacheStorage;
+ CanvasGradient;
+ CanvasPattern;
+ CanvasRenderingContext2D;
+ CapturedMouseEvent: Event;
+ CaretPosition;
+ CharacterData: Node;
+ Client;
+ Clients;
+ Clipboard: EventTarget;
+ ClipboardEvent: Event;
+ ClipboardItem;
+ CloseEvent: Event;
+ CommandEvent: Event;
+ Comment: CharacterData;
+ CompositionEvent: UIEvent;
+ CompressionStream;
+ ContentVisibilityAutoStateChangeEvent: Event;
+ CountQueuingStrategy;
+ Crypto;
+ CryptoKey;
+ CustomElementRegistry;
+ CustomEvent: Event;
+ CustomStateSet;
+ CustomStateSetIterator = "CustomStateSet Iterator";
+ DOMError;
+ DOMException;
+ DOMImplementation;
+ DOMMatrix: DOMMatrixReadOnly;
+ DOMMatrixReadOnly;
+ DOMParser;
+ DOMPoint: DOMPointReadOnly;
+ DOMPointReadOnly;
+ DOMQuad;
+ DOMRect: DOMRectReadOnly;
+ DOMRectReadOnly;
+ DOMStringList;
+ DOMStringMap;
+ DOMTokenList;
+ DataTransfer;
+ DataTransferItem;
+ DataTransferItemList;
+ DecompressionStream;
+ DedicatedWorkerGlobalScope: WorkerGlobalScope;
+ DeprecatedStorageInfo;
+ DeprecatedStorageQuota;
+ Document: Node;
+ DocumentFragment: Node;
+ DocumentTimeline: AnimationTimeline;
+ DocumentType: Node;
+ DragEvent: MouseEvent;
+ DynamicsCompressorNode;
+ Element: Node;
+ ElementInternals;
+ ErrorEvent: Event;
+ Event;
+ EventCounts;
+ EventCountsIterator = "EventCounts Iterator";
+ EventSource: EventTarget;
+ EventTarget;
+ ExtendableEvent: Event;
+ ExtendableMessageEvent: ExtendableEvent;
+ FetchEvent: ExtendableEvent;
+ File: Blob;
+ FileList;
+ FileReader: EventTarget;
+ FileReaderSync;
+ FileSystem;
+ FileSystemDirectoryEntry: FileSystemEntry;
+ FileSystemDirectoryHandle: FileSystemHandle;
+ FileSystemDirectoryHandleAsyncIterator = "FileSystemDirectoryHandle AsyncIterator";
+ FileSystemDirectoryReader;
+ FileSystemEntry;
+ FileSystemFileEntry: FileSystemEntry;
+ FileSystemFileHandle: FileSystemHandle;
+ FileSystemHandle;
+ FileSystemSyncAccessHandle;
+ FileSystemWritableFileStream: WritableStream;
+ FocusEvent: UIEvent;
+ FontFace;
+ FontFaceSet;
+ FontFaceSetIterator = "FontFaceSet Iterator";
+ FontFaceSetLoadEvent: Event;
+ FormData;
+ FormDataIterator = "FormData Iterator";
+ FormDataEvent: Event;
+ Geolocation;
+ GeolocationCoordinates;
+ GeolocationPosition;
+ GeolocationPositionError;
+ HTMLAllCollection;
+ HTMLAnchorElement: HTMLElement;
+ HTMLAreaElement: HTMLElement;
+ HTMLAudioElement: HTMLMediaElement;
+ HTMLBRElement: HTMLElement;
+ HTMLBaseElement: HTMLElement;
+ HTMLBodyElement: HTMLElement;
+ HTMLButtonElement: HTMLElement;
+ HTMLCanvasElement: HTMLElement;
+ HTMLCollection;
+ HTMLDListElement: HTMLElement;
+ HTMLDataElement: HTMLElement;
+ HTMLDataListElement: HTMLElement;
+ HTMLDetailsElement: HTMLElement;
+ HTMLDialogElement: HTMLElement;
+ HTMLDirectoryElement: HTMLElement;
+ HTMLDivElement: HTMLElement;
+ HTMLDocument: Document;
+ HTMLElement: Element;
+ HTMLEmbedElement: HTMLElement;
+ HTMLFieldSetElement: HTMLElement;
+ HTMLFontElement: HTMLElement;
+ HTMLFormControlsCollection: HTMLCollection;
+ HTMLFormElement: HTMLElement;
+ HTMLFrameElement: HTMLElement;
+ HTMLFrameSetElement: HTMLElement;
+ HTMLHRElement: HTMLElement;
+ HTMLHeadElement: HTMLElement;
+ HTMLHeadingElement: HTMLElement;
+ HTMLHtmlElement: HTMLElement;
+ HTMLIFrameElement: HTMLElement;
+ HTMLImageElement: HTMLElement;
+ HTMLInputElement: HTMLElement;
+ HTMLLIElement: HTMLElement;
+ HTMLLabelElement: HTMLElement;
+ HTMLLegendElement: HTMLElement;
+ HTMLLinkElement: HTMLElement;
+ HTMLMapElement: HTMLElement;
+ HTMLMarqueeElement: HTMLElement;
+ HTMLMediaElement: HTMLElement;
+ HTMLMenuElement: HTMLElement;
+ HTMLMetaElement: HTMLElement;
+ HTMLMeterElement: HTMLElement;
+ HTMLModElement: HTMLElement;
+ HTMLOListElement: HTMLElement;
+ HTMLObjectElement: HTMLElement;
+ HTMLOptGroupElement: HTMLElement;
+ HTMLOptionElement: HTMLElement;
+ HTMLOptionsCollection: HTMLCollection;
+ HTMLOutputElement: HTMLElement;
+ HTMLParagraphElement: HTMLElement;
+ HTMLParamElement: HTMLElement;
+ HTMLPictureElement: HTMLElement;
+ HTMLPreElement: HTMLElement;
+ HTMLProgressElement: HTMLElement;
+ HTMLQuoteElement: HTMLElement;
+ HTMLScriptElement: HTMLElement;
+ HTMLSelectElement: HTMLElement;
+ HTMLSlotElement: HTMLElement;
+ HTMLSourceElement: HTMLElement;
+ HTMLSpanElement: HTMLElement;
+ HTMLStyleElement: HTMLElement;
+ HTMLTableCaptionElement: HTMLElement;
+ HTMLTableCellElement: HTMLElement;
+ HTMLTableColElement: HTMLElement;
+ HTMLTableElement: HTMLElement;
+ HTMLTableRowElement: HTMLElement;
+ HTMLTableSectionElement: HTMLElement;
+ HTMLTemplateElement: HTMLElement;
+ HTMLTextAreaElement: HTMLElement;
+ HTMLTimeElement: HTMLElement;
+ HTMLTitleElement: HTMLElement;
+ HTMLTrackElement: HTMLElement;
+ HTMLUListElement: HTMLElement;
+ HTMLUnknownElement: HTMLElement;
+ HTMLVideoElement: HTMLMediaElement;
+ HashChangeEvent: Event;
+ Headers;
+ HeadersIterator = "Headers Iterator";
+ Highlight;
+ HighlightIterator = "Highlight Iterator";
+ HighlightRegistry;
+ HighlightRegistryIterator = "HighlightRegistry Iterator";
+ History;
+ IDBCursor;
+ IDBCursorWithValue: IDBCursor;
+ IDBDatabase: EventTarget;
+ IDBFactory;
+ IDBIndex;
+ IDBKeyRange;
+ IDBObjectStore;
+ IDBOpenDBRequest: IDBRequest;
+ IDBRequest: EventTarget;
+ IDBTransaction: EventTarget;
+ IDBVersionChangeEvent: Event;
+ IdleDeadline;
+ IdleDetector: EventTarget;
+ Image;
+ ImageBitmap;
+ ImageData;
+ InputEvent: UIEvent;
+ InterestEvent: Event;
+ IntersectionObserver;
+ IntersectionObserverEntry;
+ KeyboardEvent: UIEvent;
+ KeyframeEffect: AnimationEffect;
+ Location;
+ MathMLElement: Element;
+ MediaCapabilities;
+ MediaDevices: EventTarget;
+ MediaError;
+ MediaList;
+ MediaQueryList;
+ MediaQueryListEvent: Event;
+ MediaSource: EventTarget;
+ MemoryInfo;
+ MessageChannel;
+ MessageEvent: Event;
+ MessagePort: EventTarget;
+ MimeType;
+ MimeTypeArray;
+ MouseEvent: UIEvent;
+ MutationObserver;
+ MutationRecord;
+ NamedNodeMap;
+ NavigateEvent: Event;
+ Navigation: EventTarget;
+ NavigationActivation;
+ NavigationCurrentEntryChangeEvent: Event;
+ NavigationDestination;
+ NavigationHistoryEntry: EventTarget;
+ NavigationPrecommitController;
+ NavigationPreloadManager;
+ NavigationTransition;
+ Navigator;
+ NavigatorUAData;
+ NetworkInformation: EventTarget;
+ Node: EventTarget;
+ NodeIterator;
+ NodeList;
+ Notification: EventTarget;
+ NotificationEvent: ExtendableEvent;
+ OfflineAudioCompletionEvent: Event;
+ OfflineAudioContext: BaseAudioContext;
+ OffscreenCanvas;
+ OffscreenCanvasRenderingContext2D;
+ Option;
+ OscillatorNode;
+ PageTransitionEvent: Event;
+ Path2D;
+ Performance: EventTarget;
+ PerformanceEntry;
+ PerformanceMark: PerformanceEntry;
+ PerformanceMeasure: PerformanceEntry;
+ PerformanceNavigation;
+ PerformanceNavigationTiming: PerformanceEntry;
+ PerformanceObserver;
+ PerformanceObserverEntryList;
+ PerformanceResourceTiming: PerformanceEntry;
+ PerformanceTiming;
+ PeriodicSyncEvent: ExtendableEvent;
+ PeriodicSyncManager;
+ PermissionStatus;
+ Permissions;
+ Plugin;
+ PluginArray;
+ PointerEvent: MouseEvent;
+ PopStateEvent: Event;
+ ProcessingInstruction: CharacterData;
+ ProgressEvent: Event;
+ PromiseRejectionEvent: Event;
+ PushEvent: ExtendableEvent;
+ PushManager;
+ PushMessageData;
+ PushSubscription;
+ PushSubscriptionOptions;
+ QuotaExceededError: DOMException;
+ RTCDataChannel: EventTarget;
+ RTCIceCandidate;
+ RTCPeerConnection: EventTarget;
+ RTCRtpReceiver;
+ RTCSessionDescription;
+ RadioNodeList: NodeList;
+ Range: AbstractRange;
+ ReadableByteStreamController;
+ ReadableStream;
+ ReadableStreamAsyncIterator = "ReadableStream AsyncIterator";
+ ReadableStreamBYOBReader;
+ ReadableStreamBYOBRequest;
+ ReadableStreamDefaultController;
+ ReadableStreamDefaultReader;
+ Request;
+ ResizeObserver;
+ ResizeObserverEntry;
+ ResizeObserverSize;
+ Response;
+ SVGAElement: SVGGraphicsElement;
+ SVGAnimatedEnumeration;
+ SVGAnimatedLength;
+ SVGAnimatedLengthList;
+ SVGAnimatedNumber;
+ SVGAnimatedNumberList;
+ SVGAnimatedTransformList;
+ SVGCircleElement: SVGGeometryElement;
+ SVGDefsElement: SVGGraphicsElement;
+ SVGDescElement: SVGElement;
+ SVGElement: Element;
+ SVGEllipseElement: SVGGeometryElement;
+ SVGForeignObjectElement: SVGGraphicsElement;
+ SVGGElement: SVGGraphicsElement;
+ SVGGeometryElement: SVGGraphicsElement;
+ SVGGradientElement: SVGElement;
+ SVGGraphicsElement: SVGElement;
+ SVGImageElement: SVGGraphicsElement;
+ SVGLength;
+ SVGLengthList;
+ SVGLineElement: SVGGeometryElement;
+ SVGLinearGradientElement: SVGGradientElement;
+ SVGMatrix;
+ SVGMetadataElement: SVGElement;
+ SVGNumber;
+ SVGNumberList;
+ SVGPathElement: SVGGeometryElement;
+ SVGPatternElement: SVGElement;
+ SVGPolygonElement: SVGGeometryElement;
+ SVGPolylineElement: SVGGeometryElement;
+ SVGRadialGradientElement: SVGGradientElement;
+ SVGRect;
+ SVGRectElement: SVGGeometryElement;
+ SVGSVGElement: SVGGraphicsElement;
+ SVGScriptElement: SVGElement;
+ SVGStyleElement: SVGElement;
+ SVGSymbolElement: SVGGraphicsElement;
+ SVGTSpanElement: SVGTextPositioningElement;
+ SVGTextContentElement: SVGGraphicsElement;
+ SVGTextElement: SVGTextPositioningElement;
+ SVGTextPositioningElement: SVGTextContentElement;
+ SVGTitleElement: SVGElement;
+ SVGTransform;
+ SVGTransformList;
+ SVGUseElement: SVGGraphicsElement;
+ Screen;
+ ScreenOrientation: EventTarget;
+ SecurityPolicyViolationEvent: Event;
+ Selection;
+ ServiceWorker: EventTarget;
+ ServiceWorkerContainer;
+ ServiceWorkerGlobalScope: WorkerGlobalScope;
+ ServiceWorkerRegistration: EventTarget;
+ ShadowRoot: DocumentFragment;
+ SharedWorker: EventTarget;
+ SharedWorkerGlobalScope: WorkerGlobalScope;
+ SpeechSynthesis: EventTarget;
+ SpeechSynthesisUtterance: EventTarget;
+ SpeechSynthesisVoice;
+ StaticRange: AbstractRange;
+ Storage;
+ StorageAccessHandle;
+ StorageBucket;
+ StorageBucketManager;
+ StorageEstimate;
+ StorageEvent: Event;
+ StorageManager;
+ StylePropertyMapReadOnly;
+ StylePropertyMapReadOnlyIterator = "StylePropertyMapReadOnly Iterator";
+ StyleSheet;
+ StyleSheetList;
+ SubmitEvent: Event;
+ SubtleCrypto;
+ SyncEvent: ExtendableEvent;
+ SyncManager;
+ Text: CharacterData;
+ TextDecoder;
+ TextDecoderStream;
+ TextEncoder;
+ TextEncoderStream;
+ TextEvent: UIEvent;
+ TextMetrics;
+ TextTrack: EventTarget;
+ TextTrackCue: EventTarget;
+ TextTrackCueList;
+ TextTrackList: EventTarget;
+ ToggleEvent: Event;
+ Touch;
+ TouchEvent: UIEvent;
+ TouchList;
+ TrackEvent: Event;
+ TransformStream;
+ TransformStreamDefaultController;
+ TreeWalker;
+ TrustedHTML;
+ TrustedScript;
+ TrustedScriptURL;
+ TrustedTypePolicy;
+ TrustedTypePolicyFactory;
+ UIEvent: Event;
+ URL;
+ URLSearchParams;
+ URLSearchParamsIterator = "URLSearchParams Iterator";
+ UserActivation;
+ VTTCue: TextTrackCue;
+ ValidityState;
+ ViewTransition;
+ ViewTransitionTypeSet;
+ ViewTransitionTypeSetIterator = "ViewTransitionTypeSet Iterator";
+ VisualViewport: EventTarget;
+ WEBGLDebugRendererInfo = "WEBGL_debug_renderer_info";
+ WEBGLLoseContext = "WEBGL_lose_context";
+ WebGL2RenderingContext;
+ WebGLBuffer: WebGLObject;
+ WebGLFramebuffer: WebGLObject;
+ WebGLObject;
+ WebGLProgram: WebGLObject;
+ WebGLRenderbuffer: WebGLObject;
+ WebGLRenderingContext;
+ WebGLShader: WebGLObject;
+ WebGLShaderPrecisionFormat;
+ WebGLUniformLocation;
+ WebSocket: EventTarget;
+ WebSocketError: DOMException;
+ WebSocketStream;
+ WheelEvent: MouseEvent;
+ Window: EventTarget;
+ WindowClient: Client;
+ Worker: EventTarget;
+ WorkerGlobalScope: EventTarget;
+ WorkerLocation;
+ WorkerNavigator;
+ WritableStream;
+ WritableStreamDefaultController;
+ WritableStreamDefaultWriter;
+ XMLDocument: Document;
+ XMLHttpRequest: XMLHttpRequestEventTarget;
+ XMLHttpRequestEventTarget: EventTarget;
+ XMLHttpRequestUpload: XMLHttpRequestEventTarget;
+ XMLSerializer;
+ XPathEvaluator;
+ XPathResult;
+}
+
+/// Resolve dynamic native factory choices through the same catalog as derives.
+/// `name` must come from native metadata, never a JavaScript prototype or tag.
+pub(crate) fn initialize<'s>(
+ scope: &mut v8::PinScope<'s, '_>,
+ object: v8::Local<'s, v8::Object>,
+ name: &str,
+) -> Result<(), BindError> {
+ descriptor(name)
+ .ok_or_else(|| BindError::new(format!("unknown native interface `{name}`")))?
+ .initialize(scope, object)
+}
diff --git a/moli-renderer-v8/src/webidl_iterator.rs b/moli-renderer-v8/src/webidl_iterator.rs
index 0f3449fe2..9d635c977 100644
--- a/moli-renderer-v8/src/webidl_iterator.rs
+++ b/moli-renderer-v8/src/webidl_iterator.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use crate::{
callback_invocation::invoke_synchronous_webidl_callback_function,
util::{
@@ -156,7 +157,7 @@ struct SnapshotWebIdlIteratorResultDeclaration<'s> {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "StylePropertyMapReadOnly Iterator",
+ interface = web_api_interfaces::StylePropertyMapReadOnlyIterator,
intrinsic_prototype_parent = v8::Intrinsic::IteratorPrototype,
prototype_to_string_tag = "StylePropertyMapReadOnly Iterator",
readonly_prototype,
@@ -169,7 +170,7 @@ struct StylePropertyMapReadOnlyIteratorPrototypeDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "EventCounts Iterator",
+ interface = web_api_interfaces::EventCountsIterator,
intrinsic_prototype_parent = v8::Intrinsic::MapIteratorPrototype,
prototype_to_string_tag = "EventCounts Iterator",
readonly_prototype,
@@ -182,7 +183,7 @@ struct EventCountsIteratorPrototypeDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "FontFaceSet Iterator",
+ interface = web_api_interfaces::FontFaceSetIterator,
intrinsic_prototype_parent = v8::Intrinsic::SetIteratorPrototype,
prototype_to_string_tag = "FontFaceSet Iterator",
readonly_prototype,
@@ -195,7 +196,7 @@ struct FontFaceSetIteratorPrototypeDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "ViewTransitionTypeSet Iterator",
+ interface = web_api_interfaces::ViewTransitionTypeSetIterator,
intrinsic_prototype_parent = v8::Intrinsic::SetIteratorPrototype,
prototype_to_string_tag = "ViewTransitionTypeSet Iterator",
readonly_prototype,
@@ -212,7 +213,7 @@ struct ViewTransitionTypeSetIteratorPrototypeDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "CustomStateSet Iterator",
+ interface = web_api_interfaces::CustomStateSetIterator,
intrinsic_prototype_parent = v8::Intrinsic::SetIteratorPrototype,
prototype_to_string_tag = "CustomStateSet Iterator",
readonly_prototype,
@@ -229,7 +230,7 @@ struct CustomStateSetIteratorPrototypeDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "CSSFontFeatureValuesMap Iterator",
+ interface = web_api_interfaces::CSSFontFeatureValuesMapIterator,
intrinsic_prototype_parent = v8::Intrinsic::MapIteratorPrototype,
prototype_to_string_tag = "CSSFontFeatureValuesMap Iterator",
readonly_prototype,
@@ -315,7 +316,7 @@ pub(crate) fn new_snapshot_webidl_iterator<'s>(
let iterator = SnapshotWebIdlIteratorDeclaration::new(values, 0)
.bind(scope)
.ok()?;
- moli_webapi_declare::initialize_web_api_object(scope, iterator, kind.interface()).ok()?;
+ web_api_interfaces::initialize(scope, iterator, kind.interface()).ok()?;
let prototype = snapshot_webidl_iterator_prototype(scope, kind)?;
(iterator.set_prototype(scope, prototype.into()) == Some(true)).then_some(iterator)
}
@@ -330,7 +331,7 @@ pub(crate) fn new_setlike_webidl_iterator<'s>(
let iterator = NativeCollectionWebIdlIteratorDeclaration::new(native_iterator, next)
.bind(scope)
.ok()?;
- moli_webapi_declare::initialize_web_api_object(scope, iterator, kind.interface()).ok()?;
+ web_api_interfaces::initialize(scope, iterator, kind.interface()).ok()?;
let prototype = setlike_webidl_iterator_prototype(scope, kind)?;
(iterator.set_prototype(scope, prototype.into()) == Some(true)).then_some(iterator)
}
diff --git a/moli-renderer-v8/src/window_host.rs b/moli-renderer-v8/src/window_host.rs
index d0d42c13a..12b9b48d6 100644
--- a/moli-renderer-v8/src/window_host.rs
+++ b/moli-renderer-v8/src/window_host.rs
@@ -47,6 +47,7 @@ use super::{
},
webidl,
};
+use crate::web_api_interfaces;
use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use url::Url;
@@ -79,7 +80,7 @@ struct WindowDocumentEventInitDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "IdleDeadline")]
+#[webapi(interface = web_api_interfaces::IdleDeadline)]
struct IdleDeadlineDeclaration {
#[webapi(slot = IDLE_DEADLINE_MS_SLOT)]
deadline_ms: f64,
@@ -126,7 +127,7 @@ struct WindowCancelIdleCallbackArgs {
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "IdleDeadline", enumerable)]
+#[webapi(interface = web_api_interfaces::IdleDeadline, enumerable)]
struct IdleDeadlinePrototypeDeclaration {
#[webapi(
accessor_property = "didTimeout",
diff --git a/moli-renderer-v8/src/worker/abort.rs b/moli-renderer-v8/src/worker/abort.rs
index ddc38c2f2..f1aa70c93 100644
--- a/moli-renderer-v8/src/worker/abort.rs
+++ b/moli-renderer-v8/src/worker/abort.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::collections::HashMap;
use std::{cell::RefCell, rc::Rc};
@@ -52,7 +53,7 @@ struct WorkerAbortLinkedMessagePortListener {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "AbortSignal")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::AbortSignal)]
struct WorkerAbortSignalObjectDeclaration<'scope> {
#[webapi(prototype)]
prototype: v8::Local<'scope, v8::Object>,
diff --git a/moli-renderer-v8/src/worker/global_scope/mod.rs b/moli-renderer-v8/src/worker/global_scope/mod.rs
index 1549ff960..2b0af41cd 100644
--- a/moli-renderer-v8/src/worker/global_scope/mod.rs
+++ b/moli-renderer-v8/src/worker/global_scope/mod.rs
@@ -11,6 +11,7 @@
//! - `requestAnimationFrame` / `cancelAnimationFrame`
//! - `globalThis`
+use crate::web_api_interfaces;
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::ffi::c_void;
@@ -271,7 +272,7 @@ struct WorkerConsoleObjectDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(prototype = "Object", interface = "Performance")]
+#[webapi(prototype = "Object", interface = web_api_interfaces::Performance)]
struct WorkerPerformanceObjectDeclaration {
#[webapi(data_property, readonly)]
time_origin: f64,
@@ -542,7 +543,7 @@ struct ServiceWorkerGlobalEventHandlerStateDeclaration {
}
#[derive(Default, WebApiObject)]
-#[webapi(interface = "Clients", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::Clients, prototype = "Object")]
struct ServiceWorkerClientsDeclaration {
#[webapi(method, callback = service_worker_clients_claim_callback, length = 0)]
claim: (),
@@ -575,7 +576,7 @@ struct ServiceWorkerGlobalRuntimeDeclaration<'scope> {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "ExtendableEvent",
+ interface = web_api_interfaces::ExtendableEvent,
constructor_callback = extendable_event_constructor_callback,
constructor_length = 1
)]
@@ -586,7 +587,7 @@ struct ExtendableEventTemplateDeclaration {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "ExtendableMessageEvent",
+ interface = web_api_interfaces::ExtendableMessageEvent,
constructor_callback = extendable_message_event_constructor_callback,
constructor_length = 1
)]
@@ -649,7 +650,7 @@ struct WorkerPrototypeTagDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ServiceWorkerRegistration", parent = "EventTarget")]
+#[webapi(interface = web_api_interfaces::ServiceWorkerRegistration,)]
struct ServiceWorkerGlobalRegistrationDeclaration<'scope> {
#[webapi(data_property, readonly)]
scope: String,
@@ -703,7 +704,7 @@ struct ServiceWorkerGlobalRegistrationDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ServiceWorker", parent = "EventTarget")]
+#[webapi(interface = web_api_interfaces::ServiceWorker,)]
struct ServiceWorkerGlobalServiceWorkerDeclaration {
#[webapi(data_property = "scriptURL", readonly)]
script_url: String,
@@ -716,7 +717,7 @@ struct ServiceWorkerGlobalServiceWorkerDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SyncManager")]
+#[webapi(interface = web_api_interfaces::SyncManager)]
struct ServiceWorkerGlobalSyncManagerDeclaration {
#[webapi(
method = "register",
@@ -734,7 +735,7 @@ struct ServiceWorkerGlobalSyncManagerDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PeriodicSyncManager")]
+#[webapi(interface = web_api_interfaces::PeriodicSyncManager)]
struct ServiceWorkerGlobalPeriodicSyncManagerDeclaration {
#[webapi(
method = "register",
@@ -759,7 +760,7 @@ struct ServiceWorkerGlobalPeriodicSyncManagerDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PushManager")]
+#[webapi(interface = web_api_interfaces::PushManager)]
struct ServiceWorkerGlobalPushManagerDeclaration {
#[webapi(
method = "subscribe",
@@ -784,7 +785,7 @@ struct ServiceWorkerGlobalPushManagerDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "NavigationPreloadManager")]
+#[webapi(interface = web_api_interfaces::NavigationPreloadManager)]
struct ServiceWorkerGlobalNavigationPreloadManagerDeclaration {
#[webapi(
method,
@@ -816,7 +817,7 @@ struct ServiceWorkerGlobalNavigationPreloadManagerDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PushSubscription")]
+#[webapi(interface = web_api_interfaces::PushSubscription)]
struct ServiceWorkerPushSubscriptionDeclaration<'scope> {
#[webapi(data_property, readonly)]
endpoint: String,
@@ -839,7 +840,7 @@ struct ServiceWorkerPushSubscriptionDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PushSubscriptionOptions", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::PushSubscriptionOptions, prototype = "Object")]
struct ServiceWorkerPushSubscriptionOptionsDeclaration<'scope> {
#[webapi(data_property = "userVisibleOnly", readonly)]
user_visible_only: bool,
@@ -859,7 +860,7 @@ struct WorkerNavigationPreloadStateDeclaration {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ExtendableEvent", parent = "Event", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::ExtendableEvent, prototype = "Object")]
struct InitializedExtendableEventStateDeclaration<'scope> {
#[webapi(data_property = "type", enumerable)]
event_type: String,
@@ -894,8 +895,7 @@ struct InitializedExtendableEventStateDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "ExtendableMessageEvent",
- parent = "ExtendableEvent",
+ interface = web_api_interfaces::ExtendableMessageEvent,
prototype = "Object"
)]
struct ExtendableMessageEventStateDeclaration<'scope> {
@@ -916,7 +916,7 @@ struct ExtendableMessageEventStateDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Client")]
+#[webapi(interface = web_api_interfaces::Client)]
pub(super) struct ServiceWorkerBaseClientDeclaration<'scope> {
#[webapi(data_property, readonly)]
id: String,
@@ -932,7 +932,7 @@ pub(super) struct ServiceWorkerBaseClientDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "WindowClient")]
+#[webapi(interface = web_api_interfaces::WindowClient)]
pub(super) struct ServiceWorkerWindowClientDeclaration<'scope> {
#[webapi(data_property, readonly)]
id: String,
@@ -5479,21 +5479,12 @@ fn install_worker_global_scope_constructors<'s>(
global: v8::Local<'s, v8::Object>,
global_kind: &super::thread::WorkerGlobalKind,
) -> Result<()> {
- moli_webapi_declare::register_web_api_interfaces(
- scope,
- [
- ("WorkerGlobalScope", Some("EventTarget")),
- ("DedicatedWorkerGlobalScope", Some("WorkerGlobalScope")),
- ("SharedWorkerGlobalScope", Some("WorkerGlobalScope")),
- ("ServiceWorkerGlobalScope", Some("WorkerGlobalScope")),
- ],
- )?;
let interface = match global_kind {
super::thread::WorkerGlobalKind::Dedicated { .. } => "DedicatedWorkerGlobalScope",
super::thread::WorkerGlobalKind::Shared { .. } => "SharedWorkerGlobalScope",
super::thread::WorkerGlobalKind::Service { .. } => "ServiceWorkerGlobalScope",
};
- moli_webapi_declare::initialize_web_api_object(scope, global, interface)?;
+ web_api_interfaces::initialize(scope, global, interface)?;
let worker_ctor = worker_scope_constructor(scope, "WorkerGlobalScope")?;
let worker_proto = constructor_prototype(scope, worker_ctor, "WorkerGlobalScope")?;
set_worker_to_string_tag(scope, worker_proto, "WorkerGlobalScope");
@@ -5617,10 +5608,7 @@ fn install_service_worker_extendable_event_constructors<'s>(
.map_err(|error| anyhow!("failed to initialize ExtendableMessageEvent global: {error}"))?;
ensure_worker_interface_constructor(scope, "ServiceWorker")?;
- moli_webapi_declare::register_web_api_interfaces(
- scope,
- [("Client", None), ("WindowClient", Some("Client"))],
- )?;
+ web_api_interfaces::WindowClient::DESCRIPTOR.register(scope)?;
ensure_worker_interface_constructor(scope, "Client")?;
ensure_worker_interface_constructor(scope, "WindowClient")?;
if let Some(client_ctor) = global_constructor_object(scope, "Client")
diff --git a/moli-renderer-v8/src/worker/thread/dispatch.rs b/moli-renderer-v8/src/worker/thread/dispatch.rs
index 270599aa7..64e9173eb 100644
--- a/moli-renderer-v8/src/worker/thread/dispatch.rs
+++ b/moli-renderer-v8/src/worker/thread/dispatch.rs
@@ -1,3 +1,4 @@
+use crate::web_api_interfaces;
use std::{
cell::{Cell, RefCell},
pin::pin,
@@ -126,7 +127,7 @@ struct WorkerPromiseRejectionEventInitDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ErrorEvent", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::ErrorEvent, prototype = "Object")]
struct WorkerErrorEventFallbackDeclaration<'scope> {
#[webapi(data_property, enumerable)]
message: v8::Local<'scope, v8::String>,
@@ -141,7 +142,7 @@ struct WorkerErrorEventFallbackDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PromiseRejectionEvent", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::PromiseRejectionEvent, prototype = "Object")]
struct WorkerPromiseRejectionEventFallbackDeclaration<'scope> {
#[webapi(data_property, enumerable)]
promise: v8::Local<'scope, v8::Promise>,
@@ -150,7 +151,7 @@ struct WorkerPromiseRejectionEventFallbackDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "Event", prototype = "Object")]
+#[webapi(interface = web_api_interfaces::Event, prototype = "Object")]
struct WorkerBasicEventDeclaration<'scope> {
#[webapi(data_property, enumerable)]
r#type: v8::Local<'scope, v8::String>,
@@ -161,7 +162,7 @@ struct WorkerBasicEventDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "ExtendableEvent", prototype = "Object", parent = "Event")]
+#[webapi(interface = web_api_interfaces::ExtendableEvent, prototype = "Object",)]
struct ServiceWorkerLifecycleEventDeclaration<'scope> {
#[webapi(data_property, enumerable)]
r#type: v8::Local<'scope, v8::String>,
@@ -175,10 +176,8 @@ struct ServiceWorkerLifecycleEventDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "FetchEvent",
- prototype = "Object",
- parent = "ExtendableEvent"
-)]
+ interface = web_api_interfaces::FetchEvent,
+ prototype = "Object",)]
struct ServiceWorkerFetchEventDeclaration<'scope> {
#[webapi(data_property, enumerable)]
r#type: v8::Local<'scope, v8::String>,
@@ -206,10 +205,8 @@ struct ServiceWorkerFetchEventDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "ExtendableMessageEvent",
- prototype = "Object",
- parent = "ExtendableEvent"
-)]
+ interface = web_api_interfaces::ExtendableMessageEvent,
+ prototype = "Object",)]
struct ServiceWorkerMessageEventDeclaration<'scope> {
#[webapi(data_property, enumerable)]
r#type: v8::Local<'scope, v8::String>,
@@ -263,10 +260,8 @@ struct ServiceWorkerMessageDispatchMethodsDeclaration {
#[derive(WebApiObject)]
#[webapi(
- interface = "NotificationEvent",
- prototype = "Object",
- parent = "ExtendableEvent"
-)]
+ interface = web_api_interfaces::NotificationEvent,
+ prototype = "Object",)]
struct ServiceWorkerNotificationEventDeclaration<'scope> {
#[webapi(data_property, enumerable)]
r#type: v8::Local<'scope, v8::String>,
@@ -284,10 +279,8 @@ struct ServiceWorkerNotificationEventDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "PushEvent",
- prototype = "Object",
- parent = "ExtendableEvent"
-)]
+ interface = web_api_interfaces::PushEvent,
+ prototype = "Object",)]
struct ServiceWorkerPushEventDeclaration<'scope> {
#[webapi(data_property, enumerable)]
r#type: v8::Local<'scope, v8::String>,
@@ -302,7 +295,7 @@ struct ServiceWorkerPushEventDeclaration<'scope> {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PushMessageData")]
+#[webapi(interface = web_api_interfaces::PushMessageData)]
struct ServiceWorkerPushMessageDataDeclaration {
#[webapi(method = "arrayBuffer", length = 0, callback = push_message_data_array_buffer_callback)]
array_buffer: (),
@@ -316,10 +309,8 @@ struct ServiceWorkerPushMessageDataDeclaration {
#[derive(WebApiObject)]
#[webapi(
- interface = "SyncEvent",
- prototype = "Object",
- parent = "ExtendableEvent"
-)]
+ interface = web_api_interfaces::SyncEvent,
+ prototype = "Object",)]
struct ServiceWorkerSyncEventDeclaration<'scope> {
#[webapi(data_property, enumerable)]
r#type: v8::Local<'scope, v8::String>,
@@ -337,10 +328,8 @@ struct ServiceWorkerSyncEventDeclaration<'scope> {
#[derive(WebApiObject)]
#[webapi(
- interface = "PeriodicSyncEvent",
- prototype = "Object",
- parent = "ExtendableEvent"
-)]
+ interface = web_api_interfaces::PeriodicSyncEvent,
+ prototype = "Object",)]
struct ServiceWorkerPeriodicSyncEventDeclaration<'scope> {
#[webapi(data_property, enumerable)]
r#type: v8::Local<'scope, v8::String>,
@@ -753,7 +742,8 @@ fn new_worker_message_event<'s>(
ports,
)
.initialize(scope, event);
- moli_webapi_declare::initialize_web_api_object(scope, event, "MessageEvent")
+ web_api_interfaces::MessageEvent::DESCRIPTOR
+ .initialize(scope, event)
.expect("worker fallback MessageEvent identity should initialize");
event
}
diff --git a/moli-webapi-declare-derive/src/attrs.rs b/moli-webapi-declare-derive/src/attrs.rs
index 8e458799b..b73df2108 100644
--- a/moli-webapi-declare-derive/src/attrs.rs
+++ b/moli-webapi-declare-derive/src/attrs.rs
@@ -1,6 +1,55 @@
use syn::spanned::Spanned;
use syn::{Error, Expr, ExprLit, Field, Lit, LitInt, LitStr, Path, Token};
+#[derive(Clone)]
+pub(crate) enum InterfaceAttr {
+ Name(LitStr),
+ Descriptor(Path),
+}
+
+impl syn::parse::Parse for InterfaceAttr {
+ fn parse(input: syn::parse::ParseStream<'_>) -> Result<Self, Error> {
+ if input.peek(LitStr) {
+ input.parse().map(Self::Name)
+ } else {
+ input.parse().map(Self::Descriptor)
+ }
+ }
+}
+
+impl InterfaceAttr {
+ pub(crate) fn name(&self) -> proc_macro2::TokenStream {
+ match self {
+ Self::Name(name) => quote::quote!(#name),
+ Self::Descriptor(path) => quote::quote!(<#path>::DESCRIPTOR.name()),
+ }
+ }
+}
+
+fn resolve_interface_receiver(
+ receiver: &mut Option<ReceiverAttr>,
+ interface: Option<&InterfaceAttr>,
+ shorthand: Option<proc_macro2::Span>,
+) -> Result<(), Error> {
+ if let Some(span) = shorthand {
+ if receiver.is_some() {
+ return Err(Error::new(span, "receiver can only be specified once"));
+ }
+ *receiver = Some(match interface {
+ Some(InterfaceAttr::Descriptor(path)) => {
+ ReceiverAttr::Predicate(syn::parse_quote!(#path::is_instance))
+ }
+ _ => {
+ return Err(Error::new(
+ span,
+ "receiver shorthand requires an interface descriptor",
+ ));
+ }
+ });
+ }
+ Ok(())
+}
+
#[derive(Clone)]
pub(crate) enum ReceiverAttr {
Predicate(Path),
@@ -60,7 +109,7 @@ pub(crate) enum RenameRule {
#[derive(Default)]
pub(crate) struct ObjectAttrs {
pub(crate) receiver: Option<ReceiverAttr>,
- pub(crate) interface: Option<LitStr>,
+ pub(crate) interface: Option<InterfaceAttr>,
pub(crate) parent: Option<LitStr>,
pub(crate) prototype: Option<LitStr>,
pub(crate) own_to_string_tag: Option<LitStr>,
@@ -78,6 +127,7 @@ pub(crate) struct ObjectAttrs {
#[derive(Default)]
pub(crate) struct FunctionTemplateAttrs {
+ pub(crate) interface: Option<InterfaceAttr>,
pub(crate) receiver: Option<ReceiverAttr>,
pub(crate) name: Option<LitStr>,
pub(crate) constructor: Option<ConstructorAttr>,
@@ -213,6 +263,7 @@ impl FieldAttrs {
pub(crate) fn parse_object_attrs(attrs: &[syn::Attribute]) -> Result<ObjectAttrs, Error> {
let mut parsed = ObjectAttrs::default();
+ let mut interface_receiver = None;
for attr in attrs.iter().filter(|attr| attr.path().is_ident("webapi")) {
attr.parse_nested_meta(|meta| {
if meta.path.is_ident("parent") {
@@ -224,7 +275,11 @@ pub(crate) fn parse_object_attrs(attrs: &[syn::Attribute]) -> Result<ObjectAttrs
return Ok(());
}
if meta.path.is_ident("receiver") {
- parsed.receiver = Some(meta.value()?.parse()?);
+ if meta.input.peek(Token![=]) {
+ parsed.receiver = Some(meta.value()?.parse()?);
+ } else {
+ interface_receiver = Some(meta.path.span());
+ }
return Ok(());
}
if meta.path.is_ident("interface") {
@@ -279,6 +334,19 @@ pub(crate) fn parse_object_attrs(attrs: &[syn::Attribute]) -> Result<ObjectAttrs
Err(meta.error("unsupported #[webapi(...)] object attribute"))
})?;
}
+ if let Some(parent) = &parsed.parent
+ && matches!(parsed.interface, Some(InterfaceAttr::Descriptor(_)))
+ {
+ return Err(Error::new(
+ parent.span(),
+ "parent belongs in the interface descriptor, not the object declaration",
+ ));
+ }
+ resolve_interface_receiver(
+ &mut parsed.receiver,
+ parsed.interface.as_ref(),
+ interface_receiver,
+ )?;
Ok(parsed)
}
@@ -286,10 +354,19 @@ pub(crate) fn parse_function_template_attrs(
attrs: &[syn::Attribute],
) -> Result<FunctionTemplateAttrs, Error> {
let mut parsed = FunctionTemplateAttrs::default();
+ let mut interface_receiver = None;
for attr in attrs.iter().filter(|attr| attr.path().is_ident("webapi")) {
attr.parse_nested_meta(|meta| {
if meta.path.is_ident("receiver") {
- parsed.receiver = Some(meta.value()?.parse()?);
+ if meta.input.peek(Token![=]) {
+ parsed.receiver = Some(meta.value()?.parse()?);
+ } else {
+ interface_receiver = Some(meta.path.span());
+ }
+ return Ok(());
+ }
+ if meta.path.is_ident("interface") {
+ parsed.interface = Some(meta.value()?.parse()?);
return Ok(());
}
if meta.path.is_ident("name") {
@@ -355,6 +432,11 @@ pub(crate) fn parse_function_template_attrs(
Err(meta.error("unsupported #[webapi(...)] function template attribute"))
})?;
}
+ resolve_interface_receiver(
+ &mut parsed.receiver,
+ parsed.interface.as_ref(),
+ interface_receiver,
+ )?;
Ok(parsed)
}
diff --git a/moli-webapi-declare-derive/src/expand.rs b/moli-webapi-declare-derive/src/expand.rs
index 56630da15..2b6e2e5e6 100644
--- a/moli-webapi-declare-derive/src/expand.rs
+++ b/moli-webapi-declare-derive/src/expand.rs
@@ -5,9 +5,9 @@ use syn::spanned::Spanned;
use syn::{Data, DeriveInput, Error, Field, Fields, GenericParam, Ident, Lit, LitStr, Type};
use crate::attrs::{
- ConstructorAttr, ConstructorDefaultAttr, FieldAttrs, FieldDefaults, FieldKind, ObjectAttrs,
- RenameRule, ValueInitAttr, parse_field_attrs_with_defaults, parse_function_template_attrs,
- parse_object_attrs,
+ ConstructorAttr, ConstructorDefaultAttr, FieldAttrs, FieldDefaults, FieldKind, InterfaceAttr,
+ ObjectAttrs, RenameRule, ValueInitAttr, parse_field_attrs_with_defaults,
+ parse_function_template_attrs, parse_object_attrs,
};
struct DeclaredField {
@@ -59,10 +59,14 @@ pub(crate) fn expand_webapi_function_template(
let generics = input.generics;
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
let attrs = parse_function_template_attrs(&input.attrs)?;
- let template_name = attrs
- .name
- .clone()
- .unwrap_or_else(|| LitStr::new(&struct_name.to_string(), struct_name.span()));
+ let template_name = if let Some(name) = &attrs.name {
+ quote!(#name)
+ } else if let Some(interface) = &attrs.interface {
+ interface.name()
+ } else {
+ let name = LitStr::new(&struct_name.to_string(), struct_name.span());
+ quote!(#name)
+ };
let constructor_callback = match attrs
.constructor
.clone()
@@ -72,7 +76,13 @@ pub(crate) fn expand_webapi_function_template(
quote!(::moli_webapi_declare::illegal_constructor_callback)
}
ConstructorAttr::Callback(callback) => {
- quote!(::moli_webapi_declare::web_api_constructor!(#template_name, #callback))
+ let Some(InterfaceAttr::Descriptor(interface)) = &attrs.interface else {
+ return Err(Error::new(
+ struct_name.span(),
+ "constructor_callback requires an interface descriptor",
+ ));
+ };
+ quote!(::moli_webapi_declare::web_api_constructor!(#interface, #callback))
}
};
let constructor_length = attrs.constructor_length.unwrap_or(0);
@@ -207,7 +217,12 @@ pub(crate) fn expand_webapi_object(input: DeriveInput) -> Result<proc_macro2::To
.clone()
.ok_or_else(|| Error::new(struct_name.span(), "missing #[webapi(interface = \"...\")]"))?;
let has_explicit_prototype = attrs.prototype.is_some();
- let prototype = attrs.prototype.clone().unwrap_or_else(|| interface.clone());
+ let interface_name = interface.name();
+ let prototype = attrs
+ .prototype
+ .as_ref()
+ .map(|name| quote!(#name))
+ .unwrap_or_else(|| interface_name.clone());
let own_to_string_tag = match attrs.own_to_string_tag.as_ref() {
Some(tag) => quote!(::std::option::Option::Some(#tag)),
None => quote!(::std::option::Option::None),
@@ -292,13 +307,21 @@ pub(crate) fn expand_webapi_object(input: DeriveInput) -> Result<proc_macro2::To
));
}
- let initialize_brand = (!attrs.unbranded && interface.value() != "Object").then(|| {
- quote! {
- ::moli_webapi_declare::initialize_web_api_object(scope, object, #interface)?;
+ let initialize_brand = if attrs.unbranded {
+ quote!()
+ } else {
+ match &interface {
+ InterfaceAttr::Descriptor(path) => {
+ quote!(<#path>::DESCRIPTOR.initialize(scope, object)?;)
+ }
+ InterfaceAttr::Name(name) if name.value() == "Object" => quote!(),
+ InterfaceAttr::Name(name) => {
+ quote!(::moli_webapi_declare::initialize_web_api_object(scope, object, #name)?;)
+ }
}
- });
+ };
let register_parent = attrs.parent.as_ref().map(|parent| quote! {
- ::moli_webapi_declare::register_web_api_interfaces(scope, [(#interface, Some(#parent))])?;
+ ::moli_webapi_declare::register_web_api_interfaces(scope, [(#interface_name, Some(#parent))])?;
});
let initialize_body = quote! {
#register_parent
@@ -315,7 +338,7 @@ pub(crate) fn expand_webapi_object(input: DeriveInput) -> Result<proc_macro2::To
let (trait_impl_generics, _, trait_where_clause) = trait_generics.split_for_impl();
let trait_impl = quote! {
impl #trait_impl_generics ::moli_webapi_declare::WebApiObjectDeclaration<#method_scope_lifetime> for #struct_name #ty_generics #trait_where_clause {
- const INTERFACE: &'static str = #interface;
+ const INTERFACE: &'static str = #interface_name;
const OWN_TO_STRING_TAG: ::std::option::Option<&'static str> = #own_to_string_tag;
fn initialize(
@@ -445,7 +468,7 @@ struct FunctionTemplateFieldExpansions {
fn expand_function_template_fields(
fields: &[DeclaredField],
- template_name: &LitStr,
+ template_name: &proc_macro2::TokenStream,
) -> Result<FunctionTemplateFieldExpansions, Error> {
let mut template_methods = Vec::new();
let mut prototype_methods = Vec::new();
@@ -570,7 +593,7 @@ fn expand_function_template_constant_field(
fn expand_function_template_method_field(
field: &Field,
attrs: &crate::attrs::FieldAttrs,
- template_name: &LitStr,
+ template_name: &proc_macro2::TokenStream,
binding: syn::Ident,
) -> Result<proc_macro2::TokenStream, Error> {
let key = webapi_field_key(field, attrs)?;
@@ -662,7 +685,7 @@ fn expand_template_method_key(
fn expand_function_template_accessor_property_field(
field: &Field,
attrs: &crate::attrs::FieldAttrs,
- template_name: &LitStr,
+ template_name: &proc_macro2::TokenStream,
) -> Result<proc_macro2::TokenStream, Error> {
if attrs.readonly {
return Err(Error::new(
@@ -1458,7 +1481,7 @@ fn expand_template_function_member(
callback: &proc_macro2::TokenStream,
length: i32,
data: Option<&syn::Expr>,
- template_name: &LitStr,
+ template_name: &proc_macro2::TokenStream,
display_name: &proc_macro2::TokenStream,
class_name: proc_macro2::TokenStream,
) -> proc_macro2::TokenStream {
diff --git a/moli-webapi-declare/src/callback.rs b/moli-webapi-declare/src/callback.rs
index 0e31c1ee2..c7965e361 100644
--- a/moli-webapi-declare/src/callback.rs
+++ b/moli-webapi-declare/src/callback.rs
@@ -14,7 +14,7 @@ pub fn invoke_web_api_constructor<'s>(
scope: &mut v8::PinScope<'s, '_>,
args: v8::FunctionCallbackArguments<'s>,
rv: v8::ReturnValue<'s>,
- interface: &'static str,
+ interface: crate::WebApiInterfaceDescriptor,
callback: MemberCallback,
) {
let receiver = args.this();
@@ -34,7 +34,7 @@ pub fn invoke_web_api_constructor<'s>(
Err(_) if construct => receiver,
Err(_) => return,
};
- if let Err(error) = crate::initialize_web_api_object(scope, object, interface) {
+ if let Err(error) = interface.initialize(scope, object) {
let message =
v8::String::new(scope, &error.to_string()).expect("constructor identity error");
let exception = v8::Exception::type_error(scope, message);
diff --git a/moli-webapi-declare/src/interface.rs b/moli-webapi-declare/src/interface.rs
new file mode 100644
index 000000000..d94a1804b
--- /dev/null
+++ b/moli-webapi-declare/src/interface.rs
@@ -0,0 +1,109 @@
+use crate::{
+ BindError, implements_interface, initialize_web_api_object, register_web_api_interfaces, v8,
+};
+
+/// Native interface metadata shared by constructors, factories and receivers.
+/// Public JavaScript prototypes never supply this identity or its inheritance.
+#[derive(Clone, Copy, Debug)]
+pub struct WebApiInterfaceDescriptor {
+ name: &'static str,
+ parent: Option<&'static Self>,
+}
+
+impl WebApiInterfaceDescriptor {
+ pub const fn new(name: &'static str, parent: Option<&'static Self>) -> Self {
+ Self { name, parent }
+ }
+
+ pub const fn name(self) -> &'static str {
+ self.name
+ }
+
+ pub const fn parent_name(self) -> Option<&'static str> {
+ match self.parent {
+ Some(parent) => Some(parent.name),
+ None => None,
+ }
+ }
+
+ /// Register the full ancestry even in a realm without exposed constructors.
+ /// Each edge is validated before following it; repeated metadata is cheap,
+ /// and invalid cyclic native descriptors fail rather than looping forever.
+ pub fn register<C>(self, scope: &mut v8::PinScope<'_, '_, C>) -> Result<(), BindError> {
+ let mut current = Some(self);
+ while let Some(interface) = current {
+ register_web_api_interfaces(scope, [(interface.name, interface.parent_name())])?;
+ current = interface.parent.copied();
+ }
+ Ok(())
+ }
+
+ pub fn initialize<'s>(
+ self,
+ scope: &mut v8::PinScope<'s, '_>,
+ object: v8::Local<'s, v8::Object>,
+ ) -> Result<(), BindError> {
+ self.register(scope)?;
+ initialize_web_api_object(scope, object, self.name)
+ }
+
+ pub fn is_instance<'s>(
+ self,
+ scope: &mut v8::PinScope<'s, '_>,
+ object: v8::Local<'s, v8::Object>,
+ ) -> bool {
+ implements_interface(scope, object, self.name)
+ }
+}
+
+/// Declare native interface identities once and refer to them from derives.
+///
+/// ```ignore
+/// declare_web_api_interfaces! {
+/// pub Event;
+/// pub ProgressEvent: Event;
+/// pub HeadersIterator = "Headers Iterator";
+/// }
+///
+/// #[derive(WebApiObject)]
+/// #[webapi(interface = ProgressEvent)]
+/// struct ProgressEventState { /* private slots */ }
+///
+/// #[derive(WebApiFunctionTemplate)]
+/// #[webapi(interface = Event, receiver)]
+/// struct EventMethods { /* instance methods and accessors */ }
+/// ```
+///
+/// The optional JavaScript name is for names that are not Rust identifiers.
+/// A descriptor defines native ancestry; it does not install a JS prototype.
+#[macro_export]
+macro_rules! declare_web_api_interfaces {
+ ($($visibility:vis $name:ident $(= $js_name:literal)? $(: $parent:path)?;)+) => {
+ $(
+ #[allow(clippy::upper_case_acronyms)]
+ $visibility struct $name;
+ // Generated receiver helpers are intentionally optional at each use.
+ #[allow(dead_code)]
+ impl $name {
+ pub const NAME: &'static str = $crate::declare_web_api_interfaces!(@name $name $(, $js_name)?);
+
+ pub const DESCRIPTOR: $crate::WebApiInterfaceDescriptor =
+ $crate::WebApiInterfaceDescriptor::new(
+ $crate::declare_web_api_interfaces!(@name $name $(, $js_name)?),
+ $crate::declare_web_api_interfaces!(@parent $($parent)?),
+ );
+
+ pub fn is_instance<'s>(
+ scope: &mut $crate::v8::PinScope<'s, '_>,
+ object: $crate::v8::Local<'s, $crate::v8::Object>,
+ ) -> bool {
+ Self::DESCRIPTOR.is_instance(scope, object)
+ }
+ }
+ )+
+ };
+ (@name $name:ident) => { stringify!($name) };
+ (@name $name:ident, $js_name:literal) => { $js_name };
+ (@parent) => { ::std::option::Option::None };
+ (@parent $parent:path) => { ::std::option::Option::Some(&<$parent>::DESCRIPTOR) };
+}
diff --git a/moli-webapi-declare/src/lib.rs b/moli-webapi-declare/src/lib.rs
index 00e1d4862..d89c5a1e4 100644
--- a/moli-webapi-declare/src/lib.rs
+++ b/moli-webapi-declare/src/lib.rs
@@ -101,24 +101,25 @@
//! fragment stays unbranded. Do not opt actual instances out of branding to
//! make them pass structured clone.
//!
-//! Register inheritance with `register_web_api_interfaces` using the same
-//! interface metadata that drives constructor installation. Identity is independent of
-//! realm exposure and mutable JavaScript prototypes. Use `web_api_object_type`
-//! for the primary interface and `implements_interface` for inherited receiver
-//! checks. Native factories can call `initialize_web_api_object` directly.
-//! An object declaration outside the exposed-interface registry can declare
-//! `parent = "BaseInterface"`; this registers inheritance before initialization.
-//! JavaScript subclasses retain the native interface implemented by their
-//! constructor. Base initialization never downgrades an existing derived type.
-//! Inconsistent parents, cycles, and unrelated rebranding fail. The renderer
-//! registers inheritance from `ConstructorSpec.name` and `.parent` before lazy
-//! constructor exposure, without maintaining another type list.
-//! Factories using that registry should not repeat `parent`: deleting a public
-//! constructor or taking a fallback path does not remove registered inheritance.
+//! Declare each interface once with `declare_web_api_interfaces!` and reference
+//! it using `#[webapi(interface = interfaces::ProgressEvent)]`. The generated
+//! descriptor supplies the name and parent to constructor specs, factories and
+//! receiver predicates. Initialization registers the full ancestry, including
+//! when public constructors are absent. Do not repeat `parent` on object state
+//! declarations. A template's optional `name` is only its display name and must
+//! not be used to infer the identity of a shared implementation fragment.
+//!
+//! Identity is independent of realm exposure and mutable JavaScript prototypes.
+//! Use `web_api_object_type` for the primary interface. Native factories can use
+//! `Interface::DESCRIPTOR.initialize(scope, object)`; dynamic factories resolve
+//! their selected name through the same native catalog. JavaScript subclasses
+//! retain the interface implemented by their native constructor, and base
+//! initialization never downgrades a derived object. Inconsistent parents,
+//! cycles and unrelated rebranding fail.
//!
//! `WebApiFunctionTemplate` adapts native constructor
//! callbacks automatically. Hand-written templates can use
-//! `web_api_constructor!("Interface", callback)` when construction does not
+//! `web_api_constructor!(interfaces::Interface, callback)` when construction does not
//! already go through a named object declaration. Only successful construction
//! brands the resulting native object; constructors and prototypes are not
//! instances. A factory implemented with a native Proxy must brand its target
@@ -158,8 +159,10 @@
//!
//! # Receiver checks and Promise-returning members
//!
-//! `receiver = "Interface"` on a method or `accessor_property` generates an
-//! `implements_interface` check before argument conversion and implementation.
+//! `#[webapi(interface = interfaces::Event, receiver)]` checks instance methods
+//! and accessors against the declared interface before argument conversion.
+//! A field can use `receiver = interfaces::Other::is_instance` to select another
+//! interface. Merely naming a template does not enable receiver checks.
//! Invalid receivers throw `TypeError("Illegal invocation")`. Native subtypes
//! and cross-realm objects are accepted even after their JavaScript prototypes
//! change. Forged prototypes, public properties, and author Proxies cannot pass.
@@ -172,7 +175,7 @@
//! `receiver = path` remains available for a custom native predicate with
//! signature `fn(&mut v8::PinScope, v8::Local<v8::Object>) -> bool`. It must not
//! execute JavaScript or throw. Use it for checks that additionally require
-//! native resource state; ordinary interface checks should use the string form.
+//! native resource state; ordinary interface checks should use their descriptor.
//!
//! `returns_promise` on a method (including a static method) or accessor getter
//! converts synchronous exceptions from both the receiver check and the callback
@@ -228,27 +231,35 @@ mod brand;
mod callback;
mod declaration;
mod error;
+mod interface;
mod property;
mod prototype;
mod value;
pub mod __private;
+pub use interface::WebApiInterfaceDescriptor;
pub use moli_webapi_declare_derive::{WebApiFunctionTemplate, WebApiObject};
pub use v8;
/// Adapts a manual native constructor to the same identity initialization used
-/// by interface derives. The interface must be a native declaration literal,
+/// by interface derives. The interface must be a generated native identity type,
/// never a name obtained from `new.target` or another JavaScript property.
#[macro_export]
macro_rules! web_api_constructor {
- ($interface:literal, $callback:path) => {{
+ ($interface:path, $callback:path) => {{
fn __moli_native_constructor_adapter<'s>(
scope: &mut $crate::v8::PinScope<'s, '_>,
args: $crate::v8::FunctionCallbackArguments<'s>,
rv: $crate::v8::ReturnValue<'s>,
) {
- $crate::__private::invoke_web_api_constructor(scope, args, rv, $interface, $callback);
+ $crate::__private::invoke_web_api_constructor(
+ scope,
+ args,
+ rv,
+ <$interface>::DESCRIPTOR,
+ $callback,
+ );
}
__moli_native_constructor_adapter
}};
diff --git a/moli-webapi-declare/tests/brand.rs b/moli-webapi-declare/tests/brand.rs
index 66cc3f616..8daa6f4f5 100644
--- a/moli-webapi-declare/tests/brand.rs
+++ b/moli-webapi-declare/tests/brand.rs
@@ -7,11 +7,11 @@ use moli_webapi_declare::{
};
#[derive(WebApiObject)]
-#[webapi(interface = "TestBase", allow_empty)]
+#[webapi(interface = interfaces::TestBase, allow_empty)]
struct Base {}
#[derive(WebApiObject)]
-#[webapi(interface = "TestDerived", parent = "TestBase", allow_empty)]
+#[webapi(interface = interfaces::TestDerived, allow_empty)]
struct Derived {}
#[derive(WebApiObject)]
@@ -21,7 +21,7 @@ struct Record {
}
#[derive(WebApiObject)]
-#[webapi(interface = "TestBase", unbranded, allow_empty)]
+#[webapi(interface = interfaces::TestBase, unbranded, allow_empty)]
struct PrototypeMembers {}
fn eval<'s>(scope: &mut v8::PinScope<'s, '_>, source: &str) -> v8::Local<'s, v8::Value> {
@@ -137,7 +137,7 @@ fn inheritance_registration_is_atomic_and_rejects_conflicts_and_cycles() {
}
#[derive(moli_webapi_declare::WebApiFunctionTemplate)]
-#[webapi(name = "NativeConstructor", constructor_callback = native_constructor)]
+#[webapi(interface = interfaces::NativeConstructor, constructor_callback = native_constructor)]
struct NativeConstructor {}
fn native_constructor<'s>(
@@ -292,3 +292,53 @@ fn generated_interface_receivers_accept_subtypes_and_reject_forgery_before_conve
"TypeError"
);
}
+
+mod interfaces {
+ moli_webapi_declare::declare_web_api_interfaces! {
+ pub(super) NativeConstructor;
+ pub(super) TestBase;
+ pub(super) TestDerived: TestBase;
+ }
+}
+
+#[test]
+fn descriptor_registers_unexposed_ancestry_and_rejects_forged_receivers() {
+ ensure_v8();
+ let mut isolate = v8::Isolate::new(Default::default());
+ let scope = pin!(v8::HandleScope::new(&mut isolate));
+ let scope = &mut scope.init();
+ let context = v8::Context::new(scope, Default::default());
+ let scope = &mut v8::ContextScope::new(scope, context);
+ let real = v8::Object::new(scope);
+ interfaces::TestDerived::DESCRIPTOR
+ .initialize(scope, real)
+ .unwrap();
+ assert!(interfaces::TestBase::is_instance(scope, real));
+ assert!(interfaces::TestDerived::is_instance(scope, real));
+ let forged = v8::Object::new(scope);
+ forged.set_prototype(scope, real.into()).unwrap();
+ assert!(!interfaces::TestBase::is_instance(scope, forged));
+ assert!(!interfaces::TestDerived::is_instance(scope, forged));
+ real.set_prototype(scope, v8::null(scope).into()).unwrap();
+ assert!(interfaces::TestBase::is_instance(scope, real));
+}
+
+#[test]
+fn cyclic_native_descriptors_fail_during_registration() {
+ use moli_webapi_declare::WebApiInterfaceDescriptor;
+ static FIRST: WebApiInterfaceDescriptor =
+ WebApiInterfaceDescriptor::new("CycleFirst", Some(&SECOND));
+ static SECOND: WebApiInterfaceDescriptor =
+ WebApiInterfaceDescriptor::new("CycleSecond", Some(&FIRST));
+ ensure_v8();
+ let mut isolate = v8::Isolate::new(Default::default());
+ let scope = pin!(v8::HandleScope::new(&mut isolate));
+ let scope = &mut scope.init();
+ assert!(
+ FIRST
+ .register(scope)
+ .unwrap_err()
+ .to_string()
+ .contains("cycle")
+ );
+}
diff --git a/moli-webapi-declare/tests/declare.rs b/moli-webapi-declare/tests/declare.rs
index f34c7a772..547d53e9d 100644
--- a/moli-webapi-declare/tests/declare.rs
+++ b/moli-webapi-declare/tests/declare.rs
@@ -166,7 +166,7 @@ struct SamplePerformanceInterface {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "ConstructibleSample",
+ interface = interfaces::ConstructibleSample,
constructor_callback = sample_constructor_callback,
constructor_length = 2
)]
@@ -180,7 +180,7 @@ struct InterfaceDescriptorSample {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SamplePerformance")]
+#[webapi(interface = interfaces::SamplePerformance)]
struct SamplePerformanceObject {
#[webapi(data_property = SAMPLE_TIME_ORIGIN_SLOT)]
time_origin: f64,
@@ -260,7 +260,7 @@ struct SamplePerformanceObject {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SamplePerformance")]
+#[webapi(interface = interfaces::SamplePerformance)]
struct SampleLocalObjectSlot<'scope> {
#[webapi(slot = SAMPLE_LOCAL_OBJECT_SLOT)]
local_object: v8::Local<'scope, v8::Object>,
@@ -369,7 +369,7 @@ struct ConstantObject {
#[derive(WebApiFunctionTemplate)]
#[webapi(
- name = "SampleTemplate",
+ interface = interfaces::SampleTemplate,
constructor_callback = sample_constructor_callback,
constructor_length = 1,
enumerable
@@ -510,7 +510,7 @@ struct DefaultEnumerablePropertiesObject {
}
#[derive(WebApiObject)]
-#[webapi(interface = "SamplePerformance", data_properties, enumerable)]
+#[webapi(interface = interfaces::SamplePerformance, data_properties, enumerable)]
struct PrototypeBackedEnumerablePropertiesObject {
client_x: f64,
}
@@ -523,7 +523,7 @@ struct ExplicitSnakeCasePropertiesObject {
#[derive(WebApiObject)]
#[webapi(
- interface = "SamplePerformance",
+ interface = interfaces::SamplePerformance,
own_to_string_tag = "ReadonlySample",
readonly_to_string_tag,
allow_empty
@@ -531,7 +531,7 @@ struct ExplicitSnakeCasePropertiesObject {
struct ReadonlyTagObject {}
#[derive(WebApiObject)]
-#[webapi(interface = "MissingSampleInterface", require_prototype, allow_empty)]
+#[webapi(interface = interfaces::MissingSampleInterface, require_prototype, allow_empty)]
struct RequiredPrototypeObject {}
#[derive(WebApiObject)]
@@ -576,7 +576,7 @@ struct RuntimeReadonlyLockedTagObject {
#[derive(WebApiObject)]
#[webapi(
- interface = "SamplePerformance",
+ interface = interfaces::SamplePerformance,
fallback_to_string_tag = "SampleFallback",
allow_empty
)]
@@ -584,7 +584,7 @@ struct PrototypeBackedFallbackTagObject {}
#[derive(WebApiObject)]
#[webapi(
- interface = "MissingSampleInterface",
+ interface = interfaces::MissingSampleInterface,
fallback_to_string_tag = "MissingSample",
allow_empty
)]
@@ -2990,3 +2990,12 @@ fn get_private_value<'s>(
Some(value)
}
}
+
+mod interfaces {
+ moli_webapi_declare::declare_web_api_interfaces! {
+ pub(super) ConstructibleSample;
+ pub(super) MissingSampleInterface;
+ pub(super) SamplePerformance;
+ pub(super) SampleTemplate;
+ }
+}
diff --git a/moli-webapi-declare/tests/receivers.rs b/moli-webapi-declare/tests/receivers.rs
index 8c01fd8d4..09b0b0fab 100644
--- a/moli-webapi-declare/tests/receivers.rs
+++ b/moli-webapi-declare/tests/receivers.rs
@@ -56,7 +56,7 @@ fn promise_callback<'s>(
}
#[derive(WebApiFunctionTemplate)]
-#[webapi(name = "NativeSample", constructor_callback = constructor, receiver = has_brand, enumerable)]
+#[webapi(interface = interfaces::NativeSample, constructor_callback = constructor, receiver = has_brand, enumerable)]
struct NativeSample {
#[webapi(method, callback = callback, length = 1, data = 7)]
method: (),
@@ -88,7 +88,7 @@ struct PlainInterface {
}
#[derive(WebApiObject)]
-#[webapi(interface = "PlainInterface", receiver = has_brand)]
+#[webapi(interface = interfaces::PlainInterface, receiver = has_brand)]
struct PlainObject {
#[webapi(slot = BRAND)]
brand: bool,
@@ -386,3 +386,10 @@ fn promise_callbacks_do_not_convert_execution_termination_into_rejection() {
scope.cancel_terminate_execution();
assert!(run_script(scope, "new NativeSample().method() === 7").is_true());
}
+
+mod interfaces {
+ moli_webapi_declare::declare_web_api_interfaces! {
+ pub(super) NativeSample;
+ pub(super) PlainInterface;
+ }
+}