Files
moli/moli-renderer-v8/src/web_api_interfaces.rs

689 lines
21 KiB
Rust

//! The native interface catalog, independent of which constructors a realm exposes.
//! Constructor specs and bridge installation add behavior to these identities;
//! they do not repeat interface names or inheritance.
use moli_webapi_declare::{BindError, WebApiInterfaceDescriptor};
macro_rules! interfaces {
($($name:ident $(= $js_name:literal)? $(: $parent:path)?;)+) => {
moli_webapi_declare::declare_web_api_interfaces! {
$(pub(crate) $name $(= $js_name)? $(: $parent)?;)+
}
pub(crate) fn descriptor(name: &str) -> std::option::Option<WebApiInterfaceDescriptor> {
match name {
$(<$name>::NAME => Some(<$name>::DESCRIPTOR),)+
_ => None,
}
}
};
}
interfaces! {
AuthenticatorAssertionResponse: AuthenticatorResponse;
AuthenticatorAttestationResponse: AuthenticatorResponse;
AuthenticatorResponse;
PublicKeyCredential: Credential;
Credential;
CredentialsContainer;
AbortController;
AbortSignal: EventTarget;
AbstractRange;
AnalyserNode: AudioNode;
Animation;
AnimationEffect;
AnimationEvent: Event;
AnimationPlaybackEvent: Event;
AnimationTimeline;
Attr: Node;
Audio;
AudioBuffer;
AudioBufferSourceNode: AudioScheduledSourceNode;
AudioContext: BaseAudioContext;
AudioDestinationNode: AudioNode;
AudioListener;
AudioParamMap;
AudioNode: EventTarget;
AudioScheduledSourceNode: AudioNode;
AudioParam;
Worklet;
AudioWorklet: Worklet;
AudioWorkletNode: AudioNode;
BaseAudioContext: EventTarget;
BarProp;
BatteryManager: EventTarget;
BeforeUnloadEvent: Event;
BiquadFilterNode: AudioNode;
ChannelMergerNode: AudioNode;
ChannelSplitterNode: AudioNode;
ConstantSourceNode: AudioScheduledSourceNode;
DelayNode: AudioNode;
GainNode: AudioNode;
IIRFilterNode: AudioNode;
PeriodicWave;
StereoPannerNode: AudioNode;
WaveShaperNode: AudioNode;
ConvolverNode: AudioNode;
Blob;
BlobEvent: Event;
MIDIConnectionEvent: Event;
MIDIMessageEvent: Event;
BroadcastChannel: EventTarget;
ByteLengthQueuingStrategy;
CDATASection: Text;
CSSAnimation: Animation;
CSSConditionRule: CSSGroupingRule;
CSSContainerRule: CSSConditionRule;
CSSCounterStyleRule: CSSRule;
CSSFontFaceDescriptors: CSSStyleDeclaration;
CSSFontFaceRule: CSSRule;
CSSFontFeatureValuesMap;
CSSFontFeatureValuesMapIterator = "CSSFontFeatureValuesMap Iterator";
CSSFontFeatureValuesRule: CSSRule;
CSSFontPaletteValuesRule: CSSRule;
CSSGroupingRule: CSSRule;
CSSImportRule: CSSRule;
CSSKeyframeRule: CSSRule;
CSSKeyframesRule: CSSRule;
CSSKeywordValue: CSSStyleValue;
CSSLayerBlockRule: CSSGroupingRule;
CSSLayerStatementRule: CSSRule;
CSSMarginRule: CSSRule;
CSSMediaRule: CSSConditionRule;
CSSNamespaceRule: CSSRule;
CSSNestedDeclarations: CSSRule;
CSSNumericValue: CSSStyleValue;
CSSPageDescriptors: CSSStyleDeclaration;
CSSPageRule: CSSGroupingRule;
CSSPropertyRule: CSSRule;
CSSRule;
CSSRuleList;
CSSScopeRule: CSSGroupingRule;
CSSStartingStyleRule: CSSGroupingRule;
CSSStyleDeclaration;
CSSStyleProperties: CSSStyleDeclaration;
CSSStyleRule: CSSGroupingRule;
CSSStyleSheet: StyleSheet;
CSSStyleValue;
CSSSupportsRule: CSSConditionRule;
CSSTransition: Animation;
CSSUnitValue: CSSNumericValue;
Cache;
CacheStorage;
CanvasGradient;
CanvasPattern;
CanvasRenderingContext2D;
CapturedMouseEvent: Event;
CaretPosition;
CharacterData: Node;
Client;
Clients;
Clipboard: EventTarget;
ClipboardEvent: Event;
ClipboardItem;
CloseEvent: Event;
CommandEvent: Event;
Comment: CharacterData;
CompositionEvent: UIEvent;
CompressionStream;
ContentVisibilityAutoStateChangeEvent: Event;
CountQueuingStrategy;
Crypto;
CryptoKey;
CustomElementRegistry;
CustomEvent: Event;
CustomStateSet;
CustomStateSetIterator = "CustomStateSet Iterator";
DOMError;
DOMException;
DOMImplementation;
DOMMatrix: DOMMatrixReadOnly;
DOMMatrixReadOnly;
DOMParser;
DOMPoint: DOMPointReadOnly;
DOMPointReadOnly;
DOMQuad;
DOMRect: DOMRectReadOnly;
DOMRectList;
DOMRectReadOnly;
DOMStringList;
DOMStringMap;
DOMTokenList;
DataTransfer;
DataTransferItem;
DataTransferItemList;
DecompressionStream;
DedicatedWorkerGlobalScope: WorkerGlobalScope;
DeprecatedStorageInfo;
DeprecatedStorageQuota;
DeviceMotionEvent: Event;
DeviceMotionEventAcceleration;
DeviceMotionEventRotationRate;
DeviceOrientationEvent: Event;
Document: Node;
DocumentFragment: Node;
DocumentTimeline: AnimationTimeline;
DocumentType: Node;
DragEvent: MouseEvent;
DynamicsCompressorNode: AudioNode;
Element: Node;
ElementInternals;
EncodedVideoChunk;
ErrorEvent: Event;
Event;
EventCounts;
EventCountsIterator = "EventCounts Iterator";
EventSource: EventTarget;
EventTarget;
External;
ExtendableEvent: Event;
ExtendableMessageEvent: ExtendableEvent;
FetchEvent: ExtendableEvent;
File: Blob;
FileList;
FileReader: EventTarget;
FileReaderSync;
FileSystem;
FileSystemDirectoryEntry: FileSystemEntry;
FileSystemDirectoryHandle: FileSystemHandle;
FileSystemDirectoryHandleAsyncIterator = "FileSystemDirectoryHandle AsyncIterator";
FileSystemDirectoryReader;
FileSystemEntry;
FileSystemFileEntry: FileSystemEntry;
FileSystemFileHandle: FileSystemHandle;
FileSystemHandle;
FileSystemSyncAccessHandle;
FileSystemWritableFileStream: WritableStream;
FocusEvent: UIEvent;
FontFace;
FontFaceSet: EventTarget;
FontFaceSetIterator = "FontFaceSet Iterator";
FontFaceSetLoadEvent: Event;
FormData;
FormDataIterator = "FormData Iterator";
FormDataEvent: Event;
Geolocation;
GeolocationCoordinates;
GeolocationPosition;
GeolocationPositionError;
Gamepad;
GamepadButton;
GamepadEvent: Event;
PictureInPictureEvent: Event;
PaymentRequestUpdateEvent: Event;
PaymentMethodChangeEvent: PaymentRequestUpdateEvent;
PictureInPictureWindow: EventTarget;
GamepadHapticActuator;
HTMLAllCollection;
HTMLAnchorElement: HTMLElement;
HTMLAreaElement: HTMLElement;
HTMLAudioElement: HTMLMediaElement;
HTMLBRElement: HTMLElement;
HTMLBaseElement: HTMLElement;
HTMLBodyElement: HTMLElement;
HTMLButtonElement: HTMLElement;
HTMLCanvasElement: HTMLElement;
HTMLCollection;
HTMLDListElement: HTMLElement;
HTMLDataElement: HTMLElement;
HTMLDataListElement: HTMLElement;
HTMLDetailsElement: HTMLElement;
HTMLDialogElement: HTMLElement;
HTMLDirectoryElement: HTMLElement;
HTMLDivElement: HTMLElement;
HTMLDocument: Document;
HTMLElement: Element;
HTMLEmbedElement: HTMLElement;
HTMLFieldSetElement: HTMLElement;
HTMLFontElement: HTMLElement;
HTMLFormControlsCollection: HTMLCollection;
HTMLFormElement: HTMLElement;
HTMLFrameElement: HTMLElement;
HTMLFrameSetElement: HTMLElement;
HTMLHRElement: HTMLElement;
HTMLHeadElement: HTMLElement;
HTMLHeadingElement: HTMLElement;
HTMLHtmlElement: HTMLElement;
HTMLIFrameElement: HTMLElement;
HTMLImageElement: HTMLElement;
HTMLInputElement: HTMLElement;
HTMLLIElement: HTMLElement;
HTMLLabelElement: HTMLElement;
HTMLLegendElement: HTMLElement;
HTMLLinkElement: HTMLElement;
HTMLMapElement: HTMLElement;
HTMLMarqueeElement: HTMLElement;
HTMLMediaElement: HTMLElement;
HTMLMenuElement: HTMLElement;
HTMLMetaElement: HTMLElement;
HTMLMeterElement: HTMLElement;
HTMLModElement: HTMLElement;
HTMLOListElement: HTMLElement;
HTMLObjectElement: HTMLElement;
HTMLOptGroupElement: HTMLElement;
HTMLOptionElement: HTMLElement;
HTMLOptionsCollection: HTMLCollection;
HTMLOutputElement: HTMLElement;
HTMLParagraphElement: HTMLElement;
HTMLParamElement: HTMLElement;
HTMLPictureElement: HTMLElement;
HTMLPreElement: HTMLElement;
HTMLProgressElement: HTMLElement;
HTMLQuoteElement: HTMLElement;
HTMLScriptElement: HTMLElement;
HTMLSelectElement: HTMLElement;
HTMLSlotElement: HTMLElement;
HTMLSourceElement: HTMLElement;
HTMLSpanElement: HTMLElement;
HTMLStyleElement: HTMLElement;
HTMLTableCaptionElement: HTMLElement;
HTMLTableCellElement: HTMLElement;
HTMLTableColElement: HTMLElement;
HTMLTableElement: HTMLElement;
HTMLTableRowElement: HTMLElement;
HTMLTableSectionElement: HTMLElement;
HTMLTemplateElement: HTMLElement;
HTMLTextAreaElement: HTMLElement;
HTMLTimeElement: HTMLElement;
HTMLTitleElement: HTMLElement;
HTMLTrackElement: HTMLElement;
HTMLUListElement: HTMLElement;
HTMLUnknownElement: HTMLElement;
HTMLVideoElement: HTMLMediaElement;
HashChangeEvent: Event;
Headers;
HeadersIterator = "Headers Iterator";
Highlight;
HighlightIterator = "Highlight Iterator";
HighlightRegistry;
HighlightRegistryIterator = "HighlightRegistry Iterator";
History;
IDBCursor;
IDBCursorWithValue: IDBCursor;
IDBDatabase: EventTarget;
IDBFactory;
IDBIndex;
IDBKeyRange;
IDBRecord;
IDBObjectStore;
IDBOpenDBRequest: IDBRequest;
IDBRequest: EventTarget;
IDBTransaction: EventTarget;
IDBVersionChangeEvent: Event;
IdleDeadline;
IdleDetector: EventTarget;
Image;
ImageBitmapRenderingContext;
ImageBitmap;
ImageData;
InputEvent: UIEvent;
InterestEvent: Event;
IntersectionObserver;
IntersectionObserverEntry;
KeyboardEvent: UIEvent;
KeyframeEffect: AnimationEffect;
Lock;
LockManager;
Location;
MathMLElement: Element;
MediaCapabilities;
MediaDeviceInfo;
InputDeviceCapabilities;
InputDeviceInfo: MediaDeviceInfo;
MediaStreamTrack: EventTarget;
CanvasCaptureMediaStreamTrack: MediaStreamTrack;
MediaDevices: EventTarget;
MediaElementAudioSourceNode: AudioNode;
MediaError;
MediaKeySession: EventTarget;
MediaKeyStatusMap;
MediaKeySystemAccess;
MediaKeys;
MediaList;
MediaQueryList: EventTarget;
MediaQueryListEvent: Event;
MediaRecorder: EventTarget;
MediaSession;
MediaSourceHandle;
SourceBuffer: EventTarget;
SourceBufferList: EventTarget;
MediaSource: EventTarget;
MemoryInfo;
MIDIPort: EventTarget;
MIDIAccess: EventTarget;
MIDIInput: MIDIPort;
MIDIOutput: MIDIPort;
MIDIInputMap;
MIDIOutputMap;
MessageChannel;
MessageEvent: Event;
MessagePort: EventTarget;
ModelContext: EventTarget;
MimeType;
MimeTypeArray;
MouseEvent: UIEvent;
MutationObserver;
MutationRecord;
NamedNodeMap;
NavigateEvent: Event;
Navigation: EventTarget;
NavigationActivation;
NavigationCurrentEntryChangeEvent: Event;
NavigationDestination;
NavigationHistoryEntry: EventTarget;
NavigationPrecommitController;
NavigationPreloadManager;
NavigationTransition;
Navigator;
NavigatorUAData;
NetworkInformation: EventTarget;
Node: EventTarget;
NodeIterator;
NodeList;
Notification: EventTarget;
NotificationEvent: ExtendableEvent;
OfflineAudioCompletionEvent: Event;
AudioProcessingEvent: Event;
OfflineAudioContext: BaseAudioContext;
OffscreenCanvas;
OffscreenCanvasRenderingContext2D;
Option;
OscillatorNode: AudioScheduledSourceNode;
PageTransitionEvent: Event;
Path2D;
PaymentResponse: EventTarget;
LargestContentfulPaint: PerformanceEntry;
PerformanceEventTiming: PerformanceEntry;
PerformancePaintTiming: PerformanceEntry;
PerformanceServerTiming;
Performance: EventTarget;
PerformanceEntry;
PerformanceMark: PerformanceEntry;
PerformanceMeasure: PerformanceEntry;
PerformanceNavigation;
PerformanceNavigationTiming: PerformanceResourceTiming;
PerformanceObserver;
PerformanceObserverEntryList;
PerformanceResourceTiming: PerformanceEntry;
PerformanceTiming;
PeriodicSyncEvent: ExtendableEvent;
PeriodicSyncManager;
PermissionStatus: EventTarget;
Permissions;
Plugin;
PluginArray;
PointerEvent: MouseEvent;
PopStateEvent: Event;
ProcessingInstruction: CharacterData;
ProgressEvent: Event;
PromiseRejectionEvent: Event;
PushEvent: ExtendableEvent;
PushManager;
PushMessageData;
PushSubscription;
PushSubscriptionOptions;
QuotaExceededError: DOMException;
RTCCertificate;
RTCDataChannel: EventTarget;
RTCDTMFSender: EventTarget;
RTCDtlsTransport: EventTarget;
RTCError: DOMException;
RTCErrorEvent: Event;
RTCIceCandidate;
RTCIceTransport: EventTarget;
RTCEncodedAudioFrame;
RTCEncodedVideoFrame;
RTCPeerConnection: EventTarget;
RTCPeerConnectionIceEvent: Event;
RTCDataChannelEvent: Event;
RTCPeerConnectionIceErrorEvent: Event;
RTCRtpReceiver;
RTCRtpSender;
RTCRtpTransceiver;
RTCSctpTransport: EventTarget;
RTCSessionDescription;
RTCStatsReport;
RadioNodeList: NodeList;
Range: AbstractRange;
ReadableByteStreamController;
ReadableStream;
ReadableStreamAsyncIterator = "ReadableStream AsyncIterator";
ReadableStreamBYOBReader;
ReadableStreamBYOBRequest;
ReadableStreamDefaultController;
ReadableStreamDefaultReader;
ReportBody;
Request;
RemotePlayback: EventTarget;
ResizeObserver;
ResizeObserverEntry;
ResizeObserverSize;
Response;
SVGAElement: SVGGraphicsElement;
SVGAnimationElement: SVGElement;
SVGAnimateElement: SVGAnimationElement;
SVGAnimateMotionElement: SVGAnimationElement;
SVGAnimateTransformElement: SVGAnimationElement;
SVGSetElement: SVGAnimationElement;
SVGAnimatedEnumeration;
SVGUnitTypes;
SVGAnimatedString;
SVGAnimatedLength;
SVGAnimatedLengthList;
SVGAnimatedBoolean;
SVGFEConvolveMatrixElement: SVGElement;
SVGAngle;
SVGAnimatedAngle;
SVGMarkerElement: SVGElement;
SVGAnimatedInteger;
SVGAnimatedRect;
SVGPreserveAspectRatio;
SVGAnimatedPreserveAspectRatio;
SVGAnimatedNumber;
SVGAnimatedNumberList;
SVGAnimatedTransformList;
SVGCircleElement: SVGGeometryElement;
SVGClipPathElement: SVGElement;
SVGFilterElement: SVGElement;
SVGMaskElement: SVGElement;
SVGViewElement: SVGElement;
SVGDefsElement: SVGGraphicsElement;
SVGDescElement: SVGElement;
SVGComponentTransferFunctionElement: SVGElement;
SVGFEFuncAElement: SVGComponentTransferFunctionElement;
SVGFEFuncBElement: SVGComponentTransferFunctionElement;
SVGFEFuncGElement: SVGComponentTransferFunctionElement;
SVGFEFuncRElement: SVGComponentTransferFunctionElement;
SVGFEBlendElement: SVGElement;
SVGFEColorMatrixElement: SVGElement;
SVGFECompositeElement: SVGElement;
SVGFEDisplacementMapElement: SVGElement;
SVGFEMorphologyElement: SVGElement;
SVGFETurbulenceElement: SVGElement;
SVGTextPathElement: SVGTextContentElement;
SVGFEDiffuseLightingElement: SVGElement;
SVGFEDistantLightElement: SVGElement;
SVGFEDropShadowElement: SVGElement;
SVGFEGaussianBlurElement: SVGElement;
SVGFEOffsetElement: SVGElement;
SVGFEPointLightElement: SVGElement;
SVGFESpecularLightingElement: SVGElement;
SVGFESpotLightElement: SVGElement;
SVGStopElement: SVGElement;
SVGElement: Element;
SVGEllipseElement: SVGGeometryElement;
SVGFEComponentTransferElement: SVGElement;
SVGFEFloodElement: SVGElement;
SVGFEImageElement: SVGElement;
SVGFEMergeElement: SVGElement;
SVGFEMergeNodeElement: SVGElement;
SVGFETileElement: SVGElement;
SVGForeignObjectElement: SVGGraphicsElement;
SVGGElement: SVGGraphicsElement;
SVGGeometryElement: SVGGraphicsElement;
SVGGradientElement: SVGElement;
SVGGraphicsElement: SVGElement;
SVGImageElement: SVGGraphicsElement;
SVGLength;
SVGLengthList;
SVGLineElement: SVGGeometryElement;
SVGLinearGradientElement: SVGGradientElement;
SVGMatrix;
SVGMetadataElement: SVGElement;
SVGMPathElement: SVGElement;
SVGNumber;
SVGNumberList;
SVGPathElement: SVGGeometryElement;
SVGPatternElement: SVGElement;
SVGPolygonElement: SVGGeometryElement;
SVGPolylineElement: SVGGeometryElement;
SVGRadialGradientElement: SVGGradientElement;
SVGRect;
SVGRectElement: SVGGeometryElement;
SVGSVGElement: SVGGraphicsElement;
SVGScriptElement: SVGElement;
SVGStyleElement: SVGElement;
SVGSwitchElement: SVGGraphicsElement;
SVGSymbolElement: SVGGraphicsElement;
SVGTSpanElement: SVGTextPositioningElement;
SVGTextContentElement: SVGGraphicsElement;
SVGTextElement: SVGTextPositioningElement;
SVGTextPositioningElement: SVGTextContentElement;
SVGTitleElement: SVGElement;
SVGPointList;
SVGStringList;
SVGTransform;
SVGTransformList;
SVGUseElement: SVGGraphicsElement;
Screen: EventTarget;
ScreenOrientation: EventTarget;
SecurityPolicyViolationEvent: Event;
Selection;
ServiceWorker: EventTarget;
ServiceWorkerContainer: EventTarget;
ServiceWorkerGlobalScope: WorkerGlobalScope;
ServiceWorkerRegistration: EventTarget;
ShadowRoot: DocumentFragment;
SharedWorker: EventTarget;
SharedWorkerGlobalScope: WorkerGlobalScope;
SpeechSynthesis: EventTarget;
SpeechSynthesisEvent: Event;
SpeechSynthesisErrorEvent: SpeechSynthesisEvent;
SpeechSynthesisUtterance: EventTarget;
SpeechSynthesisVoice;
StaticRange: AbstractRange;
Storage;
StorageAccessHandle;
StorageBucket;
StorageBucketManager;
StorageEstimate;
StorageEvent: Event;
StorageManager;
StylePropertyMapReadOnly;
StylePropertyMapReadOnlyIterator = "StylePropertyMapReadOnly Iterator";
StyleSheet;
StyleSheetList;
SubmitEvent: Event;
SubtleCrypto;
SyncEvent: ExtendableEvent;
SyncManager;
Text: CharacterData;
TextDecoder;
TextDecoderStream;
TextEncoder;
TextEncoderStream;
TextEvent: UIEvent;
TextMetrics;
TextTrack: EventTarget;
TextTrackCue: EventTarget;
TextTrackCueList;
TextTrackList: EventTarget;
ToggleEvent: Event;
TimeRanges;
VideoPlaybackQuality;
ToolActivatedEvent: Event;
ToolCancelEvent: Event;
Touch;
TouchEvent: UIEvent;
TouchList;
TrackEvent: Event;
TransformStream;
TransitionEvent: Event;
TransformStreamDefaultController;
TreeWalker;
TrustedHTML;
TrustedScript;
TrustedScriptURL;
TrustedTypePolicy;
TrustedTypePolicyFactory;
UIEvent: Event;
URL;
URLSearchParams;
URLSearchParamsIterator = "URLSearchParams Iterator";
UserActivation;
VideoDecoder: EventTarget;
VideoEncoder: EventTarget;
VTTCue: TextTrackCue;
ValidityState;
ViewTransition;
ViewTransitionTypeSet;
ViewTransitionTypeSetIterator = "ViewTransitionTypeSet Iterator";
VisualViewport: EventTarget;
WEBGLDebugRendererInfo = "WEBGL_debug_renderer_info";
WEBGLLoseContext = "WEBGL_lose_context";
WebGL2RenderingContext;
WebGLBuffer: WebGLObject;
WebGLFramebuffer: WebGLObject;
WebGLObject;
WebGLProgram: WebGLObject;
WebGLRenderbuffer: WebGLObject;
WebGLRenderingContext;
WebGLShader: WebGLObject;
WebGLShaderPrecisionFormat;
WebGLActiveInfo;
WebGLContextEvent: Event;
WebGLTexture: WebGLObject;
WebGLQuery: WebGLObject;
WebGLSampler: WebGLObject;
WebGLSync: WebGLObject;
WebGLTransformFeedback: WebGLObject;
WebGLVertexArrayObject: WebGLObject;
WebGLUniformLocation;
WebTransportError: DOMException;
WebTransportBidirectionalStream;
WebTransportDatagramDuplexStream;
WebSocket: EventTarget;
WebSocketError: DOMException;
WebSocketStream;
WheelEvent: MouseEvent;
Window: EventTarget;
WindowClient: Client;
Worker: EventTarget;
WorkerGlobalScope: EventTarget;
WorkerLocation;
WorkerNavigator;
WritableStream;
WritableStreamDefaultController;
WritableStreamDefaultWriter;
XMLDocument: Document;
XMLHttpRequest: XMLHttpRequestEventTarget;
XMLHttpRequestEventTarget: EventTarget;
XMLHttpRequestUpload: XMLHttpRequestEventTarget;
XMLSerializer;
XPathEvaluator;
XPathExpression;
XPathResult;
}
/// Resolve dynamic native factory choices through the same catalog as derives.
/// `name` must come from native metadata, never a JavaScript prototype or tag.
pub(crate) fn initialize<'s>(
scope: &mut v8::PinScope<'s, '_>,
object: v8::Local<'s, v8::Object>,
name: &str,
) -> Result<(), BindError> {
descriptor(name)
.ok_or_else(|| BindError::new(format!("unknown native interface `{name}`")))?
.initialize(scope, object)
}