refactor(webapi): share generated interface descriptors

This commit is contained in:
ldm0
2026-09-11 22:44:18 +08:00
parent 377275f993
commit d5ed3cb2fd
221 changed files with 2829 additions and 1988 deletions
+3 -2
View File
@@ -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: (),
@@ -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
)]
+17 -8
View File
@@ -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
@@ -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: (),
@@ -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)
}
@@ -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 {
@@ -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.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);
crate::network_host::install_progress_event_template_bindings(
scope,
template,
spec.interface.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);
@@ -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),
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(
"ShadowRoot",
Some("DocumentFragment"),
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(
"SVGGeometryElement",
Some("SVGGraphicsElement"),
web_api_interfaces::SVGGraphicsElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
descriptor("SVGAElement", Some("SVGGraphicsElement"), ELEMENT_GROUPS),
specialized_descriptor(
"SVGCircleElement",
Some("SVGGeometryElement"),
descriptor(
web_api_interfaces::SVGGeometryElement::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::SVGAElement::DESCRIPTOR, ELEMENT_GROUPS),
specialized_descriptor(
"SVGEllipseElement",
Some("SVGGeometryElement"),
web_api_interfaces::SVGCircleElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS,
),
descriptor(
"SVGForeignObjectElement",
Some("SVGGraphicsElement"),
web_api_interfaces::SVGDefsElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
descriptor("SVGGElement", Some("SVGGraphicsElement"), ELEMENT_GROUPS),
descriptor(
"SVGImageElement",
Some("SVGGraphicsElement"),
web_api_interfaces::SVGDescElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
specialized_descriptor(
"SVGLineElement",
Some("SVGGeometryElement"),
web_api_interfaces::SVGEllipseElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS,
),
descriptor("SVGGradientElement", Some("SVGElement"), ELEMENT_GROUPS),
descriptor(
web_api_interfaces::SVGForeignObjectElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
descriptor(web_api_interfaces::SVGGElement::DESCRIPTOR, ELEMENT_GROUPS),
descriptor(
web_api_interfaces::SVGImageElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
specialized_descriptor(
"SVGLinearGradientElement",
Some("SVGGradientElement"),
web_api_interfaces::SVGLineElement::DESCRIPTOR,
ELEMENT_GROUPS,
SpecializedTemplateInstaller::None,
SVG_GEOMETRY_RUNTIME_INSTALL_GROUPS,
),
descriptor(
web_api_interfaces::SVGGradientElement::DESCRIPTOR,
ELEMENT_GROUPS,
),
specialized_descriptor(
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(
"HTMLHeadingElement",
Some("HTMLElement"),
web_api_interfaces::HTMLFrameElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
descriptor(
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"),
HTML_ELEMENT_GROUPS,
),
descriptor("HTMLSpanElement", Some("HTMLElement"), HTML_ELEMENT_GROUPS),
descriptor(
"HTMLTableCaptionElement",
Some("HTMLElement"),
web_api_interfaces::HTMLSourceElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
descriptor(
"HTMLTableColElement",
Some("HTMLElement"),
web_api_interfaces::HTMLSpanElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
descriptor(
web_api_interfaces::HTMLTableCaptionElement::DESCRIPTOR,
HTML_ELEMENT_GROUPS,
),
descriptor(
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)]
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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: (),
@@ -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,
@@ -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,
@@ -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
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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());
@@ -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: (),
@@ -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,
@@ -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: (),
@@ -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());
@@ -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());
@@ -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,
@@ -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",
@@ -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);
@@ -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,
@@ -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,
@@ -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,
@@ -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"
@@ -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
));
}
@@ -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(
@@ -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>,
@@ -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: (),
@@ -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: (),
@@ -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
@@ -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,
@@ -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: (),
@@ -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: (),
@@ -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,
@@ -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>,
@@ -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
@@ -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",
@@ -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",
@@ -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,
@@ -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");
@@ -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>,
@@ -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
@@ -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,
@@ -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: (),
@@ -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
@@ -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
@@ -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
@@ -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,
@@ -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>,
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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,
@@ -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,
@@ -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: (),
@@ -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,
@@ -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)]
@@ -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",
@@ -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>,
@@ -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,
@@ -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
)]
@@ -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>,
@@ -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,
@@ -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>,
@@ -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: (),
@@ -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>,
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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: (),
@@ -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,
@@ -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: (),
@@ -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: (),
@@ -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: (),
+13 -12
View File
@@ -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,
@@ -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>,
@@ -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,
@@ -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)
@@ -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,
@@ -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>>,

Some files were not shown because too many files have changed in this diff Show More