diff options
Diffstat (limited to 'components/script')
464 files changed, 17 insertions, 25082 deletions
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 2934bfec419..9b2cf1519d5 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -21,17 +21,12 @@ tracing = ["dep:tracing"] webgl_backtrace = ["canvas_traits/webgl_backtrace"] js_backtrace = [] refcell_backtrace = ["accountable-refcell"] -webxr = ["webxr-api"] -webgpu = [] +webxr = ["webxr-api", "script_bindings/webxr"] +webgpu = ["script_bindings/webgpu"] [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(crown)'] } -[build-dependencies] -phf_codegen = "0.11" -phf_shared = "0.11" -serde_json = { workspace = true } - [dependencies] aes = { workspace = true } aes-kw = { workspace = true } @@ -99,6 +94,7 @@ range = { path = "../range" } ref_filter_map = "1.0.1" regex = { workspace = true } ring = { workspace = true } +script_bindings = { path = "../script_bindings" } script_layout_interface = { workspace = true } script_traits = { workspace = true } selectors = { workspace = true } diff --git a/components/script/build.rs b/components/script/build.rs index 1635558b4b8..d8780ec56c0 100644 --- a/components/script/build.rs +++ b/components/script/build.rs @@ -2,121 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use std::fs::File; -use std::io::Write; -use std::path::PathBuf; -use std::process::Command; -use std::time::Instant; -use std::{env, fmt}; - -use phf_shared::{self, FmtConst}; -use serde_json::{self, Value}; +use std::env; fn main() { - let start = Instant::now(); - - let style_out_dir = PathBuf::from(env::var_os("DEP_SERVO_STYLE_CRATE_OUT_DIR").unwrap()); - let css_properties_json = style_out_dir.join("css-properties.json"); - let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); - - println!("cargo::rerun-if-changed=dom/webidls"); - println!("cargo::rerun-if-changed=dom/bindings/codegen"); - println!("cargo::rerun-if-changed={}", css_properties_json.display()); - println!("cargo::rerun-if-changed=../../third_party/WebIDL/WebIDL.py"); - // NB: We aren't handling changes in `third_party/ply` here. - - let status = Command::new(find_python()) - .arg("dom/bindings/codegen/run.py") - .arg(&css_properties_json) - .arg(&out_dir) - .status() - .unwrap(); - if !status.success() { - std::process::exit(1) - } - - println!("Binding generation completed in {:?}", start.elapsed()); - - let json = out_dir.join("InterfaceObjectMapData.json"); - let json: Value = serde_json::from_reader(File::open(json).unwrap()).unwrap(); - let mut map = phf_codegen::Map::new(); - for (key, value) in json.as_object().unwrap() { - map.entry(Bytes(key), value.as_str().unwrap()); - } - let phf = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("InterfaceObjectMapPhf.rs"); - let mut phf = File::create(phf).unwrap(); - writeln!( - &mut phf, - "pub(crate) static MAP: phf::Map<&'static [u8], fn(JSContext, HandleObject)> = {};", - map.build(), - ) - .unwrap(); -} - -#[derive(Eq, Hash, PartialEq)] -struct Bytes<'a>(&'a str); - -impl FmtConst for Bytes<'_> { - fn fmt_const(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "b\"{}\"", self.0) - } -} - -impl phf_shared::PhfHash for Bytes<'_> { - fn phf_hash<H: std::hash::Hasher>(&self, hasher: &mut H) { - self.0.as_bytes().phf_hash(hasher) - } -} - -/// Tries to find a suitable python -/// -/// Algorithm -/// 1. Trying to find python3/python in $VIRTUAL_ENV (this should be from Servo's venv) -/// 2. Checking PYTHON3 (set by mach) -/// 3. Falling back to the system installation. -/// -/// Note: This function should be kept in sync with the version in `components/servo/build.rs` -fn find_python() -> PathBuf { - let mut candidates = vec![]; - if let Some(venv) = env::var_os("VIRTUAL_ENV") { - let bin_directory = PathBuf::from(venv).join("bin"); - - let python3 = bin_directory.join("python3"); - if python3.exists() { - candidates.push(python3); - } - let python = bin_directory.join("python"); - if python.exists() { - candidates.push(python); - } - }; - if let Some(python3) = env::var_os("PYTHON3") { - let python3 = PathBuf::from(python3); - if python3.exists() { - candidates.push(python3); - } - } - - let system_python = ["python3", "python"].map(PathBuf::from); - candidates.extend_from_slice(&system_python); - - for name in &candidates { - // Command::new() allows us to omit the `.exe` suffix on windows - if Command::new(name) - .arg("--version") - .output() - .is_ok_and(|out| out.status.success()) - { - return name.to_owned(); - } - } - let candidates = candidates - .into_iter() - .map(|c| c.into_os_string()) - .collect::<Vec<_>>(); - panic!( - "Can't find python (tried {:?})! Try enabling Servo's Python venv, \ - setting the PYTHON3 env var or adding python3 to PATH.", - candidates.join(", ".as_ref()) - ) + println!( + "cargo:rustc-env=BINDINGS_OUT_DIR={}", + env::var("DEP_SCRIPT_BINDINGS_CRATE_OUT_DIR").unwrap(), + ); } diff --git a/components/script/dom/bindings/codegen/Bindings.conf b/components/script/dom/bindings/codegen/Bindings.conf deleted file mode 100644 index 6d52f5634d9..00000000000 --- a/components/script/dom/bindings/codegen/Bindings.conf +++ /dev/null @@ -1,615 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -# DOM Bindings Configuration. -# -# The WebIDL interfaces are defined in dom/webidls. For each such interface, -# there is a corresponding entry in the configuration table below. -# The configuration table maps each interface name to a |descriptor|. -# -# Valid fields for all descriptors: -# * outerObjectHook: string to use in place of default value for outerObject and thisObject -# JS class hooks - -DOMInterfaces = { - -'AbstractRange': { - 'weakReferenceable': True, -}, - -'AudioContext': { - 'inRealms': ['Close', 'Suspend'], - 'canGc':['CreateMediaStreamDestination', 'CreateMediaElementSource', 'CreateMediaStreamSource', 'CreateMediaStreamTrackSource', 'Suspend', 'Close'], -}, - -'BaseAudioContext': { - 'inRealms': ['DecodeAudioData', 'Resume', 'ParseFromString', 'GetBounds', 'GetClientRects'], - 'canGc': ['CreateChannelMerger', 'CreateOscillator', 'CreateStereoPanner', 'CreateGain', 'CreateIIRFilter', 'CreateBiquadFilter', 'CreateBufferSource', 'CreateAnalyser', 'CreatePanner', 'CreateChannelSplitter', 'CreateBuffer', 'CreateConstantSource', 'Resume', 'DecodeAudioData'], -}, - -'Blob': { - 'weakReferenceable': True, - 'canGc': ['Slice', 'Text', 'ArrayBuffer', 'Stream'], -}, - -'Bluetooth': { - 'inRealms': ['GetAvailability', 'RequestDevice'], - 'canGc': ['RequestDevice', 'GetAvailability'], -}, - -'BluetoothDevice': { - 'inRealms': ['WatchAdvertisements'], - 'canGc': ['WatchAdvertisements'], -}, - -'BluetoothRemoteGATTCharacteristic': { - 'inRealms': ['ReadValue', 'StartNotifications', 'StopNotifications', 'WriteValue'], - 'canGc': ['GetDescriptor', 'GetDescriptors', 'ReadValue', 'StartNotifications', 'StopNotifications', 'WriteValue'], -}, - -'BluetoothRemoteGATTDescriptor': { - 'inRealms': ['ReadValue', 'WriteValue'], - 'canGc': ['ReadValue', 'WriteValue'], -}, - -'BluetoothRemoteGATTServer': { - 'inRealms': ['Connect'], - 'canGc': ['GetPrimaryService', 'GetPrimaryServices', 'Connect', 'Disconnect'], -}, - -'BluetoothRemoteGATTService': { - 'canGc': ['GetCharacteristic', 'GetCharacteristics', 'GetIncludedService', 'GetIncludedServices'], -}, - -'CanvasGradient': { - 'canGc': ['AddColorStop'], -}, - -'CanvasRenderingContext2D': { - 'canGc': ['GetTransform','GetImageData', 'CreateImageData', 'CreateImageData_', 'SetFont', 'FillText', 'MeasureText', 'SetStrokeStyle', 'SetFillStyle', 'SetShadowColor'], -}, - -'CharacterData': { - 'canGc': ['Before', 'After', 'ReplaceWith'] -}, - -'CSSStyleDeclaration': { - 'canGc': ['RemoveProperty', 'SetCssText', 'GetPropertyValue', 'SetProperty', 'CssFloat', 'SetCssFloat'] -}, - -'CustomElementRegistry': { - 'inRealms': ['WhenDefined'], - 'canGc': ['WhenDefined'], -}, - -'DataTransfer': { - 'canGc': ['Files'] -}, - -'DataTransferItem': { - 'canGc': ['GetAsFile'] -}, - -'DataTransferItemList': { - 'canGc': ['IndexedGetter', 'Add', 'Add_'] -}, - -'Document': { - 'canGc': ['Close', 'CreateElement', 'CreateElementNS', 'ImportNode', 'SetTitle', 'Write', 'Writeln', 'CreateEvent', 'CreateRange', 'Open', 'Open_', 'CreateComment', 'CreateAttribute', 'CreateAttributeNS', 'CreateDocumentFragment', 'CreateTextNode', 'CreateCDATASection', 'CreateProcessingInstruction', 'Prepend', 'Append', 'ReplaceChildren', 'SetBgColor', 'SetFgColor', 'Fonts', 'ElementFromPoint', 'ElementsFromPoint', 'ExitFullscreen', 'CreateExpression', 'CreateNSResolver', 'Evaluate'], -}, - -'DocumentFragment': { - 'canGc': ['Prepend', 'Append', 'ReplaceChildren'] -}, - -'DocumentType': { - 'canGc': ['Before', 'After', 'ReplaceWith'] -}, - -'DOMImplementation': { - 'canGc': ['CreateDocument', 'CreateHTMLDocument', 'CreateDocumentType'], -}, - -'DOMMatrix': { - 'canGc': ['FromMatrix', 'FromFloat32Array', 'FromFloat64Array'], -}, - -'DOMMatrixReadOnly': { - 'canGc': ['Multiply', 'Inverse', 'Scale', 'Translate', 'Rotate', 'RotateFromVector','FlipY', 'ScaleNonUniform', 'Scale3d', 'RotateAxisAngle', 'SkewX', 'SkewY', 'FlipX', 'TransformPoint', 'FromFloat32Array', 'FromFloat64Array','FromMatrix'], -}, - -'DOMParser': { - 'canGc': ['ParseFromString'], -}, - -'DOMPoint': { - 'canGc': ['FromPoint'], -}, - -'DOMPointReadOnly': { - 'canGc': ['FromPoint'], -}, - -'DOMQuad': { - 'canGc': ['FromRect', 'FromQuad', 'GetBounds'], -}, - -'DOMStringMap': { - 'canGc': ['NamedSetter'] -}, - -"DOMTokenList": { - 'canGc': ['SetValue', 'Add', 'Remove', 'Toggle', 'Replace'] -}, - -'DynamicModuleOwner': { - 'inRealms': ['PromiseAttribute'], -}, - -'Element': { - 'canGc': ['SetInnerHTML', 'SetOuterHTML', 'InsertAdjacentHTML', 'GetClientRects', 'GetBoundingClientRect', 'InsertAdjacentText', 'ToggleAttribute', 'SetAttribute', 'SetAttributeNS', 'SetId','SetClassName','Prepend','Append','ReplaceChildren','Before','After','ReplaceWith', 'SetRole', 'SetAriaAtomic', 'SetAriaAutoComplete', 'SetAriaBrailleLabel', 'SetAriaBrailleRoleDescription', 'SetAriaBusy', 'SetAriaChecked', 'SetAriaColCount', 'SetAriaColIndex', 'SetAriaColIndexText', 'SetAriaColSpan', 'SetAriaCurrent', 'SetAriaDescription', 'SetAriaDisabled', 'SetAriaExpanded', 'SetAriaHasPopup', 'SetAriaHidden', 'SetAriaInvalid', 'SetAriaKeyShortcuts', 'SetAriaLabel', 'SetAriaLevel', 'SetAriaLive', 'SetAriaModal', 'SetAriaMultiLine', 'SetAriaMultiSelectable', 'SetAriaOrientation', 'SetAriaPlaceholder', 'SetAriaPosInSet', 'SetAriaPressed','SetAriaReadOnly', 'SetAriaRelevant', 'SetAriaRequired', 'SetAriaRoleDescription', 'SetAriaRowCount', 'SetAriaRowIndex', 'SetAriaRowIndexText', 'SetAriaRowSpan', 'SetAriaSelected', 'SetAriaSetSize','SetAriaSort', 'SetAriaValueMax', 'SetAriaValueMin', 'SetAriaValueNow', 'SetAriaValueText', 'SetScrollTop', 'SetScrollLeft', 'Scroll', 'Scroll_', 'ScrollBy', 'ScrollBy_', 'ScrollWidth', 'ScrollHeight', 'ScrollTop', 'ScrollLeft', 'ClientTop', 'ClientLeft', 'ClientWidth', 'ClientHeight', 'RequestFullscreen'], -}, - -'ElementInternals': { - 'canGc': ['CheckValidity', 'ReportValidity'], -}, - -'EventSource': { - 'weakReferenceable': True, -}, - -'EventTarget': { - 'canGc': ['DispatchEvent'], -}, - -'FakeXRDevice': { - 'canGc': ['Disconnect'], -}, - -'File': { - 'weakReferenceable': True, -}, - -'FileReader': { - 'canGc': ['Abort'], -}, - -'GamepadHapticActuator': { - 'inRealms': ['PlayEffect', 'Reset'], - 'canGc': ['PlayEffect', 'Reset'], -}, - -'GPU': { - 'inRealms': ['RequestAdapter'], - 'canGc': ['RequestAdapter', 'WgslLanguageFeatures'], -}, - -'GPUAdapter': { - 'inRealms': ['RequestAdapterInfo', 'RequestDevice'], - 'canGc': ['RequestAdapterInfo', 'RequestDevice'], -}, - -'GPUBuffer': { - 'inRealms': ['MapAsync'], - 'canGc': ['MapAsync'], -}, - -'GPUCanvasContext': { - 'weakReferenceable': True, -}, - -'GPUDevice': { - 'inRealms': [ - 'CreateComputePipelineAsync', - 'CreateRenderPipelineAsync', - 'CreateShaderModule', # Creates promise for compilation info - 'PopErrorScope' - ], - 'canGc': [ - 'CreateComputePipelineAsync', - 'CreateRenderPipelineAsync', - 'CreateShaderModule', - 'PopErrorScope' - ], - 'weakReferenceable': True, # for usage in GlobalScope https://github.com/servo/servo/issues/32519 -}, - -'GPUQueue': { - 'canGc': ['OnSubmittedWorkDone'], -}, - -'History': { - 'canGc': ['Go'], -}, - -"HTMLAnchorElement": { - "canGc": ["SetText","SetRel","SetHref", 'SetHash', 'SetHost', 'SetHostname', 'SetPassword', 'SetPathname', 'SetPort', 'SetProtocol', 'SetSearch', 'SetUsername'] -}, - -"HTMLAreaElement": { - "canGc": ["SetRel"] -}, - -"HTMLBodyElement": { - "canGc": ["SetBackground"] -}, - -'HTMLButtonElement': { - 'canGc': ['CheckValidity', 'ReportValidity','SetBackground'], -}, - -'HTMLCanvasElement': { - 'canGc': ['CaptureStream', 'GetContext'], -}, - -'HTMLDialogElement': { - 'canGc': ['Show'], -}, - -'HTMLElement': { - 'canGc': ['Focus', 'Blur', 'Click', 'SetInnerText', 'SetOuterText', "SetTranslate", 'SetAutofocus', 'GetOffsetParent', 'OffsetTop', 'OffsetLeft', 'OffsetWidth', 'OffsetHeight', 'InnerText', 'GetOuterText', 'GetOnerror', 'GetOnload', 'GetOnblur', 'GetOnfocus', 'GetOnresize', 'GetOnscroll'], -}, - -'HTMLFieldSetElement': { - 'canGc': ['CheckValidity', 'ReportValidity'], -}, - -'HTMLFontElement': { - 'canGc': ['SetSize'] -}, - -'HTMLFormElement': { - 'canGc': ['CheckValidity', 'RequestSubmit', 'ReportValidity', 'Submit', 'Reset', 'SetRel'], -}, - -'HTMLImageElement': { - 'canGc': ['RequestSubmit', 'ReportValidity', 'Reset','SetRel', 'Width', 'Height', 'Decode', 'SetCrossOrigin', 'SetWidth', 'SetHeight', 'SetReferrerPolicy'], -}, - -'HTMLInputElement': { - 'canGc': ['ReportValidity', 'SetValue', 'SetValueAsNumber', 'SetValueAsDate', 'StepUp', 'StepDown', 'CheckValidity', 'ReportValidity', 'SelectFiles'], -}, - -'HTMLLinkElement': { - 'canGc': ['SetRel', 'SetCrossOrigin'], -}, - -'HTMLMediaElement': { - 'canGc': ['Load', 'Pause', 'Play', 'SetSrcObject', 'SetCrossOrigin'], - 'inRealms': ['Play'], -}, - -'HTMLMeterElement': { - 'canGc': ['SetValue', 'SetMin', 'SetMax', 'SetLow', 'SetHigh', 'SetOptimum', 'CheckValidity', 'ReportValidity'] -}, - -'HTMLObjectElement': { - 'canGc': ['CheckValidity', 'ReportValidity'], -}, - -'HTMLOptionElement': { - 'canGc': ['SetText'] -}, - -'HTMLOptionsCollection': { - 'canGc': ['IndexedSetter', 'SetLength'] -}, - -'HTMLOutputElement': { - 'canGc': ['ReportValidity', 'SetDefaultValue', 'SetValue', 'CheckValidity'], -}, - -'HTMLProgressElement': { - 'canGc': ['SetValue', 'SetMax'] -}, - -'HTMLScriptElement': { - 'canGc': ['SetAsync', 'SetCrossOrigin', 'SetText'] -}, - -'HTMLSelectElement': { - 'canGc': ['ReportValidity', 'SetLength', 'IndexedSetter', 'CheckValidity'], -}, - -'HTMLTableElement': { - 'canGc': ['CreateCaption', 'CreateTBody', 'InsertRow', 'InsertCell', 'InsertRow', 'CreateTHead', 'CreateTFoot'] -}, - -'HTMLTableRowElement': { - 'canGc': ['InsertCell'] -}, - -'HTMLTableSectionElement': { - 'canGc': ['InsertRow'] -}, - -'HTMLTemplateElement': { - 'canGc': ['Content'], -}, - -'HTMLTextAreaElement': { - 'canGc': ['ReportValidity', 'SetDefaultValue', 'CheckValidity'], -}, - -'HTMLTitleElement': { - 'canGc': ['SetText'] -}, - -'Location': { - 'canGc': ['Assign', 'Reload', 'Replace', 'SetHash', 'SetHost', 'SetHostname', 'SetHref', 'SetPathname', 'SetPort', 'SetProtocol', 'SetSearch'], -}, - -'MediaDevices': { - 'canGc': ['GetUserMedia', 'EnumerateDevices'], - 'inRealms': ['GetUserMedia', 'GetClientRects', 'GetBoundingClientRect'], -}, - -'MediaQueryList': { - 'weakReferenceable': True, -}, - -'MediaSession': { - 'canGc': ['GetMetadata'], -}, - -'MediaStream': { - 'canGc': ['Clone'], -}, - -'MessagePort': { - 'weakReferenceable': True, - 'canGc': ['GetOnmessage'], -}, - -'MouseEvent': { - 'canGc': ['OffsetX', 'OffsetY'], -}, - -'NavigationPreloadManager': { - 'inRealms': ['Disable', 'Enable', 'GetState', 'SetHeaderValue'], - 'canGc': ['Disable', 'Enable', 'GetState', 'SetHeaderValue'], -}, - -'Navigator': { - 'inRealms': ['GetVRDisplays'], -}, - -'Node': { - 'canGc': ['CloneNode', 'SetTextContent'], -}, - -'OfflineAudioContext': { - 'inRealms': ['StartRendering'], - 'canGc': ['StartRendering'], -}, - -'OffscreenCanvasRenderingContext2D': { - 'canGc': ['CreateImageData', 'CreateImageData_', 'GetImageData', 'GetTransform', 'SetFont', 'FillText', 'MeasureText', 'SetStrokeStyle', 'SetFillStyle', 'SetShadowColor'], -}, - -'PaintRenderingContext2D': { - 'canGc': ['GetTransform', 'SetStrokeStyle', 'SetFillStyle', 'SetShadowColor'], -}, - -'Performance': { - 'canGc': ['Mark', 'Measure'], -}, - -'Permissions': { - 'canGc': ['Query', 'Request', 'Revoke'], -}, - -'Promise': { - 'spiderMonkeyInterface': True, -}, - -'Range': { - 'canGc': ['CloneContents', 'CloneRange', 'CreateContextualFragment', 'ExtractContents', 'SurroundContents', 'InsertNode'], - 'weakReferenceable': True, -}, - -'Request': { - 'canGc': ['Headers', 'Text', 'Blob', 'FormData', 'Json', 'ArrayBuffer', 'Clone'], -}, - -'Response': { - 'canGc': ['Error', 'Redirect', 'Clone', 'Text', 'Blob', 'FormData', 'Json', 'ArrayBuffer', 'Headers'], -}, - -'RTCPeerConnection': { - 'inRealms': ['AddIceCandidate', 'CreateAnswer', 'CreateOffer', 'SetLocalDescription', 'SetRemoteDescription'], - 'canGc': ['Close', 'AddIceCandidate', 'CreateAnswer', 'CreateOffer', 'SetLocalDescription', 'SetRemoteDescription'], -}, - -'RTCRtpSender': { - 'canGc': ['SetParameters'], -}, - -'Selection': { - 'canGc': ['Collapse', 'CollapseToEnd', 'CollapseToStart', 'Extend', 'SelectAllChildren', 'SetBaseAndExtent', 'SetPosition'], -}, - -'ServiceWorkerContainer': { - 'inRealms': ['Register'], - 'canGc': ['Register'], -}, - -'ShadowRoot': { - 'canGc': ['ElementFromPoint', 'ElementsFromPoint', 'SetInnerHTML'], -}, - -'StaticRange': { - 'weakReferenceable': True, -}, - -'SubtleCrypto': { - 'inRealms': ['Encrypt', 'Decrypt', 'Sign', 'Verify', 'GenerateKey', 'DeriveKey', 'DeriveBits', 'Digest', 'ImportKey', 'ExportKey', 'WrapKey', 'UnwrapKey'], - 'canGc': ['Encrypt', 'Decrypt', 'Sign', 'Verify', 'GenerateKey', 'DeriveKey', 'DeriveBits', 'Digest', 'ImportKey', 'ExportKey', 'WrapKey', 'UnwrapKey'], -}, - -'SVGElement': { - 'canGc': ['SetAutofocus'] -}, - -#FIXME(jdm): This should be 'register': False, but then we don't generate enum types -'TestBinding': { - 'inRealms': ['PromiseAttribute', 'PromiseNativeHandler'], - 'canGc': ['InterfaceAttribute', 'GetInterfaceAttributeNullable', 'ReceiveInterface', 'ReceiveInterfaceSequence', 'ReceiveNullableInterface', 'PromiseAttribute', 'PromiseNativeHandler'], -}, - -'TestWorklet': { - 'inRealms': ['AddModule'], - 'canGc': ['AddModule'], -}, - -'Text': { - 'canGc': ['SplitText'] -}, - -'URL': { - 'weakReferenceable': True, - 'canGc': ['Parse', 'SearchParams'], -}, - -'WebGLRenderingContext': { - 'canGc': ['MakeXRCompatible'], -}, - -'WebGL2RenderingContext': { - 'canGc': ['MakeXRCompatible'], -}, - -'Window': { - 'canGc': ['Stop', 'Fetch', 'Scroll', 'Scroll_','ScrollBy', 'ScrollBy_', 'Stop', 'Fetch', 'Open', 'CreateImageBitmap'], - 'inRealms': ['Fetch', 'GetOpener'], -}, - -'WindowProxy' : { - 'path': 'crate::dom::windowproxy::WindowProxy', - 'register': False, -}, - -'WorkerGlobalScope': { - 'inRealms': ['Fetch'], - 'canGc': ['Fetch', 'CreateImageBitmap', 'ImportScripts'], -}, - -'Worklet': { - 'inRealms': ['AddModule'], - 'canGc': ['AddModule'], -}, - -'XMLHttpRequest': { - 'canGc': ['Abort', 'GetResponseXML', 'Response', 'Send'], -}, - -'XPathEvaluator': { - 'canGc': ['CreateExpression', 'Evaluate'], -}, - -'XPathExpression': { - 'canGc': ['Evaluate'], -}, - -'XRBoundedReferenceSpace': { - 'canGc': ['BoundsGeometry'], -}, - -'XRFrame': { - 'canGc': ['GetViewerPose', 'GetPose', 'GetJointPose'], -}, - -'XRHitTestResult': { - 'canGc': ['GetPose'], -}, - -'XRRay': { - 'canGc': ['Origin', 'Direction'], -}, - -'XRReferenceSpace': { - 'canGc': ['GetOffsetReferenceSpace'], -}, - -'XRRigidTransform': { - 'canGc': ['Position', 'Orientation', 'Inverse'], -}, - -'XRSession': { - 'inRealms': ['RequestReferenceSpace', 'UpdateRenderState', 'UpdateTargetFrameRate'], - 'canGc': ['End', 'RequestReferenceSpace', 'UpdateTargetFrameRate', 'RequestHitTestSource'], -}, - -'XRSystem': { - 'inRealms': ['RequestSession'], - 'canGc': ['RequestSession', 'IsSessionSupported'], -}, - -'XRTest': { - 'canGc': ['SimulateDeviceConnection', 'DisconnectAllDevices'], -}, - -'ReadableStream': { - 'canGc': ['GetReader', 'Cancel', 'Tee'], -}, - -"ReadableStreamDefaultController": { - "canGc": ["Enqueue"] -}, - -"ReadableStreamBYOBReader": { - "canGc": ["Read", "Cancel"] -}, - -"ReadableStreamDefaultReader": { - "canGc": ["Read", "Cancel"] -}, - -} - -Dictionaries = { -'GPUCanvasConfiguration': { - 'derives': ['Clone'] -}, - -'GPUExtent3DDict': { - 'derives': ["MallocSizeOf"], -}, - -'GPUObjectDescriptorBase': { - 'derives': ['MallocSizeOf'] -}, - -'GPUTextureDescriptor': { - 'derives': ["MallocSizeOf"], -}, - -'HeadersInit': { - 'derives': ["Clone"], -}, -} - -Enums = { -'GPUFeatureName': { - 'derives': ['Hash', 'Eq'] -} -} - -Unions = { -'ByteStringSequenceSequenceOrByteStringByteStringRecord': { - 'derives': ['Clone'] -}, - -'HTMLCanvasElementOrOffscreenCanvas': { - 'derives': ['Clone', 'MallocSizeOf'] -}, - -'RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict': { - 'derives': ['MallocSizeOf'] -}, - -'StringOrUnsignedLong': { - 'derives': ['Clone'], -}, -} diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py deleted file mode 100644 index 8eb1ce2ce69..00000000000 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ /dev/null @@ -1,8502 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -# Common codegen classes. - -from collections import defaultdict -from itertools import groupby - -import operator -import os -import re -import string -import textwrap -import functools - -from WebIDL import ( - BuiltinTypes, - IDLBuiltinType, - IDLDefaultDictionaryValue, - IDLEmptySequenceValue, - IDLInterfaceMember, - IDLNullableType, - IDLNullValue, - IDLObject, - IDLPromiseType, - IDLType, - IDLUndefinedValue, - IDLWrapperType, -) - -from Configuration import ( - MakeNativeName, - MemberIsLegacyUnforgeable, - getModuleFromObject, - getTypesFromCallback, - getTypesFromDescriptor, - getTypesFromDictionary, - iteratorNativeType -) - -AUTOGENERATED_WARNING_COMMENT = "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n" -ALLOWED_WARNING_LIST = ['non_camel_case_types', 'non_upper_case_globals', 'unused_imports', - 'unused_variables', 'unused_assignments', 'unused_mut', - 'clippy::approx_constant', 'clippy::enum_variant_names', 'clippy::let_unit_value', - 'clippy::needless_return', 'clippy::too_many_arguments', 'clippy::unnecessary_cast', - 'clippy::upper_case_acronyms'] -ALLOWED_WARNINGS = f"#![allow({','.join(ALLOWED_WARNING_LIST)})]\n\n" - -FINALIZE_HOOK_NAME = '_finalize' -TRACE_HOOK_NAME = '_trace' -CONSTRUCT_HOOK_NAME = '_constructor' -HASINSTANCE_HOOK_NAME = '_hasInstance' - -RUST_KEYWORDS = {"abstract", "alignof", "as", "become", "box", "break", "const", "continue", - "else", "enum", "extern", "false", "final", "fn", "for", "if", "impl", "in", - "let", "loop", "macro", "match", "mod", "move", "mut", "offsetof", "override", - "priv", "proc", "pub", "pure", "ref", "return", "static", "self", "sizeof", - "struct", "super", "true", "trait", "type", "typeof", "unsafe", "unsized", - "use", "virtual", "where", "while", "yield"} - - -def toStringBool(arg): - return str(not not arg).lower() - - -def toBindingNamespace(arg): - """ - Namespaces are *_Bindings - - actual path is `codegen::Bindings::{toBindingModuleFile(name)}::{toBindingNamespace(name)}` - """ - return re.sub("((_workers)?$)", "_Binding\\1", MakeNativeName(arg)) - - -def toBindingModuleFile(arg): - """ - Module files are *Bindings - - actual path is `codegen::Bindings::{toBindingModuleFile(name)}::{toBindingNamespace(name)}` - """ - return re.sub("((_workers)?$)", "Binding\\1", MakeNativeName(arg)) - - -def toBindingModuleFileFromDescriptor(desc): - if desc.maybeGetSuperModule() is not None: - return toBindingModuleFile(desc.maybeGetSuperModule()) - else: - return toBindingModuleFile(desc.name) - - -def stripTrailingWhitespace(text): - tail = '\n' if text.endswith('\n') else '' - lines = text.splitlines() - for i in range(len(lines)): - lines[i] = lines[i].rstrip() - joined_lines = '\n'.join(lines) - return f"{joined_lines}{tail}" - - -def innerContainerType(type): - assert type.isSequence() or type.isRecord() - return type.inner.inner if type.nullable() else type.inner - - -def wrapInNativeContainerType(type, inner): - if type.isSequence(): - return CGWrapper(inner, pre="Vec<", post=">") - elif type.isRecord(): - key = type.inner.keyType if type.nullable() else type.keyType - return CGRecord(key, inner) - else: - raise TypeError(f"Unexpected container type {type}") - - -builtinNames = { - IDLType.Tags.bool: 'bool', - IDLType.Tags.int8: 'i8', - IDLType.Tags.int16: 'i16', - IDLType.Tags.int32: 'i32', - IDLType.Tags.int64: 'i64', - IDLType.Tags.uint8: 'u8', - IDLType.Tags.uint16: 'u16', - IDLType.Tags.uint32: 'u32', - IDLType.Tags.uint64: 'u64', - IDLType.Tags.unrestricted_float: 'f32', - IDLType.Tags.float: 'Finite<f32>', - IDLType.Tags.unrestricted_double: 'f64', - IDLType.Tags.double: 'Finite<f64>', - IDLType.Tags.int8array: 'Int8Array', - IDLType.Tags.uint8array: 'Uint8Array', - IDLType.Tags.int16array: 'Int16Array', - IDLType.Tags.uint16array: 'Uint16Array', - IDLType.Tags.int32array: 'Int32Array', - IDLType.Tags.uint32array: 'Uint32Array', - IDLType.Tags.float32array: 'Float32Array', - IDLType.Tags.float64array: 'Float64Array', - IDLType.Tags.arrayBuffer: 'ArrayBuffer', - IDLType.Tags.arrayBufferView: 'ArrayBufferView', - IDLType.Tags.uint8clampedarray: 'Uint8ClampedArray', -} - -numericTags = [ - IDLType.Tags.int8, IDLType.Tags.uint8, - IDLType.Tags.int16, IDLType.Tags.uint16, - IDLType.Tags.int32, IDLType.Tags.uint32, - IDLType.Tags.int64, IDLType.Tags.uint64, - IDLType.Tags.unrestricted_float, - IDLType.Tags.unrestricted_double -] - - -# We'll want to insert the indent at the beginnings of lines, but we -# don't want to indent empty lines. So only indent lines that have a -# non-newline character on them. -lineStartDetector = re.compile("^(?=[^\n#])", re.MULTILINE) - - -def indent(s, indentLevel=2): - """ - Indent C++ code. - - Weird secret feature: this doesn't indent lines that start with # (such as - #include lines or #ifdef/#endif). - """ - if s == "": - return s - return re.sub(lineStartDetector, indentLevel * " ", s) - - -# dedent() and fill() are often called on the same string multiple -# times. We want to memoize their return values so we don't keep -# recomputing them all the time. -def memoize(fn): - """ - Decorator to memoize a function of one argument. The cache just - grows without bound. - """ - cache = {} - - @functools.wraps(fn) - def wrapper(arg): - retval = cache.get(arg) - if retval is None: - retval = cache[arg] = fn(arg) - return retval - return wrapper - - -@memoize -def dedent(s): - """ - Remove all leading whitespace from s, and remove a blank line - at the beginning. - """ - if s.startswith('\n'): - s = s[1:] - return textwrap.dedent(s) - - -# This works by transforming the fill()-template to an equivalent -# string.Template. -fill_multiline_substitution_re = re.compile(r"( *)\$\*{(\w+)}(\n)?") - - -@memoize -def compile_fill_template(template): - """ - Helper function for fill(). Given the template string passed to fill(), - do the reusable part of template processing and return a pair (t, - argModList) that can be used every time fill() is called with that - template argument. - - argsModList is list of tuples that represent modifications to be - made to args. Each modification has, in order: i) the arg name, - ii) the modified name, iii) the indent depth. - """ - t = dedent(template) - assert t.endswith("\n") or "\n" not in t - argModList = [] - - def replace(match): - """ - Replaces a line like ' $*{xyz}\n' with '${xyz_n}', - where n is the indent depth, and add a corresponding entry to - argModList. - - Note that this needs to close over argModList, so it has to be - defined inside compile_fill_template(). - """ - indentation, name, nl = match.groups() - depth = len(indentation) - - # Check that $*{xyz} appears by itself on a line. - prev = match.string[:match.start()] - if (prev and not prev.endswith("\n")) or nl is None: - raise ValueError(f"Invalid fill() template: $*{name} must appear by itself on a line") - - # Now replace this whole line of template with the indented equivalent. - modified_name = f"{name}_{depth}" - argModList.append((name, modified_name, depth)) - return f"${{{modified_name}}}" - - t = re.sub(fill_multiline_substitution_re, replace, t) - return (string.Template(t), argModList) - - -def fill(template, **args): - """ - Convenience function for filling in a multiline template. - - `fill(template, name1=v1, name2=v2)` is a lot like - `string.Template(template).substitute({"name1": v1, "name2": v2})`. - - However, it's shorter, and has a few nice features: - - * If `template` is indented, fill() automatically dedents it! - This makes code using fill() with Python's multiline strings - much nicer to look at. - - * If `template` starts with a blank line, fill() strips it off. - (Again, convenient with multiline strings.) - - * fill() recognizes a special kind of substitution - of the form `$*{name}`. - - Use this to paste in, and automatically indent, multiple lines. - (Mnemonic: The `*` is for "multiple lines"). - - A `$*` substitution must appear by itself on a line, with optional - preceding indentation (spaces only). The whole line is replaced by the - corresponding keyword argument, indented appropriately. If the - argument is an empty string, no output is generated, not even a blank - line. - """ - - t, argModList = compile_fill_template(template) - # Now apply argModList to args - for (name, modified_name, depth) in argModList: - if not (args[name] == "" or args[name].endswith("\n")): - raise ValueError(f"Argument {name} with value {args[name]} is missing a newline") - args[modified_name] = indent(args[name], depth) - - return t.substitute(args) - - -class CGThing(): - """ - Abstract base class for things that spit out code. - """ - def __init__(self): - pass # Nothing for now - - def define(self): - """Produce code for a Rust file.""" - raise NotImplementedError # Override me! - - -class CGMethodCall(CGThing): - """ - A class to generate selection of a method signature from a set of - signatures and generation of a call to that signature. - """ - def __init__(self, argsPre, nativeMethodName, static, descriptor, method): - CGThing.__init__(self) - - methodName = f'\\"{descriptor.interface.identifier.name}.{method.identifier.name}\\"' - - def requiredArgCount(signature): - arguments = signature[1] - if len(arguments) == 0: - return 0 - requiredArgs = len(arguments) - while requiredArgs and arguments[requiredArgs - 1].optional: - requiredArgs -= 1 - return requiredArgs - - signatures = method.signatures() - - def getPerSignatureCall(signature, argConversionStartsAt=0): - signatureIndex = signatures.index(signature) - return CGPerSignatureCall(signature[0], argsPre, signature[1], - f"{nativeMethodName}{'_' * signatureIndex}", - static, descriptor, - method, argConversionStartsAt) - - if len(signatures) == 1: - # Special case: we can just do a per-signature method call - # here for our one signature and not worry about switching - # on anything. - signature = signatures[0] - self.cgRoot = CGList([getPerSignatureCall(signature)]) - requiredArgs = requiredArgCount(signature) - - if requiredArgs > 0: - code = ( - f"if argc < {requiredArgs} {{\n" - f" throw_type_error(*cx, \"Not enough arguments to {methodName}.\");\n" - " return false;\n" - "}") - self.cgRoot.prepend( - CGWrapper(CGGeneric(code), pre="\n", post="\n")) - - return - - # Need to find the right overload - maxArgCount = method.maxArgCount - allowedArgCounts = method.allowedArgCounts - - argCountCases = [] - for argCount in allowedArgCounts: - possibleSignatures = method.signaturesForArgCount(argCount) - if len(possibleSignatures) == 1: - # easy case! - signature = possibleSignatures[0] - argCountCases.append(CGCase(str(argCount), getPerSignatureCall(signature))) - continue - - distinguishingIndex = method.distinguishingIndexForArgCount(argCount) - - # We can't handle unions of non-object values at the distinguishing index. - for (returnType, args) in possibleSignatures: - type = args[distinguishingIndex].type - if type.isUnion(): - if type.nullable(): - type = type.inner - for type in type.flatMemberTypes: - if not (type.isObject() or type.isNonCallbackInterface()): - raise TypeError("No support for unions with non-object variants " - f"as distinguishing arguments yet: {args[distinguishingIndex].location}", - ) - - # Convert all our arguments up to the distinguishing index. - # Doesn't matter which of the possible signatures we use, since - # they all have the same types up to that point; just use - # possibleSignatures[0] - caseBody = [ - CGArgumentConverter(possibleSignatures[0][1][i], - i, "args", "argc", descriptor) - for i in range(0, distinguishingIndex)] - - # Select the right overload from our set. - distinguishingArg = f"HandleValue::from_raw(args.get({distinguishingIndex}))" - - def pickFirstSignature(condition, filterLambda): - sigs = list(filter(filterLambda, possibleSignatures)) - assert len(sigs) < 2 - if len(sigs) > 0: - call = getPerSignatureCall(sigs[0], distinguishingIndex) - if condition is None: - caseBody.append(call) - else: - caseBody.append(CGGeneric(f"if {condition} {{")) - caseBody.append(CGIndenter(call)) - caseBody.append(CGGeneric("}")) - return True - return False - - # First check for null or undefined - pickFirstSignature(f"{distinguishingArg}.get().is_null_or_undefined()", - lambda s: (s[1][distinguishingIndex].type.nullable() - or s[1][distinguishingIndex].type.isDictionary())) - - # Now check for distinguishingArg being an object that implements a - # non-callback interface. That includes typed arrays and - # arraybuffers. - interfacesSigs = [ - s for s in possibleSignatures - if (s[1][distinguishingIndex].type.isObject() - or s[1][distinguishingIndex].type.isUnion() - or s[1][distinguishingIndex].type.isNonCallbackInterface())] - # There might be more than one of these; we need to check - # which ones we unwrap to. - - if len(interfacesSigs) > 0: - # The spec says that we should check for "platform objects - # implementing an interface", but it's enough to guard on these - # being an object. The code for unwrapping non-callback - # interfaces and typed arrays will just bail out and move on to - # the next overload if the object fails to unwrap correctly. We - # could even not do the isObject() check up front here, but in - # cases where we have multiple object overloads it makes sense - # to do it only once instead of for each overload. That will - # also allow the unwrapping test to skip having to do codegen - # for the null-or-undefined case, which we already handled - # above. - caseBody.append(CGGeneric(f"if {distinguishingArg}.get().is_object() {{")) - for idx, sig in enumerate(interfacesSigs): - caseBody.append(CGIndenter(CGGeneric("'_block: {"))) - type = sig[1][distinguishingIndex].type - - # The argument at index distinguishingIndex can't possibly - # be unset here, because we've already checked that argc is - # large enough that we can examine this argument. - info = getJSToNativeConversionInfo( - type, descriptor, failureCode="break '_block;", isDefinitelyObject=True) - template = info.template - declType = info.declType - - testCode = instantiateJSToNativeConversionTemplate( - template, - {"val": distinguishingArg}, - declType, - f"arg{distinguishingIndex}", - needsAutoRoot=type_needs_auto_root(type)) - - # Indent by 4, since we need to indent further than our "do" statement - caseBody.append(CGIndenter(testCode, 4)) - # If we got this far, we know we unwrapped to the right - # interface, so just do the call. Start conversion with - # distinguishingIndex + 1, since we already converted - # distinguishingIndex. - caseBody.append(CGIndenter( - getPerSignatureCall(sig, distinguishingIndex + 1), 4)) - caseBody.append(CGIndenter(CGGeneric("}"))) - - caseBody.append(CGGeneric("}")) - - # XXXbz Now we're supposed to check for distinguishingArg being - # an array or a platform object that supports indexed - # properties... skip that last for now. It's a bit of a pain. - pickFirstSignature(f"{distinguishingArg}.get().is_object() && is_array_like(*cx, {distinguishingArg})", - lambda s: - (s[1][distinguishingIndex].type.isSequence() - or s[1][distinguishingIndex].type.isObject())) - - # Check for vanilla JS objects - # XXXbz Do we need to worry about security wrappers? - pickFirstSignature(f"{distinguishingArg}.get().is_object()", - lambda s: (s[1][distinguishingIndex].type.isCallback() - or s[1][distinguishingIndex].type.isCallbackInterface() - or s[1][distinguishingIndex].type.isDictionary() - or s[1][distinguishingIndex].type.isObject())) - - # The remaining cases are mutually exclusive. The - # pickFirstSignature calls are what change caseBody - # Check for strings or enums - if pickFirstSignature(None, - lambda s: (s[1][distinguishingIndex].type.isString() - or s[1][distinguishingIndex].type.isEnum())): - pass - # Check for primitives - elif pickFirstSignature(None, - lambda s: s[1][distinguishingIndex].type.isPrimitive()): - pass - # Check for "any" - elif pickFirstSignature(None, - lambda s: s[1][distinguishingIndex].type.isAny()): - pass - else: - # Just throw; we have no idea what we're supposed to - # do with this. - caseBody.append(CGGeneric("throw_type_error(*cx, \"Could not convert JavaScript argument\");\n" - "return false;")) - - argCountCases.append(CGCase(str(argCount), - CGList(caseBody, "\n"))) - - overloadCGThings = [] - overloadCGThings.append( - CGGeneric(f"let argcount = cmp::min(argc, {maxArgCount});")) - overloadCGThings.append( - CGSwitch("argcount", - argCountCases, - CGGeneric(f"throw_type_error(*cx, \"Not enough arguments to {methodName}.\");\n" - "return false;"))) - # XXXjdm Avoid unreachable statement warnings - # overloadCGThings.append( - # CGGeneric('panic!("We have an always-returning default case");\n' - # 'return false;')) - self.cgRoot = CGWrapper(CGList(overloadCGThings, "\n"), - pre="\n") - - def define(self): - return self.cgRoot.define() - - -def dictionaryHasSequenceMember(dictionary): - return (any(typeIsSequenceOrHasSequenceMember(m.type) for m in - dictionary.members) - or (dictionary.parent - and dictionaryHasSequenceMember(dictionary.parent))) - - -def typeIsSequenceOrHasSequenceMember(type): - if type.nullable(): - type = type.inner - if type.isSequence(): - return True - if type.isDictionary(): - return dictionaryHasSequenceMember(type.inner) - if type.isUnion(): - return any(typeIsSequenceOrHasSequenceMember(m.type) for m in - type.flatMemberTypes) - return False - - -def union_native_type(t): - name = t.unroll().name - return f'UnionTypes::{name}' - - -# Unfortunately, .capitalize() on a string will lowercase things inside the -# string, which we do not want. -def firstCap(string): - return f"{string[0].upper()}{string[1:]}" - - -class JSToNativeConversionInfo(): - """ - An object representing information about a JS-to-native conversion. - """ - def __init__(self, template, default=None, declType=None): - """ - template: A string representing the conversion code. This will have - template substitution performed on it as follows: - - ${val} is a handle to the JS::Value in question - - default: A string or None representing rust code for default value(if any). - - declType: A CGThing representing the native C++ type we're converting - to. This is allowed to be None if the conversion code is - supposed to be used as-is. - """ - assert isinstance(template, str) - assert declType is None or isinstance(declType, CGThing) - self.template = template - self.default = default - self.declType = declType - - -def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, - isDefinitelyObject=False, - isMember=False, - isArgument=False, - isAutoRooted=False, - invalidEnumValueFatal=True, - defaultValue=None, - exceptionCode=None, - allowTreatNonObjectAsNull=False, - isCallbackReturnValue=False, - sourceDescription="value"): - """ - Get a template for converting a JS value to a native object based on the - given type and descriptor. If failureCode is given, then we're actually - testing whether we can convert the argument to the desired type. That - means that failures to convert due to the JS value being the wrong type of - value need to use failureCode instead of throwing exceptions. Failures to - convert that are due to JS exceptions (from toString or valueOf methods) or - out of memory conditions need to throw exceptions no matter what - failureCode is. - - If isDefinitelyObject is True, that means we know the value - isObject() and we have no need to recheck that. - - isMember is `False`, "Dictionary", "Union" or "Variadic", and affects - whether this function returns code suitable for an on-stack rooted binding - or suitable for storing in an appropriate larger structure. - - invalidEnumValueFatal controls whether an invalid enum value conversion - attempt will throw (if true) or simply return without doing anything (if - false). - - If defaultValue is not None, it's the IDL default value for this conversion - - If allowTreatNonObjectAsNull is true, then [TreatNonObjectAsNull] - extended attributes on nullable callback functions will be honored. - - The return value from this function is an object of JSToNativeConversionInfo consisting of four things: - - 1) A string representing the conversion code. This will have template - substitution performed on it as follows: - - ${val} replaced by an expression for the JS::Value in question - - 2) A string or None representing Rust code for the default value (if any). - - 3) A CGThing representing the native C++ type we're converting to - (declType). This is allowed to be None if the conversion code is - supposed to be used as-is. - - 4) A boolean indicating whether the caller has to root the result. - - """ - # We should not have a defaultValue if we know we're an object - assert not isDefinitelyObject or defaultValue is None - - isEnforceRange = type.hasEnforceRange() - isClamp = type.hasClamp() - if type.legacyNullToEmptyString: - treatNullAs = "EmptyString" - else: - treatNullAs = "Default" - - # If exceptionCode is not set, we'll just rethrow the exception we got. - # Note that we can't just set failureCode to exceptionCode, because setting - # failureCode will prevent pending exceptions from being set in cases when - # they really should be! - if exceptionCode is None: - exceptionCode = "return false;\n" - - if failureCode is None: - failOrPropagate = f"throw_type_error(*cx, &error);\n{exceptionCode}" - else: - failOrPropagate = failureCode - - def handleOptional(template, declType, default): - assert (defaultValue is None) == (default is None) - return JSToNativeConversionInfo(template, default, declType) - - # Helper functions for dealing with failures due to the JS value being the - # wrong type of value. - def onFailureNotAnObject(failureCode): - return CGWrapper( - CGGeneric( - failureCode - or (f'throw_type_error(*cx, "{firstCap(sourceDescription)} is not an object.");\n' - f'{exceptionCode}')), - post="\n") - - def onFailureNotCallable(failureCode): - return CGGeneric( - failureCode - or (f'throw_type_error(*cx, \"{firstCap(sourceDescription)} is not callable.\");\n' - f'{exceptionCode}')) - - # A helper function for handling default values. - def handleDefault(nullValue): - if defaultValue is None: - return None - - if isinstance(defaultValue, IDLNullValue): - assert type.nullable() - return nullValue - elif isinstance(defaultValue, IDLDefaultDictionaryValue): - assert type.isDictionary() - return nullValue - elif isinstance(defaultValue, IDLEmptySequenceValue): - assert type.isSequence() - return "Vec::new()" - - raise TypeError("Can't handle non-null, non-empty sequence or non-empty dictionary default value here") - - # A helper function for wrapping up the template body for - # possibly-nullable objecty stuff - def wrapObjectTemplate(templateBody, nullValue, isDefinitelyObject, type, - failureCode=None): - if not isDefinitelyObject: - # Handle the non-object cases by wrapping up the whole - # thing in an if cascade. - templateBody = ( - "if ${val}.get().is_object() {\n" - f"{CGIndenter(CGGeneric(templateBody)).define()}\n") - if type.nullable(): - templateBody += ( - "} else if ${val}.get().is_null_or_undefined() {\n" - f" {nullValue}\n") - templateBody += ( - "} else {\n" - f"{CGIndenter(onFailureNotAnObject(failureCode)).define()}" - "}") - return templateBody - - assert not (isEnforceRange and isClamp) # These are mutually exclusive - - if type.isSequence() or type.isRecord(): - innerInfo = getJSToNativeConversionInfo(innerContainerType(type), - descriptorProvider, - isMember="Sequence", - isAutoRooted=isAutoRooted) - declType = wrapInNativeContainerType(type, innerInfo.declType) - config = getConversionConfigForType(type, innerContainerType(type).hasEnforceRange(), isClamp, treatNullAs) - - if type.nullable(): - declType = CGWrapper(declType, pre="Option<", post=" >") - - templateBody = (f"match FromJSValConvertible::from_jsval(*cx, ${{val}}, {config}) {{\n" - " Ok(ConversionResult::Success(value)) => value,\n" - " Ok(ConversionResult::Failure(error)) => {\n" - f"{indent(failOrPropagate, 8)}\n" - " }\n" - f" _ => {{ {exceptionCode} }},\n" - "}") - - return handleOptional(templateBody, declType, handleDefault("None")) - - if type.isUnion(): - declType = CGGeneric(union_native_type(type)) - if type.nullable(): - declType = CGWrapper(declType, pre="Option<", post=" >") - - templateBody = ("match FromJSValConvertible::from_jsval(*cx, ${val}, ()) {\n" - " Ok(ConversionResult::Success(value)) => value,\n" - " Ok(ConversionResult::Failure(error)) => {\n" - f"{indent(failOrPropagate, 8)}\n" - " }\n" - f" _ => {{ {exceptionCode} }},\n" - "}") - - dictionaries = [ - memberType - for memberType in type.unroll().flatMemberTypes - if memberType.isDictionary() - ] - if (defaultValue - and not isinstance(defaultValue, IDLNullValue) - and not isinstance(defaultValue, IDLDefaultDictionaryValue)): - tag = defaultValue.type.tag() - if tag is IDLType.Tags.bool: - boolean = "true" if defaultValue.value else "false" - default = f"{union_native_type(type)}::Boolean({boolean})" - elif tag is IDLType.Tags.usvstring: - default = f'{union_native_type(type)}::USVString(USVString("{defaultValue.value}".to_owned()))' - elif defaultValue.type.isEnum(): - enum = defaultValue.type.inner.identifier.name - default = f"{union_native_type(type)}::{enum}({enum}::{getEnumValueName(defaultValue.value)})" - else: - raise NotImplementedError("We don't currently support default values that aren't \ - null, boolean or default dictionary") - elif dictionaries: - if defaultValue: - assert isinstance(defaultValue, IDLDefaultDictionaryValue) - dictionary, = dictionaries - default = ( - f"{union_native_type(type)}::{dictionary.name}(" - f"{CGDictionary.makeModuleName(dictionary.inner)}::" - f"{CGDictionary.makeDictionaryName(dictionary.inner)}::empty())" - ) - else: - default = None - else: - default = handleDefault("None") - - return handleOptional(templateBody, declType, default) - - if type.isPromise(): - assert not type.nullable() - # Per spec, what we're supposed to do is take the original - # Promise.resolve and call it with the original Promise as this - # value to make a Promise out of whatever value we actually have - # here. The question is which global we should use. There are - # a couple cases to consider: - # - # 1) Normal call to API with a Promise argument. This is a case the - # spec covers, and we should be using the current Realm's - # Promise. That means the current realm. - # 2) Promise return value from a callback or callback interface. - # This is in theory a case the spec covers but in practice it - # really doesn't define behavior here because it doesn't define - # what Realm we're in after the callback returns, which is when - # the argument conversion happens. We will use the current - # realm, which is the realm of the callable (which - # may itself be a cross-realm wrapper itself), which makes - # as much sense as anything else. In practice, such an API would - # once again be providing a Promise to signal completion of an - # operation, which would then not be exposed to anyone other than - # our own implementation code. - templateBody = fill( - """ - { // Scope for our JSAutoRealm. - - rooted!(in(*cx) let globalObj = CurrentGlobalOrNull(*cx)); - let promiseGlobal = GlobalScope::from_object_maybe_wrapped(globalObj.handle().get(), *cx); - - rooted!(in(*cx) let mut valueToResolve = $${val}.get()); - if !JS_WrapValue(*cx, valueToResolve.handle_mut()) { - $*{exceptionCode} - } - match Promise::new_resolved(&promiseGlobal, cx, valueToResolve.handle()) { - Ok(value) => value, - Err(error) => { - throw_dom_exception(cx, &promiseGlobal, error); - $*{exceptionCode} - } - } - } - """, - exceptionCode=exceptionCode) - - if isArgument: - declType = CGGeneric("&Promise") - else: - declType = CGGeneric("Rc<Promise>") - return handleOptional(templateBody, declType, handleDefault("None")) - - if type.isGeckoInterface(): - assert not isEnforceRange and not isClamp - - descriptor = descriptorProvider.getDescriptor( - type.unroll().inner.identifier.name) - - if descriptor.interface.isCallback(): - name = descriptor.nativeType - declType = CGWrapper(CGGeneric(name), pre="Rc<", post=">") - template = f"{name}::new(cx, ${{val}}.get().to_object())" - if type.nullable(): - declType = CGWrapper(declType, pre="Option<", post=">") - template = wrapObjectTemplate(f"Some({template})", "None", - isDefinitelyObject, type, - failureCode) - - return handleOptional(template, declType, handleDefault("None")) - - conversionFunction = "root_from_handlevalue" - descriptorType = descriptor.returnType - if isMember == "Variadic": - conversionFunction = "native_from_handlevalue" - descriptorType = descriptor.nativeType - elif isArgument: - descriptorType = descriptor.argumentType - elif descriptor.interface.identifier.name == "WindowProxy": - conversionFunction = "windowproxy_from_handlevalue" - - if failureCode is None: - unwrapFailureCode = ( - f'throw_type_error(*cx, "{sourceDescription} does not ' - f'implement interface {descriptor.interface.identifier.name}.");\n' - f'{exceptionCode}') - else: - unwrapFailureCode = failureCode - - templateBody = fill( - """ - match ${function}($${val}, *cx) { - Ok(val) => val, - Err(()) => { - $*{failureCode} - } - } - """, - failureCode=unwrapFailureCode + "\n", - function=conversionFunction) - - declType = CGGeneric(descriptorType) - if type.nullable(): - templateBody = f"Some({templateBody})" - declType = CGWrapper(declType, pre="Option<", post=">") - - templateBody = wrapObjectTemplate(templateBody, "None", - isDefinitelyObject, type, failureCode) - - return handleOptional(templateBody, declType, handleDefault("None")) - - if is_typed_array(type): - if failureCode is None: - unwrapFailureCode = (f'throw_type_error(*cx, "{sourceDescription} is not a typed array.");\n' - f'{exceptionCode}') - else: - unwrapFailureCode = failureCode - - typeName = type.unroll().name # unroll because it may be nullable - - if isMember == "Union": - typeName = f"Heap{typeName}" - - templateBody = fill( - """ - match typedarray::${ty}::from($${val}.get().to_object()) { - Ok(val) => val, - Err(()) => { - $*{failureCode} - } - } - """, - ty=typeName, - failureCode=f"{unwrapFailureCode}\n", - ) - - if isMember == "Union": - templateBody = f"RootedTraceableBox::new({templateBody})" - - declType = CGGeneric(f"typedarray::{typeName}") - if type.nullable(): - templateBody = f"Some({templateBody})" - declType = CGWrapper(declType, pre="Option<", post=">") - - templateBody = wrapObjectTemplate(templateBody, "None", - isDefinitelyObject, type, failureCode) - - return handleOptional(templateBody, declType, handleDefault("None")) - - elif type.isSpiderMonkeyInterface(): - raise TypeError("Can't handle SpiderMonkey interface arguments other than typed arrays yet") - - if type.isDOMString(): - nullBehavior = getConversionConfigForType(type, isEnforceRange, isClamp, treatNullAs) - - conversionCode = ( - f"match FromJSValConvertible::from_jsval(*cx, ${{val}}, {nullBehavior}) {{\n" - " Ok(ConversionResult::Success(strval)) => strval,\n" - " Ok(ConversionResult::Failure(error)) => {\n" - f"{indent(failOrPropagate, 8)}\n" - " }\n" - f" _ => {{ {exceptionCode} }},\n" - "}") - - if defaultValue is None: - default = None - elif isinstance(defaultValue, IDLNullValue): - assert type.nullable() - default = "None" - else: - assert defaultValue.type.tag() == IDLType.Tags.domstring - default = f'DOMString::from("{defaultValue.value}")' - if type.nullable(): - default = f"Some({default})" - - declType = "DOMString" - if type.nullable(): - declType = f"Option<{declType}>" - - return handleOptional(conversionCode, CGGeneric(declType), default) - - if type.isUSVString(): - assert not isEnforceRange and not isClamp - - conversionCode = ( - "match FromJSValConvertible::from_jsval(*cx, ${val}, ()) {\n" - " Ok(ConversionResult::Success(strval)) => strval,\n" - " Ok(ConversionResult::Failure(error)) => {\n" - f"{indent(failOrPropagate, 8)}\n" - " }\n" - f" _ => {{ {exceptionCode} }},\n" - "}") - - if defaultValue is None: - default = None - elif isinstance(defaultValue, IDLNullValue): - assert type.nullable() - default = "None" - else: - assert defaultValue.type.tag() in (IDLType.Tags.domstring, IDLType.Tags.usvstring) - default = f'USVString("{defaultValue.value}".to_owned())' - if type.nullable(): - default = f"Some({default})" - - declType = "USVString" - if type.nullable(): - declType = f"Option<{declType}>" - - return handleOptional(conversionCode, CGGeneric(declType), default) - - if type.isByteString(): - assert not isEnforceRange and not isClamp - - conversionCode = ( - "match FromJSValConvertible::from_jsval(*cx, ${val}, ()) {\n" - " Ok(ConversionResult::Success(strval)) => strval,\n" - " Ok(ConversionResult::Failure(error)) => {\n" - f"{indent(failOrPropagate, 8)}\n" - " }\n" - f" _ => {{ {exceptionCode} }},\n" - "}") - - if defaultValue is None: - default = None - elif isinstance(defaultValue, IDLNullValue): - assert type.nullable() - default = "None" - else: - assert defaultValue.type.tag() in (IDLType.Tags.domstring, IDLType.Tags.bytestring) - default = f'ByteString::new(b"{defaultValue.value}".to_vec())' - if type.nullable(): - default = f"Some({default})" - - declType = "ByteString" - if type.nullable(): - declType = f"Option<{declType}>" - - return handleOptional(conversionCode, CGGeneric(declType), default) - - if type.isEnum(): - assert not isEnforceRange and not isClamp - - if type.nullable(): - raise TypeError("We don't support nullable enumerated arguments " - "yet") - enum = type.inner.identifier.name - if invalidEnumValueFatal: - handleInvalidEnumValueCode = failureCode or f"throw_type_error(*cx, &error); {exceptionCode}" - else: - handleInvalidEnumValueCode = "return true;" - - template = ( - "match FromJSValConvertible::from_jsval(*cx, ${val}, ()) {" - f" Err(_) => {{ {exceptionCode} }},\n" - " Ok(ConversionResult::Success(v)) => v,\n" - f" Ok(ConversionResult::Failure(error)) => {{ {handleInvalidEnumValueCode} }},\n" - "}") - - if defaultValue is not None: - assert defaultValue.type.tag() == IDLType.Tags.domstring - default = f"{enum}::{getEnumValueName(defaultValue.value)}" - else: - default = None - - return handleOptional(template, CGGeneric(enum), default) - - if type.isCallback(): - assert not isEnforceRange and not isClamp - assert not type.treatNonCallableAsNull() - assert not type.treatNonObjectAsNull() or type.nullable() - assert not type.treatNonObjectAsNull() or not type.treatNonCallableAsNull() - - callback = type.unroll().callback - declType = CGGeneric(callback.identifier.name) - finalDeclType = CGTemplatedType("Rc", declType) - - conversion = CGCallbackTempRoot(declType.define()) - - if type.nullable(): - declType = CGTemplatedType("Option", declType) - finalDeclType = CGTemplatedType("Option", finalDeclType) - conversion = CGWrapper(conversion, pre="Some(", post=")") - - if allowTreatNonObjectAsNull and type.treatNonObjectAsNull(): - if not isDefinitelyObject: - haveObject = "${val}.get().is_object()" - template = CGIfElseWrapper(haveObject, - conversion, - CGGeneric("None")).define() - else: - template = conversion - else: - template = CGIfElseWrapper("IsCallable(${val}.get().to_object())", - conversion, - onFailureNotCallable(failureCode)).define() - template = wrapObjectTemplate( - template, - "None", - isDefinitelyObject, - type, - failureCode) - - if defaultValue is not None: - assert allowTreatNonObjectAsNull - assert type.treatNonObjectAsNull() - assert type.nullable() - assert isinstance(defaultValue, IDLNullValue) - default = "None" - else: - default = None - - return JSToNativeConversionInfo(template, default, finalDeclType) - - if type.isAny(): - assert not isEnforceRange and not isClamp - assert isMember != "Union" - - if isMember in ("Dictionary", "Sequence") or isAutoRooted: - templateBody = "${val}.get()" - - if defaultValue is None: - default = None - elif isinstance(defaultValue, IDLNullValue): - default = "NullValue()" - elif isinstance(defaultValue, IDLUndefinedValue): - default = "UndefinedValue()" - else: - raise TypeError("Can't handle non-null, non-undefined default value here") - - if not isAutoRooted: - templateBody = f"RootedTraceableBox::from_box(Heap::boxed({templateBody}))" - if default is not None: - default = f"RootedTraceableBox::from_box(Heap::boxed({default}))" - declType = CGGeneric("RootedTraceableBox<Heap<JSVal>>") - # AutoRooter can trace properly inner raw GC thing pointers - else: - declType = CGGeneric("JSVal") - - return handleOptional(templateBody, declType, default) - - declType = CGGeneric("HandleValue") - - if defaultValue is None: - default = None - elif isinstance(defaultValue, IDLNullValue): - default = "HandleValue::null()" - elif isinstance(defaultValue, IDLUndefinedValue): - default = "HandleValue::undefined()" - else: - raise TypeError("Can't handle non-null, non-undefined default value here") - - return handleOptional("${val}", declType, default) - - if type.isObject(): - assert not isEnforceRange and not isClamp - - templateBody = "${val}.get().to_object()" - default = "ptr::null_mut()" - - if isMember in ("Dictionary", "Union", "Sequence") and not isAutoRooted: - templateBody = f"RootedTraceableBox::from_box(Heap::boxed({templateBody}))" - default = "RootedTraceableBox::new(Heap::default())" - declType = CGGeneric("RootedTraceableBox<Heap<*mut JSObject>>") - else: - # TODO: Need to root somehow - # https://github.com/servo/servo/issues/6382 - declType = CGGeneric("*mut JSObject") - - templateBody = wrapObjectTemplate(templateBody, default, - isDefinitelyObject, type, failureCode) - - return handleOptional(templateBody, declType, - handleDefault(default)) - - if type.isDictionary(): - # There are no nullable dictionaries - assert not type.nullable() or (isMember and isMember != "Dictionary") - - typeName = f"{CGDictionary.makeModuleName(type.inner)}::{CGDictionary.makeDictionaryName(type.inner)}" - declType = CGGeneric(typeName) - empty = f"{typeName}::empty()" - - if type_needs_tracing(type): - declType = CGTemplatedType("RootedTraceableBox", declType) - - template = ( - "match FromJSValConvertible::from_jsval(*cx, ${val}, ()) {\n" - " Ok(ConversionResult::Success(dictionary)) => dictionary,\n" - " Ok(ConversionResult::Failure(error)) => {\n" - f"{indent(failOrPropagate, 8)}\n" - " }\n" - f" _ => {{ {exceptionCode} }},\n" - "}") - - return handleOptional(template, declType, handleDefault(empty)) - - if type.isUndefined(): - # This one only happens for return values, and its easy: Just - # ignore the jsval. - return JSToNativeConversionInfo("", None, None) - - if not type.isPrimitive(): - raise TypeError(f"Need conversion for argument type '{type}'") - - conversionBehavior = getConversionConfigForType(type, isEnforceRange, isClamp, treatNullAs) - - if failureCode is None: - failureCode = 'return false' - - declType = CGGeneric(builtinNames[type.tag()]) - if type.nullable(): - declType = CGWrapper(declType, pre="Option<", post=">") - - template = ( - f"match FromJSValConvertible::from_jsval(*cx, ${{val}}, {conversionBehavior}) {{\n" - " Ok(ConversionResult::Success(v)) => v,\n" - " Ok(ConversionResult::Failure(error)) => {\n" - f"{indent(failOrPropagate, 8)}\n" - " }\n" - f" _ => {{ {exceptionCode} }}\n" - "}") - - if defaultValue is not None: - if isinstance(defaultValue, IDLNullValue): - assert type.nullable() - defaultStr = "None" - else: - tag = defaultValue.type.tag() - if tag in [IDLType.Tags.float, IDLType.Tags.double]: - defaultStr = f"Finite::wrap({defaultValue.value})" - elif tag in numericTags: - defaultStr = str(defaultValue.value) - else: - assert tag == IDLType.Tags.bool - defaultStr = toStringBool(defaultValue.value) - - if type.nullable(): - defaultStr = f"Some({defaultStr})" - else: - defaultStr = None - - return handleOptional(template, declType, defaultStr) - - -def instantiateJSToNativeConversionTemplate(templateBody, replacements, - declType, declName, - needsAutoRoot=False): - """ - Take the templateBody and declType as returned by - getJSToNativeConversionInfo, a set of replacements as required by the - strings in such a templateBody, and a declName, and generate code to - convert into a stack Rust binding with that name. - """ - result = CGList([], "\n") - - conversion = CGGeneric(string.Template(templateBody).substitute(replacements)) - - if declType is not None: - newDecl = [ - CGGeneric("let "), - CGGeneric(declName), - CGGeneric(": "), - declType, - CGGeneric(" = "), - conversion, - CGGeneric(";"), - ] - result.append(CGList(newDecl)) - else: - result.append(conversion) - - if needsAutoRoot: - result.append(CGGeneric(f"auto_root!(in(*cx) let {declName} = {declName});")) - # Add an empty CGGeneric to get an extra newline after the argument - # conversion. - result.append(CGGeneric("")) - - return result - - -def convertConstIDLValueToJSVal(value): - if isinstance(value, IDLNullValue): - return "ConstantVal::NullVal" - tag = value.type.tag() - if tag in [IDLType.Tags.int8, IDLType.Tags.uint8, IDLType.Tags.int16, - IDLType.Tags.uint16, IDLType.Tags.int32]: - return f"ConstantVal::Int({value.value})" - if tag == IDLType.Tags.uint32: - return f"ConstantVal::Uint({value.value})" - if tag in [IDLType.Tags.int64, IDLType.Tags.uint64]: - return f"ConstantVal::Double({value.value} as f64)" - if tag == IDLType.Tags.bool: - return "ConstantVal::Bool(true)" if value.value else "ConstantVal::BoolVal(false)" - if tag in [IDLType.Tags.unrestricted_float, IDLType.Tags.float, - IDLType.Tags.unrestricted_double, IDLType.Tags.double]: - return f"ConstantVal::Double({value.value} as f64)" - raise TypeError(f"Const value of unhandled type: {value.type}") - - -class CGArgumentConverter(CGThing): - """ - A class that takes an IDL argument object, its index in the - argument list, and the argv and argc strings and generates code to - unwrap the argument to the right native type. - """ - def __init__(self, argument, index, args, argc, descriptorProvider, - invalidEnumValueFatal=True): - CGThing.__init__(self) - assert not argument.defaultValue or argument.optional - - replacementVariables = { - "val": f"HandleValue::from_raw({args}.get({index}))", - } - - info = getJSToNativeConversionInfo( - argument.type, - descriptorProvider, - invalidEnumValueFatal=invalidEnumValueFatal, - defaultValue=argument.defaultValue, - isMember="Variadic" if argument.variadic else False, - isAutoRooted=type_needs_auto_root(argument.type), - allowTreatNonObjectAsNull=argument.allowTreatNonCallableAsNull()) - template = info.template - default = info.default - declType = info.declType - - if not argument.variadic: - if argument.optional: - condition = f"{args}.get({index}).is_undefined()" - if argument.defaultValue: - assert default - template = CGIfElseWrapper(condition, - CGGeneric(default), - CGGeneric(template)).define() - else: - assert not default - declType = CGWrapper(declType, pre="Option<", post=">") - template = CGIfElseWrapper(condition, - CGGeneric("None"), - CGGeneric(f"Some({template})")).define() - else: - assert not default - - arg = f"arg{index}" - - self.converter = instantiateJSToNativeConversionTemplate( - template, replacementVariables, declType, arg, - needsAutoRoot=type_needs_auto_root(argument.type)) - - else: - assert argument.optional - variadicConversion = { - "val": f"HandleValue::from_raw({args}.get(variadicArg))", - } - innerConverter = [instantiateJSToNativeConversionTemplate( - template, variadicConversion, declType, "slot")] - - arg = f"arg{index}" - if argument.type.isGeckoInterface(): - init = f"rooted_vec!(let mut {arg})" - innerConverter.append(CGGeneric(f"{arg}.push(Dom::from_ref(&*slot));")) - else: - init = f"let mut {arg} = vec![]" - innerConverter.append(CGGeneric(f"{arg}.push(slot);")) - inner = CGIndenter(CGList(innerConverter, "\n"), 8).define() - - sub = "" if index == 0 else f"- {index}" - - self.converter = CGGeneric(f""" -{init}; -if {argc} > {index} {{ - {arg}.reserve({argc} as usize{sub}); - for variadicArg in {index}..{argc} {{ -{inner} - }} -}}""") - - def define(self): - return self.converter.define() - - -def wrapForType(jsvalRef, result='result', successCode='true', pre=''): - """ - Reflect a Rust value into JS. - - * 'jsvalRef': a MutableHandleValue in which to store the result - of the conversion; - * 'result': the name of the variable in which the Rust value is stored; - * 'successCode': the code to run once we have done the conversion. - * 'pre': code to run before the conversion if rooting is necessary - """ - wrap = f"{pre}\n({result}).to_jsval(*cx, {jsvalRef});" - if successCode: - wrap += f"\n{successCode}" - return wrap - - -def typeNeedsCx(type, retVal=False): - if type is None: - return False - if type.nullable(): - type = type.inner - if type.isSequence(): - type = type.inner - if type.isUnion(): - return any(typeNeedsCx(t) for t in type.unroll().flatMemberTypes) - if retVal and type.isSpiderMonkeyInterface(): - return True - return type.isAny() or type.isObject() - - -def returnTypeNeedsOutparam(type): - if type.nullable(): - type = type.inner - return type.isAny() - - -def outparamTypeFromReturnType(type): - if type.isAny(): - return "MutableHandleValue" - raise f"Don't know how to handle {type} as an outparam" - - -# Returns a conversion behavior suitable for a type -def getConversionConfigForType(type, isEnforceRange, isClamp, treatNullAs): - if type.isSequence() or type.isRecord(): - return getConversionConfigForType(innerContainerType(type), isEnforceRange, isClamp, treatNullAs) - if type.isDOMString(): - assert not isEnforceRange and not isClamp - - treatAs = { - "Default": "StringificationBehavior::Default", - "EmptyString": "StringificationBehavior::Empty", - } - if treatNullAs not in treatAs: - raise TypeError(f"We don't support [TreatNullAs={treatNullAs}]") - if type.nullable(): - # Note: the actual behavior passed here doesn't matter for nullable - # strings. - return "StringificationBehavior::Default" - else: - return treatAs[treatNullAs] - if type.isPrimitive() and type.isInteger(): - if isEnforceRange: - return "ConversionBehavior::EnforceRange" - elif isClamp: - return "ConversionBehavior::Clamp" - else: - return "ConversionBehavior::Default" - assert not isEnforceRange and not isClamp - return "()" - - -def builtin_return_type(returnType): - result = CGGeneric(builtinNames[returnType.tag()]) - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - - -# Returns a CGThing containing the type of the return value. -def getRetvalDeclarationForType(returnType, descriptorProvider): - if returnType is None or returnType.isUndefined(): - # Nothing to declare - return CGGeneric("()") - if returnType.isPrimitive() and returnType.tag() in builtinNames: - return builtin_return_type(returnType) - if is_typed_array(returnType) and returnType.tag() in builtinNames: - return builtin_return_type(returnType) - if returnType.isDOMString(): - result = CGGeneric("DOMString") - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - if returnType.isUSVString(): - result = CGGeneric("USVString") - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - if returnType.isByteString(): - result = CGGeneric("ByteString") - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - if returnType.isEnum(): - result = CGGeneric(returnType.unroll().inner.identifier.name) - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - if returnType.isPromise(): - assert not returnType.nullable() - return CGGeneric("Rc<Promise>") - if returnType.isGeckoInterface(): - descriptor = descriptorProvider.getDescriptor( - returnType.unroll().inner.identifier.name) - result = CGGeneric(descriptor.returnType) - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - if returnType.isCallback(): - callback = returnType.unroll().callback - result = CGGeneric(f'Rc<{getModuleFromObject(callback)}::{callback.identifier.name}>') - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - if returnType.isUnion(): - result = CGGeneric(union_native_type(returnType)) - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - if returnType.isAny(): - return CGGeneric("JSVal") - if returnType.isObject() or returnType.isSpiderMonkeyInterface(): - result = CGGeneric("NonNull<JSObject>") - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - if returnType.isSequence() or returnType.isRecord(): - result = getRetvalDeclarationForType(innerContainerType(returnType), descriptorProvider) - result = wrapInNativeContainerType(returnType, result) - if returnType.nullable(): - result = CGWrapper(result, pre="Option<", post=">") - return result - if returnType.isDictionary(): - nullable = returnType.nullable() - dictName = returnType.inner.name if nullable else returnType.name - result = CGGeneric(dictName) - if type_needs_tracing(returnType): - result = CGWrapper(result, pre="RootedTraceableBox<", post=">") - if nullable: - result = CGWrapper(result, pre="Option<", post=">") - return result - - raise TypeError(f"Don't know how to declare return value for {returnType}") - - -def MemberCondition(pref, func, exposed, secure): - """ - A string representing the condition for a member to actually be exposed. - Any of the arguments can be None. If not None, they should have the - following types: - - pref: The name of the preference. - func: The name of the function. - exposed: One or more names of an exposed global. - secure: Requires secure context. - """ - assert pref is None or isinstance(pref, str) - assert func is None or isinstance(func, str) - assert exposed is None or isinstance(exposed, set) - assert func is None or pref is None or exposed is None or secure is None - conditions = [] - if secure: - conditions.append('Condition::SecureContext()') - if pref: - conditions.append(f'Condition::Pref("{pref}")') - if func: - conditions.append(f'Condition::Func({func})') - if exposed: - conditions.extend([ - f"Condition::Exposed(InterfaceObjectMap::Globals::{camel_to_upper_snake(i)})" for i in exposed - ]) - if len(conditions) == 0: - conditions.append("Condition::Satisfied") - return conditions - - -class PropertyDefiner: - """ - A common superclass for defining things on prototype objects. - - Subclasses should implement generateArray to generate the actual arrays of - things we're defining. They should also set self.regular to the list of - things exposed to web pages. - """ - def __init__(self, descriptor, name): - self.descriptor = descriptor - self.name = name - - def variableName(self): - return f"s{self.name}" - - def length(self): - return len(self.regular) - - def __str__(self): - # We only need to generate id arrays for things that will end - # up used via ResolveProperty or EnumerateProperties. - return self.generateArray(self.regular, self.variableName()) - - @staticmethod - def getStringAttr(member, name): - attr = member.getExtendedAttribute(name) - if attr is None: - return None - # It's a list of strings - assert len(attr) == 1 - assert attr[0] is not None - return attr[0] - - @staticmethod - def getControllingCondition(interfaceMember, descriptor): - return MemberCondition( - PropertyDefiner.getStringAttr(interfaceMember, - "Pref"), - PropertyDefiner.getStringAttr(interfaceMember, - "Func"), - interfaceMember.exposureSet, - interfaceMember.getExtendedAttribute("SecureContext")) - - def generateGuardedArray(self, array, name, specTemplate, specTerminator, - specType, getCondition, getDataTuple): - """ - This method generates our various arrays. - - array is an array of interface members as passed to generateArray - - name is the name as passed to generateArray - - specTemplate is a template for each entry of the spec array - - specTerminator is a terminator for the spec array (inserted at the end - of the array), or None - - specType is the actual typename of our spec - - getDataTuple is a callback function that takes an array entry and - returns a tuple suitable for substitution into specTemplate. - """ - - # We generate an all-encompassing list of lists of specs, with each sublist - # representing a group of members that share a common pref name. That will - # make sure the order of the properties as exposed on the interface and - # interface prototype objects does not change when pref control is added to - # members while still allowing us to define all the members in the smallest - # number of JSAPI calls. - assert len(array) != 0 - specs = [] - prefableSpecs = [] - prefableTemplate = ' Guard::new(%s, (%s)[%d])' - origTemplate = specTemplate - if isinstance(specTemplate, str): - specTemplate = lambda _: origTemplate # noqa - - for cond, members in groupby(array, lambda m: getCondition(m, self.descriptor)): - currentSpecs = [specTemplate(m) % getDataTuple(m) for m in members] - if specTerminator: - currentSpecs.append(specTerminator) - joinedCurrentSpecs = ',\n'.join(currentSpecs) - specs.append(f"&Box::leak(Box::new([\n{joinedCurrentSpecs}]))[..]\n") - conds = ','.join(cond) if isinstance(cond, list) else cond - prefableSpecs.append( - prefableTemplate % (f"&[{conds}]", f"unsafe {{ {name}_specs.get() }}", len(specs) - 1) - ) - - joinedSpecs = ',\n'.join(specs) - specsArray = f"static {name}_specs: ThreadUnsafeOnceLock<&[&[{specType}]]> = ThreadUnsafeOnceLock::new();\n" - - initSpecs = f""" -pub(crate) fn init_{name}_specs() {{ - {name}_specs.set(Box::leak(Box::new([{joinedSpecs}]))); -}}""" - - joinedPrefableSpecs = ',\n'.join(prefableSpecs) - prefArray = f"static {name}: ThreadUnsafeOnceLock<&[Guard<&[{specType}]>]> = ThreadUnsafeOnceLock::new();\n" - - initPrefs = f""" -pub(crate) fn init_{name}_prefs() {{ - {name}.set(Box::leak(Box::new([{joinedPrefableSpecs}]))); -}}""" - - return f"{specsArray}{initSpecs}{prefArray}{initPrefs}" - - def generateUnguardedArray(self, array, name, specTemplate, specTerminator, - specType, getCondition, getDataTuple): - """ - Takes the same set of parameters as generateGuardedArray but instead - generates a single, flat array of type `&[specType]` that contains all - provided members. The provided members' conditions shall be homogeneous, - or else this method will fail. - """ - - # this method can't handle heterogeneous condition - groups = groupby(array, lambda m: getCondition(m, self.descriptor)) - assert len(list(groups)) == 1 - - origTemplate = specTemplate - if isinstance(specTemplate, str): - specTemplate = lambda _: origTemplate # noqa - - specsArray = [specTemplate(m) % getDataTuple(m) for m in array] - specsArray.append(specTerminator) - - joinedSpecs = ',\n'.join(specsArray) - initialSpecs = f"static {name}: ThreadUnsafeOnceLock<&[{specType}]> = ThreadUnsafeOnceLock::new();\n" - initSpecs = f""" -pub(crate) fn init_{name}() {{ - {name}.set(Box::leak(Box::new([{joinedSpecs}]))); -}}""" - return dedent(f"{initialSpecs}{initSpecs}") - - -# The length of a method is the minimum of the lengths of the -# argument lists of all its overloads. -def methodLength(method): - signatures = method.signatures() - return min( - len([arg for arg in arguments if not arg.optional and not arg.variadic]) - for (_, arguments) in signatures) - - -class MethodDefiner(PropertyDefiner): - """ - A class for defining methods on a prototype object. - """ - def __init__(self, descriptor, name, static, unforgeable, crossorigin=False): - assert not (static and unforgeable) - assert not (static and crossorigin) - assert not (unforgeable and crossorigin) - PropertyDefiner.__init__(self, descriptor, name) - - # TODO: Separate the `(static, unforgeable, crossorigin) = (False, False, True)` case - # to a separate class or something. - - # FIXME https://bugzilla.mozilla.org/show_bug.cgi?id=772822 - # We should be able to check for special operations without an - # identifier. For now we check if the name starts with __ - - # Ignore non-static methods for callback interfaces - if not descriptor.interface.isCallback() or static: - methods = [m for m in descriptor.interface.members if - m.isMethod() and m.isStatic() == static - and (bool(m.getExtendedAttribute("CrossOriginCallable")) or not crossorigin) - and not m.isIdentifierLess() - and (MemberIsLegacyUnforgeable(m, descriptor) == unforgeable or crossorigin)] - else: - methods = [] - self.regular = [{"name": m.identifier.name, - "methodInfo": not m.isStatic(), - "length": methodLength(m), - "flags": "JSPROP_READONLY" if crossorigin else "JSPROP_ENUMERATE", - "condition": PropertyDefiner.getControllingCondition(m, descriptor), - "returnsPromise": m.returnsPromise()} - for m in methods] - - # TODO: Once iterable is implemented, use tiebreak rules instead of - # failing. Also, may be more tiebreak rules to implement once spec bug - # is resolved. - # https://www.w3.org/Bugs/Public/show_bug.cgi?id=28592 - def hasIterator(methods, regular): - return (any("@@iterator" in m.aliases for m in methods) - or any("@@iterator" == r["name"] for r in regular)) - - # Check whether we need to output an @@iterator due to having an indexed - # getter. We only do this while outputting non-static and - # non-unforgeable methods, since the @@iterator function will be - # neither. - if (not static - and not unforgeable - and not crossorigin - and descriptor.supportsIndexedProperties()): # noqa - if hasIterator(methods, self.regular): # noqa - raise TypeError("Cannot have indexed getter/attr on " - f"interface {self.descriptor.interface.identifier.name} with other members " - "that generate @@iterator, such as " - "maplike/setlike or aliased functions.") - self.regular.append({"name": '@@iterator', - "methodInfo": False, - "selfHostedName": "$ArrayValues", - "length": 0, - "flags": "0", # Not enumerable, per spec. - "condition": "Condition::Satisfied"}) - - # Generate the keys/values/entries aliases for value iterables. - maplikeOrSetlikeOrIterable = descriptor.interface.maplikeOrSetlikeOrIterable - if (not static and not unforgeable and not crossorigin - and maplikeOrSetlikeOrIterable - and maplikeOrSetlikeOrIterable.isIterable() - and maplikeOrSetlikeOrIterable.isValueIterator()): - m = maplikeOrSetlikeOrIterable - - # Add our keys/values/entries/forEach - self.regular.append({ - "name": "keys", - "methodInfo": False, - "selfHostedName": "ArrayKeys", - "length": 0, - "flags": "JSPROP_ENUMERATE", - "condition": PropertyDefiner.getControllingCondition(m, - descriptor) - }) - self.regular.append({ - "name": "values", - "methodInfo": False, - "selfHostedName": "$ArrayValues", - "length": 0, - "flags": "JSPROP_ENUMERATE", - "condition": PropertyDefiner.getControllingCondition(m, - descriptor) - }) - self.regular.append({ - "name": "entries", - "methodInfo": False, - "selfHostedName": "ArrayEntries", - "length": 0, - "flags": "JSPROP_ENUMERATE", - "condition": PropertyDefiner.getControllingCondition(m, - descriptor) - }) - self.regular.append({ - "name": "forEach", - "methodInfo": False, - "selfHostedName": "ArrayForEach", - "length": 1, - "flags": "JSPROP_ENUMERATE", - "condition": PropertyDefiner.getControllingCondition(m, - descriptor) - }) - - isLegacyUnforgeableInterface = bool(descriptor.interface.getExtendedAttribute("LegacyUnforgeable")) - if not static and unforgeable == isLegacyUnforgeableInterface and not crossorigin: - stringifier = descriptor.operations['Stringifier'] - if stringifier: - self.regular.append({ - "name": "toString", - "nativeName": stringifier.identifier.name, - "length": 0, - "flags": "JSPROP_ENUMERATE", - "condition": PropertyDefiner.getControllingCondition(stringifier, descriptor) - }) - self.unforgeable = unforgeable - self.crossorigin = crossorigin - - def generateArray(self, array, name): - if len(array) == 0: - return "" - - def condition(m, d): - return m["condition"] - - def specData(m): - flags = m["flags"] - if self.unforgeable: - flags += " | JSPROP_PERMANENT | JSPROP_READONLY" - if flags != "0": - flags = f"({flags}) as u16" - if "selfHostedName" in m: - selfHostedName = str_to_cstr_ptr(m["selfHostedName"]) - assert not m.get("methodInfo", True) - accessor = "None" - jitinfo = "ptr::null()" - else: - selfHostedName = "ptr::null()" - if m.get("methodInfo", True): - if m.get("returnsPromise", False): - exceptionToRejection = "true" - else: - exceptionToRejection = "false" - identifier = m.get("nativeName", m["name"]) - # Go through an intermediate type here, because it's not - # easy to tell whether the methodinfo is a JSJitInfo or - # a JSTypedMethodJitInfo here. The compiler knows, though, - # so let it do the work. - jitinfo = (f"unsafe {{ {identifier}_methodinfo.get() }}" - " as *const _ as *const JSJitInfo") - accessor = f"Some(generic_method::<{exceptionToRejection}>)" - else: - if m.get("returnsPromise", False): - jitinfo = f"unsafe {{ {m.get('nativeName', m['name'])}_methodinfo.get() }}" - accessor = "Some(generic_static_promise_method)" - else: - jitinfo = "ptr::null()" - accessor = f'Some({m.get("nativeName", m["name"])})' - if m["name"].startswith("@@"): - assert not self.crossorigin - name = f'JSPropertySpec_Name {{ symbol_: SymbolCode::{m["name"][2:]} as usize + 1 }}' - else: - name = f'JSPropertySpec_Name {{ string_: {str_to_cstr_ptr(m["name"])} }}' - return (name, accessor, jitinfo, m["length"], flags, selfHostedName) - - specTemplate = ( - ' JSFunctionSpec {\n' - ' name: %s,\n' - ' call: JSNativeWrapper { op: %s, info: %s },\n' - ' nargs: %s,\n' - ' flags: %s,\n' - ' selfHostedName: %s\n' - ' }') - specTerminator = ( - ' JSFunctionSpec {\n' - ' name: JSPropertySpec_Name { string_: ptr::null() },\n' - ' call: JSNativeWrapper { op: None, info: ptr::null() },\n' - ' nargs: 0,\n' - ' flags: 0,\n' - ' selfHostedName: ptr::null()\n' - ' }') - - if self.crossorigin: - return self.generateUnguardedArray( - array, name, - specTemplate, specTerminator, - 'JSFunctionSpec', - condition, specData) - else: - return self.generateGuardedArray( - array, name, - specTemplate, specTerminator, - 'JSFunctionSpec', - condition, specData) - - -class AttrDefiner(PropertyDefiner): - def __init__(self, descriptor, name, static, unforgeable, crossorigin=False): - assert not (static and unforgeable) - assert not (static and crossorigin) - assert not (unforgeable and crossorigin) - PropertyDefiner.__init__(self, descriptor, name) - - # TODO: Separate the `(static, unforgeable, crossorigin) = (False, False, True)` case - # to a separate class or something. - - self.name = name - self.descriptor = descriptor - self.regular = [ - { - "name": m.identifier.name, - "attr": m, - "flags": "JSPROP_ENUMERATE", - "kind": "JSPropertySpec_Kind::NativeAccessor", - } - for m in descriptor.interface.members if - m.isAttr() and m.isStatic() == static - and (MemberIsLegacyUnforgeable(m, descriptor) == unforgeable or crossorigin) - and (not crossorigin - or m.getExtendedAttribute("CrossOriginReadable") - or m.getExtendedAttribute("CrossOriginWritable")) - ] - self.static = static - self.unforgeable = unforgeable - self.crossorigin = crossorigin - - if not static and not unforgeable and not crossorigin and not ( - descriptor.interface.isNamespace() or descriptor.interface.isCallback() - ): - self.regular.append({ - "name": "@@toStringTag", - "attr": None, - "flags": "JSPROP_READONLY", - "kind": "JSPropertySpec_Kind::Value", - }) - - def generateArray(self, array, name): - if len(array) == 0: - return "" - - def getter(attr): - attr = attr['attr'] - - if self.crossorigin and not attr.getExtendedAttribute("CrossOriginReadable"): - return "JSNativeWrapper { op: None, info: ptr::null() }" - - if self.static: - accessor = f'get_{self.descriptor.internalNameFor(attr.identifier.name)}' - jitinfo = "ptr::null()" - else: - if attr.type.isPromise(): - exceptionToRejection = "true" - else: - exceptionToRejection = "false" - if attr.hasLegacyLenientThis(): - accessor = f"generic_lenient_getter::<{exceptionToRejection}>" - else: - accessor = f"generic_getter::<{exceptionToRejection}>" - internalName = self.descriptor.internalNameFor(attr.identifier.name) - jitinfo = f"unsafe {{ {internalName}_getterinfo.get() }}" - - return f"JSNativeWrapper {{ op: Some({accessor}), info: {jitinfo} }}" - - def setter(attr): - attr = attr['attr'] - - if ((self.crossorigin and not attr.getExtendedAttribute("CrossOriginWritable")) - or (attr.readonly - and not attr.getExtendedAttribute("PutForwards") - and not attr.getExtendedAttribute("Replaceable"))): - return "JSNativeWrapper { op: None, info: ptr::null() }" - - if self.static: - accessor = f'set_{self.descriptor.internalNameFor(attr.identifier.name)}' - jitinfo = "ptr::null()" - else: - if attr.hasLegacyLenientThis(): - accessor = "generic_lenient_setter" - else: - accessor = "generic_setter" - internalName = self.descriptor.internalNameFor(attr.identifier.name) - jitinfo = f"unsafe {{ {internalName}_setterinfo.get() }}" - - return f"JSNativeWrapper {{ op: Some({accessor}), info: {jitinfo} }}" - - def condition(m, d): - if m["name"] == "@@toStringTag": - return MemberCondition(pref=None, func=None, exposed=None, secure=None) - return PropertyDefiner.getControllingCondition(m["attr"], d) - - def specData(attr): - if attr["name"] == "@@toStringTag": - return (attr["name"][2:], attr["flags"], attr["kind"], - str_to_cstr_ptr(self.descriptor.interface.getClassName())) - - flags = attr["flags"] - if self.unforgeable: - flags += " | JSPROP_PERMANENT" - return (str_to_cstr_ptr(attr["attr"].identifier.name), flags, attr["kind"], getter(attr), - setter(attr)) - - def template(m): - if m["name"] == "@@toStringTag": - return """ JSPropertySpec { - name: JSPropertySpec_Name { symbol_: SymbolCode::%s as usize + 1 }, - attributes_: (%s), - kind_: (%s), - u: JSPropertySpec_AccessorsOrValue { - value: JSPropertySpec_ValueWrapper { - type_: JSPropertySpec_ValueWrapper_Type::String, - __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 { - string: %s, - } - } - } - } -""" - return """ JSPropertySpec { - name: JSPropertySpec_Name { string_: %s }, - attributes_: (%s), - kind_: (%s), - u: JSPropertySpec_AccessorsOrValue { - accessors: JSPropertySpec_AccessorsOrValue_Accessors { - getter: JSPropertySpec_Accessor { - native: %s, - }, - setter: JSPropertySpec_Accessor { - native: %s, - } - } - } - } -""" - - if self.crossorigin: - return self.generateUnguardedArray( - array, name, - template, - ' JSPropertySpec::ZERO', - 'JSPropertySpec', - condition, specData) - else: - return self.generateGuardedArray( - array, name, - template, - ' JSPropertySpec::ZERO', - 'JSPropertySpec', - condition, specData) - - -class ConstDefiner(PropertyDefiner): - """ - A class for definining constants on the interface object - """ - def __init__(self, descriptor, name): - PropertyDefiner.__init__(self, descriptor, name) - self.name = name - self.regular = [m for m in descriptor.interface.members if m.isConst()] - - def generateArray(self, array, name): - if len(array) == 0: - return "" - - def specData(const): - return (str_to_cstr(const.identifier.name), - convertConstIDLValueToJSVal(const.value)) - - return self.generateGuardedArray( - array, name, - ' ConstantSpec { name: %s, value: %s }', - None, - 'ConstantSpec', - PropertyDefiner.getControllingCondition, specData) - - -# We'll want to insert the indent at the beginnings of lines, but we -# don't want to indent empty lines. So only indent lines that have a -# non-newline character on them. -lineStartDetector = re.compile("^(?=[^\n])", re.MULTILINE) - - -class CGIndenter(CGThing): - """ - A class that takes another CGThing and generates code that indents that - CGThing by some number of spaces. The default indent is two spaces. - """ - def __init__(self, child, indentLevel=4): - CGThing.__init__(self) - self.child = child - self.indent = " " * indentLevel - - def define(self): - defn = self.child.define() - if defn != "": - return re.sub(lineStartDetector, self.indent, defn) - else: - return defn - - -class CGWrapper(CGThing): - """ - Generic CGThing that wraps other CGThings with pre and post text. - """ - def __init__(self, child, pre="", post="", reindent=False): - CGThing.__init__(self) - self.child = child - self.pre = pre - self.post = post - self.reindent = reindent - - def define(self): - defn = self.child.define() - if self.reindent: - # We don't use lineStartDetector because we don't want to - # insert whitespace at the beginning of our _first_ line. - defn = stripTrailingWhitespace( - defn.replace("\n", f"\n{' ' * len(self.pre)}")) - return f"{self.pre}{defn}{self.post}" - - -class CGRecord(CGThing): - """ - CGThing that wraps value CGThing in record with key type equal to keyType parameter - """ - def __init__(self, keyType, value): - CGThing.__init__(self) - assert keyType.isString() - self.keyType = keyType - self.value = value - - def define(self): - if self.keyType.isByteString(): - keyDef = "ByteString" - elif self.keyType.isDOMString(): - keyDef = "DOMString" - elif self.keyType.isUSVString(): - keyDef = "USVString" - else: - assert False - - defn = f"{keyDef}, {self.value.define()}" - return f"Record<{defn}>" - - -class CGImports(CGWrapper): - """ - Generates the appropriate import/use statements. - """ - def __init__(self, child, descriptors, callbacks, dictionaries, enums, typedefs, imports, config): - """ - Adds a set of imports. - """ - - def componentTypes(type): - if type.isType() and type.nullable(): - type = type.unroll() - if type.isUnion(): - return type.flatMemberTypes - if type.isDictionary(): - return [type] + getTypesFromDictionary(type) - if type.isSequence(): - return componentTypes(type.inner) - return [type] - - def isImportable(type): - if not type.isType(): - assert (type.isInterface() or type.isDictionary() - or type.isEnum() or type.isNamespace()) - return True - return not (type.builtin or type.isSequence() or type.isUnion()) - - def relatedTypesForSignatures(method): - types = [] - for (returnType, arguments) in method.signatures(): - types += componentTypes(returnType) - for arg in arguments: - types += componentTypes(arg.type) - - return types - - def getIdentifier(t): - if t.isType(): - if t.nullable(): - t = t.inner - if t.isCallback(): - return t.callback.identifier - return t.identifier - assert t.isInterface() or t.isDictionary() or t.isEnum() or t.isNamespace() - return t.identifier - - def removeWrapperAndNullableTypes(types): - normalized = [] - for t in types: - while (t.isType() and t.nullable()) or isinstance(t, IDLWrapperType): - t = t.inner - if isImportable(t): - normalized += [t] - return normalized - - types = [] - descriptorProvider = config.getDescriptorProvider() - for d in descriptors: - if not d.interface.isCallback(): - types += [d.interface] - - if d.interface.isIteratorInterface(): - types += [d.interface.iterableInterface] - - members = d.interface.members + d.interface.legacyFactoryFunctions - constructor = d.interface.ctor() - if constructor: - members += [constructor] - - if d.proxy: - members += [o for o in list(d.operations.values()) if o] - - for m in members: - if m.isMethod(): - types += relatedTypesForSignatures(m) - if m.isStatic(): - types += [ - descriptorProvider.getDescriptor(iface).interface - for iface in d.interface.exposureSet - ] - elif m.isAttr(): - types += componentTypes(m.type) - - # Import the type names used in the callbacks that are being defined. - for c in callbacks: - types += relatedTypesForSignatures(c) - - # Import the type names used in the dictionaries that are being defined. - for d in dictionaries: - types += componentTypes(d) - - # Import the type names used in the typedefs that are being defined. - for t in typedefs: - if not t.innerType.isCallback(): - types += componentTypes(t.innerType) - - # Normalize the types we've collected and remove any ones which can't be imported. - types = removeWrapperAndNullableTypes(types) - - descriptorProvider = config.getDescriptorProvider() - extras = [] - for t in types: - # Importing these callbacks in the same module that defines them is an error. - if t.isCallback(): - if getIdentifier(t) in [c.identifier for c in callbacks]: - continue - # Importing these types in the same module that defines them is an error. - if t in dictionaries or t in enums: - continue - if t.isInterface() or t.isNamespace(): - name = getIdentifier(t).name - descriptor = descriptorProvider.getDescriptor(name) - if name != 'GlobalScope': - extras += [descriptor.path] - parentName = descriptor.getParentName() - while parentName: - descriptor = descriptorProvider.getDescriptor(parentName) - extras += [descriptor.path, descriptor.bindingPath] - parentName = descriptor.getParentName() - elif t.isType() and t.isRecord(): - extras += ['crate::dom::bindings::record::Record'] - elif isinstance(t, IDLPromiseType): - extras += ['crate::dom::promise::Promise'] - else: - if t.isEnum(): - extras += [f'{getModuleFromObject(t)}::{getIdentifier(t).name}Values'] - extras += [f'{getModuleFromObject(t)}::{getIdentifier(t).name}'] - - statements = [] - statements.extend(f'use {i};' for i in sorted(set(imports + extras))) - - joinedStatements = '\n'.join(statements) - CGWrapper.__init__(self, child, - pre=f'{joinedStatements}\n\n') - - -class CGIfWrapper(CGWrapper): - def __init__(self, condition, child): - pre = CGWrapper(CGGeneric(condition), pre="if ", post=" {\n", - reindent=True) - CGWrapper.__init__(self, CGIndenter(child), pre=pre.define(), - post="\n}") - - -class CGTemplatedType(CGWrapper): - def __init__(self, templateName, child): - CGWrapper.__init__(self, child, pre=f"{templateName}<", post=">") - - -class CGNamespace(CGWrapper): - def __init__(self, namespace, child, public=False): - pub = "pub(crate) " if public else "" - pre = f"{pub}mod {namespace} {{\n" - post = f"}} // mod {namespace}" - CGWrapper.__init__(self, child, pre=pre, post=post) - - @staticmethod - def build(namespaces, child, public=False): - """ - Static helper method to build multiple wrapped namespaces. - """ - if not namespaces: - return child - inner = CGNamespace.build(namespaces[1:], child, public=public) - return CGNamespace(namespaces[0], inner, public=public) - - -def DOMClassTypeId(desc): - protochain = desc.prototypeChain - inner = "" - if desc.hasDescendants(): - if desc.interface.getExtendedAttribute("Abstract"): - return "crate::dom::bindings::codegen::InheritTypes::TopTypeId { abstract_: () }" - name = desc.interface.identifier.name - inner = f"(crate::dom::bindings::codegen::InheritTypes::{name}TypeId::{name})" - elif len(protochain) == 1: - return "crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () }" - reversed_protochain = list(reversed(protochain)) - for (child, parent) in zip(reversed_protochain, reversed_protochain[1:]): - inner = f"(crate::dom::bindings::codegen::InheritTypes::{parent}TypeId::{child}{inner})" - return f"crate::dom::bindings::codegen::InheritTypes::TopTypeId {{ {protochain[0].lower()}: {inner} }}" - - -def DOMClass(descriptor): - protoList = [f'PrototypeList::ID::{proto}' for proto in descriptor.prototypeChain] - # Pad out the list to the right length with ID::Last so we - # guarantee that all the lists are the same length. ID::Last - # is never the ID of any prototype, so it's safe to use as - # padding. - protoList.extend(['PrototypeList::ID::Last'] * (descriptor.config.maxProtoChainLength - len(protoList))) - prototypeChainString = ', '.join(protoList) - mallocSizeOf = f"malloc_size_of_including_raw_self::<{descriptor.concreteType}>" - if descriptor.isGlobal(): - globals_ = camel_to_upper_snake(descriptor.name) - else: - globals_ = 'EMPTY' - return f""" -DOMClass {{ - interface_chain: [ {prototypeChainString} ], - depth: {descriptor.prototypeDepth}, - type_id: {DOMClassTypeId(descriptor)}, - malloc_size_of: {mallocSizeOf} as unsafe fn(&mut _, _) -> _, - global: InterfaceObjectMap::Globals::{globals_}, -}}""" - - -class CGDOMJSClass(CGThing): - """ - Generate a DOMJSClass for a given descriptor - """ - def __init__(self, descriptor): - CGThing.__init__(self) - self.descriptor = descriptor - - def define(self): - parentName = self.descriptor.getParentName() - if not parentName: - parentName = "Reflector" - - args = { - "domClass": DOMClass(self.descriptor), - "enumerateHook": "None", - "finalizeHook": FINALIZE_HOOK_NAME, - "flags": "JSCLASS_FOREGROUND_FINALIZE", - "name": str_to_cstr_ptr(self.descriptor.interface.identifier.name), - "resolveHook": "None", - "slots": "1", - "traceHook": TRACE_HOOK_NAME, - } - if self.descriptor.isGlobal(): - assert not self.descriptor.weakReferenceable - args["enumerateHook"] = "Some(enumerate_global)" - args["flags"] = "JSCLASS_IS_GLOBAL | JSCLASS_DOM_GLOBAL | JSCLASS_FOREGROUND_FINALIZE" - args["slots"] = "JSCLASS_GLOBAL_SLOT_COUNT + 1" - args["resolveHook"] = "Some(resolve_global)" - args["traceHook"] = "js::jsapi::JS_GlobalObjectTraceHook" - elif self.descriptor.weakReferenceable: - args["slots"] = "2" - return f""" -static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new(); - -pub(crate) fn init_class_ops() {{ - CLASS_OPS.set(JSClassOps {{ - addProperty: None, - delProperty: None, - enumerate: None, - newEnumerate: {args['enumerateHook']}, - resolve: {args['resolveHook']}, - mayResolve: None, - finalize: Some({args['finalizeHook']}), - call: None, - construct: None, - trace: Some({args['traceHook']}), - }}); -}} - -static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new(); - -pub(crate) fn init_domjs_class() {{ - init_class_ops(); - Class.set(DOMJSClass {{ - base: JSClass {{ - name: {args['name']}, - flags: JSCLASS_IS_DOMJSCLASS | {args['flags']} | - ((({args['slots']}) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT) - /* JSCLASS_HAS_RESERVED_SLOTS({args['slots']}) */, - cOps: unsafe {{ CLASS_OPS.get() }}, - spec: ptr::null(), - ext: ptr::null(), - oOps: ptr::null(), - }}, - dom_class: {args['domClass']}, - }}); -}} -""" - - -class CGAssertInheritance(CGThing): - """ - Generate a type assertion for inheritance - """ - def __init__(self, descriptor): - CGThing.__init__(self) - self.descriptor = descriptor - - def define(self): - parent = self.descriptor.interface.parent - parentName = "" - if parent: - parentName = parent.identifier.name - else: - parentName = "Reflector" - - selfName = self.descriptor.interface.identifier.name - - if selfName == "PaintRenderingContext2D": - # PaintRenderingContext2D embeds a CanvasRenderingContext2D - # instead of a Reflector as an optimization, - # but this is fine since CanvasRenderingContext2D - # also has a reflector - # - # FIXME *RenderingContext2D should use Inline - parentName = "crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D" - args = { - "parentName": parentName, - "selfName": selfName, - } - - return f""" -impl {args['selfName']} {{ - fn __assert_parent_type(&self) {{ - use crate::dom::bindings::inheritance::HasParent; - // If this type assertion fails, make sure the first field of your - // DOM struct is of the correct type -- it must be the parent class. - let _: &{args['parentName']} = self.as_parent(); - }} -}} -""" - - -def str_to_cstr(s): - return f'c"{s}"' - - -def str_to_cstr_ptr(s): - return f'c"{s}".as_ptr()' - - -class CGPrototypeJSClass(CGThing): - def __init__(self, descriptor): - CGThing.__init__(self) - self.descriptor = descriptor - - def define(self): - name = str_to_cstr_ptr(f"{self.descriptor.interface.identifier.name}Prototype") - slotCount = 0 - if self.descriptor.hasLegacyUnforgeableMembers: - slotCount += 1 - slotCountStr = f"{slotCount} & JSCLASS_RESERVED_SLOTS_MASK" if slotCount > 0 else "0" - return f""" -static PrototypeClass: JSClass = JSClass {{ - name: {name}, - flags: - // JSCLASS_HAS_RESERVED_SLOTS() - ({slotCountStr} ) << JSCLASS_RESERVED_SLOTS_SHIFT, - cOps: ptr::null(), - spec: ptr::null(), - ext: ptr::null(), - oOps: ptr::null(), -}}; -""" - - -class CGInterfaceObjectJSClass(CGThing): - def __init__(self, descriptor): - assert descriptor.interface.hasInterfaceObject() and not descriptor.interface.isCallback() - CGThing.__init__(self) - self.descriptor = descriptor - - def define(self): - if self.descriptor.interface.isNamespace(): - classString = self.descriptor.interface.getExtendedAttribute("ClassString") - if classString: - classString = classString[0] - else: - classString = "Object" - return f""" -static NAMESPACE_OBJECT_CLASS: NamespaceObjectClass = unsafe {{ - NamespaceObjectClass::new({str_to_cstr(classString)}) -}}; -""" - if self.descriptor.interface.ctor(): - constructorBehavior = f"InterfaceConstructorBehavior::call({CONSTRUCT_HOOK_NAME})" - else: - constructorBehavior = "InterfaceConstructorBehavior::throw()" - name = self.descriptor.interface.identifier.name - representation = f'b"function {name}() {{\\n [native code]\\n}}"' - return f""" -static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new(); - -pub(crate) fn init_interface_object() {{ - INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new( - {{ - // Intermediate `const` because as of nightly-2018-10-05, - // rustc is conservative in promotion to `'static` of the return values of `const fn`s: - // https://github.com/rust-lang/rust/issues/54846 - // https://github.com/rust-lang/rust/pull/53851 - const BEHAVIOR: InterfaceConstructorBehavior = {constructorBehavior}; - &BEHAVIOR - }}, - {representation}, - PrototypeList::ID::{name}, - {self.descriptor.prototypeDepth}, - )); -}} -""" - - -class CGList(CGThing): - """ - Generate code for a list of GCThings. Just concatenates them together, with - an optional joiner string. "\n" is a common joiner. - """ - def __init__(self, children, joiner=""): - CGThing.__init__(self) - # Make a copy of the kids into a list, because if someone passes in a - # generator we won't be able to both declare and define ourselves, or - # define ourselves more than once! - self.children = list(children) - self.joiner = joiner - - def append(self, child): - self.children.append(child) - - def prepend(self, child): - self.children.insert(0, child) - - def join(self, iterable): - return self.joiner.join(s for s in iterable if len(s) > 0) - - def define(self): - return self.join(child.define() for child in self.children if child is not None) - - def __len__(self): - return len(self.children) - - -class CGIfElseWrapper(CGList): - def __init__(self, condition, ifTrue, ifFalse): - if ifFalse.text.strip().startswith("if"): - elseBranch = CGWrapper(ifFalse, pre=" else ") - else: - elseBranch = CGWrapper(CGIndenter(ifFalse), pre=" else {\n", post="\n}") - kids = [CGIfWrapper(condition, ifTrue), elseBranch] - CGList.__init__(self, kids) - - -class CGGeneric(CGThing): - """ - A class that spits out a fixed string into the codegen. Can spit out a - separate string for the declaration too. - """ - def __init__(self, text): - self.text = text - - def define(self): - return self.text - - -class CGCallbackTempRoot(CGGeneric): - def __init__(self, name): - CGGeneric.__init__(self, f"{name}::new(cx, ${{val}}.get().to_object())") - - -def getAllTypes(descriptors, dictionaries, callbacks, typedefs): - """ - Generate all the types we're dealing with. For each type, a tuple - containing type, descriptor, dictionary is yielded. The - descriptor can be None if the type does not come from a descriptor. - """ - for d in descriptors: - for t in getTypesFromDescriptor(d): - yield (t, d) - for dictionary in dictionaries: - for t in getTypesFromDictionary(dictionary): - yield (t, None) - for callback in callbacks: - for t in getTypesFromCallback(callback): - yield (t, None) - for typedef in typedefs: - yield (typedef.innerType, None) - - -def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config): - """ - Returns a CGList containing CGUnionStructs for every union. - """ - - imports = [ - 'crate::dom', - 'crate::dom::bindings::import::base::*', - 'crate::dom::bindings::codegen::DomTypes::DomTypes', - 'crate::dom::bindings::conversions::windowproxy_from_handlevalue', - 'crate::dom::bindings::record::Record', - 'crate::dom::types::*', - 'crate::dom::windowproxy::WindowProxy', - 'js::typedarray', - ] - - # Now find all the things we'll need as arguments and return values because - # we need to wrap or unwrap them. - unionStructs = dict() - for (t, descriptor) in getAllTypes(descriptors, dictionaries, callbacks, typedefs): - t = t.unroll() - if not t.isUnion(): - continue - for memberType in t.flatMemberTypes: - if memberType.isDictionary() or memberType.isEnum() or memberType.isCallback(): - memberModule = getModuleFromObject(memberType) - memberName = (memberType.callback.identifier.name - if memberType.isCallback() else memberType.inner.identifier.name) - imports.append(f"{memberModule}::{memberName}") - if memberType.isEnum(): - imports.append(f"{memberModule}::{memberName}Values") - name = str(t) - if name not in unionStructs: - provider = descriptor or config.getDescriptorProvider() - unionStructs[name] = CGList([ - CGUnionStruct(t, provider, config), - CGUnionConversionStruct(t, provider) - ]) - - # Sort unionStructs by key, retrieve value - unionStructs = (i[1] for i in sorted(list(unionStructs.items()), key=operator.itemgetter(0))) - - return CGImports(CGList(unionStructs, "\n\n"), descriptors=[], callbacks=[], dictionaries=[], enums=[], - typedefs=[], imports=imports, config=config) - - -def DomTypes(descriptors, descriptorProvider, dictionaries, callbacks, typedefs, config): - traits = [ - "js::rust::Trace", - "malloc_size_of::MallocSizeOf", - "Sized", - ] - joinedTraits = ' + '.join(traits) - elements = [CGGeneric(f"pub(crate) trait DomTypes: {joinedTraits} where Self: 'static {{\n")] - for descriptor in descriptors: - iface_name = descriptor.interface.identifier.name - traits = [] - - chain = descriptor.prototypeChain - upcast = descriptor.hasDescendants() - - if not upcast: - # No other interface will implement DeriveFrom<Foo> for this Foo, so avoid - # implementing it for itself. - chain = chain[:-1] - - if chain: - traits += ["crate::dom::bindings::inheritance::Castable"] - - for parent in chain: - traits += [f"crate::dom::bindings::conversions::DerivedFrom<Self::{parent}>"] - - iterableDecl = descriptor.interface.maplikeOrSetlikeOrIterable - if iterableDecl: - if iterableDecl.isMaplike(): - keytype = getRetvalDeclarationForType(iterableDecl.keyType, None).define() - valuetype = getRetvalDeclarationForType(iterableDecl.valueType, None).define() - traits += [f"crate::dom::bindings::like::Maplike<Key={keytype}, Value={valuetype}>"] - if iterableDecl.isSetlike(): - keytype = getRetvalDeclarationForType(iterableDecl.keyType, None).define() - traits += [f"crate::dom::bindings::like::Setlike<Key={keytype}>"] - if iterableDecl.hasKeyType(): - traits += [ - "crate::dom::bindings::reflector::DomObjectIteratorWrap", - ] - - if descriptor.weakReferenceable: - traits += ["crate::dom::bindings::weakref::WeakReferenceable"] - - if not descriptor.interface.isNamespace(): - traits += [ - "js::conversions::ToJSValConvertible", - "crate::dom::bindings::reflector::MutDomObject", - "crate::dom::bindings::reflector::DomObject", - ] - - if descriptor.register: - if ( - (descriptor.concrete or descriptor.hasDescendants()) - and not descriptor.interface.isNamespace() - and not descriptor.interface.isIteratorInterface() - ): - traits += [ - "crate::dom::bindings::conversions::IDLInterface", - "PartialEq", - ] - - if descriptor.concrete and not descriptor.isGlobal(): - traits += ["crate::dom::bindings::reflector::DomObjectWrap"] - - if not descriptor.interface.isCallback() and not descriptor.interface.isIteratorInterface(): - nonConstMembers = [m for m in descriptor.interface.members if not m.isConst()] - ctor = descriptor.interface.ctor() - if ( - nonConstMembers - or (ctor and not ctor.isHTMLConstructor()) - or descriptor.interface.legacyFactoryFunctions - ): - namespace = f"{toBindingPath(descriptor)}" - traits += [f"crate::dom::bindings::codegen::Bindings::{namespace}::{iface_name}Methods<Self>"] - isPromise = firstCap(iface_name) == "Promise" - elements += [ - CGGeneric(" #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]\n"), - CGGeneric( - " #[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_in_rc)]\n" - if isPromise else "" - ), - CGGeneric(f" type {firstCap(iface_name)}: {' + '.join(traits)};\n") - ] - elements += [CGGeneric("}\n")] - return CGList([CGGeneric("use crate::dom::bindings::str::DOMString;\n")] + elements) - - -def DomTypeHolder(descriptors, descriptorProvider, dictionaries, callbacks, typedefs, config): - elements = [ - CGGeneric( - "#[derive(JSTraceable, MallocSizeOf, PartialEq)]\n" - "pub(crate) struct DomTypeHolder;\n" - "impl crate::DomTypes for DomTypeHolder {\n" - ), - ] - for descriptor in descriptors: - if descriptor.interface.isCallback() or descriptor.interface.isIteratorInterface(): - continue - iface_name = descriptor.interface.identifier.name - path = f"crate::dom::{iface_name.lower()}::{firstCap(iface_name)}" - elements.append(CGGeneric(f" type {firstCap(iface_name)} = {path};\n")) - elements.append(CGGeneric("}\n")) - return CGList(elements) - - -class Argument(): - """ - A class for outputting the type and name of an argument - """ - def __init__(self, argType, name, default=None, mutable=False): - self.argType = argType - self.name = name - self.default = default - self.mutable = mutable - - def declare(self): - mut = 'mut ' if self.mutable else '' - argType = f': {self.argType}' if self.argType else '' - string = f"{mut}{self.name}{argType}" - # XXXjdm Support default arguments somehow :/ - # if self.default is not None: - # string += " = " + self.default - return string - - def define(self): - return f'{self.argType} {self.name}' - - -class CGAbstractMethod(CGThing): - """ - An abstract class for generating code for a method. Subclasses - should override definition_body to create the actual code. - - descriptor is the descriptor for the interface the method is associated with - - name is the name of the method as a string - - returnType is the IDLType of the return value - - args is a list of Argument objects - - inline should be True to generate an inline method, whose body is - part of the declaration. - - alwaysInline should be True to generate an inline method annotated with - MOZ_ALWAYS_INLINE. - - If templateArgs is not None it should be a list of strings containing - template arguments, and the function will be templatized using those - arguments. - - docs is None or documentation for the method in a string. - - unsafe is used to add the decorator 'unsafe' to a function, giving as a result - an 'unsafe fn()' declaration. - """ - def __init__(self, descriptor, name, returnType, args, inline=False, - alwaysInline=False, extern=False, unsafe=False, pub=False, - templateArgs=None, docs=None, doesNotPanic=False, extra_decorators=[]): - CGThing.__init__(self) - self.descriptor = descriptor - self.name = name - self.returnType = returnType - self.args = args - self.alwaysInline = alwaysInline - self.extern = extern - self.unsafe = extern or unsafe - self.templateArgs = templateArgs - self.pub = pub - self.docs = docs - self.catchPanic = self.extern and not doesNotPanic - self.extra_decorators = extra_decorators - - def _argstring(self): - return ', '.join([a.declare() for a in self.args]) - - def _template(self): - if self.templateArgs is None: - return '' - return f'<{", ".join(self.templateArgs)}>\n' - - def _docs(self): - if self.docs is None: - return '' - - lines = self.docs.splitlines() - return ''.join(f'/// {line}\n' for line in lines) - - def _decorators(self): - decorators = [] - if self.alwaysInline: - decorators.append('#[inline]') - - decorators.extend(self.extra_decorators) - - if self.pub: - decorators.append('pub') - - if self.unsafe: - decorators.append('unsafe') - - if self.extern: - decorators.append('extern') - - if not decorators: - return '' - return f'{" ".join(decorators)} ' - - def _returnType(self): - return f" -> {self.returnType}" if self.returnType != "void" else "" - - def define(self): - body = self.definition_body() - - if self.catchPanic: - if self.returnType == "void": - pre = "wrap_panic(&mut || {\n" - post = "\n})" - elif "return" not in body.define() or self.name.startswith("_constructor"): - pre = ( - "let mut result = false;\n" - "wrap_panic(&mut || result = {\n" - ) - post = ( - "\n});\n" - "result" - ) - else: - pre = ( - "let mut result = false;\n" - "wrap_panic(&mut || result = (|| {\n" - ) - post = ( - "\n})());\n" - "result" - ) - body = CGWrapper(CGIndenter(body), pre=pre, post=post) - - return CGWrapper(CGIndenter(body), - pre=self.definition_prologue(), - post=self.definition_epilogue()).define() - - def definition_prologue(self): - return (f"{self._docs()}{self._decorators()}" - f"fn {self.name}{self._template()}({self._argstring()}){self._returnType()}{{\n") - - def definition_epilogue(self): - return "\n}\n" - - def definition_body(self): - raise NotImplementedError # Override me! - - -class CGConstructorEnabled(CGAbstractMethod): - """ - A method for testing whether we should be exposing this interface object. - This can perform various tests depending on what conditions are specified - on the interface. - """ - def __init__(self, descriptor): - CGAbstractMethod.__init__(self, descriptor, - 'ConstructorEnabled', 'bool', - [Argument("SafeJSContext", "aCx"), - Argument("HandleObject", "aObj")]) - - def definition_body(self): - conditions = [] - iface = self.descriptor.interface - - bits = " | ".join(sorted( - f"InterfaceObjectMap::Globals::{camel_to_upper_snake(i)}" for i in iface.exposureSet - )) - conditions.append(f"is_exposed_in(aObj, {bits})") - - pref = iface.getExtendedAttribute("Pref") - if pref: - assert isinstance(pref, list) and len(pref) == 1 - conditions.append(f'pref!({pref[0]})') - - func = iface.getExtendedAttribute("Func") - if func: - assert isinstance(func, list) and len(func) == 1 - conditions.append(f"{func[0]}(aCx, aObj)") - - secure = iface.getExtendedAttribute("SecureContext") - if secure: - conditions.append(""" -unsafe { - let in_realm_proof = AlreadyInRealm::assert_for_cx(aCx); - GlobalScope::from_context(*aCx, InRealm::Already(&in_realm_proof)).is_secure_context() -} -""") - - return CGList((CGGeneric(cond) for cond in conditions), " &&\n") - - -def InitLegacyUnforgeablePropertiesOnHolder(descriptor, properties): - """ - Define the unforgeable properties on the unforgeable holder for - the interface represented by descriptor. - - properties is a PropertyArrays instance. - """ - unforgeables = [] - - defineLegacyUnforgeableAttrs = "define_guarded_properties(cx, unforgeable_holder.handle(), %s, global);" - defineLegacyUnforgeableMethods = "define_guarded_methods(cx, unforgeable_holder.handle(), %s, global);" - - unforgeableMembers = [ - (defineLegacyUnforgeableAttrs, properties.unforgeable_attrs), - (defineLegacyUnforgeableMethods, properties.unforgeable_methods), - ] - for template, array in unforgeableMembers: - if array.length() > 0: - unforgeables.append(CGGeneric(template % f"unsafe {{ {array.variableName()}.get() }}")) - return CGList(unforgeables, "\n") - - -def CopyLegacyUnforgeablePropertiesToInstance(descriptor): - """ - Copy the unforgeable properties from the unforgeable holder for - this interface to the instance object we have. - """ - if not descriptor.hasLegacyUnforgeableMembers: - return "" - copyCode = "" - - # For proxies, we want to define on the expando object, not directly on the - # reflector, so we can make sure we don't get confused by named getters. - if descriptor.proxy: - copyCode += """\ -rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>()); -ensure_expando_object(*cx, obj.handle().into(), expando.handle_mut()); -""" - obj = "expando" - else: - obj = "obj" - - # We can't do the fast copy for globals, because we can't allocate the - # unforgeable holder for those with the right JSClass. Luckily, there - # aren't too many globals being created. - if descriptor.isGlobal(): - copyFunc = "JS_CopyOwnPropertiesAndPrivateFields" - else: - copyFunc = "JS_InitializePropertiesFromCompatibleNativeObject" - copyCode += f""" -let mut slot = UndefinedValue(); -JS_GetReservedSlot(canonical_proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &mut slot); -rooted!(in(*cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>()); -unforgeable_holder.handle_mut().set(slot.to_object()); -assert!({copyFunc}(*cx, {obj}.handle(), unforgeable_holder.handle())); -""" - - return copyCode - - -class CGWrapMethod(CGAbstractMethod): - """ - Class that generates the Foo_Binding::Wrap function for non-callback - interfaces. - """ - def __init__(self, descriptor): - assert not descriptor.interface.isCallback() - assert not descriptor.isGlobal() - args = [Argument('SafeJSContext', 'cx'), - Argument('&GlobalScope', 'scope'), - Argument('Option<HandleObject>', 'given_proto'), - Argument(f"Box<{descriptor.concreteType}>", 'object'), - Argument('CanGc', '_can_gc')] - retval = f'DomRoot<{descriptor.concreteType}>' - CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, - pub=True, unsafe=True, - extra_decorators=['#[cfg_attr(crown, allow(crown::unrooted_must_root))]']) - - def definition_body(self): - unforgeable = CopyLegacyUnforgeablePropertiesToInstance(self.descriptor) - if self.descriptor.proxy: - if self.descriptor.isMaybeCrossOriginObject(): - proto = "ptr::null_mut()" - lazyProto = "true" # Our proxy handler will manage the prototype - else: - proto = "canonical_proto.get()" - lazyProto = "false" - - create = f""" -let handler: *const libc::c_void = - RegisterBindings::proxy_handlers::{self.descriptor.concreteType} - .load(std::sync::atomic::Ordering::Acquire); -rooted!(in(*cx) let obj = NewProxyObject( - *cx, - handler, - Handle::from_raw(UndefinedHandleValue), - {proto}, - ptr::null(), - {lazyProto}, -)); -assert!(!obj.is_null()); -SetProxyReservedSlot( - obj.get(), - 0, - &PrivateValue(raw.as_ptr() as *const libc::c_void), -); -""" - else: - create = """ -rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>()); -if let Some(given) = given_proto { - *proto = *given; - if get_context_realm(*cx) != get_object_realm(*given) { - assert!(JS_WrapObject(*cx, proto.handle_mut())); - } -} else { - *proto = *canonical_proto; -} -rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto( - *cx, - &Class.get().base, - proto.handle(), -)); -assert!(!obj.is_null()); -JS_SetReservedSlot( - obj.get(), - DOM_OBJECT_SLOT, - &PrivateValue(raw.as_ptr() as *const libc::c_void), -); -""" - if self.descriptor.weakReferenceable: - create += """ -let val = PrivateValue(ptr::null()); -JS_SetReservedSlot(obj.get(), DOM_WEAK_SLOT, &val); -""" - - return CGGeneric(f""" -let raw = Root::new(MaybeUnreflectedDom::from_box(object)); - -let scope = scope.reflector().get_jsobject(); -assert!(!scope.get().is_null()); -assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0); -let _ac = JSAutoRealm::new(*cx, scope.get()); - -rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>()); -GetProtoObject(cx, scope, canonical_proto.handle_mut()); -assert!(!canonical_proto.is_null()); - -{create} -let root = raw.reflect_with(obj.get()); - -{unforgeable} - -DomRoot::from_ref(&*root)\ -""") - - -class CGWrapGlobalMethod(CGAbstractMethod): - """ - Class that generates the Foo_Binding::Wrap function for global interfaces. - """ - def __init__(self, descriptor, properties): - assert not descriptor.interface.isCallback() - assert descriptor.isGlobal() - args = [Argument('SafeJSContext', 'cx'), - Argument(f"Box<{descriptor.concreteType}>", 'object')] - retval = f'DomRoot<{descriptor.concreteType}>' - CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, - pub=True, unsafe=True, - extra_decorators=['#[cfg_attr(crown, allow(crown::unrooted_must_root))]']) - self.properties = properties - - def definition_body(self): - pairs = [ - ("define_guarded_properties", self.properties.attrs), - ("define_guarded_methods", self.properties.methods), - ("define_guarded_constants", self.properties.consts) - ] - members = [f"{function}(cx, obj.handle(), {array.variableName()}.get(), obj.handle());" - for (function, array) in pairs if array.length() > 0] - membersStr = "\n".join(members) - - return CGGeneric(f""" -let raw = Root::new(MaybeUnreflectedDom::from_box(object)); -let origin = (*raw.as_ptr()).upcast::<GlobalScope>().origin(); - -rooted!(in(*cx) let mut obj = ptr::null_mut::<JSObject>()); -create_global_object( - cx, - &Class.get().base, - raw.as_ptr() as *const libc::c_void, - _trace, - obj.handle_mut(), - origin); -assert!(!obj.is_null()); - -let root = raw.reflect_with(obj.get()); - -let _ac = JSAutoRealm::new(*cx, obj.get()); -rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>()); -GetProtoObject(cx, obj.handle(), canonical_proto.handle_mut()); -assert!(JS_SetPrototype(*cx, obj.handle(), canonical_proto.handle())); -let mut immutable = false; -assert!(JS_SetImmutablePrototype(*cx, obj.handle(), &mut immutable)); -assert!(immutable); - -{membersStr} - -{CopyLegacyUnforgeablePropertiesToInstance(self.descriptor)} - -DomRoot::from_ref(&*root)\ -""") - - -def toBindingPath(descriptor): - module = toBindingModuleFileFromDescriptor(descriptor) - namespace = toBindingNamespace(descriptor.interface.identifier.name) - return f"{module}::{namespace}" - - -class CGIDLInterface(CGThing): - """ - Class for codegen of an implementation of the IDLInterface trait. - """ - def __init__(self, descriptor): - CGThing.__init__(self) - self.descriptor = descriptor - - def define(self): - interface = self.descriptor.interface - name = self.descriptor.concreteType - if (interface.getUserData("hasConcreteDescendant", False) - or interface.getUserData("hasProxyDescendant", False)): - depth = self.descriptor.prototypeDepth - check = f"class.interface_chain[{depth}] == PrototypeList::ID::{name}" - elif self.descriptor.proxy: - check = "ptr::eq(class, &Class)" - else: - check = "ptr::eq(class, unsafe { &Class.get().dom_class })" - return f""" -impl IDLInterface for {name} {{ - #[inline] - fn derives(class: &'static DOMClass) -> bool {{ - {check} - }} -}} -""" - - -class CGDomObjectWrap(CGThing): - """ - Class for codegen of an implementation of the DomObjectWrap trait. - """ - def __init__(self, descriptor): - CGThing.__init__(self) - self.descriptor = descriptor - - def define(self): - name = self.descriptor.concreteType - name = f"dom::{name.lower()}::{name}" - return f""" -impl DomObjectWrap for {name} {{ - const WRAP: unsafe fn( - SafeJSContext, - &GlobalScope, - Option<HandleObject>, - Box<Self>, - CanGc, - ) -> Root<Dom<Self>> = Wrap; -}} -""" - - -class CGDomObjectIteratorWrap(CGThing): - """ - Class for codegen of an implementation of the DomObjectIteratorWrap trait. - """ - def __init__(self, descriptor): - CGThing.__init__(self) - self.descriptor = descriptor - - def define(self): - assert self.descriptor.interface.isIteratorInterface() - name = self.descriptor.interface.iterableInterface.identifier.name - return f""" -impl DomObjectIteratorWrap for {name} {{ - const ITER_WRAP: unsafe fn( - SafeJSContext, - &GlobalScope, - Option<HandleObject>, - Box<IterableIterator<Self>>, - CanGc, - ) -> Root<Dom<IterableIterator<Self>>> = Wrap; -}} -""" - - -class CGAbstractExternMethod(CGAbstractMethod): - """ - Abstract base class for codegen of implementation-only (no - declaration) static methods. - """ - def __init__(self, descriptor, name, returnType, args, doesNotPanic=False): - CGAbstractMethod.__init__(self, descriptor, name, returnType, args, - inline=False, extern=True, doesNotPanic=doesNotPanic) - - -class PropertyArrays(): - def __init__(self, descriptor): - self.static_methods = MethodDefiner(descriptor, "StaticMethods", - static=True, unforgeable=False) - self.static_attrs = AttrDefiner(descriptor, "StaticAttributes", - static=True, unforgeable=False) - self.methods = MethodDefiner(descriptor, "Methods", static=False, unforgeable=False) - self.unforgeable_methods = MethodDefiner(descriptor, "LegacyUnforgeableMethods", - static=False, unforgeable=True) - self.attrs = AttrDefiner(descriptor, "Attributes", static=False, unforgeable=False) - self.unforgeable_attrs = AttrDefiner(descriptor, "LegacyUnforgeableAttributes", - static=False, unforgeable=True) - self.consts = ConstDefiner(descriptor, "Constants") - pass - - @staticmethod - def arrayNames(): - return [ - "static_methods", - "static_attrs", - "methods", - "unforgeable_methods", - "attrs", - "unforgeable_attrs", - "consts", - ] - - def variableNames(self): - names = {} - for array in self.arrayNames(): - names[array] = getattr(self, array).variableName() - return names - - def __str__(self): - define = "" - for array in self.arrayNames(): - define += str(getattr(self, array)) - return define - - -class CGCrossOriginProperties(CGThing): - def __init__(self, descriptor): - self.methods = MethodDefiner(descriptor, "CrossOriginMethods", static=False, - unforgeable=False, crossorigin=True) - self.attributes = AttrDefiner(descriptor, "CrossOriginAttributes", static=False, - unforgeable=False, crossorigin=True) - - def define(self): - return f"{self.methods}{self.attributes}" + dedent( - """ - static CROSS_ORIGIN_PROPERTIES: ThreadUnsafeOnceLock<CrossOriginProperties> = ThreadUnsafeOnceLock::new(); - - pub(crate) fn init_cross_origin_properties() { - CROSS_ORIGIN_PROPERTIES.set(CrossOriginProperties { - attributes: unsafe { sCrossOriginAttributes.get() }, - methods: unsafe { sCrossOriginMethods.get() }, - }); - } - """ - ) - - -class CGCollectJSONAttributesMethod(CGAbstractMethod): - """ - Generate the CollectJSONAttributes method for an interface descriptor - """ - def __init__(self, descriptor, toJSONMethod): - args = [Argument('*mut JSContext', 'cx'), - Argument('RawHandleObject', 'obj'), - Argument('*mut libc::c_void', 'this'), - Argument('HandleObject', 'result')] - CGAbstractMethod.__init__(self, descriptor, 'CollectJSONAttributes', - 'bool', args, pub=True, unsafe=True) - self.toJSONMethod = toJSONMethod - - def definition_body(self): - ret = """let incumbent_global = GlobalScope::incumbent().expect("no incumbent global"); -let global = incumbent_global.reflector().get_jsobject();\n""" - interface = self.descriptor.interface - for m in interface.members: - if m.isAttr() and not m.isStatic() and m.type.isJSONType(): - name = m.identifier.name - conditions = MemberCondition(None, None, m.exposureSet, None) - ret_conditions = f'&[{", ".join(conditions)}]' - ret += fill( - """ - let conditions = ${conditions}; - let is_satisfied = conditions.iter().any(|c| - c.is_satisfied( - SafeJSContext::from_ptr(cx), - HandleObject::from_raw(obj), - global)); - if is_satisfied { - rooted!(in(cx) let mut temp = UndefinedValue()); - if !get_${name}(cx, obj, this, JSJitGetterCallArgs { _base: temp.handle_mut().into() }) { - return false; - } - if !JS_DefineProperty(cx, result, - ${nameAsArray}, - temp.handle(), JSPROP_ENUMERATE as u32) { - return false; - } - } - """, - name=name, nameAsArray=str_to_cstr_ptr(name), conditions=ret_conditions) - ret += 'true\n' - return CGGeneric(ret) - - -class CGCreateInterfaceObjectsMethod(CGAbstractMethod): - """ - Generate the CreateInterfaceObjects method for an interface descriptor. - - properties should be a PropertyArrays instance. - """ - def __init__(self, descriptor, properties, haveUnscopables, haveLegacyWindowAliases): - args = [Argument('SafeJSContext', 'cx'), Argument('HandleObject', 'global'), - Argument('*mut ProtoOrIfaceArray', 'cache')] - CGAbstractMethod.__init__(self, descriptor, 'CreateInterfaceObjects', 'void', args, - unsafe=True) - self.properties = properties - self.haveUnscopables = haveUnscopables - self.haveLegacyWindowAliases = haveLegacyWindowAliases - - def definition_body(self): - name = self.descriptor.interface.identifier.name - if self.descriptor.interface.isNamespace(): - if self.descriptor.interface.getExtendedAttribute("ProtoObjectHack"): - proto = "GetRealmObjectPrototype(*cx)" - else: - proto = "JS_NewPlainObject(*cx)" - if self.properties.static_methods.length(): - methods = f"{self.properties.static_methods.variableName()}.get()" - else: - methods = "&[]" - if self.descriptor.interface.hasConstants(): - constants = "sConstants.get()" - else: - constants = "&[]" - id = MakeNativeName(name) - return CGGeneric(f""" -rooted!(in(*cx) let proto = {proto}); -assert!(!proto.is_null()); -rooted!(in(*cx) let mut namespace = ptr::null_mut::<JSObject>()); -create_namespace_object(cx, global, proto.handle(), &NAMESPACE_OBJECT_CLASS, - {methods}, {constants}, {str_to_cstr(name)}, namespace.handle_mut()); -assert!(!namespace.is_null()); -assert!((*cache)[PrototypeList::Constructor::{id} as usize].is_null()); -(*cache)[PrototypeList::Constructor::{id} as usize] = namespace.get(); -<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::{id} as isize), - ptr::null_mut(), - namespace.get()); -""") - if self.descriptor.interface.isCallback(): - assert not self.descriptor.interface.ctor() and self.descriptor.interface.hasConstants() - cName = str_to_cstr(name) - return CGGeneric(f""" -rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>()); -create_callback_interface_object(cx, global, sConstants.get(), {cName}, interface.handle_mut()); -assert!(!interface.is_null()); -assert!((*cache)[PrototypeList::Constructor::{name} as usize].is_null()); -(*cache)[PrototypeList::Constructor::{name} as usize] = interface.get(); -<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::{name} as isize), - ptr::null_mut(), - interface.get()); -""") - - parentName = self.descriptor.getParentName() - if not parentName: - if self.descriptor.interface.getExtendedAttribute("ExceptionClass"): - protoGetter = "GetRealmErrorPrototype" - elif self.descriptor.interface.isIteratorInterface(): - protoGetter = "GetRealmIteratorPrototype" - else: - protoGetter = "GetRealmObjectPrototype" - getPrototypeProto = f"prototype_proto.set({protoGetter}(*cx))" - else: - getPrototypeProto = ( - f"{toBindingNamespace(parentName)}::GetProtoObject(cx, global, prototype_proto.handle_mut())" - ) - - code = [CGGeneric(f""" -rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>()); -{getPrototypeProto}; -assert!(!prototype_proto.is_null());""")] - - if self.descriptor.hasNamedPropertiesObject(): - assert not self.haveUnscopables - code.append(CGGeneric(f""" -rooted!(in(*cx) let mut prototype_proto_proto = prototype_proto.get()); -dom::types::{name}::create_named_properties_object(cx, prototype_proto_proto.handle(), prototype_proto.handle_mut()); -assert!(!prototype_proto.is_null());""")) - - properties = { - "id": name, - "unscopables": "unscopable_names" if self.haveUnscopables else "&[]", - "legacyWindowAliases": "legacy_window_aliases" if self.haveLegacyWindowAliases else "&[]" - } - for arrayName in self.properties.arrayNames(): - array = getattr(self.properties, arrayName) - if array.length(): - properties[arrayName] = f"{array.variableName()}.get()" - else: - properties[arrayName] = "&[]" - - if self.descriptor.isGlobal(): - assert not self.haveUnscopables - proto_properties = { - "attrs": "&[]", - "consts": "&[]", - "id": name, - "methods": "&[]", - "unscopables": "&[]", - } - else: - proto_properties = properties - - code.append(CGGeneric(f""" -rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>()); -create_interface_prototype_object(cx, - global, - prototype_proto.handle(), - &PrototypeClass, - {proto_properties['methods']}, - {proto_properties['attrs']}, - {proto_properties['consts']}, - {proto_properties['unscopables']}, - prototype.handle_mut()); -assert!(!prototype.is_null()); -assert!((*cache)[PrototypeList::ID::{proto_properties['id']} as usize].is_null()); -(*cache)[PrototypeList::ID::{proto_properties['id']} as usize] = prototype.get(); -<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::{proto_properties['id']} as isize), - ptr::null_mut(), - prototype.get()); -""")) - - if self.descriptor.interface.hasInterfaceObject(): - properties["name"] = str_to_cstr(name) - if self.descriptor.interface.ctor(): - properties["length"] = methodLength(self.descriptor.interface.ctor()) - else: - properties["length"] = 0 - parentName = self.descriptor.getParentName() - code.append(CGGeneric("rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());")) - if parentName: - parentName = toBindingNamespace(parentName) - code.append(CGGeneric(f""" -{parentName}::GetConstructorObject(cx, global, interface_proto.handle_mut());""")) - else: - code.append(CGGeneric("interface_proto.set(GetRealmFunctionPrototype(*cx));")) - code.append(CGGeneric(f""" -assert!(!interface_proto.is_null()); - -rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>()); -create_noncallback_interface_object(cx, - global, - interface_proto.handle(), - INTERFACE_OBJECT_CLASS.get(), - {properties['static_methods']}, - {properties['static_attrs']}, - {properties['consts']}, - prototype.handle(), - {properties['name']}, - {properties['length']}, - {properties['legacyWindowAliases']}, - interface.handle_mut()); -assert!(!interface.is_null());""")) - if self.descriptor.shouldCacheConstructor(): - code.append(CGGeneric(f""" -assert!((*cache)[PrototypeList::Constructor::{properties['id']} as usize].is_null()); -(*cache)[PrototypeList::Constructor::{properties['id']} as usize] = interface.get(); -<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::{properties['id']} as isize), - ptr::null_mut(), - interface.get()); -""")) - - aliasedMembers = [m for m in self.descriptor.interface.members if m.isMethod() and m.aliases] - if aliasedMembers: - def defineAlias(alias): - if alias == "@@iterator": - symbolJSID = "RUST_SYMBOL_TO_JSID(GetWellKnownSymbol(*cx, SymbolCode::iterator), \ - iteratorId.handle_mut())" - getSymbolJSID = CGGeneric(fill("rooted!(in(*cx) let mut iteratorId: jsid);\n${symbolJSID};\n", - symbolJSID=symbolJSID)) - defineFn = "JS_DefinePropertyById2" - prop = "iteratorId.handle()" - enumFlags = "0" # Not enumerable, per spec. - elif alias.startswith("@@"): - raise TypeError("Can't handle any well-known Symbol other than @@iterator") - else: - getSymbolJSID = None - defineFn = "JS_DefineProperty" - prop = f'"{alias}"' - enumFlags = "JSPROP_ENUMERATE" - if enumFlags != "0": - enumFlags = f"{enumFlags} as u32" - return CGList([ - getSymbolJSID, - # XXX If we ever create non-enumerable properties that can - # be aliased, we should consider making the aliases - # match the enumerability of the property being aliased. - CGGeneric(fill( - """ - assert!(${defineFn}(*cx, prototype.handle(), ${prop}, aliasedVal.handle(), ${enumFlags})); - """, - defineFn=defineFn, - prop=prop, - enumFlags=enumFlags)) - ], "\n") - - def defineAliasesFor(m): - return CGList([ - CGGeneric(fill( - """ - assert!(JS_GetProperty(*cx, prototype.handle(), - ${prop} as *const u8 as *const _, - aliasedVal.handle_mut())); - """, - prop=str_to_cstr_ptr(m.identifier.name))) - ] + [defineAlias(alias) for alias in sorted(m.aliases)]) - - defineAliases = CGList([ - CGGeneric(fill(""" - // Set up aliases on the interface prototype object we just created. - - """)), - CGGeneric("rooted!(in(*cx) let mut aliasedVal = UndefinedValue());\n\n") - ] + [defineAliasesFor(m) for m in sorted(aliasedMembers)]) - code.append(defineAliases) - - constructors = self.descriptor.interface.legacyFactoryFunctions - if constructors: - decl = f"let named_constructors: [(ConstructorClassHook, &std::ffi::CStr, u32); {len(constructors)}]" - specs = [] - for constructor in constructors: - hook = f"{CONSTRUCT_HOOK_NAME}_{constructor.identifier.name}" - name = str_to_cstr(constructor.identifier.name) - length = methodLength(constructor) - specs.append(CGGeneric(f"({hook} as ConstructorClassHook, {name}, {length})")) - values = CGIndenter(CGList(specs, "\n"), 4) - code.append(CGWrapper(values, pre=f"{decl} = [\n", post="\n];")) - code.append(CGGeneric("create_named_constructors(cx, global, &named_constructors, prototype.handle());")) - - if self.descriptor.hasLegacyUnforgeableMembers: - # We want to use the same JSClass and prototype as the object we'll - # end up defining the unforgeable properties on in the end, so that - # we can use JS_InitializePropertiesFromCompatibleNativeObject to do - # a fast copy. In the case of proxies that's null, because the - # expando object is a vanilla object, but in the case of other DOM - # objects it's whatever our class is. - # - # Also, for a global we can't use the global's class; just use - # nullpr and when we do the copy off the holder we'll take a slower - # path. This also means that we don't need to worry about matching - # the prototype. - if self.descriptor.proxy or self.descriptor.isGlobal(): - holderClass = "ptr::null()" - holderProto = "HandleObject::null()" - else: - holderClass = "&Class.get().base as *const JSClass" - holderProto = "prototype.handle()" - code.append(CGGeneric(f""" -rooted!(in(*cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>()); -unforgeable_holder.handle_mut().set( - JS_NewObjectWithoutMetadata(*cx, {holderClass}, {holderProto})); -assert!(!unforgeable_holder.is_null()); -""")) - code.append(InitLegacyUnforgeablePropertiesOnHolder(self.descriptor, self.properties)) - code.append(CGGeneric("""\ -let val = ObjectValue(unforgeable_holder.get()); -JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &val)""")) - - return CGList(code, "\n") - - -class CGGetPerInterfaceObject(CGAbstractMethod): - """ - A method for getting a per-interface object (a prototype object or interface - constructor object). - """ - def __init__(self, descriptor, name, idPrefix="", pub=False): - args = [Argument('SafeJSContext', 'cx'), - Argument('HandleObject', 'global'), - Argument('MutableHandleObject', 'mut rval')] - CGAbstractMethod.__init__(self, descriptor, name, - 'void', args, pub=pub) - self.id = f"{idPrefix}::{MakeNativeName(self.descriptor.name)}" - self.variant = self.id.split('::')[-2] - - def definition_body(self): - return CGGeneric( - "get_per_interface_object_handle" - f"(cx, global, ProtoOrIfaceIndex::{self.variant}({self.id}), CreateInterfaceObjects, rval)" - ) - - -class CGGetProtoObjectMethod(CGGetPerInterfaceObject): - """ - A method for getting the interface prototype object. - """ - def __init__(self, descriptor): - CGGetPerInterfaceObject.__init__(self, descriptor, "GetProtoObject", - "PrototypeList::ID", pub=True) - - def definition_body(self): - return CGList([ - CGGeneric("""\ -/* Get the interface prototype object for this class. This will create the - object as needed. */"""), - CGGetPerInterfaceObject.definition_body(self), - ]) - - -class CGGetConstructorObjectMethod(CGGetPerInterfaceObject): - """ - A method for getting the interface constructor object. - """ - def __init__(self, descriptor): - CGGetPerInterfaceObject.__init__(self, descriptor, "GetConstructorObject", - "PrototypeList::Constructor", - pub=True) - - def definition_body(self): - return CGList([ - CGGeneric("""\ -/* Get the interface object for this class. This will create the object as - needed. */"""), - CGGetPerInterfaceObject.definition_body(self), - ]) - - -class CGDefineProxyHandler(CGAbstractMethod): - """ - A method to create and cache the proxy trap for a given interface. - """ - def __init__(self, descriptor): - assert descriptor.proxy - CGAbstractMethod.__init__(self, descriptor, 'DefineProxyHandler', - '*const libc::c_void', [], - pub=True, unsafe=True) - - def define(self): - return CGAbstractMethod.define(self) - - def definition_body(self): - customDefineProperty = 'proxyhandler::define_property' - if self.descriptor.isMaybeCrossOriginObject() or self.descriptor.operations['IndexedSetter'] or \ - self.descriptor.operations['NamedSetter']: - customDefineProperty = 'defineProperty' - - customDelete = 'proxyhandler::delete' - if self.descriptor.isMaybeCrossOriginObject() or self.descriptor.operations['NamedDeleter']: - customDelete = 'delete' - - customGetPrototypeIfOrdinary = 'Some(proxyhandler::get_prototype_if_ordinary)' - customGetPrototype = 'None' - customSetPrototype = 'None' - if self.descriptor.isMaybeCrossOriginObject(): - customGetPrototypeIfOrdinary = 'Some(proxyhandler::maybe_cross_origin_get_prototype_if_ordinary_rawcx)' - customGetPrototype = 'Some(getPrototype)' - customSetPrototype = 'Some(proxyhandler::maybe_cross_origin_set_prototype_rawcx)' - # The base class `BaseProxyHandler`'s `setImmutablePrototype` (not to be - # confused with ECMAScript's `[[SetImmutablePrototype]]`) always fails. - # This is the desired behavior, so we don't override it. - - customSet = 'None' - if self.descriptor.isMaybeCrossOriginObject(): - # `maybe_cross_origin_set_rawcx` doesn't support legacy platform objects' - # `[[Set]]` (https://heycam.github.io/webidl/#legacy-platform-object-set) (yet). - assert not self.descriptor.operations['IndexedGetter'] - assert not self.descriptor.operations['NamedGetter'] - customSet = 'Some(proxyhandler::maybe_cross_origin_set_rawcx)' - - getOwnEnumerablePropertyKeys = "own_property_keys" - if self.descriptor.interface.getExtendedAttribute("LegacyUnenumerableNamedProperties") or \ - self.descriptor.isMaybeCrossOriginObject(): - getOwnEnumerablePropertyKeys = "getOwnEnumerablePropertyKeys" - - return CGGeneric(f""" -let traps = ProxyTraps {{ - enter: None, - getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor), - defineProperty: Some({customDefineProperty}), - ownPropertyKeys: Some(own_property_keys), - delete_: Some({customDelete}), - enumerate: None, - getPrototypeIfOrdinary: {customGetPrototypeIfOrdinary}, - getPrototype: {customGetPrototype}, - setPrototype: {customSetPrototype}, - setImmutablePrototype: None, - preventExtensions: Some(proxyhandler::prevent_extensions), - isExtensible: Some(proxyhandler::is_extensible), - has: None, - get: Some(get), - set: {customSet}, - call: None, - construct: None, - hasOwn: Some(hasOwn), - getOwnEnumerablePropertyKeys: Some({getOwnEnumerablePropertyKeys}), - nativeCall: None, - objectClassIs: None, - className: Some(className), - fun_toString: None, - boxedValue_unbox: None, - defaultValue: None, - trace: Some({TRACE_HOOK_NAME}), - finalize: Some({FINALIZE_HOOK_NAME}), - objectMoved: None, - isCallable: None, - isConstructor: None, -}}; - -CreateProxyHandler(&traps, Class.as_void_ptr())\ -""") - - -class CGDefineDOMInterfaceMethod(CGAbstractMethod): - """ - A method for resolve hooks to try to lazily define the interface object for - a given interface. - """ - def __init__(self, descriptor): - assert descriptor.interface.hasInterfaceObject() - args = [ - Argument('SafeJSContext', 'cx'), - Argument('HandleObject', 'global'), - ] - CGAbstractMethod.__init__(self, descriptor, 'DefineDOMInterface', - 'void', args, pub=True) - if self.descriptor.interface.isCallback() or self.descriptor.interface.isNamespace(): - idPrefix = "PrototypeList::Constructor" - else: - idPrefix = "PrototypeList::ID" - self.id = f"{idPrefix}::{MakeNativeName(self.descriptor.name)}" - self.variant = self.id.split('::')[-2] - - def define(self): - return CGAbstractMethod.define(self) - - def definition_body(self): - return CGGeneric( - "define_dom_interface" - f"(cx, global, ProtoOrIfaceIndex::{self.variant}({self.id}), CreateInterfaceObjects, ConstructorEnabled)" - ) - - -def needCx(returnType, arguments, considerTypes): - return (considerTypes - and (typeNeedsCx(returnType, True) - or any(typeNeedsCx(a.type) for a in arguments))) - - -class CGCallGenerator(CGThing): - """ - A class to generate an actual call to a C++ object. Assumes that the C++ - object is stored in a variable whose name is given by the |object| argument. - - errorResult should be a string for the value to return in case of an - exception from the native code, or None if no error reporting is needed. - """ - def __init__(self, errorResult, arguments, argsPre, returnType, - extendedAttributes, descriptor, nativeMethodName, - static, object="this", hasCEReactions=False): - CGThing.__init__(self) - - assert errorResult is None or isinstance(errorResult, str) - - isFallible = errorResult is not None - - result = getRetvalDeclarationForType(returnType, descriptor) - if returnType and returnTypeNeedsOutparam(returnType): - rootType = result - result = CGGeneric("()") - else: - rootType = None - - if isFallible: - result = CGWrapper(result, pre="Result<", post=", Error>") - - args = CGList([CGGeneric(arg) for arg in argsPre], ", ") - for (a, name) in arguments: - # XXXjdm Perhaps we should pass all nontrivial types by borrowed pointer - if a.type.isDictionary() and not type_needs_tracing(a.type): - name = f"&{name}" - args.append(CGGeneric(name)) - - needsCx = needCx(returnType, (a for (a, _) in arguments), True) - - if "cx" not in argsPre and needsCx: - args.prepend(CGGeneric("cx")) - if nativeMethodName in descriptor.inRealmMethods: - args.append(CGGeneric("InRealm::already(&AlreadyInRealm::assert_for_cx(cx))")) - if nativeMethodName in descriptor.canGcMethods: - args.append(CGGeneric("CanGc::note()")) - if rootType: - args.append(CGGeneric("retval.handle_mut()")) - - # Build up our actual call - self.cgRoot = CGList([], "\n") - - if rootType: - self.cgRoot.append(CGList([ - CGGeneric("rooted!(in(*cx) let mut retval: "), - rootType, - CGGeneric(");"), - ])) - - call = CGGeneric(nativeMethodName) - if static: - call = CGWrapper(call, pre=f"{MakeNativeName(descriptor.interface.identifier.name)}::") - else: - call = CGWrapper(call, pre=f"{object}.") - call = CGList([call, CGWrapper(args, pre="(", post=")")]) - - if hasCEReactions: - self.cgRoot.append(CGGeneric("push_new_element_queue();\n")) - - self.cgRoot.append(CGList([ - CGGeneric("let result: "), - result, - CGGeneric(" = "), - call, - CGGeneric(";"), - ])) - - if hasCEReactions: - self.cgRoot.append(CGGeneric("pop_current_element_queue(CanGc::note());\n")) - - if isFallible: - if static: - glob = "global.upcast::<GlobalScope>()" - else: - glob = "&this.global()" - - self.cgRoot.append(CGGeneric( - "let result = match result {\n" - " Ok(result) => result,\n" - " Err(e) => {\n" - f" throw_dom_exception(cx, {glob}, e);\n" - f" return{errorResult};\n" - " },\n" - "};")) - - def define(self): - return self.cgRoot.define() - - -class CGPerSignatureCall(CGThing): - """ - This class handles the guts of generating code for a particular - call signature. A call signature consists of four things: - - 1) A return type, which can be None to indicate that there is no - actual return value (e.g. this is an attribute setter) or an - IDLType if there's an IDL type involved (including |void|). - 2) An argument list, which is allowed to be empty. - 3) A name of a native method to call. - 4) Whether or not this method is static. - - We also need to know whether this is a method or a getter/setter - to do error reporting correctly. - - The idlNode parameter can be either a method or an attr. We can query - |idlNode.identifier| in both cases, so we can be agnostic between the two. - """ - # XXXbz For now each entry in the argument list is either an - # IDLArgument or a FakeArgument, but longer-term we may want to - # have ways of flagging things like JSContext* or optional_argc in - # there. - - def __init__(self, returnType, argsPre, arguments, nativeMethodName, static, - descriptor, idlNode, argConversionStartsAt=0, - getter=False, setter=False): - CGThing.__init__(self) - self.returnType = returnType - self.descriptor = descriptor - self.idlNode = idlNode - self.extendedAttributes = descriptor.getExtendedAttributes(idlNode, - getter=getter, - setter=setter) - self.argsPre = argsPre - self.arguments = arguments - self.argCount = len(arguments) - cgThings = [] - cgThings.extend([CGArgumentConverter(arguments[i], i, self.getArgs(), - self.getArgc(), self.descriptor, - invalidEnumValueFatal=not setter) for - i in range(argConversionStartsAt, self.argCount)]) - - errorResult = None - if self.isFallible(): - errorResult = " false" - - if idlNode.isMethod() and idlNode.isMaplikeOrSetlikeOrIterableMethod(): - if idlNode.maplikeOrSetlikeOrIterable.isMaplike() or \ - idlNode.maplikeOrSetlikeOrIterable.isSetlike(): - cgThings.append(CGMaplikeOrSetlikeMethodGenerator(descriptor, - idlNode.maplikeOrSetlikeOrIterable, - idlNode.identifier.name)) - else: - cgThings.append(CGIterableMethodGenerator(descriptor, - idlNode.maplikeOrSetlikeOrIterable, - idlNode.identifier.name)) - else: - hasCEReactions = idlNode.getExtendedAttribute("CEReactions") - cgThings.append(CGCallGenerator( - errorResult, - self.getArguments(), self.argsPre, returnType, - self.extendedAttributes, descriptor, nativeMethodName, - static, hasCEReactions=hasCEReactions)) - - self.cgRoot = CGList(cgThings, "\n") - - def getArgs(self): - return "args" if self.argCount > 0 else "" - - def getArgc(self): - return "argc" - - def getArguments(self): - return [(a, process_arg(f"arg{i}", a)) for (i, a) in enumerate(self.arguments)] - - def isFallible(self): - return 'infallible' not in self.extendedAttributes - - def wrap_return_value(self): - resultName = "result" - # Maplike methods have `any` return values in WebIDL, but our internal bindings - # use stronger types so we need to exclude them from being handled like other - # generated code. - if returnTypeNeedsOutparam(self.returnType) and ( - not (self.idlNode.isMethod() and self.idlNode.isMaplikeOrSetlikeOrIterableMethod())): - resultName = "retval" - return wrapForType( - 'MutableHandleValue::from_raw(args.rval())', - result=resultName, - successCode='return true;', - ) - - def define(self): - return f"{self.cgRoot.define()}\n{self.wrap_return_value()}" - - -class CGSwitch(CGList): - """ - A class to generate code for a switch statement. - - Takes three constructor arguments: an expression, a list of cases, - and an optional default. - - Each case is a CGCase. The default is a CGThing for the body of - the default case, if any. - """ - def __init__(self, expression, cases, default=None): - CGList.__init__(self, [CGIndenter(c) for c in cases], "\n") - self.prepend(CGWrapper(CGGeneric(expression), - pre="match ", post=" {")) - if default is not None: - self.append( - CGIndenter( - CGWrapper( - CGIndenter(default), - pre="_ => {\n", - post="\n}" - ) - ) - ) - - self.append(CGGeneric("}")) - - -class CGCase(CGList): - """ - A class to generate code for a case statement. - - Takes three constructor arguments: an expression, a CGThing for - the body (allowed to be None if there is no body), and an optional - argument (defaulting to False) for whether to fall through. - """ - def __init__(self, expression, body, fallThrough=False): - CGList.__init__(self, [], "\n") - self.append(CGWrapper(CGGeneric(expression), post=" => {")) - bodyList = CGList([body], "\n") - if fallThrough: - raise TypeError("fall through required but unsupported") - # bodyList.append(CGGeneric('panic!("fall through unsupported"); /* Fall through */')) - self.append(CGIndenter(bodyList)) - self.append(CGGeneric("}")) - - -class CGGetterCall(CGPerSignatureCall): - """ - A class to generate a native object getter call for a particular IDL - getter. - """ - def __init__(self, argsPre, returnType, nativeMethodName, descriptor, attr): - CGPerSignatureCall.__init__(self, returnType, argsPre, [], - nativeMethodName, attr.isStatic(), descriptor, - attr, getter=True) - - -class FakeArgument(): - """ - A class that quacks like an IDLArgument. This is used to make - setters look like method calls or for special operations. - """ - def __init__(self, type, interfaceMember, allowTreatNonObjectAsNull=False): - self.type = type - self.optional = False - self.variadic = False - self.defaultValue = None - self._allowTreatNonObjectAsNull = allowTreatNonObjectAsNull - - def allowTreatNonCallableAsNull(self): - return self._allowTreatNonObjectAsNull - - -class CGSetterCall(CGPerSignatureCall): - """ - A class to generate a native object setter call for a particular IDL - setter. - """ - def __init__(self, argsPre, argType, nativeMethodName, descriptor, attr): - CGPerSignatureCall.__init__(self, None, argsPre, - [FakeArgument(argType, attr, allowTreatNonObjectAsNull=True)], - nativeMethodName, attr.isStatic(), descriptor, attr, - setter=True) - - def wrap_return_value(self): - # We have no return value - return "\ntrue" - - def getArgc(self): - return "1" - - -class CGAbstractStaticBindingMethod(CGAbstractMethod): - """ - Common class to generate the JSNatives for all our static methods, getters - and setters. This will generate the function declaration and unwrap the - global object. Subclasses are expected to override the generate_code - function to do the rest of the work. This function should return a - CGThing which is already properly indented. - """ - def __init__(self, descriptor, name): - args = [ - Argument('*mut JSContext', 'cx'), - Argument('libc::c_uint', 'argc'), - Argument('*mut JSVal', 'vp'), - ] - CGAbstractMethod.__init__(self, descriptor, name, "bool", args, extern=True) - self.exposureSet = descriptor.interface.exposureSet - - def definition_body(self): - preamble = """\ -let args = CallArgs::from_vp(vp, argc); -let global = GlobalScope::from_object(args.callee()); -""" - if len(self.exposureSet) == 1: - preamble += f"let global = DomRoot::downcast::<dom::types::{list(self.exposureSet)[0]}>(global).unwrap();\n" - return CGList([CGGeneric(preamble), self.generate_code()]) - - def generate_code(self): - raise NotImplementedError # Override me! - - -def GetConstructorNameForReporting(descriptor, ctor): - # Figure out the name of our constructor for reporting purposes. - # For unnamed webidl constructors, identifier.name is "constructor" but - # the name JS sees is the interface name; for legacy factory functions - # identifier.name is the actual name. - ctorName = ctor.identifier.name - if ctorName == "constructor": - return descriptor.interface.identifier.name - return ctorName - - -class CGSpecializedMethod(CGAbstractExternMethod): - """ - A class for generating the C++ code for a specialized method that the JIT - can call with lower overhead. - """ - def __init__(self, descriptor, method): - self.method = method - name = method.identifier.name - args = [Argument('*mut JSContext', 'cx'), - Argument('RawHandleObject', '_obj'), - Argument('*mut libc::c_void', 'this'), - Argument('*const JSJitMethodCallArgs', 'args')] - CGAbstractExternMethod.__init__(self, descriptor, name, 'bool', args) - - def definition_body(self): - nativeName = CGSpecializedMethod.makeNativeName(self.descriptor, - self.method) - return CGWrapper(CGMethodCall([], nativeName, self.method.isStatic(), - self.descriptor, self.method), - pre="let cx = SafeJSContext::from_ptr(cx);\n" - f"let this = &*(this as *const {self.descriptor.concreteType});\n" - "let args = &*args;\n" - "let argc = args.argc_;\n") - - @staticmethod - def makeNativeName(descriptor, method): - if method.underlyingAttr: - return CGSpecializedGetter.makeNativeName(descriptor, method.underlyingAttr) - name = method.identifier.name - nativeName = descriptor.binaryNameFor(name) - if nativeName == name: - nativeName = descriptor.internalNameFor(name) - return MakeNativeName(nativeName) - - -# https://searchfox.org/mozilla-central/rev/b220e40ff2ee3d10ce68e07d8a8a577d5558e2a2/dom/bindings/Codegen.py#10655-10684 -class CGMethodPromiseWrapper(CGAbstractExternMethod): - """ - A class for generating a wrapper around another method that will - convert exceptions to promises. - """ - - def __init__(self, descriptor, methodToWrap): - self.method = methodToWrap - name = CGMethodPromiseWrapper.makeNativeName(descriptor, self.method) - args = [Argument('*mut JSContext', 'cx'), - Argument('RawHandleObject', '_obj'), - Argument('*mut libc::c_void', 'this'), - Argument('*const JSJitMethodCallArgs', 'args')] - CGAbstractExternMethod.__init__(self, descriptor, name, 'bool', args) - - def definition_body(self): - return CGGeneric(fill( - """ - let ok = ${methodName}(${args}); - if ok { - return true; - } - return exception_to_promise(cx, (*args).rval()); - """, - methodName=self.method.identifier.name, - args=", ".join(arg.name for arg in self.args), - )) - - @staticmethod - def makeNativeName(descriptor, m): - return f"{m.identifier.name}_promise_wrapper" - - -# https://searchfox.org/mozilla-central/rev/7279a1df13a819be254fd4649e07c4ff93e4bd45/dom/bindings/Codegen.py#11390-11419 -class CGGetterPromiseWrapper(CGAbstractExternMethod): - """ - A class for generating a wrapper around another getter that will - convert exceptions to promises. - """ - - def __init__(self, descriptor, methodToWrap): - self.method = methodToWrap - name = CGGetterPromiseWrapper.makeNativeName(descriptor, self.method) - self.method_call = CGGetterPromiseWrapper.makeOrigName(descriptor, self.method) - args = [Argument('*mut JSContext', 'cx'), - Argument('RawHandleObject', '_obj'), - Argument('*mut libc::c_void', 'this'), - Argument('JSJitGetterCallArgs', 'args')] - CGAbstractExternMethod.__init__(self, descriptor, name, 'bool', args) - - def definition_body(self): - return CGGeneric(fill( - """ - let ok = ${methodName}(${args}); - if ok { - return true; - } - return exception_to_promise(cx, args.rval()); - """, - methodName=self.method_call, - args=", ".join(arg.name for arg in self.args), - )) - - @staticmethod - def makeOrigName(descriptor, m): - return f'get_{descriptor.internalNameFor(m.identifier.name)}' - - @staticmethod - def makeNativeName(descriptor, m): - return f"{CGGetterPromiseWrapper.makeOrigName(descriptor, m)}_promise_wrapper" - - -class CGDefaultToJSONMethod(CGSpecializedMethod): - def __init__(self, descriptor, method): - assert method.isDefaultToJSON() - CGSpecializedMethod.__init__(self, descriptor, method) - - def definition_body(self): - ret = dedent(""" - use crate::dom::bindings::inheritance::HasParent; - rooted!(in(cx) let result = JS_NewPlainObject(cx)); - if result.is_null() { - return false; - } - """) - - jsonDescriptors = [self.descriptor] - interface = self.descriptor.interface.parent - while interface: - descriptor = self.descriptor.getDescriptor(interface.identifier.name) - if descriptor.hasDefaultToJSON: - jsonDescriptors.append(descriptor) - interface = interface.parent - - parents = len(jsonDescriptors) - 1 - form = """ - if !${parentclass}CollectJSONAttributes(cx, _obj, this, result.handle()) { - return false; - } - """ - - # Iterate the array in reverse: oldest ancestor first - for descriptor in jsonDescriptors[:0:-1]: - ret += fill(form, parentclass=f"{toBindingNamespace(descriptor.name)}::") - parents -= 1 - ret += fill(form, parentclass="") - ret += ('(*args).rval().set(ObjectValue(*result));\n' - 'true\n') - return CGGeneric(ret) - - -class CGStaticMethod(CGAbstractStaticBindingMethod): - """ - A class for generating the Rust code for an IDL static method. - """ - def __init__(self, descriptor, method): - self.method = method - name = method.identifier.name - CGAbstractStaticBindingMethod.__init__(self, descriptor, name) - - def generate_code(self): - nativeName = CGSpecializedMethod.makeNativeName(self.descriptor, - self.method) - safeContext = CGGeneric("let cx = SafeJSContext::from_ptr(cx);\n") - setupArgs = CGGeneric("let args = CallArgs::from_vp(vp, argc);\n") - call = CGMethodCall(["&global"], nativeName, True, self.descriptor, self.method) - return CGList([safeContext, setupArgs, call]) - - -class CGSpecializedGetter(CGAbstractExternMethod): - """ - A class for generating the code for a specialized attribute getter - that the JIT can call with lower overhead. - """ - def __init__(self, descriptor, attr): - self.attr = attr - name = f'get_{descriptor.internalNameFor(attr.identifier.name)}' - args = [Argument('*mut JSContext', 'cx'), - Argument('RawHandleObject', '_obj'), - Argument('*mut libc::c_void', 'this'), - Argument('JSJitGetterCallArgs', 'args')] - CGAbstractExternMethod.__init__(self, descriptor, name, "bool", args) - - def definition_body(self): - nativeName = CGSpecializedGetter.makeNativeName(self.descriptor, - self.attr) - - return CGWrapper(CGGetterCall([], self.attr.type, nativeName, - self.descriptor, self.attr), - pre="let cx = SafeJSContext::from_ptr(cx);\n" - f"let this = &*(this as *const {self.descriptor.concreteType});\n") - - @staticmethod - def makeNativeName(descriptor, attr): - name = attr.identifier.name - nativeName = descriptor.binaryNameFor(name) - if nativeName == name: - nativeName = descriptor.internalNameFor(name) - nativeName = MakeNativeName(nativeName) - infallible = ('infallible' in - descriptor.getExtendedAttributes(attr, getter=True)) - if attr.type.nullable() or not infallible: - return f"Get{nativeName}" - - return nativeName - - -class CGStaticGetter(CGAbstractStaticBindingMethod): - """ - A class for generating the C++ code for an IDL static attribute getter. - """ - def __init__(self, descriptor, attr): - self.attr = attr - name = f'get_{attr.identifier.name}' - CGAbstractStaticBindingMethod.__init__(self, descriptor, name) - - def generate_code(self): - nativeName = CGSpecializedGetter.makeNativeName(self.descriptor, - self.attr) - safeContext = CGGeneric("let cx = SafeJSContext::from_ptr(cx);\n") - setupArgs = CGGeneric("let args = CallArgs::from_vp(vp, argc);\n") - call = CGGetterCall(["&global"], self.attr.type, nativeName, self.descriptor, - self.attr) - return CGList([safeContext, setupArgs, call]) - - -class CGSpecializedSetter(CGAbstractExternMethod): - """ - A class for generating the code for a specialized attribute setter - that the JIT can call with lower overhead. - """ - def __init__(self, descriptor, attr): - self.attr = attr - name = f'set_{descriptor.internalNameFor(attr.identifier.name)}' - args = [Argument('*mut JSContext', 'cx'), - Argument('RawHandleObject', 'obj'), - Argument('*mut libc::c_void', 'this'), - Argument('JSJitSetterCallArgs', 'args')] - CGAbstractExternMethod.__init__(self, descriptor, name, "bool", args) - - def definition_body(self): - nativeName = CGSpecializedSetter.makeNativeName(self.descriptor, - self.attr) - return CGWrapper( - CGSetterCall([], self.attr.type, nativeName, self.descriptor, self.attr), - pre=("let cx = SafeJSContext::from_ptr(cx);\n" - f"let this = &*(this as *const {self.descriptor.concreteType});\n") - ) - - @staticmethod - def makeNativeName(descriptor, attr): - name = attr.identifier.name - nativeName = descriptor.binaryNameFor(name) - if nativeName == name: - nativeName = descriptor.internalNameFor(name) - return f"Set{MakeNativeName(nativeName)}" - - -class CGStaticSetter(CGAbstractStaticBindingMethod): - """ - A class for generating the C++ code for an IDL static attribute setter. - """ - def __init__(self, descriptor, attr): - self.attr = attr - name = f'set_{attr.identifier.name}' - CGAbstractStaticBindingMethod.__init__(self, descriptor, name) - - def generate_code(self): - nativeName = CGSpecializedSetter.makeNativeName(self.descriptor, - self.attr) - safeContext = CGGeneric("let cx = SafeJSContext::from_ptr(cx);\n") - checkForArg = CGGeneric( - "let args = CallArgs::from_vp(vp, argc);\n" - "if argc == 0 {\n" - f' throw_type_error(*cx, "Not enough arguments to {self.attr.identifier.name} setter.");\n' - " return false;\n" - "}") - call = CGSetterCall(["&global"], self.attr.type, nativeName, self.descriptor, - self.attr) - return CGList([safeContext, checkForArg, call]) - - -class CGSpecializedForwardingSetter(CGSpecializedSetter): - """ - A class for generating the code for an IDL attribute forwarding setter. - """ - def __init__(self, descriptor, attr): - CGSpecializedSetter.__init__(self, descriptor, attr) - - def definition_body(self): - attrName = self.attr.identifier.name - forwardToAttrName = self.attr.getExtendedAttribute("PutForwards")[0] - # JS_GetProperty and JS_SetProperty can only deal with ASCII - assert all(ord(c) < 128 for c in attrName) - assert all(ord(c) < 128 for c in forwardToAttrName) - return CGGeneric(f""" -let cx = SafeJSContext::from_ptr(cx); -rooted!(in(*cx) let mut v = UndefinedValue()); -if !JS_GetProperty(*cx, HandleObject::from_raw(obj), {str_to_cstr_ptr(attrName)}, v.handle_mut()) {{ - return false; -}} -if !v.is_object() {{ - throw_type_error(*cx, "Value.{attrName} is not an object."); - return false; -}} -rooted!(in(*cx) let target_obj = v.to_object()); -JS_SetProperty(*cx, target_obj.handle(), {str_to_cstr_ptr(forwardToAttrName)}, HandleValue::from_raw(args.get(0))) -""") - - -class CGSpecializedReplaceableSetter(CGSpecializedSetter): - """ - A class for generating the code for an IDL replaceable attribute setter. - """ - def __init__(self, descriptor, attr): - CGSpecializedSetter.__init__(self, descriptor, attr) - - def definition_body(self): - assert self.attr.readonly - name = str_to_cstr_ptr(self.attr.identifier.name) - # JS_DefineProperty can only deal with ASCII. - assert all(ord(c) < 128 for c in name) - return CGGeneric(f""" -JS_DefineProperty(cx, HandleObject::from_raw(obj), {name}, - HandleValue::from_raw(args.get(0)), JSPROP_ENUMERATE as u32)""") - - -class CGMemberJITInfo(CGThing): - """ - A class for generating the JITInfo for a property that points to - our specialized getter and setter. - """ - def __init__(self, descriptor, member): - self.member = member - self.descriptor = descriptor - - def defineJitInfo(self, infoName, opName, opType, infallible, movable, - aliasSet, alwaysInSlot, lazilyInSlot, slotIndex, - returnTypes, args): - """ - aliasSet is a JSJitInfo_AliasSet value, without the "JSJitInfo_AliasSet::" bit. - - args is None if we don't want to output argTypes for some - reason (e.g. we have overloads or we're not a method) and - otherwise an iterable of the arguments for this method. - """ - assert not movable or aliasSet != "AliasEverything" # Can't move write-aliasing things - assert not alwaysInSlot or movable # Things always in slots had better be movable - - def jitInfoInitializer(isTypedMethod): - initializer = fill( - """ - JSJitInfo { - __bindgen_anon_1: JSJitInfo__bindgen_ty_1 { - ${opKind}: ${opValue} - }, - __bindgen_anon_2: JSJitInfo__bindgen_ty_2 { - protoID: PrototypeList::ID::${name} as u16, - }, - __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: ${depth} }, - _bitfield_align_1: [], - _bitfield_1: __BindgenBitfieldUnit::new( - new_jsjitinfo_bitfield_1!( - JSJitInfo_OpType::${opType} as u8, - JSJitInfo_AliasSet::${aliasSet} as u8, - JSValueType::${returnType} as u8, - ${isInfallible}, - ${isMovable}, - ${isEliminatable}, - ${isAlwaysInSlot}, - ${isLazilyCachedInSlot}, - ${isTypedMethod}, - ${slotIndex}, - ).to_ne_bytes() - ), - } - """, - opValue=f"Some({opName})", - name=self.descriptor.name, - depth=self.descriptor.interface.inheritanceDepth(), - opType=opType, - opKind=opType.lower(), - aliasSet=aliasSet, - returnType=functools.reduce(CGMemberJITInfo.getSingleReturnType, returnTypes, - ""), - isInfallible=toStringBool(infallible), - isMovable=toStringBool(movable), - # FIXME(nox): https://github.com/servo/servo/issues/10991 - isEliminatable=toStringBool(False), - isAlwaysInSlot=toStringBool(alwaysInSlot), - isLazilyCachedInSlot=toStringBool(lazilyInSlot), - isTypedMethod=toStringBool(isTypedMethod), - slotIndex=slotIndex) - return initializer.rstrip() - - if args is not None: - argTypes = f"{infoName}_argTypes" - args = [CGMemberJITInfo.getJSArgType(arg.type) for arg in args] - args.append("JSJitInfo_ArgType::ArgTypeListEnd as i32") - argTypesDecl = f"const {argTypes}: [i32; {len(args)}] = [ {', '.join(args)} ];\n" - return fill( - """ - $*{argTypesDecl} - static ${infoName}: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new(); - - pub(crate) fn init_${infoName}() { - ${infoName}.set(JSTypedMethodJitInfo { - base: ${jitInfoInit}, - argTypes: &${argTypes} as *const _ as *const JSJitInfo_ArgType, - }); - } - """, - argTypesDecl=argTypesDecl, - infoName=infoName, - jitInfoInit=indent(jitInfoInitializer(True)), - argTypes=argTypes) - - return f""" -static {infoName}: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new(); - -pub(crate) fn init_{infoName}() {{ - {infoName}.set({jitInfoInitializer(False)}); -}}""" - - def define(self): - if self.member.isAttr(): - internalMemberName = self.descriptor.internalNameFor(self.member.identifier.name) - getterinfo = f"{internalMemberName}_getterinfo" - getter = f"get_{internalMemberName}" - if self.member.type.isPromise(): - getter = CGGetterPromiseWrapper.makeNativeName(self.descriptor, self.member) - getterinfal = "infallible" in self.descriptor.getExtendedAttributes(self.member, getter=True) - - movable = self.mayBeMovable() and getterinfal - aliasSet = self.aliasSet() - - isAlwaysInSlot = self.member.getExtendedAttribute("StoreInSlot") - if self.member.slotIndices is not None: - assert isAlwaysInSlot or self.member.getExtendedAttribute("Cached") - isLazilyCachedInSlot = not isAlwaysInSlot - slotIndex = memberReservedSlot(self.member) # noqa:FIXME: memberReservedSlot is not defined - # We'll statically assert that this is not too big in - # CGUpdateMemberSlotsMethod, in the case when - # isAlwaysInSlot is true. - else: - isLazilyCachedInSlot = False - slotIndex = "0" - - result = self.defineJitInfo(getterinfo, getter, "Getter", - getterinfal, movable, aliasSet, - isAlwaysInSlot, isLazilyCachedInSlot, - slotIndex, - [self.member.type], None) - if (not self.member.readonly or self.member.getExtendedAttribute("PutForwards") - or self.member.getExtendedAttribute("Replaceable")): - setterinfo = f"{internalMemberName}_setterinfo" - setter = f"set_{internalMemberName}" - # Setters are always fallible, since they have to do a typed unwrap. - result += self.defineJitInfo(setterinfo, setter, "Setter", - False, False, "AliasEverything", - False, False, "0", - [BuiltinTypes[IDLBuiltinType.Types.undefined]], - None) - return result - if self.member.isMethod(): - methodinfo = f"{self.member.identifier.name}_methodinfo" - method = f"{self.member.identifier.name}" - if self.member.returnsPromise(): - method = CGMethodPromiseWrapper.makeNativeName(self.descriptor, self.member) - - # Methods are infallible if they are infallible, have no arguments - # to unwrap, and have a return type that's infallible to wrap up for - # return. - sigs = self.member.signatures() - if len(sigs) != 1: - # Don't handle overloading. If there's more than one signature, - # one of them must take arguments. - methodInfal = False - args = None - movable = False - else: - sig = sigs[0] - # For methods that affect nothing, it's OK to set movable to our - # notion of infallible on the C++ side, without considering - # argument conversions, since argument conversions that can - # reliably throw would be effectful anyway and the jit doesn't - # move effectful things. - hasInfallibleImpl = "infallible" in self.descriptor.getExtendedAttributes(self.member) - movable = self.mayBeMovable() and hasInfallibleImpl - # XXXbz can we move the smarts about fallibility due to arg - # conversions into the JIT, using our new args stuff? - if (len(sig[1]) != 0): - # We have arguments or our return-value boxing can fail - methodInfal = False - else: - methodInfal = hasInfallibleImpl - # For now, only bother to output args if we're side-effect-free. - if self.member.affects == "Nothing": - args = sig[1] - else: - args = None - - aliasSet = self.aliasSet() - result = self.defineJitInfo(methodinfo, method, "Method", - methodInfal, movable, aliasSet, - False, False, "0", - [s[0] for s in sigs], args) - return result - raise TypeError("Illegal member type to CGPropertyJITInfo") - - def mayBeMovable(self): - """ - Returns whether this attribute or method may be movable, just - based on Affects/DependsOn annotations. - """ - affects = self.member.affects - dependsOn = self.member.dependsOn - assert affects in IDLInterfaceMember.AffectsValues - assert dependsOn in IDLInterfaceMember.DependsOnValues - # Things that are DependsOn=DeviceState are not movable, because we - # don't want them coalesced with each other or loop-hoisted, since - # their return value can change even if nothing is going on from our - # point of view. - return (affects == "Nothing" - and (dependsOn != "Everything" and dependsOn != "DeviceState")) - - def aliasSet(self): - """Returns the alias set to store in the jitinfo. This may not be the - effective alias set the JIT uses, depending on whether we have enough - information about our args to allow the JIT to prove that effectful - argument conversions won't happen. - - """ - dependsOn = self.member.dependsOn - assert dependsOn in IDLInterfaceMember.DependsOnValues - - if dependsOn == "Nothing" or dependsOn == "DeviceState": - assert self.member.affects == "Nothing" - return "AliasNone" - - if dependsOn == "DOMState": - assert self.member.affects == "Nothing" - return "AliasDOMSets" - - return "AliasEverything" - - @staticmethod - def getJSReturnTypeTag(t): - if t.nullable(): - # Sometimes it might return null, sometimes not - return "JSVAL_TYPE_UNKNOWN" - if t.isUndefined(): - # No return, every time - return "JSVAL_TYPE_UNDEFINED" - if t.isSequence(): - return "JSVAL_TYPE_OBJECT" - if t.isRecord(): - return "JSVAL_TYPE_OBJECT" - if t.isPromise(): - return "JSVAL_TYPE_OBJECT" - if t.isGeckoInterface(): - return "JSVAL_TYPE_OBJECT" - if t.isString(): - return "JSVAL_TYPE_STRING" - if t.isEnum(): - return "JSVAL_TYPE_STRING" - if t.isCallback(): - return "JSVAL_TYPE_OBJECT" - if t.isAny(): - # The whole point is to return various stuff - return "JSVAL_TYPE_UNKNOWN" - if t.isObject(): - return "JSVAL_TYPE_OBJECT" - if t.isSpiderMonkeyInterface(): - return "JSVAL_TYPE_OBJECT" - if t.isUnion(): - u = t.unroll() - if u.hasNullableType: - # Might be null or not - return "JSVAL_TYPE_UNKNOWN" - return functools.reduce(CGMemberJITInfo.getSingleReturnType, - u.flatMemberTypes, "") - if t.isDictionary(): - return "JSVAL_TYPE_OBJECT" - if not t.isPrimitive(): - raise TypeError(f"No idea what type {t} is.") - tag = t.tag() - if tag == IDLType.Tags.bool: - return "JSVAL_TYPE_BOOLEAN" - if tag in [IDLType.Tags.int8, IDLType.Tags.uint8, - IDLType.Tags.int16, IDLType.Tags.uint16, - IDLType.Tags.int32]: - return "JSVAL_TYPE_INT32" - if tag in [IDLType.Tags.int64, IDLType.Tags.uint64, - IDLType.Tags.unrestricted_float, IDLType.Tags.float, - IDLType.Tags.unrestricted_double, IDLType.Tags.double]: - # These all use JS_NumberValue, which can return int or double. - # But TI treats "double" as meaning "int or double", so we're - # good to return JSVAL_TYPE_DOUBLE here. - return "JSVAL_TYPE_DOUBLE" - if tag != IDLType.Tags.uint32: - raise TypeError(f"No idea what type {t} is.") - # uint32 is sometimes int and sometimes double. - return "JSVAL_TYPE_DOUBLE" - - @staticmethod - def getSingleReturnType(existingType, t): - type = CGMemberJITInfo.getJSReturnTypeTag(t) - if existingType == "": - # First element of the list; just return its type - return type - - if type == existingType: - return existingType - if ((type == "JSVAL_TYPE_DOUBLE" - and existingType == "JSVAL_TYPE_INT32") - or (existingType == "JSVAL_TYPE_DOUBLE" - and type == "JSVAL_TYPE_INT32")): - # Promote INT32 to DOUBLE as needed - return "JSVAL_TYPE_DOUBLE" - # Different types - return "JSVAL_TYPE_UNKNOWN" - - @staticmethod - def getJSArgType(t): - assert not t.isUndefined() - if t.nullable(): - # Sometimes it might return null, sometimes not - return f"JSJitInfo_ArgType::Null as i32 | {CGMemberJITInfo.getJSArgType(t.inner)}" - if t.isSequence(): - return "JSJitInfo_ArgType::Object as i32" - if t.isGeckoInterface(): - return "JSJitInfo_ArgType::Object as i32" - if t.isString(): - return "JSJitInfo_ArgType::String as i32" - if t.isEnum(): - return "JSJitInfo_ArgType::String as i32" - if t.isCallback(): - return "JSJitInfo_ArgType::Object as i32" - if t.isAny(): - # The whole point is to return various stuff - return "JSJitInfo_ArgType::Any as i32" - if t.isObject(): - return "JSJitInfo_ArgType::Object as i32" - if t.isSpiderMonkeyInterface(): - return "JSJitInfo_ArgType::Object as i32" - if t.isUnion(): - u = t.unroll() - type = "JSJitInfo_ArgType::Null as i32" if u.hasNullableType else "" - return functools.reduce(CGMemberJITInfo.getSingleArgType, - u.flatMemberTypes, type) - if t.isDictionary(): - return "JSJitInfo_ArgType::Object as i32" - if not t.isPrimitive(): - raise TypeError(f"No idea what type {t} is.") - tag = t.tag() - if tag == IDLType.Tags.bool: - return "JSJitInfo_ArgType::Boolean as i32" - if tag in [IDLType.Tags.int8, IDLType.Tags.uint8, - IDLType.Tags.int16, IDLType.Tags.uint16, - IDLType.Tags.int32]: - return "JSJitInfo_ArgType::Integer as i32" - if tag in [IDLType.Tags.int64, IDLType.Tags.uint64, - IDLType.Tags.unrestricted_float, IDLType.Tags.float, - IDLType.Tags.unrestricted_double, IDLType.Tags.double]: - # These all use JS_NumberValue, which can return int or double. - # But TI treats "double" as meaning "int or double", so we're - # good to return JSVAL_TYPE_DOUBLE here. - return "JSJitInfo_ArgType::Double as i32" - if tag != IDLType.Tags.uint32: - raise TypeError(f"No idea what type {t} is.") - # uint32 is sometimes int and sometimes double. - return "JSJitInfo_ArgType::Double as i32" - - @staticmethod - def getSingleArgType(existingType, t): - type = CGMemberJITInfo.getJSArgType(t) - if existingType == "": - # First element of the list; just return its type - return type - - if type == existingType: - return existingType - return f"{existingType} | {type}" - - -# https://searchfox.org/mozilla-central/rev/9993372dd72daea851eba4600d5750067104bc15/dom/bindings/Codegen.py#12355-12374 -class CGStaticMethodJitinfo(CGGeneric): - """ - A class for generating the JITInfo for a promise-returning static method. - """ - - def __init__(self, method): - CGGeneric.__init__( - self, - f""" - static {method.identifier.name}_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new(); - - pub(crate) fn init_{method.identifier.name}_methodinfo() {{ - {method.identifier.name}_methodinfo.set(JSJitInfo {{ - __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {{ - staticMethod: Some({method.identifier.name}) - }}, - __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {{ - protoID: PrototypeList::ID::Last as u16, - }}, - __bindgen_anon_3: JSJitInfo__bindgen_ty_3 {{ depth: 0 }}, - _bitfield_align_1: [], - _bitfield_1: __BindgenBitfieldUnit::new( - new_jsjitinfo_bitfield_1!( - JSJitInfo_OpType::StaticMethod as u8, - JSJitInfo_AliasSet::AliasEverything as u8, - JSValueType::JSVAL_TYPE_OBJECT as u8, - false, - false, - false, - false, - false, - false, - 0, - ).to_ne_bytes() - ), - }}); - }} - """ - ) - - -def getEnumValueName(value): - # Some enum values can be empty strings. Others might have weird - # characters in them. Deal with the former by returning "_empty", - # deal with possible name collisions from that by throwing if the - # enum value is actually "_empty", and throw on any value - # containing non-ASCII chars for now. Replace all chars other than - # [0-9A-Za-z_] with '_'. - if re.match("[^\x20-\x7E]", value): - raise SyntaxError(f'Enum value "{value}" contains non-ASCII characters') - if re.match("^[0-9]", value): - value = '_' + value - value = re.sub(r'[^0-9A-Za-z_]', '_', value) - if re.match("^_[A-Z]|__", value): - raise SyntaxError(f'Enum value "{value}" is reserved by the C++ spec') - if value == "_empty": - raise SyntaxError('"_empty" is not an IDL enum value we support yet') - if value == "": - return "_empty" - return MakeNativeName(value) - - -class CGEnum(CGThing): - def __init__(self, enum, config): - CGThing.__init__(self) - - ident = enum.identifier.name - enums = ",\n ".join(map(getEnumValueName, list(enum.values()))) - derives = ["Copy", "Clone", "Debug", "JSTraceable", "MallocSizeOf", "PartialEq"] - enum_config = config.getEnumConfig(ident) - extra_derives = enum_config.get('derives', []) - derives = ', '.join(derives + extra_derives) - decl = f""" -#[repr(usize)] -#[derive({derives})] -pub(crate) enum {ident} {{ - {enums} -}} -""" - - pairs = ",\n ".join([f'("{val}", super::{ident}::{getEnumValueName(val)})' - for val in list(enum.values())]) - - inner = f""" -use crate::dom::bindings::conversions::ConversionResult; -use crate::dom::bindings::conversions::FromJSValConvertible; -use crate::dom::bindings::conversions::ToJSValConvertible; -use crate::dom::bindings::utils::find_enum_value; -use js::jsapi::JSContext; -use js::rust::HandleValue; -use js::rust::MutableHandleValue; -use js::jsval::JSVal; - -pub(crate) const pairs: &[(&str, super::{ident})] = &[ - {pairs}, -]; - -impl super::{ident} {{ - pub(crate) fn as_str(&self) -> &'static str {{ - pairs[*self as usize].0 - }} -}} - -impl Default for super::{ident} {{ - fn default() -> super::{ident} {{ - pairs[0].1 - }} -}} - -impl std::str::FromStr for super::{ident} {{ - type Err = (); - - fn from_str(s: &str) -> Result<Self, Self::Err> {{ - pairs - .iter() - .find(|&&(key, _)| s == key) - .map(|&(_, ev)| ev) - .ok_or(()) - }} -}} - -impl ToJSValConvertible for super::{ident} {{ - unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {{ - pairs[*self as usize].0.to_jsval(cx, rval); - }} -}} - -impl FromJSValConvertible for super::{ident} {{ - type Config = (); - unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ()) - -> Result<ConversionResult<super::{ident}>, ()> {{ - match find_enum_value(cx, value, pairs) {{ - Err(_) => Err(()), - Ok((None, search)) => {{ - Ok(ConversionResult::Failure( - format!("'{{}}' is not a valid enum value for enumeration '{ident}'.", search).into() - )) - }} - Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)), - }} - }} -}} - """ - self.cgRoot = CGList([ - CGGeneric(decl), - CGNamespace.build([f"{ident}Values"], - CGIndenter(CGGeneric(inner)), public=True), - ]) - - def define(self): - return self.cgRoot.define() - - -def convertConstIDLValueToRust(value): - tag = value.type.tag() - if tag in [IDLType.Tags.int8, IDLType.Tags.uint8, - IDLType.Tags.int16, IDLType.Tags.uint16, - IDLType.Tags.int32, IDLType.Tags.uint32, - IDLType.Tags.int64, IDLType.Tags.uint64, - IDLType.Tags.unrestricted_float, IDLType.Tags.float, - IDLType.Tags.unrestricted_double, IDLType.Tags.double]: - return str(value.value) - - if tag == IDLType.Tags.bool: - return toStringBool(value.value) - - raise TypeError(f"Const value of unhandled type: {value.type}") - - -class CGConstant(CGThing): - def __init__(self, constant): - CGThing.__init__(self) - self.constant = constant - - def define(self): - name = self.constant.identifier.name - value = convertConstIDLValueToRust(self.constant.value) - - tag = self.constant.value.type.tag() - const_type = builtinNames[self.constant.value.type.tag()] - # Finite<f32> or Finite<f64> cannot be used un a constant declaration. - # Remote the Finite type from restricted float and double tag declarations. - if tag == IDLType.Tags.float: - const_type = "f32" - elif tag == IDLType.Tags.double: - const_type = "f64" - - return f"pub(crate) const {name}: {const_type} = {value};\n" - - -def getUnionTypeTemplateVars(type, descriptorProvider): - if type.isGeckoInterface(): - name = type.inner.identifier.name - typeName = descriptorProvider.getDescriptor(name).returnType - elif type.isEnum(): - name = type.inner.identifier.name - typeName = name - elif type.isDictionary(): - name = type.name - typeName = name - elif type.isSequence() or type.isRecord(): - name = type.name - inner = getUnionTypeTemplateVars(innerContainerType(type), descriptorProvider) - typeName = wrapInNativeContainerType(type, CGGeneric(inner["typeName"])).define() - elif type.isByteString(): - name = type.name - typeName = "ByteString" - elif type.isDOMString(): - name = type.name - typeName = "DOMString" - elif type.isUSVString(): - name = type.name - typeName = "USVString" - elif type.isPrimitive(): - name = type.name - typeName = builtinNames[type.tag()] - elif type.isObject(): - name = type.name - typeName = "Heap<*mut JSObject>" - elif is_typed_array(type): - name = type.name - typeName = f"typedarray::Heap{name}" - elif type.isCallback(): - name = type.name - typeName = name - else: - raise TypeError(f"Can't handle {type} in unions yet") - - info = getJSToNativeConversionInfo( - type, descriptorProvider, failureCode="return Ok(None);", - exceptionCode='return Err(());', - isDefinitelyObject=True, - isMember="Union") - template = info.template - - jsConversion = string.Template(template).substitute({ - "val": "value", - }) - jsConversion = CGWrapper(CGGeneric(jsConversion), pre="Ok(Some(", post="))") - - return { - "name": name, - "typeName": typeName, - "jsConversion": jsConversion, - } - - -class CGUnionStruct(CGThing): - def __init__(self, type, descriptorProvider, config): - assert not type.nullable() - assert not type.hasNullableType - - CGThing.__init__(self) - self.type = type - self.derives = config.getUnionConfig(str(type)).get('derives', []) - self.descriptorProvider = descriptorProvider - - def membersNeedTracing(self): - for t in self.type.flatMemberTypes: - if type_needs_tracing(t): - return True - return False - - def define(self): - def getTypeWrapper(t): - if type_needs_tracing(t): - return "RootedTraceableBox" - if t.isCallback(): - return "Rc" - return "" - - templateVars = [(getUnionTypeTemplateVars(t, self.descriptorProvider), - getTypeWrapper(t)) for t in self.type.flatMemberTypes] - enumValues = [ - f" {v['name']}({wrapper}<{v['typeName']}>)," if wrapper else f" {v['name']}({v['typeName']})," - for (v, wrapper) in templateVars - ] - enumConversions = [ - f" {self.type}::{v['name']}(ref inner) => inner.to_jsval(cx, rval)," - for (v, _) in templateVars - ] - joinedEnumValues = "\n".join(enumValues) - joinedEnumConversions = "\n".join(enumConversions) - derives = ["JSTraceable"] + self.derives - return f""" -#[derive({", ".join(derives)})] -pub(crate) enum {self.type} {{ -{joinedEnumValues} -}} - -impl ToJSValConvertible for {self.type} {{ - unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {{ - match *self {{ -{joinedEnumConversions} - }} - }} -}} -""" - - -class CGUnionConversionStruct(CGThing): - def __init__(self, type, descriptorProvider): - assert not type.nullable() - assert not type.hasNullableType - - CGThing.__init__(self) - self.type = type - self.descriptorProvider = descriptorProvider - - def membersNeedTracing(self): - for t in self.type.flatMemberTypes: - if type_needs_tracing(t): - return True - return False - - def from_jsval(self): - memberTypes = self.type.flatMemberTypes - names = [] - conversions = [] - - def get_name(memberType): - if self.type.isGeckoInterface(): - return memberType.inner.identifier.name - - return memberType.name - - def get_match(name): - return ( - f"match {self.type}::TryConvertTo{name}(SafeJSContext::from_ptr(cx), value) {{\n" - " Err(_) => return Err(()),\n" - f" Ok(Some(value)) => return Ok(ConversionResult::Success({self.type}::{name}(value))),\n" - " Ok(None) => (),\n" - "}\n") - - interfaceMemberTypes = [t for t in memberTypes if t.isNonCallbackInterface()] - if len(interfaceMemberTypes) > 0: - typeNames = [get_name(memberType) for memberType in interfaceMemberTypes] - interfaceObject = CGList(CGGeneric(get_match(typeName)) for typeName in typeNames) - names.extend(typeNames) - else: - interfaceObject = None - - arrayObjectMemberTypes = [t for t in memberTypes if t.isSequence()] - if len(arrayObjectMemberTypes) > 0: - assert len(arrayObjectMemberTypes) == 1 - typeName = arrayObjectMemberTypes[0].name - arrayObject = CGGeneric(get_match(typeName)) - names.append(typeName) - else: - arrayObject = None - - callbackMemberTypes = [t for t in memberTypes if t.isCallback() or t.isCallbackInterface()] - if len(callbackMemberTypes) > 0: - assert len(callbackMemberTypes) == 1 - typeName = callbackMemberTypes[0].name - callbackObject = CGGeneric(get_match(typeName)) - else: - callbackObject = None - - dictionaryMemberTypes = [t for t in memberTypes if t.isDictionary()] - if len(dictionaryMemberTypes) > 0: - assert len(dictionaryMemberTypes) == 1 - typeName = dictionaryMemberTypes[0].name - dictionaryObject = CGGeneric(get_match(typeName)) - names.append(typeName) - else: - dictionaryObject = None - - objectMemberTypes = [t for t in memberTypes if t.isObject()] - if len(objectMemberTypes) > 0: - assert len(objectMemberTypes) == 1 - typeName = objectMemberTypes[0].name - object = CGGeneric(get_match(typeName)) - names.append(typeName) - else: - object = None - - mozMapMemberTypes = [t for t in memberTypes if t.isRecord()] - if len(mozMapMemberTypes) > 0: - assert len(mozMapMemberTypes) == 1 - typeName = mozMapMemberTypes[0].name - mozMapObject = CGGeneric(get_match(typeName)) - names.append(typeName) - else: - mozMapObject = None - - hasObjectTypes = object or interfaceObject or arrayObject or callbackObject or mozMapObject - if hasObjectTypes: - # "object" is not distinguishable from other types - assert not object or not (interfaceObject or arrayObject or callbackObject or mozMapObject) - templateBody = CGList([], "\n") - if arrayObject or callbackObject: - # An object can be both an sequence object and a callback or - # dictionary, but we shouldn't have both in the union's members - # because they are not distinguishable. - assert not (arrayObject and callbackObject) - templateBody.append(arrayObject if arrayObject else callbackObject) - if interfaceObject: - assert not object - templateBody.append(interfaceObject) - elif object: - templateBody.append(object) - if mozMapObject: - templateBody.append(mozMapObject) - - conversions.append(CGIfWrapper("value.get().is_object()", templateBody)) - - if dictionaryObject: - assert not object - conversions.append(dictionaryObject) - - stringTypes = [t for t in memberTypes if t.isString() or t.isEnum()] - numericTypes = [t for t in memberTypes if t.isNumeric()] - booleanTypes = [t for t in memberTypes if t.isBoolean()] - if stringTypes or numericTypes or booleanTypes: - assert len(stringTypes) <= 1 - assert len(numericTypes) <= 1 - assert len(booleanTypes) <= 1 - - def getStringOrPrimitiveConversion(memberType): - typename = get_name(memberType) - return CGGeneric(get_match(typename)) - other = [] - stringConversion = list(map(getStringOrPrimitiveConversion, stringTypes)) - numericConversion = list(map(getStringOrPrimitiveConversion, numericTypes)) - booleanConversion = list(map(getStringOrPrimitiveConversion, booleanTypes)) - if stringConversion: - if booleanConversion: - other.append(CGIfWrapper("value.get().is_boolean()", booleanConversion[0])) - if numericConversion: - other.append(CGIfWrapper("value.get().is_number()", numericConversion[0])) - other.append(stringConversion[0]) - elif numericConversion: - if booleanConversion: - other.append(CGIfWrapper("value.get().is_boolean()", booleanConversion[0])) - other.append(numericConversion[0]) - else: - assert booleanConversion - other.append(booleanConversion[0]) - conversions.append(CGList(other, "\n\n")) - conversions.append(CGGeneric( - f'Ok(ConversionResult::Failure("argument could not be converted to any of: {", ".join(names)}".into()))' - )) - method = CGWrapper( - CGIndenter(CGList(conversions, "\n\n")), - pre="unsafe fn from_jsval(cx: *mut JSContext,\n" - " value: HandleValue,\n" - " _option: ())\n" - f" -> Result<ConversionResult<{self.type}>, ()> {{\n", - post="\n}") - return CGWrapper( - CGIndenter(CGList([ - CGGeneric("type Config = ();"), - method, - ], "\n")), - pre=f"impl FromJSValConvertible for {self.type} {{\n", - post="\n}") - - def try_method(self, t): - templateVars = getUnionTypeTemplateVars(t, self.descriptorProvider) - actualType = templateVars["typeName"] - if type_needs_tracing(t): - actualType = f"RootedTraceableBox<{actualType}>" - if t.isCallback(): - actualType = f"Rc<{actualType}>" - returnType = f"Result<Option<{actualType}>, ()>" - jsConversion = templateVars["jsConversion"] - - return CGWrapper( - CGIndenter(jsConversion, 4), - pre=f"unsafe fn TryConvertTo{t.name}(cx: SafeJSContext, value: HandleValue) -> {returnType} {{\n", - post="\n}") - - def define(self): - from_jsval = self.from_jsval() - methods = CGIndenter(CGList([ - self.try_method(t) for t in self.type.flatMemberTypes - ], "\n\n")) - return f""" -{from_jsval.define()} - -impl {self.type} {{ -{methods.define()} -}} -""" - - -class ClassItem: - """ Use with CGClass """ - def __init__(self, name, visibility): - self.name = name - self.visibility = visibility - - def declare(self, cgClass): - assert False - - def define(self, cgClass): - assert False - - -class ClassBase(ClassItem): - def __init__(self, name, visibility='pub'): - ClassItem.__init__(self, name, visibility) - - def declare(self, cgClass): - return f'{self.visibility} {self.name}' - - def define(self, cgClass): - # Only in the header - return '' - - -class ClassMethod(ClassItem): - def __init__(self, name, returnType, args, inline=False, static=False, - virtual=False, const=False, bodyInHeader=False, - templateArgs=None, visibility='public', body=None, - breakAfterReturnDecl="\n", unsafe=False, - breakAfterSelf="\n", override=False): - """ - override indicates whether to flag the method as MOZ_OVERRIDE - """ - assert not override or virtual - assert not (override and static) - self.returnType = returnType - self.args = args - self.inline = False - self.static = static - self.virtual = virtual - self.const = const - self.bodyInHeader = True - self.templateArgs = templateArgs - self.body = body - self.breakAfterReturnDecl = breakAfterReturnDecl - self.breakAfterSelf = breakAfterSelf - self.override = override - self.unsafe = unsafe - ClassItem.__init__(self, name, visibility) - - def getDecorators(self, declaring): - decorators = [] - if self.inline: - decorators.append('inline') - if declaring: - if self.static: - decorators.append('static') - if self.virtual: - decorators.append('virtual') - if decorators: - return f'{" ".join(decorators)} ' - return '' - - def getBody(self): - # Override me or pass a string to constructor - assert self.body is not None - return self.body - - def declare(self, cgClass): - - templateClause = f"<{', '.join(self.templateArgs)}>" if self.bodyInHeader and self.templateArgs else '<>' - args = ', '.join([a.declare() for a in self.args]) - if self.bodyInHeader: - body = CGIndenter(CGGeneric(self.getBody())).define() - body = f' {{\n{body}\n}}' - else: - body = ';' - visibility = f'{self.visibility} ' if self.visibility != 'priv' else '' - unsafe = "unsafe " if self.unsafe else "" - returnType = f" -> {self.returnType}" if self.returnType else "" - const = ' const' if self.const else '' - override = ' MOZ_OVERRIDE' if self.override else '' - return ( - f"{self.getDecorators(True)}{self.breakAfterReturnDecl}" - f"{visibility}{unsafe}fn {self.name}{templateClause}({args})" - f"{returnType}{const}{override}{body}{self.breakAfterSelf}" - ) - - def define(self, cgClass): - pass - - -class ClassConstructor(ClassItem): - """ - Used for adding a constructor to a CGClass. - - args is a list of Argument objects that are the arguments taken by the - constructor. - - inline should be True if the constructor should be marked inline. - - bodyInHeader should be True if the body should be placed in the class - declaration in the header. - - visibility determines the visibility of the constructor (public, - protected, private), defaults to private. - - explicit should be True if the constructor should be marked explicit. - - baseConstructors is a list of strings containing calls to base constructors, - defaults to None. - - body contains a string with the code for the constructor, defaults to empty. - """ - def __init__(self, args, inline=False, bodyInHeader=False, - visibility="priv", explicit=False, baseConstructors=None, - body=""): - self.args = args - self.inline = False - self.bodyInHeader = bodyInHeader - self.explicit = explicit - self.baseConstructors = baseConstructors or [] - self.body = body - ClassItem.__init__(self, None, visibility) - - def getDecorators(self, declaring): - decorators = [] - if self.explicit: - decorators.append('explicit') - if self.inline and declaring: - decorators.append('inline') - if decorators: - return f'{" ".join(decorators)} ' - return '' - - def getInitializationList(self, cgClass): - items = [str(c) for c in self.baseConstructors] - for m in cgClass.members: - if not m.static: - initialize = m.body - if initialize: - items.append(f"{m.name}({initialize})") - - if len(items) > 0: - joinedItems = ",\n ".join(items) - return f'\n : {joinedItems}' - return '' - - def getBody(self, cgClass): - initializers = [f" parent: {self.baseConstructors[0]}"] - joinedInitializers = '\n'.join(initializers) - return ( - f"{self.body}" - f"let mut ret = Rc::new({cgClass.name} {{\n" - f"{joinedInitializers}\n" - "});\n" - "// Note: callback cannot be moved after calling init.\n" - "match Rc::get_mut(&mut ret) {\n" - f" Some(ref mut callback) => callback.parent.init({self.args[0].name}, {self.args[1].name}),\n" - " None => unreachable!(),\n" - "};\n" - "ret" - ) - - def declare(self, cgClass): - args = ', '.join([a.declare() for a in self.args]) - body = f' {self.getBody(cgClass)}' - body = stripTrailingWhitespace(body.replace('\n', '\n ')) - if len(body) > 0: - body += '\n' - body = f' {{\n{body}}}' - - return f""" -pub(crate) unsafe fn {self.getDecorators(True)}new({args}) -> Rc<{cgClass.getNameString()}>{body} -""" - - def define(self, cgClass): - if self.bodyInHeader: - return '' - - args = ', '.join([a.define() for a in self.args]) - - body = f' {self.getBody()}' - trimmedBody = stripTrailingWhitespace(body.replace('\n', '\n ')) - body = f'\n{trimmedBody}' - if len(body) > 0: - body += '\n' - - className = cgClass.getNameString() - return f""" -{self.getDecorators(False)} -{className}::{className}({args}){self.getInitializationList(cgClass)} -{{{body}}} -""" - - -class ClassMember(ClassItem): - def __init__(self, name, type, visibility="priv", static=False, - body=None): - self.type = type - self.static = static - self.body = body - ClassItem.__init__(self, name, visibility) - - def declare(self, cgClass): - return f'{self.visibility} {self.name}: {self.type},\n' - - def define(self, cgClass): - if not self.static: - return '' - if self.body: - body = f" = {self.body}" - else: - body = "" - return f'{self.type} {cgClass.getNameString()}::{self.name}{body};\n' - - -class CGClass(CGThing): - def __init__(self, name, bases=[], members=[], constructors=[], - destructor=None, methods=[], - typedefs=[], enums=[], unions=[], templateArgs=[], - templateSpecialization=[], - disallowCopyConstruction=False, indent='', - decorators='', - extradeclarations=''): - CGThing.__init__(self) - self.name = name - self.bases = bases - self.members = members - self.constructors = constructors - # We store our single destructor in a list, since all of our - # code wants lists of members. - self.destructors = [destructor] if destructor else [] - self.methods = methods - self.typedefs = typedefs - self.enums = enums - self.unions = unions - self.templateArgs = templateArgs - self.templateSpecialization = templateSpecialization - self.disallowCopyConstruction = disallowCopyConstruction - self.indent = indent - self.decorators = decorators - self.extradeclarations = extradeclarations - - def getNameString(self): - className = self.name - if self.templateSpecialization: - className = f"{className}<{', '.join([str(a) for a in self.templateSpecialization])}>" - return className - - def define(self): - result = '' - if self.templateArgs: - templateArgs = [a.declare() for a in self.templateArgs] - templateArgs = templateArgs[len(self.templateSpecialization):] - result = f"{result}{self.indent}template <{','.join([str(a) for a in templateArgs])}>\n" - - if self.templateSpecialization: - specialization = f"<{', '.join([str(a) for a in self.templateSpecialization])}>" - else: - specialization = '' - - myself = '' - if self.decorators != '': - myself += f'{self.decorators}\n' - myself += f'{self.indent}pub(crate) struct {self.name}{specialization}' - result += myself - - assert len(self.bases) == 1 # XXjdm Can we support multiple inheritance? - - result += ' {\n' - - if self.bases: - self.members = [ClassMember("parent", self.bases[0].name, "pub(crate)")] + self.members - - result += CGIndenter(CGGeneric(self.extradeclarations), - len(self.indent)).define() - - def declareMembers(cgClass, memberList): - result = '' - - for member in memberList: - declaration = member.declare(cgClass) - declaration = CGIndenter(CGGeneric(declaration)).define() - result = f"{result}{declaration}" - return result - - if self.disallowCopyConstruction: - class DisallowedCopyConstructor(object): - def __init__(self): - self.visibility = "private" - - def declare(self, cgClass): - name = cgClass.getNameString() - return (f"{name}(const {name}&) MOZ_DELETE;\n" - f"void operator=(const {name}) MOZ_DELETE;\n") - disallowedCopyConstructors = [DisallowedCopyConstructor()] - else: - disallowedCopyConstructors = [] - - order = [(self.enums, ''), (self.unions, ''), - (self.typedefs, ''), (self.members, '')] - - for (memberList, separator) in order: - memberString = declareMembers(self, memberList) - if self.indent: - memberString = CGIndenter(CGGeneric(memberString), - len(self.indent)).define() - result = f"{result}{memberString}" - - result += f'{self.indent}}}\n\n' - result += f'impl {self.name} {{\n' - - order = [(self.constructors + disallowedCopyConstructors, '\n'), - (self.destructors, '\n'), (self.methods, '\n)')] - for (memberList, separator) in order: - memberString = declareMembers(self, memberList) - if self.indent: - memberString = CGIndenter(CGGeneric(memberString), - len(self.indent)).define() - result = f"{result}{memberString}" - - result += "}" - return result - - -class CGProxySpecialOperation(CGPerSignatureCall): - """ - Base class for classes for calling an indexed or named special operation - (don't use this directly, use the derived classes below). - """ - def __init__(self, descriptor, operation): - nativeName = MakeNativeName(descriptor.binaryNameFor(operation)) - operation = descriptor.operations[operation] - assert len(operation.signatures()) == 1 - signature = operation.signatures()[0] - - (returnType, arguments) = signature - if operation.isGetter() and not returnType.nullable(): - returnType = IDLNullableType(returnType.location, returnType) - - # We pass len(arguments) as the final argument so that the - # CGPerSignatureCall won't do any argument conversion of its own. - CGPerSignatureCall.__init__(self, returnType, "", arguments, nativeName, - False, descriptor, operation, - len(arguments)) - - if operation.isSetter(): - # arguments[0] is the index or name of the item that we're setting. - argument = arguments[1] - info = getJSToNativeConversionInfo( - argument.type, descriptor, - exceptionCode="return false;") - template = info.template - declType = info.declType - - templateValues = { - "val": "value.handle()", - } - self.cgRoot.prepend(instantiateJSToNativeConversionTemplate( - template, templateValues, declType, argument.identifier.name)) - self.cgRoot.prepend(CGGeneric("rooted!(in(*cx) let value = desc.value_);")) - - def getArguments(self): - args = [(a, process_arg(a.identifier.name, a)) for a in self.arguments] - return args - - def wrap_return_value(self): - if not self.idlNode.isGetter() or self.templateValues is None: - return "" - - wrap = CGGeneric(wrapForType(**self.templateValues)) - wrap = CGIfWrapper("let Some(result) = result", wrap) - return f"\n{wrap.define()}" - - -class CGProxyIndexedGetter(CGProxySpecialOperation): - """ - Class to generate a call to an indexed getter. If templateValues is not None - the returned value will be wrapped with wrapForType using templateValues. - """ - def __init__(self, descriptor, templateValues=None): - self.templateValues = templateValues - CGProxySpecialOperation.__init__(self, descriptor, 'IndexedGetter') - - -class CGProxyIndexedSetter(CGProxySpecialOperation): - """ - Class to generate a call to an indexed setter. - """ - def __init__(self, descriptor): - CGProxySpecialOperation.__init__(self, descriptor, 'IndexedSetter') - - -class CGProxyNamedOperation(CGProxySpecialOperation): - """ - Class to generate a call to a named operation. - """ - def __init__(self, descriptor, name): - CGProxySpecialOperation.__init__(self, descriptor, name) - - def define(self): - # Our first argument is the id we're getting. - argName = self.arguments[0].identifier.name - return (f'let {argName} = jsid_to_string(*cx, Handle::from_raw(id)).expect("Not a string-convertible JSID?");\n' - "let this = UnwrapProxy(proxy);\n" - "let this = &*this;\n" - f"{CGProxySpecialOperation.define(self)}") - - -class CGProxyNamedGetter(CGProxyNamedOperation): - """ - Class to generate a call to an named getter. If templateValues is not None - the returned value will be wrapped with wrapForType using templateValues. - """ - def __init__(self, descriptor, templateValues=None): - self.templateValues = templateValues - CGProxySpecialOperation.__init__(self, descriptor, 'NamedGetter') - - -class CGProxyNamedPresenceChecker(CGProxyNamedGetter): - """ - Class to generate a call that checks whether a named property exists. - For now, we just delegate to CGProxyNamedGetter - """ - def __init__(self, descriptor): - CGProxyNamedGetter.__init__(self, descriptor) - - -class CGProxyNamedSetter(CGProxyNamedOperation): - """ - Class to generate a call to a named setter. - """ - def __init__(self, descriptor): - CGProxySpecialOperation.__init__(self, descriptor, 'NamedSetter') - - -class CGProxyNamedDeleter(CGProxyNamedOperation): - """ - Class to generate a call to a named deleter. - """ - def __init__(self, descriptor): - CGProxySpecialOperation.__init__(self, descriptor, 'NamedDeleter') - - def define(self): - # Our first argument is the id we're getting. - argName = self.arguments[0].identifier.name - return ("if !id.is_symbol() {\n" - f' let {argName} = match jsid_to_string(*cx, Handle::from_raw(id)) {{\n' - " Some(val) => val,\n" - " None => {\n" - " throw_type_error(*cx, \"Not a string-convertible JSID\");\n" - " return false;\n" - " }\n" - " };\n" - " let this = UnwrapProxy(proxy);\n" - " let this = &*this;\n" - f" {CGProxySpecialOperation.define(self)}" - "}\n") - - -class CGProxyUnwrap(CGAbstractMethod): - def __init__(self, descriptor): - args = [Argument('RawHandleObject', 'obj')] - CGAbstractMethod.__init__(self, descriptor, "UnwrapProxy", - f'*const {descriptor.concreteType}', args, - alwaysInline=True, unsafe=True) - - def definition_body(self): - return CGGeneric(f""" - let mut slot = UndefinedValue(); - GetProxyReservedSlot(obj.get(), 0, &mut slot); - let box_ = slot.to_private() as *const {self.descriptor.concreteType}; -return box_;""") - - -class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod): - def __init__(self, descriptor): - args = [Argument('*mut JSContext', 'cx'), Argument('RawHandleObject', 'proxy'), - Argument('RawHandleId', 'id'), - Argument('RawMutableHandle<PropertyDescriptor>', 'mut desc'), - Argument('*mut bool', 'is_none')] - CGAbstractExternMethod.__init__(self, descriptor, "getOwnPropertyDescriptor", - "bool", args) - self.descriptor = descriptor - - # https://heycam.github.io/webidl/#LegacyPlatformObjectGetOwnProperty - def getBody(self): - indexedGetter = self.descriptor.operations['IndexedGetter'] - - get = "let cx = SafeJSContext::from_ptr(cx);\n" - - if self.descriptor.isMaybeCrossOriginObject(): - get += dedent( - """ - if !proxyhandler::is_platform_object_same_origin(cx, proxy) { - if !proxyhandler::cross_origin_get_own_property_helper( - cx, proxy, CROSS_ORIGIN_PROPERTIES.get(), id, desc, &mut *is_none - ) { - return false; - } - if *is_none { - return proxyhandler::cross_origin_property_fallback(cx, proxy, id, desc, &mut *is_none); - } - return true; - } - - // Safe to enter the Realm of proxy now. - let _ac = JSAutoRealm::new(*cx, proxy.get()); - """) - - if indexedGetter: - get += "let index = get_array_index_from_id(*cx, Handle::from_raw(id));\n" - - attrs = "JSPROP_ENUMERATE" - if self.descriptor.operations['IndexedSetter'] is None: - attrs += " | JSPROP_READONLY" - fillDescriptor = ("set_property_descriptor(\n" - " MutableHandle::from_raw(desc),\n" - " rval.handle(),\n" - f" ({attrs}) as u32,\n" - " &mut *is_none\n" - ");\n" - "return true;") - templateValues = { - 'jsvalRef': 'rval.handle_mut()', - 'successCode': fillDescriptor, - 'pre': 'rooted!(in(*cx) let mut rval = UndefinedValue());' - } - get += ("if let Some(index) = index {\n" - " let this = UnwrapProxy(proxy);\n" - " let this = &*this;\n" - f"{CGIndenter(CGProxyIndexedGetter(self.descriptor, templateValues)).define()}\n" - "}\n") - - if self.descriptor.supportsNamedProperties(): - attrs = [] - if not self.descriptor.interface.getExtendedAttribute("LegacyUnenumerableNamedProperties"): - attrs.append("JSPROP_ENUMERATE") - if self.descriptor.operations['NamedSetter'] is None: - attrs.append("JSPROP_READONLY") - if attrs: - attrs = " | ".join(attrs) - else: - attrs = "0" - fillDescriptor = ("set_property_descriptor(\n" - " MutableHandle::from_raw(desc),\n" - " rval.handle(),\n" - f" ({attrs}) as u32,\n" - " &mut *is_none\n" - ");\n" - "return true;") - templateValues = { - 'jsvalRef': 'rval.handle_mut()', - 'successCode': fillDescriptor, - 'pre': 'rooted!(in(*cx) let mut rval = UndefinedValue());' - } - - # See the similar-looking in CGDOMJSProxyHandler_get for the spec quote. - condition = "id.is_string() || id.is_int()" - if indexedGetter: - condition = f"index.is_none() && ({condition})" - # Once we start supporting OverrideBuiltins we need to make - # ResolveOwnProperty or EnumerateOwnProperties filter out named - # properties that shadow prototype properties. - namedGet = f""" -if {condition} {{ - let mut has_on_proto = false; - if !has_property_on_prototype(*cx, proxy_lt, id_lt, &mut has_on_proto) {{ - return false; - }} - if !has_on_proto {{ - {CGIndenter(CGProxyNamedGetter(self.descriptor, templateValues), 8).define()} - }} -}} -""" - else: - namedGet = "" - - return f"""{get}\ -rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>()); -get_expando_object(proxy, expando.handle_mut()); -//if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) {{ -let proxy_lt = Handle::from_raw(proxy); -let id_lt = Handle::from_raw(id); -if !expando.is_null() {{ - rooted!(in(*cx) let mut ignored = ptr::null_mut::<JSObject>()); - if !JS_GetPropertyDescriptorById(*cx, expando.handle().into(), id, desc, ignored.handle_mut().into(), is_none) {{ - return false; - }} - if !*is_none {{ - // Pretend the property lives on the wrapper. - return true; - }} -}} -{namedGet}\ -true""" - - def definition_body(self): - return CGGeneric(self.getBody()) - - -class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod): - def __init__(self, descriptor): - args = [Argument('*mut JSContext', 'cx'), Argument('RawHandleObject', 'proxy'), - Argument('RawHandleId', 'id'), - Argument('RawHandle<PropertyDescriptor>', 'desc'), - Argument('*mut ObjectOpResult', 'opresult')] - CGAbstractExternMethod.__init__(self, descriptor, "defineProperty", "bool", args) - self.descriptor = descriptor - - def getBody(self): - set = "let cx = SafeJSContext::from_ptr(cx);\n" - - if self.descriptor.isMaybeCrossOriginObject(): - set += dedent( - """ - if !proxyhandler::is_platform_object_same_origin(cx, proxy) { - return proxyhandler::report_cross_origin_denial(cx, id, "define"); - } - - // Safe to enter the Realm of proxy now. - let _ac = JSAutoRealm::new(*cx, proxy.get()); - """) - - indexedSetter = self.descriptor.operations['IndexedSetter'] - if indexedSetter: - set += ("let index = get_array_index_from_id(*cx, Handle::from_raw(id));\n" - "if let Some(index) = index {\n" - " let this = UnwrapProxy(proxy);\n" - " let this = &*this;\n" - f"{CGIndenter(CGProxyIndexedSetter(self.descriptor)).define()}" - " return (*opresult).succeed();\n" - "}\n") - elif self.descriptor.operations['IndexedGetter']: - set += ("if get_array_index_from_id(*cx, Handle::from_raw(id)).is_some() {\n" - " return (*opresult).failNoIndexedSetter();\n" - "}\n") - - namedSetter = self.descriptor.operations['NamedSetter'] - if namedSetter: - if self.descriptor.hasLegacyUnforgeableMembers: - raise TypeError("Can't handle a named setter on an interface that has " - "unforgeables. Figure out how that should work!") - set += ("if id.is_string() || id.is_int() {\n" - f"{CGIndenter(CGProxyNamedSetter(self.descriptor)).define()}" - " return (*opresult).succeed();\n" - "}\n") - elif self.descriptor.supportsNamedProperties(): - set += ("if id.is_string() || id.is_int() {\n" - f"{CGIndenter(CGProxyNamedGetter(self.descriptor)).define()}" - " if result.is_some() {\n" - " return (*opresult).fail_no_named_setter();\n" - " }\n" - "}\n") - set += f"return proxyhandler::define_property(*cx, {', '.join(a.name for a in self.args[1:])});" - return set - - def definition_body(self): - return CGGeneric(self.getBody()) - - -class CGDOMJSProxyHandler_delete(CGAbstractExternMethod): - def __init__(self, descriptor): - args = [Argument('*mut JSContext', 'cx'), Argument('RawHandleObject', 'proxy'), - Argument('RawHandleId', 'id'), - Argument('*mut ObjectOpResult', 'res')] - CGAbstractExternMethod.__init__(self, descriptor, "delete", "bool", args) - self.descriptor = descriptor - - def getBody(self): - set = "let cx = SafeJSContext::from_ptr(cx);\n" - - if self.descriptor.isMaybeCrossOriginObject(): - set += dedent( - """ - if !proxyhandler::is_platform_object_same_origin(cx, proxy) { - return proxyhandler::report_cross_origin_denial(cx, id, "delete"); - } - - // Safe to enter the Realm of proxy now. - let _ac = JSAutoRealm::new(*cx, proxy.get()); - """) - - if self.descriptor.operations['NamedDeleter']: - if self.descriptor.hasLegacyUnforgeableMembers: - raise TypeError("Can't handle a deleter on an interface that has " - "unforgeables. Figure out how that should work!") - set += CGProxyNamedDeleter(self.descriptor).define() - set += f"return proxyhandler::delete(*cx, {', '.join(a.name for a in self.args[1:])});" - return set - - def definition_body(self): - return CGGeneric(self.getBody()) - - -class CGDOMJSProxyHandler_ownPropertyKeys(CGAbstractExternMethod): - def __init__(self, descriptor): - args = [Argument('*mut JSContext', 'cx'), - Argument('RawHandleObject', 'proxy'), - Argument('RawMutableHandleIdVector', 'props')] - CGAbstractExternMethod.__init__(self, descriptor, "own_property_keys", "bool", args) - self.descriptor = descriptor - - def getBody(self): - body = dedent( - """ - let cx = SafeJSContext::from_ptr(cx); - let unwrapped_proxy = UnwrapProxy(proxy); - """) - - if self.descriptor.isMaybeCrossOriginObject(): - body += dedent( - """ - if !proxyhandler::is_platform_object_same_origin(cx, proxy) { - return proxyhandler::cross_origin_own_property_keys( - cx, proxy, CROSS_ORIGIN_PROPERTIES.get(), props - ); - } - - // Safe to enter the Realm of proxy now. - let _ac = JSAutoRealm::new(*cx, proxy.get()); - """) - - if self.descriptor.operations['IndexedGetter']: - body += dedent( - """ - for i in 0..(*unwrapped_proxy).Length() { - rooted!(in(*cx) let mut rooted_jsid: jsid); - int_to_jsid(i as i32, rooted_jsid.handle_mut()); - AppendToIdVector(props, rooted_jsid.handle()); - } - """) - - if self.descriptor.supportsNamedProperties(): - body += dedent( - """ - for name in (*unwrapped_proxy).SupportedPropertyNames() { - let cstring = CString::new(name).unwrap(); - let jsstring = JS_AtomizeAndPinString(*cx, cstring.as_ptr()); - rooted!(in(*cx) let rooted = jsstring); - rooted!(in(*cx) let mut rooted_jsid: jsid); - RUST_INTERNED_STRING_TO_JSID(*cx, rooted.handle().get(), rooted_jsid.handle_mut()); - AppendToIdVector(props, rooted_jsid.handle()); - } - """) - - body += dedent( - """ - rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>()); - get_expando_object(proxy, expando.handle_mut()); - if !expando.is_null() && - !GetPropertyKeys(*cx, expando.handle(), JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props) { - return false; - } - - true - """) - - return body - - def definition_body(self): - return CGGeneric(self.getBody()) - - -class CGDOMJSProxyHandler_getOwnEnumerablePropertyKeys(CGAbstractExternMethod): - def __init__(self, descriptor): - assert (descriptor.operations["IndexedGetter"] - and descriptor.interface.getExtendedAttribute("LegacyUnenumerableNamedProperties") - or descriptor.isMaybeCrossOriginObject()) - args = [Argument('*mut JSContext', 'cx'), - Argument('RawHandleObject', 'proxy'), - Argument('RawMutableHandleIdVector', 'props')] - CGAbstractExternMethod.__init__(self, descriptor, - "getOwnEnumerablePropertyKeys", "bool", args) - self.descriptor = descriptor - - def getBody(self): - body = dedent( - """ - let cx = SafeJSContext::from_ptr(cx); - let unwrapped_proxy = UnwrapProxy(proxy); - """) - - if self.descriptor.isMaybeCrossOriginObject(): - body += dedent( - """ - if !proxyhandler::is_platform_object_same_origin(cx, proxy) { - // There are no enumerable cross-origin props, so we're done. - return true; - } - - // Safe to enter the Realm of proxy now. - let _ac = JSAutoRealm::new(*cx, proxy.get()); - """) - - if self.descriptor.operations['IndexedGetter']: - body += dedent( - """ - for i in 0..(*unwrapped_proxy).Length() { - rooted!(in(*cx) let mut rooted_jsid: jsid); - int_to_jsid(i as i32, rooted_jsid.handle_mut()); - AppendToIdVector(props, rooted_jsid.handle()); - } - """) - - body += dedent( - """ - rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>()); - get_expando_object(proxy, expando.handle_mut()); - if !expando.is_null() && - !GetPropertyKeys(*cx, expando.handle(), JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props) { - return false; - } - - true - """) - - return body - - def definition_body(self): - return CGGeneric(self.getBody()) - - -class CGDOMJSProxyHandler_hasOwn(CGAbstractExternMethod): - def __init__(self, descriptor): - args = [Argument('*mut JSContext', 'cx'), Argument('RawHandleObject', 'proxy'), - Argument('RawHandleId', 'id'), Argument('*mut bool', 'bp')] - CGAbstractExternMethod.__init__(self, descriptor, "hasOwn", "bool", args) - self.descriptor = descriptor - - def getBody(self): - indexedGetter = self.descriptor.operations['IndexedGetter'] - indexed = "let cx = SafeJSContext::from_ptr(cx);\n" - - if self.descriptor.isMaybeCrossOriginObject(): - indexed += dedent( - """ - if !proxyhandler::is_platform_object_same_origin(cx, proxy) { - return proxyhandler::cross_origin_has_own( - cx, proxy, CROSS_ORIGIN_PROPERTIES.get(), id, bp - ); - } - - // Safe to enter the Realm of proxy now. - let _ac = JSAutoRealm::new(*cx, proxy.get()); - """) - - if indexedGetter: - indexed += ("let index = get_array_index_from_id(*cx, Handle::from_raw(id));\n" - "if let Some(index) = index {\n" - " let this = UnwrapProxy(proxy);\n" - " let this = &*this;\n" - f"{CGIndenter(CGProxyIndexedGetter(self.descriptor)).define()}\n" - " *bp = result.is_some();\n" - " return true;\n" - "}\n\n") - - condition = "id.is_string() || id.is_int()" - if indexedGetter: - condition = f"index.is_none() && ({condition})" - if self.descriptor.supportsNamedProperties(): - named = f""" -if {condition} {{ - let mut has_on_proto = false; - if !has_property_on_prototype(*cx, proxy_lt, id_lt, &mut has_on_proto) {{ - return false; - }} - if !has_on_proto {{ - {CGIndenter(CGProxyNamedGetter(self.descriptor), 8).define()} - *bp = result.is_some(); - return true; - }} -}} - -""" - else: - named = "" - - return f"""{indexed}\ -rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>()); -let proxy_lt = Handle::from_raw(proxy); -let id_lt = Handle::from_raw(id); -get_expando_object(proxy, expando.handle_mut()); -if !expando.is_null() {{ - let ok = JS_HasPropertyById(*cx, expando.handle().into(), id, bp); - if !ok || *bp {{ - return ok; - }} -}} -{named}\ -*bp = false; -true""" - - def definition_body(self): - return CGGeneric(self.getBody()) - - -class CGDOMJSProxyHandler_get(CGAbstractExternMethod): - def __init__(self, descriptor): - args = [Argument('*mut JSContext', 'cx'), Argument('RawHandleObject', 'proxy'), - Argument('RawHandleValue', 'receiver'), Argument('RawHandleId', 'id'), - Argument('RawMutableHandleValue', 'vp')] - CGAbstractExternMethod.__init__(self, descriptor, "get", "bool", args) - self.descriptor = descriptor - - # https://heycam.github.io/webidl/#LegacyPlatformObjectGetOwnProperty - def getBody(self): - if self.descriptor.isMaybeCrossOriginObject(): - maybeCrossOriginGet = dedent( - """ - if !proxyhandler::is_platform_object_same_origin(cx, proxy) { - return proxyhandler::cross_origin_get(cx, proxy, receiver, id, vp); - } - - // Safe to enter the Realm of proxy now. - let _ac = JSAutoRealm::new(*cx, proxy.get()); - """) - else: - maybeCrossOriginGet = "" - getFromExpando = """\ -rooted!(in(*cx) let mut expando = ptr::null_mut::<JSObject>()); -get_expando_object(proxy, expando.handle_mut()); -if !expando.is_null() { - let mut hasProp = false; - if !JS_HasPropertyById(*cx, expando.handle().into(), id, &mut hasProp) { - return false; - } - - if hasProp { - return JS_ForwardGetPropertyTo(*cx, expando.handle().into(), id, receiver, vp); - } -}""" - - templateValues = { - 'jsvalRef': 'vp_lt', - 'successCode': 'return true;', - } - - indexedGetter = self.descriptor.operations['IndexedGetter'] - if indexedGetter: - getIndexedOrExpando = ("let index = get_array_index_from_id(*cx, id_lt);\n" - "if let Some(index) = index {\n" - " let this = UnwrapProxy(proxy);\n" - " let this = &*this;\n" - f"{CGIndenter(CGProxyIndexedGetter(self.descriptor, templateValues)).define()}") - trimmedGetFromExpando = stripTrailingWhitespace(getFromExpando.replace('\n', '\n ')) - getIndexedOrExpando += f""" - // Even if we don't have this index, we don't forward the - // get on to our expando object. -}} else {{ - {trimmedGetFromExpando} -}} -""" - else: - getIndexedOrExpando = f"{getFromExpando}\n" - - if self.descriptor.supportsNamedProperties(): - condition = "id.is_string() || id.is_int()" - # From step 1: - # If O supports indexed properties and P is an array index, then: - # - # 3. Set ignoreNamedProps to true. - if indexedGetter: - condition = f"index.is_none() && ({condition})" - getNamed = (f"if {condition} {{\n" - f"{CGIndenter(CGProxyNamedGetter(self.descriptor, templateValues)).define()}}}\n") - else: - getNamed = "" - - return f""" -//MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy), -//"Should not have a XrayWrapper here"); -let cx = SafeJSContext::from_ptr(cx); - -{maybeCrossOriginGet} - -let proxy_lt = Handle::from_raw(proxy); -let vp_lt = MutableHandle::from_raw(vp); -let id_lt = Handle::from_raw(id); -let receiver_lt = Handle::from_raw(receiver); - -{getIndexedOrExpando} -let mut found = false; -if !get_property_on_prototype(*cx, proxy_lt, receiver_lt, id_lt, &mut found, vp_lt) {{ - return false; -}} - -if found {{ - return true; -}} -{getNamed} -vp.set(UndefinedValue()); -true""" - - def definition_body(self): - return CGGeneric(self.getBody()) - - -class CGDOMJSProxyHandler_getPrototype(CGAbstractExternMethod): - def __init__(self, descriptor): - args = [Argument('*mut JSContext', 'cx'), Argument('RawHandleObject', 'proxy'), - Argument('RawMutableHandleObject', 'proto')] - CGAbstractExternMethod.__init__(self, descriptor, "getPrototype", "bool", args) - assert descriptor.isMaybeCrossOriginObject() - self.descriptor = descriptor - - def getBody(self): - return dedent( - """ - let cx = SafeJSContext::from_ptr(cx); - proxyhandler::maybe_cross_origin_get_prototype(cx, proxy, GetProtoObject, proto) - """) - - def definition_body(self): - return CGGeneric(self.getBody()) - - -class CGDOMJSProxyHandler_className(CGAbstractExternMethod): - def __init__(self, descriptor): - args = [Argument('*mut JSContext', 'cx'), Argument('RawHandleObject', '_proxy')] - CGAbstractExternMethod.__init__(self, descriptor, "className", "*const libc::c_char", args, doesNotPanic=True) - self.descriptor = descriptor - - def getBody(self): - return str_to_cstr_ptr(self.descriptor.name) - - def definition_body(self): - return CGGeneric(self.getBody()) - - -class CGAbstractClassHook(CGAbstractExternMethod): - """ - Meant for implementing JSClass hooks, like Finalize or Trace. Does very raw - 'this' unwrapping as it assumes that the unwrapped type is always known. - """ - def __init__(self, descriptor, name, returnType, args, doesNotPanic=False): - CGAbstractExternMethod.__init__(self, descriptor, name, returnType, - args) - - def definition_body_prologue(self): - return CGGeneric(f""" -let this = native_from_object_static::<{self.descriptor.concreteType}>(obj).unwrap(); -""") - - def definition_body(self): - return CGList([ - self.definition_body_prologue(), - self.generate_code(), - ]) - - def generate_code(self): - raise NotImplementedError # Override me! - - -def finalizeHook(descriptor, hookName, context): - if descriptor.isGlobal(): - release = "finalize_global(obj, this);" - elif descriptor.weakReferenceable: - release = "finalize_weak_referenceable(obj, this);" - else: - release = "finalize_common(this);" - return release - - -class CGClassTraceHook(CGAbstractClassHook): - """ - A hook to trace through our native object; used for GC and CC - """ - def __init__(self, descriptor): - args = [Argument('*mut JSTracer', 'trc'), Argument('*mut JSObject', 'obj')] - CGAbstractClassHook.__init__(self, descriptor, TRACE_HOOK_NAME, 'void', - args, doesNotPanic=True) - self.traceGlobal = descriptor.isGlobal() - - def generate_code(self): - body = [CGGeneric("if this.is_null() { return; } // GC during obj creation\n" - f"(*this).trace({self.args[0].name});")] - if self.traceGlobal: - body += [CGGeneric("trace_global(trc, obj);")] - return CGList(body, "\n") - - -class CGClassConstructHook(CGAbstractExternMethod): - """ - JS-visible constructor for our objects - """ - def __init__(self, descriptor, constructor=None): - args = [Argument('*mut JSContext', 'cx'), Argument('u32', 'argc'), Argument('*mut JSVal', 'vp')] - name = CONSTRUCT_HOOK_NAME - if constructor: - name += f"_{constructor.identifier.name}" - else: - constructor = descriptor.interface.ctor() - assert constructor - CGAbstractExternMethod.__init__(self, descriptor, name, 'bool', args) - self.constructor = constructor - self.exposureSet = descriptor.interface.exposureSet - - def definition_body(self): - preamble = """let cx = SafeJSContext::from_ptr(cx); -let args = CallArgs::from_vp(vp, argc); -let global = GlobalScope::from_object(JS_CALLEE(*cx, vp).to_object()); -""" - if self.constructor.isHTMLConstructor(): - signatures = self.constructor.signatures() - assert len(signatures) == 1 - constructorCall = f""" - call_html_constructor::<dom::types::{self.descriptor.name}>( - cx, - &args, - &global, - PrototypeList::ID::{MakeNativeName(self.descriptor.name)}, - CreateInterfaceObjects, - CanGc::note() - ) - """ - else: - ctorName = GetConstructorNameForReporting(self.descriptor, self.constructor) - name = self.constructor.identifier.name - nativeName = MakeNativeName(self.descriptor.binaryNameFor(name)) - - if len(self.exposureSet) == 1: - args = [ - f"global.downcast::<dom::types::{list(self.exposureSet)[0]}>().unwrap()", - "Some(desired_proto)", - "CanGc::note()" - ] - else: - args = [ - "global", - "Some(desired_proto)", - "CanGc::note()" - ] - - constructor = CGMethodCall(args, nativeName, True, self.descriptor, self.constructor) - constructorCall = f""" - call_default_constructor( - cx, - &args, - &global, - PrototypeList::ID::{MakeNativeName(self.descriptor.name)}, - \"{ctorName}\", - CreateInterfaceObjects, - |cx: SafeJSContext, args: &CallArgs, global: &GlobalScope, desired_proto: HandleObject| {{ - {constructor.define()} - }} - ) - """ - return CGList([CGGeneric(preamble), CGGeneric(constructorCall)]) - - -class CGClassFinalizeHook(CGAbstractClassHook): - """ - A hook for finalize, used to release our native object. - """ - def __init__(self, descriptor): - args = [Argument('*mut GCContext', '_cx'), Argument('*mut JSObject', 'obj')] - CGAbstractClassHook.__init__(self, descriptor, FINALIZE_HOOK_NAME, - 'void', args) - - def generate_code(self): - return CGGeneric(finalizeHook(self.descriptor, self.name, self.args[0].name)) - - -class CGDOMJSProxyHandlerDOMClass(CGThing): - def __init__(self, descriptor): - CGThing.__init__(self) - self.descriptor = descriptor - - def define(self): - return f"static Class: DOMClass = {DOMClass(self.descriptor)};\n" - - -class CGInterfaceTrait(CGThing): - def __init__(self, descriptor, descriptorProvider): - CGThing.__init__(self) - - def attribute_arguments(attribute_type, argument=None, inRealm=False, canGc=False, retval=False): - if typeNeedsCx(attribute_type, retval): - yield "cx", "SafeJSContext" - - if argument: - yield "value", argument_type(descriptor, argument) - - if inRealm: - yield "_comp", "InRealm" - - if canGc: - yield "_can_gc", "CanGc" - - if retval and returnTypeNeedsOutparam(attribute_type): - yield "retval", outparamTypeFromReturnType(attribute_type) - - def members(): - for m in descriptor.interface.members: - if (m.isMethod() - and not m.isMaplikeOrSetlikeOrIterableMethod() - and (not m.isIdentifierLess() or (m.isStringifier() and not m.underlyingAttr)) - and not m.isDefaultToJSON()): - name = CGSpecializedMethod.makeNativeName(descriptor, m) - infallible = 'infallible' in descriptor.getExtendedAttributes(m) - for idx, (rettype, arguments) in enumerate(m.signatures()): - arguments = method_arguments(descriptor, rettype, arguments, - inRealm=name in descriptor.inRealmMethods, - canGc=name in descriptor.canGcMethods) - rettype = return_type(descriptor, rettype, infallible) - yield f"{name}{'_' * idx}", arguments, rettype, m.isStatic() - elif m.isAttr(): - name = CGSpecializedGetter.makeNativeName(descriptor, m) - infallible = 'infallible' in descriptor.getExtendedAttributes(m, getter=True) - yield (name, - attribute_arguments( - m.type, - inRealm=name in descriptor.inRealmMethods, - canGc=name in descriptor.canGcMethods, - retval=True - ), - return_type(descriptor, m.type, infallible), - m.isStatic()) - - if not m.readonly: - name = CGSpecializedSetter.makeNativeName(descriptor, m) - infallible = 'infallible' in descriptor.getExtendedAttributes(m, setter=True) - if infallible: - rettype = "()" - else: - rettype = "ErrorResult" - yield (name, - attribute_arguments( - m.type, - m.type, - inRealm=name in descriptor.inRealmMethods, - canGc=name in descriptor.canGcMethods, - retval=False, - ), - rettype, - m.isStatic()) - - if descriptor.proxy or descriptor.isGlobal(): - for name, operation in descriptor.operations.items(): - if not operation or operation.isStringifier(): - continue - - assert len(operation.signatures()) == 1 - rettype, arguments = operation.signatures()[0] - - infallible = 'infallible' in descriptor.getExtendedAttributes(operation) - if operation.isGetter(): - if not rettype.nullable(): - rettype = IDLNullableType(rettype.location, rettype) - arguments = method_arguments(descriptor, rettype, arguments, - inRealm=name in descriptor.inRealmMethods, - canGc=name in descriptor.canGcMethods) - - # If this interface 'supports named properties', then we - # should be able to access 'supported property names' - # - # WebIDL, Second Draft, section 3.2.4.5 - # https://heycam.github.io/webidl/#idl-named-properties - if operation.isNamed(): - yield "SupportedPropertyNames", [], "Vec<DOMString>", False - else: - arguments = method_arguments(descriptor, rettype, arguments, - inRealm=name in descriptor.inRealmMethods, - canGc=name in descriptor.canGcMethods) - rettype = return_type(descriptor, rettype, infallible) - yield name, arguments, rettype, False - - def fmt(arguments, leadingComma=True): - keywords = {"async"} - prefix = "" if not leadingComma else ", " - return prefix + ", ".join( - f"{name if name not in keywords else f'r#{name}'}: {type_}" - for name, type_ in arguments - ) - - def contains_unsafe_arg(arguments): - if not arguments or len(arguments) == 0: - return False - return functools.reduce((lambda x, y: x or y[1] == '*mut JSContext'), arguments, False) - - methods = [] - exposureSet = list(descriptor.interface.exposureSet) - exposedGlobal = "GlobalScope" if len(exposureSet) > 1 else exposureSet[0] - hasLength = False - for name, arguments, rettype, isStatic in members(): - if name == "Length": - hasLength = True - arguments = list(arguments) - unsafe = 'unsafe ' if contains_unsafe_arg(arguments) else '' - returnType = f" -> {rettype}" if rettype != '()' else '' - selfArg = "&self" if not isStatic else "" - extra = [("global", f"&{exposedGlobal}")] if isStatic else [] - if arguments and arguments[0][0] == "cx": - arguments = [arguments[0]] + extra + arguments[1:] - else: - arguments = extra + arguments - methods.append(CGGeneric( - f"{unsafe}fn {name}({selfArg}" - f"{fmt(arguments, leadingComma=not isStatic)}){returnType};\n" - )) - - def ctorMethod(ctor, baseName=None): - infallible = 'infallible' in descriptor.getExtendedAttributes(ctor) - for (i, (rettype, arguments)) in enumerate(ctor.signatures()): - name = (baseName or ctor.identifier.name) + ('_' * i) - args = list(method_arguments(descriptor, rettype, arguments)) - extra = [ - ("global", f"&{exposedGlobal}"), - ("proto", "Option<HandleObject>"), - ("can_gc", "CanGc"), - ] - if args and args[0][0] == "cx": - args = [args[0]] + extra + args[1:] - else: - args = extra + args - yield CGGeneric( - f"fn {name}({fmt(args, leadingComma=False)}) -> " - f"{return_type(descriptorProvider, rettype, infallible)};\n" - ) - - ctor = descriptor.interface.ctor() - if ctor and not ctor.isHTMLConstructor(): - methods.extend(list(ctorMethod(ctor, "Constructor"))) - - for ctor in descriptor.interface.legacyFactoryFunctions: - methods.extend(list(ctorMethod(ctor))) - - if descriptor.operations['IndexedGetter'] and not hasLength: - methods.append(CGGeneric("fn Length(&self) -> u32;\n")) - - if methods: - name = descriptor.interface.identifier.name - self.cgRoot = CGWrapper(CGIndenter(CGList(methods, "")), - pre=f"pub(crate) trait {name}Methods<D: DomTypes> {{\n", - post="}") - else: - self.cgRoot = CGGeneric("") - self.empty = not methods - - def define(self): - return self.cgRoot.define() - - -class CGWeakReferenceableTrait(CGThing): - def __init__(self, descriptor): - CGThing.__init__(self) - assert descriptor.weakReferenceable - self.code = f"impl WeakReferenceable for {descriptor.interface.identifier.name} {{}}" - - def define(self): - return self.code - - -class CGInitStatics(CGThing): - def __init__(self, descriptor): - CGThing.__init__(self) - - def internal(method): - return descriptor.internalNameFor(method.identifier.name) - - properties = PropertyArrays(descriptor) - all_names = PropertyArrays.arrayNames() - arrays = [getattr(properties, name) for name in all_names] - nonempty = map(lambda x: x.variableName(), filter(lambda x: x.length() != 0, arrays)) - specs = [[ - f'init_{name}_specs();', - f'init_{name}_prefs();', - ] for name in nonempty] - flat_specs = [x for xs in specs for x in xs] - specs = '\n'.join(flat_specs) - module = f"crate::dom::bindings::codegen::Bindings::{toBindingPath(descriptor)}" - relevantMethods = [ - m for m in descriptor.interface.members if m.isMethod() - ] if not descriptor.interface.isCallback() else [] - allOperations = descriptor.operations.keys() - relevantOperations = list(map(lambda x: f"__{x.lower()}", filter(lambda o: o != "Stringifier", allOperations))) - relevantMethods = filter( - lambda m: internal(m) not in relevantOperations, - relevantMethods, - ) - relevantMethods = filter( - lambda x: ( - not x.isStatic() - or any([r.isPromise() for r, _ in x.signatures()]) - ), - relevantMethods - ) - - methods = [f'{module}::init_{internal(m)}_methodinfo();' for m in relevantMethods] - getters = [ - f'init_{internal(m)}_getterinfo();' - for m in descriptor.interface.members if m.isAttr() and not m.isStatic() - ] - setters = [ - f'init_{internal(m)}_setterinfo();' - for m in descriptor.interface.members - if m.isAttr() and ( - not m.readonly - or m.getExtendedAttribute("PutForwards") - or m.getExtendedAttribute("Replaceable") - ) and not m.isStatic() - ] - methods = '\n'.join(methods) - getters = '\n'.join(getters) - setters = '\n'.join(setters) - crossorigin = [ - "init_sCrossOriginMethods();", - "init_sCrossOriginAttributes();", - "init_cross_origin_properties();" - ] if descriptor.isMaybeCrossOriginObject() else [] - crossorigin_joined = '\n'.join(crossorigin) - interface = ( - "init_interface_object();" - if descriptor.interface.hasInterfaceObject() - and not descriptor.interface.isNamespace() - and not descriptor.interface.isCallback() - and not descriptor.interface.getExtendedAttribute("Inline") - else "" - ) - nonproxy = ( - "init_domjs_class();" - if not descriptor.proxy - and descriptor.concrete - else "" - ) - - self.code = f""" - pub(crate) fn init_statics() {{ - {interface} - {nonproxy} - {methods} - {getters} - {setters} - {crossorigin_joined} - {specs} - }} - """ - - def define(self): - return self.code - - -class CGDescriptor(CGThing): - def __init__(self, descriptor, config, soleDescriptor): - CGThing.__init__(self) - - assert not descriptor.concrete or not descriptor.interface.isCallback() - - reexports = [] - - def reexportedName(name): - if name.startswith(descriptor.name): - return name - if not soleDescriptor: - return f'{name} as {descriptor.name}{name}' - return name - - cgThings = [] - - defaultToJSONMethod = None - unscopableNames = [] - for m in descriptor.interface.members: - if (m.isMethod() - and (not m.isIdentifierLess() or m == descriptor.operations["Stringifier"])): - if m.getExtendedAttribute("Unscopable"): - assert not m.isStatic() - unscopableNames.append(m.identifier.name) - if m.isDefaultToJSON(): - defaultToJSONMethod = m - elif m.isStatic(): - assert descriptor.interface.hasInterfaceObject() - cgThings.append(CGStaticMethod(descriptor, m)) - if m.returnsPromise(): - cgThings.append(CGStaticMethodJitinfo(m)) - elif not descriptor.interface.isCallback(): - cgThings.append(CGSpecializedMethod(descriptor, m)) - if m.returnsPromise(): - cgThings.append( - CGMethodPromiseWrapper(descriptor, m) - ) - cgThings.append(CGMemberJITInfo(descriptor, m)) - elif m.isAttr(): - if m.getExtendedAttribute("Unscopable"): - assert not m.isStatic() - unscopableNames.append(m.identifier.name) - if m.isStatic(): - assert descriptor.interface.hasInterfaceObject() - cgThings.append(CGStaticGetter(descriptor, m)) - elif not descriptor.interface.isCallback(): - cgThings.append(CGSpecializedGetter(descriptor, m)) - if m.type.isPromise(): - cgThings.append( - CGGetterPromiseWrapper(descriptor, m) - ) - - if not m.readonly: - if m.isStatic(): - assert descriptor.interface.hasInterfaceObject() - cgThings.append(CGStaticSetter(descriptor, m)) - elif not descriptor.interface.isCallback(): - cgThings.append(CGSpecializedSetter(descriptor, m)) - elif m.getExtendedAttribute("PutForwards"): - cgThings.append(CGSpecializedForwardingSetter(descriptor, m)) - elif m.getExtendedAttribute("Replaceable"): - cgThings.append(CGSpecializedReplaceableSetter(descriptor, m)) - - if (not m.isStatic() and not descriptor.interface.isCallback()): - cgThings.append(CGMemberJITInfo(descriptor, m)) - - if defaultToJSONMethod: - cgThings.append(CGDefaultToJSONMethod(descriptor, defaultToJSONMethod)) - cgThings.append(CGMemberJITInfo(descriptor, defaultToJSONMethod)) - - if descriptor.concrete: - cgThings.append(CGClassFinalizeHook(descriptor)) - cgThings.append(CGClassTraceHook(descriptor)) - - # If there are no constant members, don't make a module for constants - constMembers = [CGConstant(m) for m in descriptor.interface.members if m.isConst()] - if constMembers: - cgThings.append(CGNamespace.build([f"{descriptor.name}Constants"], - CGIndenter(CGList(constMembers)), - public=True)) - reexports.append(f'{descriptor.name}Constants') - - if descriptor.proxy: - cgThings.append(CGDefineProxyHandler(descriptor)) - - if descriptor.isMaybeCrossOriginObject(): - cgThings.append(CGCrossOriginProperties(descriptor)) - - properties = PropertyArrays(descriptor) - - if defaultToJSONMethod: - cgThings.append(CGCollectJSONAttributesMethod(descriptor, defaultToJSONMethod)) - - if descriptor.concrete: - if descriptor.proxy: - # cgThings.append(CGProxyIsProxy(descriptor)) - cgThings.append(CGProxyUnwrap(descriptor)) - cgThings.append(CGDOMJSProxyHandlerDOMClass(descriptor)) - cgThings.append(CGDOMJSProxyHandler_ownPropertyKeys(descriptor)) - if descriptor.interface.getExtendedAttribute("LegacyUnenumerableNamedProperties") or \ - descriptor.isMaybeCrossOriginObject(): - cgThings.append(CGDOMJSProxyHandler_getOwnEnumerablePropertyKeys(descriptor)) - cgThings.append(CGDOMJSProxyHandler_getOwnPropertyDescriptor(descriptor)) - cgThings.append(CGDOMJSProxyHandler_className(descriptor)) - cgThings.append(CGDOMJSProxyHandler_get(descriptor)) - cgThings.append(CGDOMJSProxyHandler_hasOwn(descriptor)) - - if descriptor.isMaybeCrossOriginObject() or descriptor.operations['IndexedSetter'] or \ - descriptor.operations['NamedSetter']: - cgThings.append(CGDOMJSProxyHandler_defineProperty(descriptor)) - - # We want to prevent indexed deleters from compiling at all. - assert not descriptor.operations['IndexedDeleter'] - - if descriptor.isMaybeCrossOriginObject() or descriptor.operations['NamedDeleter']: - cgThings.append(CGDOMJSProxyHandler_delete(descriptor)) - - if descriptor.isMaybeCrossOriginObject(): - cgThings.append(CGDOMJSProxyHandler_getPrototype(descriptor)) - - # cgThings.append(CGDOMJSProxyHandler(descriptor)) - # cgThings.append(CGIsMethod(descriptor)) - pass - else: - cgThings.append(CGDOMJSClass(descriptor)) - if not descriptor.interface.isIteratorInterface(): - cgThings.append(CGAssertInheritance(descriptor)) - pass - - if descriptor.isGlobal(): - cgThings.append(CGWrapGlobalMethod(descriptor, properties)) - else: - cgThings.append(CGWrapMethod(descriptor)) - if descriptor.interface.isIteratorInterface(): - cgThings.append(CGDomObjectIteratorWrap(descriptor)) - else: - cgThings.append(CGDomObjectWrap(descriptor)) - reexports.append('Wrap') - - haveUnscopables = False - if not descriptor.interface.isCallback() and not descriptor.interface.isNamespace(): - if unscopableNames: - haveUnscopables = True - cgThings.append( - CGList([CGGeneric("const unscopable_names: &[&std::ffi::CStr] = &["), - CGIndenter(CGList([CGGeneric(str_to_cstr(name)) for - name in unscopableNames], ",\n")), - CGGeneric("];\n")], "\n")) - if descriptor.concrete or descriptor.hasDescendants(): - cgThings.append(CGIDLInterface(descriptor)) - - if descriptor.weakReferenceable: - cgThings.append(CGWeakReferenceableTrait(descriptor)) - - if not descriptor.interface.isCallback(): - interfaceTrait = CGInterfaceTrait(descriptor, config.getDescriptorProvider()) - cgThings.append(interfaceTrait) - if not interfaceTrait.empty: - reexports.append(f'{descriptor.name}Methods') - - legacyWindowAliases = descriptor.interface.legacyWindowAliases - haveLegacyWindowAliases = len(legacyWindowAliases) != 0 - if haveLegacyWindowAliases: - cgThings.append( - CGList([CGGeneric("const legacy_window_aliases: &[&std::ffi::CStr] = &["), - CGIndenter(CGList([CGGeneric(str_to_cstr(name)) for - name in legacyWindowAliases], ",\n")), - CGGeneric("];\n")], "\n")) - - cgThings.append(CGGeneric(str(properties))) - - if not descriptor.interface.getExtendedAttribute("Inline"): - if not descriptor.interface.isCallback() and not descriptor.interface.isNamespace(): - cgThings.append(CGGetProtoObjectMethod(descriptor)) - reexports.append('GetProtoObject') - cgThings.append(CGPrototypeJSClass(descriptor)) - if descriptor.interface.hasInterfaceObject(): - if descriptor.interface.ctor(): - cgThings.append(CGClassConstructHook(descriptor)) - for ctor in descriptor.interface.legacyFactoryFunctions: - cgThings.append(CGClassConstructHook(descriptor, ctor)) - if not descriptor.interface.isCallback(): - cgThings.append(CGInterfaceObjectJSClass(descriptor)) - if descriptor.shouldHaveGetConstructorObjectMethod(): - cgThings.append(CGGetConstructorObjectMethod(descriptor)) - reexports.append('GetConstructorObject') - if descriptor.register: - cgThings.append(CGDefineDOMInterfaceMethod(descriptor)) - reexports.append('DefineDOMInterface') - cgThings.append(CGConstructorEnabled(descriptor)) - cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties, haveUnscopables, - haveLegacyWindowAliases)) - - cgThings.append(CGInitStatics(descriptor)) - - cgThings = CGList(cgThings, '\n') - - # Add imports - # These are inside the generated module - cgThings = CGImports(cgThings, descriptors=[descriptor], callbacks=[], - dictionaries=[], enums=[], typedefs=[], imports=[ - 'crate::dom', - 'crate::dom::bindings::import::module::*', - ], config=config) - - cgThings = CGWrapper(CGNamespace(toBindingNamespace(descriptor.name), - cgThings, public=True), - post='\n') - - if reexports: - reexports = ', '.join([reexportedName(name) for name in reexports]) - namespace = toBindingNamespace(descriptor.name) - cgThings = CGList([CGGeneric(f'pub(crate) use self::{namespace}::{{{reexports}}};'), - cgThings], '\n') - - self.cgRoot = cgThings - - def define(self): - return self.cgRoot.define() - - -class CGNonNamespacedEnum(CGThing): - def __init__(self, enumName, names, first, comment="", deriving="", repr=""): - # Account for first value - entries = [f"{names[0]} = {first}"] + names[1:] - - # Append a Last. - entries.append(f'#[allow(dead_code)] Last = {first + len(entries)}') - - # Indent. - entries = [f' {e}' for e in entries] - - # Build the enum body. - joinedEntries = ',\n'.join(entries) - enumstr = f"{comment}pub(crate) enum {enumName} {{\n{joinedEntries}\n}}\n" - if repr: - enumstr = f"#[repr({repr})]\n{enumstr}" - if deriving: - enumstr = f"#[derive({deriving})]\n{enumstr}" - curr = CGGeneric(enumstr) - - # Add some whitespace padding. - curr = CGWrapper(curr, pre='\n', post='\n') - - # Add the typedef - # typedef = '\ntypedef %s::%s %s;\n\n' % (namespace, enumName, enumName) - # curr = CGList([curr, CGGeneric(typedef)]) - - # Save the result. - self.node = curr - - def define(self): - return self.node.define() - - -class CGDictionary(CGThing): - def __init__(self, dictionary, descriptorProvider, config): - self.dictionary = dictionary - self.derives = config.getDictConfig(dictionary.identifier.name).get('derives', []) - if all(CGDictionary(d, descriptorProvider, config).generatable for - d in CGDictionary.getDictionaryDependencies(dictionary)): - self.generatable = True - else: - self.generatable = False - # Nothing else to do here - return - - self.memberInfo = [ - (member, - getJSToNativeConversionInfo(member.type, - descriptorProvider, - isMember="Dictionary", - defaultValue=member.defaultValue, - exceptionCode="return Err(());\n")) - for member in dictionary.members] - - def define(self): - if not self.generatable: - return "" - return f"{self.struct()}\n{self.impl()}" - - def struct(self): - d = self.dictionary - if d.parent: - typeName = f"{self.makeModuleName(d.parent)}::{self.makeClassName(d.parent)}" - if type_needs_tracing(d.parent): - typeName = f"RootedTraceableBox<{typeName}>" - inheritance = f" pub(crate) parent: {typeName},\n" - else: - inheritance = "" - memberDecls = [f" pub(crate) {self.makeMemberName(m[0].identifier.name)}: {self.getMemberType(m)}," - for m in self.memberInfo] - - derive = ["JSTraceable"] + self.derives - default = "" - mustRoot = "" - if self.membersNeedTracing(): - mustRoot = "#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]\n" - - # We can't unconditionally derive Default here, because union types can have unique - # default values provided for each usage. Instead, whenever possible we re-use the empty() - # method that is generated. - if not self.hasRequiredFields(self.dictionary): - if d.parent: - inheritanceDefault = " parent: Default::default(),\n" - else: - inheritanceDefault = "" - if not self.membersNeedTracing(): - impl = " Self::empty()\n" - else: - memberDefaults = [f" {self.makeMemberName(m[0].identifier.name)}: Default::default()," - for m in self.memberInfo] - joinedDefaults = '\n'.join(memberDefaults) - impl = ( - " Self {\n" - f" {inheritanceDefault}{joinedDefaults}" - " }\n" - ) - - default = ( - f"impl Default for {self.makeClassName(d)} {{\n" - " fn default() -> Self {\n" - f"{impl}" - " }\n" - "}\n" - ) - - joinedMemberDecls = '\n'.join(memberDecls) - return ( - f"#[derive({', '.join(derive)})]\n" - f"{mustRoot}" - f"pub(crate) struct {self.makeClassName(d)} {{\n" - f"{inheritance}" - f"{joinedMemberDecls}\n" - "}\n" - f"{default}" - ) - - def impl(self): - d = self.dictionary - if d.parent: - initParent = ( - "{\n" - f" match {self.makeModuleName(d.parent)}::{self.makeClassName(d.parent)}::new(cx, val)? {{\n" - " ConversionResult::Success(v) => v,\n" - " ConversionResult::Failure(error) => {\n" - " throw_type_error(*cx, &error);\n" - " return Err(());\n" - " }\n" - " }\n" - "}" - ) - else: - initParent = "" - - def memberInit(memberInfo, isInitial): - member, _ = memberInfo - name = self.makeMemberName(member.identifier.name) - conversion = self.getMemberConversion(memberInfo, member.type) - if isInitial: - return CGGeneric(f"{name}: {conversion.define()},\n") - return CGGeneric(f"dictionary.{name} = {conversion.define()};\n") - - def varInsert(varName, dictionaryName): - insertion = ( - f"rooted!(in(cx) let mut {varName}_js = UndefinedValue());\n" - f"{varName}.to_jsval(cx, {varName}_js.handle_mut());\n" - f'set_dictionary_property(cx, obj.handle(), "{dictionaryName}", {varName}_js.handle()).unwrap();') - return CGGeneric(insertion) - - def memberInsert(memberInfo): - member, _ = memberInfo - name = self.makeMemberName(member.identifier.name) - if member.optional and not member.defaultValue: - insertion = CGIfWrapper(f"let Some(ref {name}) = self.{name}", - varInsert(name, member.identifier.name)) - else: - insertion = CGGeneric(f"let {name} = &self.{name};\n" - f"{varInsert(name, member.identifier.name).define()}") - return CGGeneric(f"{insertion.define()}\n") - - memberInserts = [memberInsert(m) for m in self.memberInfo] - - if d.parent: - memberInserts = [CGGeneric("self.parent.to_jsobject(cx, obj);\n")] + memberInserts - - selfName = self.makeClassName(d) - if self.membersNeedTracing(): - actualType = f"RootedTraceableBox<{selfName}>" - preInitial = f"let dictionary = RootedTraceableBox::new({selfName} {{\n" - postInitial = "});\n" - else: - actualType = selfName - preInitial = f"let dictionary = {selfName} {{\n" - postInitial = "};\n" - initParent = f"parent: {initParent},\n" if initParent else "" - memberInits = CGList([memberInit(m, True) for m in self.memberInfo]) - - unsafe_if_necessary = "unsafe" - if not initParent and not memberInits: - unsafe_if_necessary = "" - return ( - f"impl {selfName} {{\n" - f"{CGIndenter(CGGeneric(self.makeEmpty()), indentLevel=4).define()}\n" - " pub(crate) fn new(cx: SafeJSContext, val: HandleValue) \n" - f" -> Result<ConversionResult<{actualType}>, ()> {{\n" - f" {unsafe_if_necessary} {{\n" - " let object = if val.get().is_null_or_undefined() {\n" - " ptr::null_mut()\n" - " } else if val.get().is_object() {\n" - " val.get().to_object()\n" - " } else {\n" - " return Ok(ConversionResult::Failure(\"Value is not an object.\".into()));\n" - " };\n" - " rooted!(in(*cx) let object = object);\n" - f"{CGIndenter(CGGeneric(preInitial), indentLevel=8).define()}" - f"{CGIndenter(CGGeneric(initParent), indentLevel=16).define()}" - f"{CGIndenter(memberInits, indentLevel=16).define()}" - f"{CGIndenter(CGGeneric(postInitial), indentLevel=8).define()}" - " Ok(ConversionResult::Success(dictionary))\n" - " }\n" - " }\n" - "}\n" - "\n" - f"impl FromJSValConvertible for {actualType} {{\n" - " type Config = ();\n" - " unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())\n" - f" -> Result<ConversionResult<{actualType}>, ()> {{\n" - f" {selfName}::new(SafeJSContext::from_ptr(cx), value)\n" - " }\n" - "}\n" - "\n" - f"impl {selfName} {{\n" - " pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {\n" - f"{CGIndenter(CGList(memberInserts), indentLevel=8).define()} }}\n" - "}\n" - "\n" - f"impl ToJSValConvertible for {selfName} {{\n" - " unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {\n" - " rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));\n" - " self.to_jsobject(cx, obj.handle_mut());\n" - " rval.set(ObjectOrNullValue(obj.get()))\n" - " }\n" - "}\n" - ) - - def membersNeedTracing(self): - return type_needs_tracing(self.dictionary) - - @staticmethod - def makeDictionaryName(dictionary): - if isinstance(dictionary, IDLWrapperType): - return CGDictionary.makeDictionaryName(dictionary.inner) - else: - return dictionary.identifier.name - - def makeClassName(self, dictionary): - return self.makeDictionaryName(dictionary) - - @staticmethod - def makeModuleName(dictionary): - return getModuleFromObject(dictionary) - - def getMemberType(self, memberInfo): - member, info = memberInfo - declType = info.declType - if member.optional and not member.defaultValue: - declType = CGWrapper(info.declType, pre="Option<", post=">") - return declType.define() - - def getMemberConversion(self, memberInfo, memberType): - def indent(s): - return CGIndenter(CGGeneric(s), 12).define() - - member, info = memberInfo - templateBody = info.template - default = info.default - replacements = {"val": "rval.handle()"} - conversion = string.Template(templateBody).substitute(replacements) - - assert (member.defaultValue is None) == (default is None) - if not member.optional: - assert default is None - default = (f'throw_type_error(*cx, "Missing required member \\"{member.identifier.name}\\".");\n' - "return Err(());") - elif not default: - default = "None" - conversion = f"Some({conversion})" - - conversion = ( - "{\n" - " rooted!(in(*cx) let mut rval = UndefinedValue());\n" - f' if get_dictionary_property(*cx, object.handle(), "{member.identifier.name}", rval.handle_mut())?' - " && !rval.is_undefined() {\n" - f"{indent(conversion)}\n" - " } else {\n" - f"{indent(default)}\n" - " }\n" - "}") - - return CGGeneric(conversion) - - def makeEmpty(self): - if self.hasRequiredFields(self.dictionary): - return "" - parentTemplate = "parent: %s::%s::empty(),\n" - fieldTemplate = "%s: %s,\n" - functionTemplate = ( - "pub(crate) fn empty() -> Self {\n" - " Self {\n" - "%s" - " }\n" - "}" - ) - if self.membersNeedTracing(): - parentTemplate = "dictionary.parent = %s::%s::empty();\n" - fieldTemplate = "dictionary.%s = %s;\n" - functionTemplate = ( - "pub(crate) fn empty() -> RootedTraceableBox<Self> {\n" - " let mut dictionary = RootedTraceableBox::new(Self::default());\n" - "%s" - " dictionary\n" - "}" - ) - s = "" - if self.dictionary.parent: - s += parentTemplate % (self.makeModuleName(self.dictionary.parent), - self.makeClassName(self.dictionary.parent)) - for member, info in self.memberInfo: - if not member.optional: - return "" - default = info.default - if not default: - default = "None" - s += fieldTemplate % (self.makeMemberName(member.identifier.name), default) - return functionTemplate % CGIndenter(CGGeneric(s), 12).define() - - def hasRequiredFields(self, dictionary): - if dictionary.parent: - if self.hasRequiredFields(dictionary.parent): - return True - for member in dictionary.members: - if not member.optional: - return True - return False - - @staticmethod - def makeMemberName(name): - # Can't use Rust keywords as member names. - if name in RUST_KEYWORDS: - return f"{name}_" - return name - - @staticmethod - def getDictionaryDependencies(dictionary): - deps = set() - if dictionary.parent: - deps.add(dictionary.parent) - for member in dictionary.members: - if member.type.isDictionary(): - deps.add(member.type.unroll().inner) - return deps - - -class CGInitAllStatics(CGAbstractMethod): - def __init__(self, config): - docs = "Initialize the static data used by the SpiderMonkey DOM bindings to implement JS interfaces." - descriptors = (config.getDescriptors(isCallback=False, register=True) - + config.getDescriptors(isCallback=True, hasInterfaceObject=True, register=True)) - CGAbstractMethod.__init__(self, None, 'InitAllStatics', 'void', [], - pub=True, docs=docs) - self.descriptors = descriptors - - def definition_body(self): - return CGList([ - CGGeneric(f" Bindings::{toBindingModuleFileFromDescriptor(desc)}::{toBindingNamespace(desc.name)}" - "::init_statics();") - for desc in self.descriptors - ], "\n") - - -class CGRegisterProxyHandlersMethod(CGAbstractMethod): - def __init__(self, descriptors): - docs = "Create the global vtables used by the generated DOM bindings to implement JS proxies." - CGAbstractMethod.__init__(self, None, 'RegisterProxyHandlers', 'void', [], - unsafe=True, pub=True, docs=docs) - self.descriptors = descriptors - - def definition_body(self): - return CGList([ - CGGeneric(f"proxy_handlers::{desc.name}.store(\n" - f" Bindings::{toBindingModuleFile(desc.name)}::{toBindingNamespace(desc.name)}" - "::DefineProxyHandler() as *mut _,\n" - " std::sync::atomic::Ordering::Release,\n" - ");") - for desc in self.descriptors - ], "\n") - - -class CGRegisterProxyHandlers(CGThing): - def __init__(self, config): - descriptors = config.getDescriptors(proxy=True) - body = "".join( - f" pub(crate) static {desc.name}: std::sync::atomic::AtomicPtr<libc::c_void> =\n" - " std::sync::atomic::AtomicPtr::new(std::ptr::null_mut());\n" - for desc in descriptors - ) - self.root = CGList([ - CGGeneric( - "#[allow(non_upper_case_globals)]\n" - "pub(crate) mod proxy_handlers {\n" - f"{body}}}\n" - ), - CGRegisterProxyHandlersMethod(descriptors), - CGInitAllStatics(config), - ], "\n") - - def define(self): - return self.root.define() - - -class CGBindingRoot(CGThing): - """ - DomRoot codegen class for binding generation. Instantiate the class, and call - declare or define to generate header or cpp code (respectively). - """ - def __init__(self, config, prefix, webIDLFile): - descriptors = config.getDescriptors(webIDLFile=webIDLFile, - hasInterfaceObject=True) - # We also want descriptors that have an interface prototype object - # (isCallback=False), but we don't want to include a second copy - # of descriptors that we also matched in the previous line - # (hence hasInterfaceObject=False). - descriptors.extend(config.getDescriptors(webIDLFile=webIDLFile, - hasInterfaceObject=False, - isCallback=False, - register=True)) - - dictionaries = config.getDictionaries(webIDLFile=webIDLFile) - - mainCallbacks = config.getCallbacks(webIDLFile=webIDLFile) - callbackDescriptors = config.getDescriptors(webIDLFile=webIDLFile, - isCallback=True) - - enums = config.getEnums(webIDLFile) - typedefs = config.getTypedefs(webIDLFile) - - if not (descriptors or dictionaries or mainCallbacks or callbackDescriptors or enums): - self.root = None - return - - # Do codegen for all the enums. - cgthings = [CGEnum(e, config) for e in enums] - - # Do codegen for all the typedefs - for t in typedefs: - typeName = getRetvalDeclarationForType(t.innerType, config.getDescriptorProvider()) - name = t.identifier.name - type = typeName.define() - - if t.innerType.isUnion() and not t.innerType.nullable(): - # Allow using the typedef's name for accessing variants. - typeDefinition = f"pub(crate) use self::{type} as {name};" - else: - typeDefinition = f"pub(crate) type {name} = {type};" - - cgthings.append(CGGeneric(typeDefinition)) - - # Do codegen for all the dictionaries. - cgthings.extend([CGDictionary(d, config.getDescriptorProvider(), config) - for d in dictionaries]) - - # Do codegen for all the callbacks. - cgthings.extend(CGList([CGCallbackFunction(c, config.getDescriptorProvider()), - CGCallbackFunctionImpl(c)], "\n") - for c in mainCallbacks) - - # Do codegen for all the descriptors - cgthings.extend([CGDescriptor(x, config, len(descriptors) == 1) for x in descriptors]) - - # Do codegen for all the callback interfaces. - cgthings.extend(CGList([CGCallbackInterface(x), - CGCallbackFunctionImpl(x.interface)], "\n") - for x in callbackDescriptors) - - # And make sure we have the right number of newlines at the end - curr = CGWrapper(CGList(cgthings, "\n\n"), post="\n\n") - - # Add imports - # These are the global imports (outside of the generated module) - curr = CGImports(curr, descriptors=callbackDescriptors, callbacks=mainCallbacks, - dictionaries=dictionaries, enums=enums, typedefs=typedefs, - imports=['crate::dom::bindings::import::base::*'], config=config) - - # Add the auto-generated comment. - curr = CGWrapper(curr, pre=f"{AUTOGENERATED_WARNING_COMMENT}{ALLOWED_WARNINGS}") - - # Store the final result. - self.root = curr - - def define(self): - if not self.root: - return None - return stripTrailingWhitespace(self.root.define()) - - -def type_needs_tracing(t): - assert isinstance(t, IDLObject), (t, type(t)) - - if t.isType(): - if isinstance(t, IDLWrapperType): - return type_needs_tracing(t.inner) - - if t.nullable(): - return type_needs_tracing(t.inner) - - if t.isAny(): - return True - - if t.isObject(): - return True - - if t.isSequence(): - return type_needs_tracing(t.inner) - - if t.isUnion(): - return any(type_needs_tracing(member) for member in t.flatMemberTypes) - - if is_typed_array(t): - return True - - return False - - if t.isDictionary(): - if t.parent and type_needs_tracing(t.parent): - return True - - if any(type_needs_tracing(member.type) for member in t.members): - return True - - return False - - if t.isInterface(): - return False - - if t.isEnum(): - return False - - assert False, (t, type(t)) - - -def is_typed_array(t): - assert isinstance(t, IDLObject), (t, type(t)) - - return t.isTypedArray() or t.isArrayBuffer() or t.isArrayBufferView() - - -def type_needs_auto_root(t): - """ - Certain IDL types, such as `sequence<any>` or `sequence<object>` need to be - traced and wrapped via (Custom)AutoRooter - """ - assert isinstance(t, IDLObject), (t, type(t)) - - if t.isType(): - if t.isSequence() and (t.inner.isAny() or t.inner.isObject()): - return True - # SpiderMonkey interfaces, we currently don't support any other except typed arrays - if is_typed_array(t): - return True - - return False - - -def argument_type(descriptorProvider, ty, optional=False, defaultValue=None, variadic=False): - info = getJSToNativeConversionInfo( - ty, descriptorProvider, isArgument=True, - isAutoRooted=type_needs_auto_root(ty)) - declType = info.declType - - if variadic: - if ty.isGeckoInterface(): - declType = CGWrapper(declType, pre="&[", post="]") - else: - declType = CGWrapper(declType, pre="Vec<", post=">") - elif optional and not defaultValue: - declType = CGWrapper(declType, pre="Option<", post=">") - - if ty.isDictionary() and not type_needs_tracing(ty): - declType = CGWrapper(declType, pre="&") - - if type_needs_auto_root(ty): - declType = CGTemplatedType("CustomAutoRooterGuard", declType) - - return declType.define() - - -def method_arguments(descriptorProvider, returnType, arguments, passJSBits=True, trailing=None, - inRealm=False, canGc=False): - if needCx(returnType, arguments, passJSBits): - yield "cx", "SafeJSContext" - - for argument in arguments: - ty = argument_type(descriptorProvider, argument.type, argument.optional, - argument.defaultValue, argument.variadic) - yield CGDictionary.makeMemberName(argument.identifier.name), ty - - if trailing: - yield trailing - - if inRealm: - yield "_comp", "InRealm" - - if canGc: - yield "_can_gc", "CanGc" - - if returnTypeNeedsOutparam(returnType): - yield "rval", outparamTypeFromReturnType(returnType), - - -def return_type(descriptorProvider, rettype, infallible): - result = getRetvalDeclarationForType(rettype, descriptorProvider) - if rettype and returnTypeNeedsOutparam(rettype): - result = CGGeneric("()") - if not infallible: - result = CGWrapper(result, pre="Fallible<", post=">") - return result.define() - - -class CGNativeMember(ClassMethod): - def __init__(self, descriptorProvider, member, name, signature, extendedAttrs, - breakAfter=True, passJSBitsAsNeeded=True, visibility="public", - unsafe=False): - """ - If passJSBitsAsNeeded is false, we don't automatically pass in a - JSContext* or a JSObject* based on the return and argument types. - """ - self.descriptorProvider = descriptorProvider - self.member = member - self.extendedAttrs = extendedAttrs - self.passJSBitsAsNeeded = passJSBitsAsNeeded - breakAfterSelf = "\n" if breakAfter else "" - ClassMethod.__init__(self, name, - self.getReturnType(signature[0]), - self.getArgs(signature[0], signature[1]), - static=member.isStatic(), - # Mark our getters, which are attrs that - # have a non-void return type, as const. - const=(not member.isStatic() and member.isAttr() - and not signature[0].isUndefined()), - breakAfterSelf=breakAfterSelf, - unsafe=unsafe, - visibility=visibility) - - def getReturnType(self, type): - infallible = 'infallible' in self.extendedAttrs - typeDecl = return_type(self.descriptorProvider, type, infallible) - return typeDecl - - def getArgs(self, returnType, argList): - return [Argument(arg[1], arg[0]) for arg in method_arguments(self.descriptorProvider, - returnType, - argList, - self.passJSBitsAsNeeded)] - - -class CGCallback(CGClass): - def __init__(self, idlObject, descriptorProvider, baseName, methods): - self.baseName = baseName - self._deps = idlObject.getDeps() - name = idlObject.identifier.name - # For our public methods that needThisHandling we want most of the - # same args and the same return type as what CallbackMember - # generates. So we want to take advantage of all its - # CGNativeMember infrastructure, but that infrastructure can't deal - # with templates and most especially template arguments. So just - # cheat and have CallbackMember compute all those things for us. - realMethods = [] - for method in methods: - if not method.needThisHandling: - realMethods.append(method) - else: - realMethods.extend(self.getMethodImpls(method)) - CGClass.__init__(self, name, - bases=[ClassBase(baseName)], - constructors=self.getConstructors(), - methods=realMethods, - decorators="#[derive(JSTraceable, PartialEq)]\n" - "#[cfg_attr(crown, allow(crown::unrooted_must_root))]\n" - "#[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]") - - def getConstructors(self): - return [ClassConstructor( - [Argument("SafeJSContext", "aCx"), Argument("*mut JSObject", "aCallback")], - bodyInHeader=True, - visibility="pub", - explicit=False, - baseConstructors=[ - f"{self.baseName}::new()" - ])] - - def getMethodImpls(self, method): - assert method.needThisHandling - args = list(method.args) - # Strip out the JSContext*/JSObject* args - # that got added. - assert args[0].name == "cx" and args[0].argType == "SafeJSContext" - assert args[1].name == "aThisObj" and args[1].argType == "HandleObject" - args = args[2:] - # Record the names of all the arguments, so we can use them when we call - # the private method. - argnames = [arg.name for arg in args] - argnamesWithThis = ["s.get_context()", "thisObjJS.handle()"] + argnames - argnamesWithoutThis = ["s.get_context()", "thisObjJS.handle()"] + argnames - # Now that we've recorded the argnames for our call to our private - # method, insert our optional argument for deciding whether the - # CallSetup should re-throw exceptions on aRv. - args.append(Argument("ExceptionHandling", "aExceptionHandling", - "ReportExceptions")) - - # And now insert our template argument. - argsWithoutThis = list(args) - args.insert(0, Argument("&T", "thisObj")) - - # And the self argument - method.args.insert(0, Argument(None, "&self")) - args.insert(0, Argument(None, "&self")) - argsWithoutThis.insert(0, Argument(None, "&self")) - - setupCall = "let s = CallSetup::new(self, aExceptionHandling);\n" - - bodyWithThis = ( - f"{setupCall}rooted!(in(*s.get_context()) let mut thisObjJS = ptr::null_mut::<JSObject>());\n" - "wrap_call_this_object(s.get_context(), thisObj, thisObjJS.handle_mut());\n" - "if thisObjJS.is_null() {\n" - " return Err(JSFailed);\n" - "}\n" - f"unsafe {{ self.{method.name}({', '.join(argnamesWithThis)}) }}") - bodyWithoutThis = ( - f"{setupCall}rooted!(in(*s.get_context()) let thisObjJS = ptr::null_mut::<JSObject>());\n" - f"unsafe {{ self.{method.name}({', '.join(argnamesWithoutThis)}) }}") - return [ClassMethod(f'{method.name}_', method.returnType, args, - bodyInHeader=True, - templateArgs=["T: ThisReflector"], - body=bodyWithThis, - visibility='pub'), - ClassMethod(f'{method.name}__', method.returnType, argsWithoutThis, - bodyInHeader=True, - body=bodyWithoutThis, - visibility='pub'), - method] - - def deps(self): - return self._deps - - -# We're always fallible -def callbackGetterName(attr, descriptor): - return f"Get{MakeNativeName(descriptor.binaryNameFor(attr.identifier.name))}" - - -def callbackSetterName(attr, descriptor): - return f"Set{MakeNativeName(descriptor.binaryNameFor(attr.identifier.name))}" - - -class CGCallbackFunction(CGCallback): - def __init__(self, callback, descriptorProvider): - CGCallback.__init__(self, callback, descriptorProvider, - "CallbackFunction", - methods=[CallCallback(callback, descriptorProvider)]) - - def getConstructors(self): - return CGCallback.getConstructors(self) - - -class CGCallbackFunctionImpl(CGGeneric): - def __init__(self, callback): - type = callback.identifier.name - impl = (f""" -impl CallbackContainer for {type} {{ - unsafe fn new(cx: SafeJSContext, callback: *mut JSObject) -> Rc<{type}> {{ - {type}::new(cx, callback) - }} - - fn callback_holder(&self) -> &CallbackObject {{ - self.parent.callback_holder() - }} -}} - -impl ToJSValConvertible for {type} {{ - unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {{ - self.callback().to_jsval(cx, rval); - }} -}}\ -""") - CGGeneric.__init__(self, impl) - - -class CGCallbackInterface(CGCallback): - def __init__(self, descriptor): - iface = descriptor.interface - attrs = [m for m in iface.members if m.isAttr() and not m.isStatic()] - assert not attrs - methods = [m for m in iface.members - if m.isMethod() and not m.isStatic() and not m.isIdentifierLess()] - methods = [CallbackOperation(m, sig, descriptor) for m in methods - for sig in m.signatures()] - assert not iface.isJSImplemented() or not iface.ctor() - CGCallback.__init__(self, iface, descriptor, "CallbackInterface", methods) - - -class FakeMember(): - def __init__(self): - pass - - def isStatic(self): - return False - - def isAttr(self): - return False - - def isMethod(self): - return False - - def getExtendedAttribute(self, name): - return None - - -class CallbackMember(CGNativeMember): - def __init__(self, sig, name, descriptorProvider, needThisHandling): - """ - needThisHandling is True if we need to be able to accept a specified - thisObj, False otherwise. - """ - - self.retvalType = sig[0] - self.originalSig = sig - args = sig[1] - self.argCount = len(args) - if self.argCount > 0: - # Check for variadic arguments - lastArg = args[self.argCount - 1] - if lastArg.variadic: - self.argCountStr = ( - f"{self.argCount - 1} + {lastArg.identifier.name}.len()").removeprefix("0 + ") - else: - self.argCountStr = f"{self.argCount}" - self.usingOutparam = returnTypeNeedsOutparam(self.retvalType) - self.needThisHandling = needThisHandling - # If needThisHandling, we generate ourselves as private and the caller - # will handle generating public versions that handle the "this" stuff. - visibility = "priv" if needThisHandling else "pub" - # We don't care, for callback codegen, whether our original member was - # a method or attribute or whatnot. Just always pass FakeMember() - # here. - CGNativeMember.__init__(self, descriptorProvider, FakeMember(), - name, (self.retvalType, args), - extendedAttrs={}, - passJSBitsAsNeeded=False, - unsafe=needThisHandling, - visibility=visibility) - # We have to do all the generation of our body now, because - # the caller relies on us throwing if we can't manage it. - self.exceptionCode = "return Err(JSFailed);\n" - self.body = self.getImpl() - - def getImpl(self): - argvDecl = ( - "rooted_vec!(let mut argv);\n" - f"argv.extend((0..{self.argCountStr}).map(|_| Heap::default()));\n" - ) if self.argCount > 0 else "" # Avoid weird 0-sized arrays - - # Newlines and semicolons are in the values - pre = ( - f"{self.getCallSetup()}" - f"{self.getRvalDecl()}" - f"{argvDecl}" - ) - body = ( - f"{self.getArgConversions()}" - f"{self.getCall()}" - f"{self.getResultConversion()}" - ) - return f"{pre}\n{body}" - - def getResultConversion(self): - replacements = { - "val": "rval.handle()", - } - - info = getJSToNativeConversionInfo( - self.retvalType, - self.descriptorProvider, - exceptionCode=self.exceptionCode, - isCallbackReturnValue="Callback", - # XXXbz we should try to do better here - sourceDescription="return value") - template = info.template - declType = info.declType - - if self.usingOutparam: - convertType = CGGeneric("") - else: - convertType = instantiateJSToNativeConversionTemplate( - template, replacements, declType, "retval") - - if self.retvalType is None or self.retvalType.isUndefined() or self.usingOutparam: - retval = "()" - else: - retval = "retval" - - return f"{convertType.define()}\nOk({retval})\n" - - def getArgConversions(self): - # Just reget the arglist from self.originalSig, because our superclasses - # just have way to many members they like to clobber, so I can't find a - # safe member name to store it in. - arglist = self.originalSig[1] - argConversions = [self.getArgConversion(i, arg) for (i, arg) - in enumerate(arglist)] - # Do them back to front, so our argc modifications will work - # correctly, because we examine trailing arguments first. - argConversions.reverse() - argConversions = [CGGeneric(c) for c in argConversions] - # If arg count is only 1 but it's optional and not default value, - # argc should be mutable. - if self.argCount == 1 and not (arglist[0].optional and not arglist[0].defaultValue): - argConversions.insert(0, self.getArgcDecl(True)) - elif self.argCount > 0: - argConversions.insert(0, self.getArgcDecl(False)) - # And slap them together. - return CGList(argConversions, "\n\n").define() + "\n\n" - - def getArgConversion(self, i, arg): - argval = arg.identifier.name - - if arg.variadic: - argval = f"{argval}[idx].get()" - jsvalIndex = f"{i} + idx" - else: - jsvalIndex = f"{i}" - if arg.optional and not arg.defaultValue: - argval += ".unwrap()" - - conversion = wrapForType( - "argv_root.handle_mut()", result=argval, - successCode=("{\n" - f"let arg = &mut argv[{jsvalIndex.removeprefix('0 + ')}];\n" - "*arg = Heap::default();\n" - "arg.set(argv_root.get());\n" - "}"), - pre="rooted!(in(*cx) let mut argv_root = UndefinedValue());") - if arg.variadic: - conversion = ( - f"for idx in 0..{arg.identifier.name}.len() {{\n" - f"{CGIndenter(CGGeneric(conversion)).define()}\n}}" - ) - elif arg.optional and not arg.defaultValue: - conversion = ( - f"{CGIfWrapper(f'{arg.identifier.name}.is_some()', CGGeneric(conversion)).define()}" - f" else if argc == {i + 1} {{\n" - " // This is our current trailing argument; reduce argc\n" - " argc -= 1;\n" - "} else {\n" - f" argv[{i}] = Heap::default();\n" - "}" - ) - return conversion - - def getArgs(self, returnType, argList): - args = CGNativeMember.getArgs(self, returnType, argList) - if not self.needThisHandling: - # Since we don't need this handling, we're the actual method that - # will be called, so we need an aRethrowExceptions argument. - args.append(Argument("ExceptionHandling", "aExceptionHandling", - "ReportExceptions")) - return args - # We want to allow the caller to pass in a "this" object, as - # well as a JSContext. - return [Argument("SafeJSContext", "cx"), - Argument("HandleObject", "aThisObj")] + args - - def getCallSetup(self): - if self.needThisHandling: - # It's been done for us already - return "" - return ( - "CallSetup s(CallbackPreserveColor(), aRv, aExceptionHandling);\n" - "JSContext* cx = *s.get_context();\n" - "if (!cx) {\n" - " return Err(JSFailed);\n" - "}\n") - - def getArgcDecl(self, immutable): - if immutable: - return CGGeneric(f"let argc = {self.argCountStr};") - return CGGeneric(f"let mut argc = {self.argCountStr};") - - @staticmethod - def ensureASCIIName(idlObject): - type = "attribute" if idlObject.isAttr() else "operation" - if re.match("[^\x20-\x7E]", idlObject.identifier.name): - raise SyntaxError(f'Callback {type} name "{idlObject.identifier.name}" contains non-ASCII ' - f"characters. We can't handle that. {idlObject.location}") - if re.match('"', idlObject.identifier.name): - raise SyntaxError(f"Callback {type} name '{idlObject.identifier.name}' contains " - "double-quote character. We can't handle " - f"that. {idlObject.location}") - - -class CallbackMethod(CallbackMember): - def __init__(self, sig, name, descriptorProvider, needThisHandling): - CallbackMember.__init__(self, sig, name, descriptorProvider, - needThisHandling) - - def getRvalDecl(self): - if self.usingOutparam: - return "" - else: - return "rooted!(in(*cx) let mut rval = UndefinedValue());\n" - - def getCall(self): - if self.argCount > 0: - argv = "argv.as_ptr() as *const JSVal" - argc = "argc" - else: - argv = "ptr::null_mut()" - argc = "0" - suffix = "" if self.usingOutparam else ".handle_mut()" - return (f"{self.getCallableDecl()}" - f"rooted!(in(*cx) let rootedThis = {self.getThisObj()});\n" - f"let ok = {self.getCallGuard()}JS_CallFunctionValue(\n" - " *cx, rootedThis.handle(), callable.handle(),\n" - " &HandleValueArray {\n" - f" length_: {argc} as ::libc::size_t,\n" - f" elements_: {argv}\n" - f" }}, rval{suffix});\n" - "maybe_resume_unwind();\n" - "if !ok {\n" - " return Err(JSFailed);\n" - "}\n") - - -class CallCallback(CallbackMethod): - def __init__(self, callback, descriptorProvider): - self.callback = callback - CallbackMethod.__init__(self, callback.signatures()[0], "Call", - descriptorProvider, needThisHandling=True) - - def getThisObj(self): - return "aThisObj.get()" - - def getCallableDecl(self): - return "rooted!(in(*cx) let callable = ObjectValue(self.callback()));\n" - - def getCallGuard(self): - if self.callback._treatNonObjectAsNull: - return "!IsCallable(self.callback()) || " - return "" - - -class CallbackOperationBase(CallbackMethod): - """ - Common class for implementing various callback operations. - """ - def __init__(self, signature, jsName, nativeName, descriptor, singleOperation): - self.singleOperation = singleOperation - self.methodName = jsName - CallbackMethod.__init__(self, signature, nativeName, descriptor, singleOperation) - - def getThisObj(self): - if not self.singleOperation: - return "self.callback()" - # This relies on getCallableDecl declaring a boolean - # isCallable in the case when we're a single-operation - # interface. - return "if isCallable { aThisObj.get() } else { self.callback() }" - - def getCallableDecl(self): - getCallableFromProp = f'self.parent.get_callable_property(cx, "{self.methodName}")?' - if not self.singleOperation: - return f'rooted!(in(*cx) let callable =\n{getCallableFromProp});\n' - callable = CGIndenter( - CGIfElseWrapper('isCallable', CGGeneric('ObjectValue(self.callback())'), CGGeneric(getCallableFromProp)) - ).define() - return ('let isCallable = IsCallable(self.callback());\n' - 'rooted!(in(*cx) let callable =\n' - f"{callable});\n") - - def getCallGuard(self): - return "" - - -class CallbackOperation(CallbackOperationBase): - """ - Codegen actual WebIDL operations on callback interfaces. - """ - def __init__(self, method, signature, descriptor): - self.ensureASCIIName(method) - jsName = method.identifier.name - CallbackOperationBase.__init__(self, signature, - jsName, - MakeNativeName(descriptor.binaryNameFor(jsName)), - descriptor, descriptor.interface.isSingleOperationInterface()) - - -class CGMaplikeOrSetlikeMethodGenerator(CGGeneric): - """ - Creates methods for *like interfaces. Unwrapping/wrapping - will be taken care of by the usual method generation machinery in - CGMethodCall/CGPerSignatureCall. Functionality is filled in here instead of - using CGCallGenerator. - """ - def __init__(self, descriptor, likeable, methodName): - trait: str - if likeable.isSetlike(): - trait = "Setlike" - elif likeable.isMaplike(): - trait = "Maplike" - else: - raise TypeError("CGMaplikeOrSetlikeMethodGenerator is only for Setlike/Maplike") - """ - setlike: - fn size(&self) -> usize; - fn add(&self, key: Self::Key); - fn has(&self, key: &Self::Key) -> bool; - fn clear(&self); - fn delete(&self, key: &Self::Key) -> bool; - maplike: - fn get(&self, key: Self::Key) -> Self::Value; - fn size(&self) -> usize; - fn set(&self, key: Self::Key, value: Self::Value); - fn has(&self, key: &Self::Key) -> bool; - fn clear(&self); - fn delete(&self, key: &Self::Key) -> bool; - like iterable: - keys/values/entries/forEach - """ - # like iterables are implemented seperatly as we are actually implementing them - if methodName in ["keys", "values", "entries", "forEach"]: - CGIterableMethodGenerator.__init__(self, descriptor, likeable, methodName) - elif methodName in ["size", "clear"]: # zero arguments - CGGeneric.__init__(self, fill( - """ - let result = ${trt}::${method}(this); - """, - trt=trait, - method=methodName.lower())) - elif methodName == "add": # special case one argumet - CGGeneric.__init__(self, fill( - """ - ${trt}::${method}(this, arg0); - // Returns itself per https://webidl.spec.whatwg.org/#es-set-add - let result = this; - """, - trt=trait, - method=methodName)) - elif methodName in ["has", "delete", "get"]: # one argument - CGGeneric.__init__(self, fill( - """ - let result = ${trt}::${method}(this, arg0); - """, - trt=trait, - method=methodName)) - elif methodName == "set": # two arguments - CGGeneric.__init__(self, fill( - """ - ${trt}::${method}(this, arg0, arg1); - // Returns itself per https://webidl.spec.whatwg.org/#es-map-set - let result = this; - """, - trt=trait, - method=methodName)) - else: - raise TypeError(f"Do not know how to impl *like method: {methodName}") - - -class CGIterableMethodGenerator(CGGeneric): - """ - Creates methods for iterable interfaces. Unwrapping/wrapping - will be taken care of by the usual method generation machinery in - CGMethodCall/CGPerSignatureCall. Functionality is filled in here instead of - using CGCallGenerator. - """ - def __init__(self, descriptor, iterable, methodName): - if methodName == "forEach": - CGGeneric.__init__(self, fill( - """ - if !IsCallable(arg0) { - throw_type_error(*cx, "Argument 1 of ${ifaceName}.forEach is not callable."); - return false; - } - rooted!(in(*cx) let arg0 = ObjectValue(arg0)); - rooted!(in(*cx) let mut call_arg1 = UndefinedValue()); - rooted!(in(*cx) let mut call_arg2 = UndefinedValue()); - rooted_vec!(let mut call_args); - call_args.push(UndefinedValue()); - call_args.push(UndefinedValue()); - call_args.push(ObjectValue(*_obj)); - rooted!(in(*cx) let mut ignoredReturnVal = UndefinedValue()); - - // This has to be a while loop since get_iterable_length() may change during - // the callback, and we need to avoid iterator invalidation. - // - // It is possible for this to loop infinitely, but that matches the spec - // and other browsers. - // - // https://heycam.github.io/webidl/#es-forEach - let mut i = 0; - while i < (*this).get_iterable_length() { - (*this).get_value_at_index(i).to_jsval(*cx, call_arg1.handle_mut()); - (*this).get_key_at_index(i).to_jsval(*cx, call_arg2.handle_mut()); - call_args[0] = call_arg1.handle().get(); - call_args[1] = call_arg2.handle().get(); - let call_args_handle = HandleValueArray::from(&call_args); - if !Call(*cx, arg1, arg0.handle(), &call_args_handle, - ignoredReturnVal.handle_mut()) { - return false; - } - - i += 1; - } - - let result = (); - """, - ifaceName=descriptor.interface.identifier.name)) - return - CGGeneric.__init__(self, fill( - """ - let result = ${iterClass}::new(this, IteratorType::${itrMethod}); - """, - iterClass=iteratorNativeType(descriptor, True), - ifaceName=descriptor.interface.identifier.name, - itrMethod=methodName.title())) - - -def camel_to_upper_snake(s): - return "_".join(m.group(0).upper() for m in re.finditer("[A-Z][a-z]*", s)) - - -def process_arg(expr, arg): - if arg.type.isGeckoInterface() and not arg.type.unroll().inner.isCallback(): - if arg.variadic or arg.type.isSequence(): - expr += ".r()" - elif arg.type.nullable() and arg.optional and not arg.defaultValue: - expr += ".as_ref().map(Option::as_deref)" - elif arg.type.nullable() or arg.optional and not arg.defaultValue: - expr += ".as_deref()" - else: - expr = f"&{expr}" - elif isinstance(arg.type, IDLPromiseType): - expr = f"&{expr}" - return expr - - -class GlobalGenRoots(): - """ - Roots for global codegen. - - To generate code, call the method associated with the target, and then - call the appropriate define/declare method. - """ - - @staticmethod - def InterfaceObjectMap(config): - mods = [ - "crate::dom::bindings::codegen", - "crate::script_runtime::JSContext", - "js::rust::HandleObject", - ] - imports = CGList([CGGeneric(f"use {mod};") for mod in mods], "\n") - - global_descriptors = config.getDescriptors(isGlobal=True) - flags = [("EMPTY", 0)] - flags.extend( - (camel_to_upper_snake(d.name), 2 ** idx) - for (idx, d) in enumerate(global_descriptors) - ) - global_flags = CGWrapper(CGIndenter(CGList([ - CGGeneric(f"const {args[0]} = {args[1]};") - for args in flags - ], "\n")), pre="#[derive(Clone, Copy)]\npub(crate) struct Globals: u8 {\n", post="\n}") - globals_ = CGWrapper(CGIndenter(global_flags), pre="bitflags::bitflags! {\n", post="\n}") - - phf = CGGeneric("include!(concat!(env!(\"OUT_DIR\"), \"/InterfaceObjectMapPhf.rs\"));") - - return CGList([ - CGGeneric(AUTOGENERATED_WARNING_COMMENT), - CGList([imports, globals_, phf], "\n\n") - ]) - - @staticmethod - def InterfaceObjectMapData(config): - pairs = [] - for d in config.getDescriptors(hasInterfaceObject=True, isInline=False): - binding_mod = toBindingModuleFileFromDescriptor(d) - binding_ns = toBindingNamespace(d.name) - pairs.append((d.name, binding_mod, binding_ns)) - for alias in d.interface.legacyWindowAliases: - pairs.append((alias, binding_mod, binding_ns)) - for ctor in d.interface.legacyFactoryFunctions: - pairs.append((ctor.identifier.name, binding_mod, binding_ns)) - pairs.sort(key=operator.itemgetter(0)) - mappings = [ - CGGeneric(f'"{pair[0]}": "codegen::Bindings::{pair[1]}::{pair[2]}::DefineDOMInterface"') - for pair in pairs - ] - return CGWrapper( - CGList(mappings, ",\n"), - pre="{\n", - post="\n}\n") - - @staticmethod - def PrototypeList(config): - # Prototype ID enum. - interfaces = config.getDescriptors(isCallback=False, isNamespace=False) - protos = [d.name for d in interfaces] - constructors = sorted([MakeNativeName(d.name) - for d in config.getDescriptors(hasInterfaceObject=True) - if d.shouldHaveGetConstructorObjectMethod()]) - - return CGList([ - CGGeneric(AUTOGENERATED_WARNING_COMMENT), - CGGeneric(f"pub(crate) const PROTO_OR_IFACE_LENGTH: usize = {len(protos) + len(constructors)};\n"), - CGGeneric(f"pub(crate) const MAX_PROTO_CHAIN_LENGTH: usize = {config.maxProtoChainLength};\n\n"), - CGGeneric("#[allow(clippy::enum_variant_names, dead_code)]"), - CGNonNamespacedEnum('ID', protos, 0, deriving="PartialEq, Copy, Clone", repr="u16"), - CGNonNamespacedEnum('Constructor', constructors, len(protos), - deriving="PartialEq, Copy, Clone", repr="u16"), - CGWrapper(CGIndenter(CGList([CGGeneric(f'"{name}"') for name in protos], - ",\n"), - indentLevel=4), - pre=f"static INTERFACES: [&str; {len(protos)}] = [\n", - post="\n];\n\n"), - CGGeneric("pub(crate) fn proto_id_to_name(proto_id: u16) -> &'static str {\n" - " debug_assert!(proto_id < ID::Last as u16);\n" - " INTERFACES[proto_id as usize]\n" - "}\n\n"), - ]) - - @staticmethod - def RegisterBindings(config): - # TODO - Generate the methods we want - code = CGList([ - CGRegisterProxyHandlers(config), - ], "\n") - - return CGImports(code, descriptors=[], callbacks=[], dictionaries=[], enums=[], typedefs=[], imports=[ - 'crate::dom::bindings::codegen::Bindings', - ], config=config) - - @staticmethod - def InterfaceTypes(config): - descriptors = sorted([MakeNativeName(d.name) - for d in config.getDescriptors(register=True, - isCallback=False, - isIteratorInterface=False)]) - curr = CGList([CGGeneric(f"pub(crate) use crate::dom::{name.lower()}::{MakeNativeName(name)};\n") - for name in descriptors]) - curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT) - return curr - - @staticmethod - def Bindings(config): - - def leafModule(d): - return getModuleFromObject(d).split('::')[-1] - - descriptors = config.getDescriptors(register=True, isIteratorInterface=False) - descriptors = (set(toBindingModuleFile(d.name) for d in descriptors if d.maybeGetSuperModule() is None) - | set(leafModule(d) for d in config.callbacks) - | set(leafModule(d) for d in config.getDictionaries())) - curr = CGList([CGGeneric( - "#[allow(clippy::derivable_impls)]\n" - f"pub(crate) mod {name};\n" - ) for name in sorted(descriptors)]) - curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT) - return curr - - @staticmethod - def InheritTypes(config): - - descriptors = config.getDescriptors(register=True, isCallback=False) - imports = [CGGeneric("use crate::dom::types::*;\n"), - CGGeneric("use crate::dom::bindings::conversions::{DerivedFrom, get_dom_class};\n"), - CGGeneric("use crate::dom::bindings::inheritance::Castable;\n"), - CGGeneric("use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom};\n"), - CGGeneric("use crate::dom::bindings::trace::JSTraceable;\n"), - CGGeneric("use crate::dom::bindings::reflector::DomObject;\n"), - CGGeneric("use js::jsapi::JSTracer;\n\n"), - CGGeneric("use std::mem;\n\n")] - allprotos = [] - topTypes = [] - hierarchy = defaultdict(list) - for descriptor in descriptors: - name = descriptor.name - chain = descriptor.prototypeChain - upcast = descriptor.hasDescendants() - downcast = len(chain) != 1 - - if upcast and not downcast: - topTypes.append(name) - - if not upcast: - # No other interface will implement DeriveFrom<Foo> for this Foo, so avoid - # implementing it for itself. - chain = chain[:-1] - - # Implement `DerivedFrom<Bar>` for `Foo`, for all `Bar` that `Foo` inherits from. - if chain: - allprotos.append(CGGeneric(f"impl Castable for {name} {{}}\n")) - for baseName in chain: - allprotos.append(CGGeneric(f"impl DerivedFrom<{baseName}> for {name} {{}}\n")) - if chain: - allprotos.append(CGGeneric("\n")) - - if downcast: - hierarchy[descriptor.interface.parent.identifier.name].append(name) - - typeIdCode = [] - topTypeVariants = [ - ("ID used by abstract interfaces.", "pub(crate) abstract_: ()"), - ("ID used by interfaces that are not castable.", "pub(crate) alone: ()"), - ] - topTypeVariants += [ - (f"ID used by interfaces that derive from {typeName}.", - f"pub(crate) {typeName.lower()}: {typeName}TypeId") - for typeName in topTypes - ] - topTypeVariantsAsStrings = [CGGeneric(f"/// {variant[0]}\n{variant[1]},") for variant in topTypeVariants] - typeIdCode.append(CGWrapper(CGIndenter(CGList(topTypeVariantsAsStrings, "\n"), 4), - pre="#[derive(Copy)]\npub(crate) union TopTypeId {\n", - post="\n}\n\n")) - - typeIdCode.append(CGGeneric("""\ -impl Clone for TopTypeId { - fn clone(&self) -> Self { *self } -} - -""")) - - def type_id_variant(name): - # If `name` is present in the hierarchy keys', that means some other interfaces - # derive from it and this enum variant should have an argument with its own - # TypeId enum. - return f"{name}({name}TypeId)" if name in hierarchy else name - - for base, derived in hierarchy.items(): - variants = [] - if config.getDescriptor(base).concrete: - variants.append(CGGeneric(base)) - variants += [CGGeneric(type_id_variant(derivedName)) for derivedName in derived] - derives = "Clone, Copy, Debug, PartialEq" - typeIdCode.append(CGWrapper(CGIndenter(CGList(variants, ",\n"), 4), - pre=f"#[derive({derives})]\npub(crate) enum {base}TypeId {{\n", - post="\n}\n\n")) - if base in topTypes: - typeIdCode.append(CGGeneric(f""" -impl {base} {{ - pub(crate) fn type_id(&self) -> &'static {base}TypeId {{ - unsafe {{ - &get_dom_class(self.reflector().get_jsobject().get()) - .unwrap() - .type_id - .{base.lower()} - }} - }} -}} - -""")) - - curr = CGList(imports + typeIdCode + allprotos) - curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT) - return curr - - @staticmethod - def UnionTypes(config): - - curr = UnionTypes(config.getDescriptors(), - config.getDictionaries(), - config.getCallbacks(), - config.typedefs, - config) - - # Add the auto-generated comment. - curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT) - - # Done. - return curr - - @staticmethod - def DomTypes(config): - curr = DomTypes(config.getDescriptors(), - config.getDescriptorProvider(), - config.getDictionaries(), - config.getCallbacks(), - config.typedefs, - config) - - # Add the auto-generated comment. - curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT) - - # Done. - return curr - - @staticmethod - def DomTypeHolder(config): - curr = DomTypeHolder(config.getDescriptors(), - config.getDescriptorProvider(), - config.getDictionaries(), - config.getCallbacks(), - config.typedefs, - config) - - # Add the auto-generated comment. - curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT) - - # Done. - return curr - - @staticmethod - def SupportedDomApis(config): - descriptors = config.getDescriptors(isExposedConditionally=False) - - base_path = os.path.dirname(__file__) - with open(os.path.join(base_path, 'apis.html.template')) as f: - base_template = f.read() - with open(os.path.join(base_path, 'api.html.template')) as f: - api_template = f.read() - with open(os.path.join(base_path, 'property.html.template')) as f: - property_template = f.read() - with open(os.path.join(base_path, 'interface.html.template')) as f: - interface_template = f.read() - - apis = [] - interfaces = [] - for descriptor in descriptors: - props = [] - for m in descriptor.interface.members: - if PropertyDefiner.getStringAttr(m, 'Pref') or \ - PropertyDefiner.getStringAttr(m, 'Func') or \ - PropertyDefiner.getStringAttr(m, 'Exposed') or \ - m.getExtendedAttribute('SecureContext') or \ - (m.isMethod() and m.isIdentifierLess()): - continue - bracket = '()' if m.isMethod() else '' - display = f"{m.identifier.name}{bracket}" - props += [property_template.replace('${name}', display)] - name = descriptor.interface.identifier.name - apis += [(api_template.replace('${interface}', name) - .replace('${properties}', '\n'.join(props)))] - interfaces += [interface_template.replace('${interface}', name)] - - return CGGeneric((base_template.replace('${apis}', '\n'.join(apis)) - .replace('${interfaces}', '\n'.join(interfaces)))) diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py deleted file mode 100644 index 07822eac1b3..00000000000 --- a/components/script/dom/bindings/codegen/Configuration.py +++ /dev/null @@ -1,553 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -import functools -import os - -from WebIDL import IDLExternalInterface, IDLSequenceType, IDLWrapperType, WebIDLError - - -class Configuration: - """ - Represents global configuration state based on IDL parse data and - the configuration file. - """ - def __init__(self, filename, parseData): - # Read the configuration file. - glbl = {} - exec(compile(open(filename).read(), filename, 'exec'), glbl) - config = glbl['DOMInterfaces'] - self.enumConfig = glbl['Enums'] - self.dictConfig = glbl['Dictionaries'] - self.unionConfig = glbl['Unions'] - - # Build descriptors for all the interfaces we have in the parse data. - # This allows callers to specify a subset of interfaces by filtering - # |parseData|. - self.descriptors = [] - self.interfaces = {} - self.maxProtoChainLength = 0 - for thing in parseData: - # Servo does not support external interfaces. - if isinstance(thing, IDLExternalInterface): - raise WebIDLError("Servo does not support external interfaces.", - [thing.location]) - - assert not thing.isType() - - if not thing.isInterface() and not thing.isNamespace(): - continue - - iface = thing - self.interfaces[iface.identifier.name] = iface - if iface.identifier.name not in config: - entry = {} - else: - entry = config[iface.identifier.name] - if not isinstance(entry, list): - assert isinstance(entry, dict) - entry = [entry] - self.descriptors.extend( - [Descriptor(self, iface, x) for x in entry]) - - # Mark the descriptors for which only a single nativeType implements - # an interface. - for descriptor in self.descriptors: - interfaceName = descriptor.interface.identifier.name - otherDescriptors = [d for d in self.descriptors - if d.interface.identifier.name == interfaceName] - descriptor.uniqueImplementation = len(otherDescriptors) == 1 - - self.enums = [e for e in parseData if e.isEnum()] - self.typedefs = [e for e in parseData if e.isTypedef()] - self.dictionaries = [d for d in parseData if d.isDictionary()] - self.callbacks = [c for c in parseData if - c.isCallback() and not c.isInterface()] - - # Keep the descriptor list sorted for determinism. - def cmp(x, y): - return (x > y) - (x < y) - self.descriptors.sort(key=functools.cmp_to_key(lambda x, y: cmp(x.name, y.name))) - - def getInterface(self, ifname): - return self.interfaces[ifname] - - def getDescriptors(self, **filters): - """Gets the descriptors that match the given filters.""" - curr = self.descriptors - for key, val in filters.items(): - if key == 'webIDLFile': - def getter(x): - return x.interface.location.filename - elif key == 'hasInterfaceObject': - def getter(x): - return x.interface.hasInterfaceObject() - elif key == 'isCallback': - def getter(x): - return x.interface.isCallback() - elif key == 'isNamespace': - def getter(x): - return x.interface.isNamespace() - elif key == 'isJSImplemented': - def getter(x): - return x.interface.isJSImplemented() - elif key == 'isGlobal': - def getter(x): - return x.isGlobal() - elif key == 'isInline': - def getter(x): - return x.interface.getExtendedAttribute('Inline') is not None - elif key == 'isExposedConditionally': - def getter(x): - return x.interface.isExposedConditionally() - elif key == 'isIteratorInterface': - def getter(x): - return x.interface.isIteratorInterface() - else: - def getter(x): - return getattr(x, key) - curr = [x for x in curr if getter(x) == val] - return curr - - def getEnums(self, webIDLFile): - return [e for e in self.enums if e.filename == webIDLFile] - - def getEnumConfig(self, name): - return self.enumConfig.get(name, {}) - - def getTypedefs(self, webIDLFile): - return [e for e in self.typedefs if e.filename == webIDLFile] - - @staticmethod - def _filterForFile(items, webIDLFile=""): - """Gets the items that match the given filters.""" - if not webIDLFile: - return items - - return [x for x in items if x.filename == webIDLFile] - - def getUnionConfig(self, name): - return self.unionConfig.get(name, {}) - - def getDictionaries(self, webIDLFile=""): - return self._filterForFile(self.dictionaries, webIDLFile=webIDLFile) - - def getDictConfig(self, name): - return self.dictConfig.get(name, {}) - - def getCallbacks(self, webIDLFile=""): - return self._filterForFile(self.callbacks, webIDLFile=webIDLFile) - - def getDescriptor(self, interfaceName): - """ - Gets the appropriate descriptor for the given interface name. - """ - iface = self.getInterface(interfaceName) - descriptors = self.getDescriptors(interface=iface) - - # We should have exactly one result. - if len(descriptors) != 1: - raise NoSuchDescriptorError("For " + interfaceName + " found " - + str(len(descriptors)) + " matches") - return descriptors[0] - - def getDescriptorProvider(self): - """ - Gets a descriptor provider that can provide descriptors as needed. - """ - return DescriptorProvider(self) - - -class NoSuchDescriptorError(TypeError): - def __init__(self, str): - TypeError.__init__(self, str) - - -class DescriptorProvider: - """ - A way of getting descriptors for interface names - """ - def __init__(self, config): - self.config = config - - def getDescriptor(self, interfaceName): - """ - Gets the appropriate descriptor for the given interface name given the - context of the current descriptor. - """ - return self.config.getDescriptor(interfaceName) - - -def MemberIsLegacyUnforgeable(member, descriptor): - return ((member.isAttr() or member.isMethod()) - and not member.isStatic() - and (member.isLegacyUnforgeable() - or bool(descriptor.interface.getExtendedAttribute("LegacyUnforgeable")))) - - -class Descriptor(DescriptorProvider): - """ - Represents a single descriptor for an interface. See Bindings.conf. - """ - def __init__(self, config, interface, desc): - DescriptorProvider.__init__(self, config) - self.interface = interface - - if not self.isExposedConditionally(): - if interface.parent and interface.parent.isExposedConditionally(): - raise TypeError("%s is not conditionally exposed but inherits from " - "%s which is" % - (interface.identifier.name, interface.parent.identifier.name)) - - # Read the desc, and fill in the relevant defaults. - ifaceName = self.interface.identifier.name - nativeTypeDefault = ifaceName - - # For generated iterator interfaces for other iterable interfaces, we - # just use IterableIterator as the native type, templated on the - # nativeType of the iterable interface. That way we can have a - # templated implementation for all the duplicated iterator - # functionality. - if self.interface.isIteratorInterface(): - itrName = self.interface.iterableInterface.identifier.name - itrDesc = self.getDescriptor(itrName) - nativeTypeDefault = iteratorNativeType(itrDesc) - - typeName = desc.get('nativeType', nativeTypeDefault) - - spiderMonkeyInterface = desc.get('spiderMonkeyInterface', False) - - # Callback and SpiderMonkey types do not use JS smart pointers, so we should not use the - # built-in rooting mechanisms for them. - if spiderMonkeyInterface: - self.returnType = 'Rc<%s>' % typeName - self.argumentType = '&%s' % typeName - self.nativeType = typeName - pathDefault = 'crate::dom::types::%s' % typeName - elif self.interface.isCallback(): - ty = 'crate::dom::bindings::codegen::Bindings::%sBinding::%s' % (ifaceName, ifaceName) - pathDefault = ty - self.returnType = "Rc<%s>" % ty - self.argumentType = "???" - self.nativeType = ty - else: - self.returnType = "DomRoot<%s>" % typeName - self.argumentType = "&%s" % typeName - self.nativeType = "*const %s" % typeName - if self.interface.isIteratorInterface(): - pathDefault = 'crate::dom::bindings::iterable::IterableIterator' - else: - pathDefault = 'crate::dom::types::%s' % MakeNativeName(typeName) - - self.concreteType = typeName - self.register = desc.get('register', True) - self.path = desc.get('path', pathDefault) - self.inRealmMethods = [name for name in desc.get('inRealms', [])] - self.canGcMethods = [name for name in desc.get('canGc', [])] - self.bindingPath = f"{getModuleFromObject(self.interface)}::{ifaceName}_Binding" - self.outerObjectHook = desc.get('outerObjectHook', 'None') - self.proxy = False - self.weakReferenceable = desc.get('weakReferenceable', False) - - # If we're concrete, we need to crawl our ancestor interfaces and mark - # them as having a concrete descendant. - self.concrete = (not self.interface.isCallback() - and not self.interface.isNamespace() - and not self.interface.getExtendedAttribute("Abstract") - and not self.interface.getExtendedAttribute("Inline") - and not spiderMonkeyInterface) - self.hasLegacyUnforgeableMembers = (self.concrete - and any(MemberIsLegacyUnforgeable(m, self) for m in - self.interface.members)) - - self.operations = { - 'IndexedGetter': None, - 'IndexedSetter': None, - 'IndexedDeleter': None, - 'NamedGetter': None, - 'NamedSetter': None, - 'NamedDeleter': None, - 'Stringifier': None, - } - - self.hasDefaultToJSON = False - - def addOperation(operation, m): - if not self.operations[operation]: - self.operations[operation] = m - - # Since stringifiers go on the prototype, we only need to worry - # about our own stringifier, not those of our ancestor interfaces. - for m in self.interface.members: - if m.isMethod() and m.isStringifier(): - addOperation('Stringifier', m) - if m.isMethod() and m.isDefaultToJSON(): - self.hasDefaultToJSON = True - - if self.concrete: - iface = self.interface - while iface: - for m in iface.members: - if not m.isMethod(): - continue - - def addIndexedOrNamedOperation(operation, m): - if not self.isGlobal(): - self.proxy = True - if m.isIndexed(): - operation = 'Indexed' + operation - else: - assert m.isNamed() - operation = 'Named' + operation - addOperation(operation, m) - - if m.isGetter(): - addIndexedOrNamedOperation('Getter', m) - if m.isSetter(): - addIndexedOrNamedOperation('Setter', m) - if m.isDeleter(): - addIndexedOrNamedOperation('Deleter', m) - - iface = iface.parent - if iface: - iface.setUserData('hasConcreteDescendant', True) - - if self.isMaybeCrossOriginObject(): - self.proxy = True - - if self.proxy: - iface = self.interface - while iface.parent: - iface = iface.parent - iface.setUserData('hasProxyDescendant', True) - - self.name = interface.identifier.name - - # self.extendedAttributes is a dict of dicts, keyed on - # all/getterOnly/setterOnly and then on member name. Values are an - # array of extended attributes. - self.extendedAttributes = {'all': {}, 'getterOnly': {}, 'setterOnly': {}} - - def addExtendedAttribute(attribute, config): - def add(key, members, attribute): - for member in members: - self.extendedAttributes[key].setdefault(member, []).append(attribute) - - if isinstance(config, dict): - for key in ['all', 'getterOnly', 'setterOnly']: - add(key, config.get(key, []), attribute) - elif isinstance(config, list): - add('all', config, attribute) - else: - assert isinstance(config, str) - if config == '*': - iface = self.interface - while iface: - add('all', [m.name for m in iface.members], attribute) - iface = iface.parent - else: - add('all', [config], attribute) - - self._binaryNames = desc.get('binaryNames', {}) - self._binaryNames.setdefault('__legacycaller', 'LegacyCall') - self._binaryNames.setdefault('__stringifier', 'Stringifier') - - self._internalNames = desc.get('internalNames', {}) - - for member in self.interface.members: - if not member.isAttr() and not member.isMethod(): - continue - binaryName = member.getExtendedAttribute("BinaryName") - if binaryName: - assert isinstance(binaryName, list) - assert len(binaryName) == 1 - self._binaryNames.setdefault(member.identifier.name, - binaryName[0]) - self._internalNames.setdefault(member.identifier.name, - member.identifier.name.replace('-', '_')) - - # Build the prototype chain. - self.prototypeChain = [] - parent = interface - while parent: - self.prototypeChain.insert(0, parent.identifier.name) - parent = parent.parent - self.prototypeDepth = len(self.prototypeChain) - 1 - config.maxProtoChainLength = max(config.maxProtoChainLength, - len(self.prototypeChain)) - - def maybeGetSuperModule(self): - """ - Returns name of super module if self is part of it - """ - filename = getIdlFileName(self.interface) - # if interface name is not same as webidl file - # webidl is super module for interface - if filename.lower() != self.interface.identifier.name.lower(): - return filename - return None - - def binaryNameFor(self, name): - return self._binaryNames.get(name, name) - - def internalNameFor(self, name): - return self._internalNames.get(name, name) - - def hasNamedPropertiesObject(self): - if self.interface.isExternal(): - return False - - return self.isGlobal() and self.supportsNamedProperties() - - def supportsNamedProperties(self): - return self.operations['NamedGetter'] is not None - - def getExtendedAttributes(self, member, getter=False, setter=False): - def maybeAppendInfallibleToAttrs(attrs, throws): - if throws is None: - attrs.append("infallible") - elif throws is True: - pass - else: - raise TypeError("Unknown value for 'Throws'") - - name = member.identifier.name - if member.isMethod(): - attrs = self.extendedAttributes['all'].get(name, []) - throws = member.getExtendedAttribute("Throws") - maybeAppendInfallibleToAttrs(attrs, throws) - return attrs - - assert member.isAttr() - assert bool(getter) != bool(setter) - key = 'getterOnly' if getter else 'setterOnly' - attrs = self.extendedAttributes['all'].get(name, []) + self.extendedAttributes[key].get(name, []) - throws = member.getExtendedAttribute("Throws") - if throws is None: - throwsAttr = "GetterThrows" if getter else "SetterThrows" - throws = member.getExtendedAttribute(throwsAttr) - maybeAppendInfallibleToAttrs(attrs, throws) - return attrs - - def getParentName(self): - parent = self.interface.parent - while parent: - if not parent.getExtendedAttribute("Inline"): - return parent.identifier.name - parent = parent.parent - return None - - def supportsIndexedProperties(self): - return self.operations['IndexedGetter'] is not None - - def isMaybeCrossOriginObject(self): - # If we're isGlobal and have cross-origin members, we're a Window, and - # that's not a cross-origin object. The WindowProxy is. - return self.concrete and self.interface.hasCrossOriginMembers and not self.isGlobal() - - def hasDescendants(self): - return (self.interface.getUserData("hasConcreteDescendant", False) - or self.interface.getUserData("hasProxyDescendant", False)) - - def hasHTMLConstructor(self): - ctor = self.interface.ctor() - return ctor and ctor.isHTMLConstructor() - - def shouldHaveGetConstructorObjectMethod(self): - assert self.interface.hasInterfaceObject() - if self.interface.getExtendedAttribute("Inline"): - return False - return (self.interface.isCallback() or self.interface.isNamespace() - or self.hasDescendants() or self.hasHTMLConstructor()) - - def shouldCacheConstructor(self): - return self.hasDescendants() or self.hasHTMLConstructor() - - def isExposedConditionally(self): - return self.interface.isExposedConditionally() - - def isGlobal(self): - """ - Returns true if this is the primary interface for a global object - of some sort. - """ - return bool(self.interface.getExtendedAttribute("Global") - or self.interface.getExtendedAttribute("PrimaryGlobal")) - - -# Some utility methods - - -def MakeNativeName(name): - return name[0].upper() + name[1:] - - -def getIdlFileName(object): - return os.path.basename(object.location.filename).split('.webidl')[0] - - -def getModuleFromObject(object): - return ('crate::dom::bindings::codegen::Bindings::' + getIdlFileName(object) + 'Binding') - - -def getTypesFromDescriptor(descriptor): - """ - Get all argument and return types for all members of the descriptor - """ - members = [m for m in descriptor.interface.members] - if descriptor.interface.ctor(): - members.append(descriptor.interface.ctor()) - members.extend(descriptor.interface.legacyFactoryFunctions) - signatures = [s for m in members if m.isMethod() for s in m.signatures()] - types = [] - for s in signatures: - assert len(s) == 2 - (returnType, arguments) = s - types.append(returnType) - types.extend(a.type for a in arguments) - - types.extend(a.type for a in members if a.isAttr()) - return types - - -def getTypesFromDictionary(dictionary): - """ - Get all member types for this dictionary - """ - if isinstance(dictionary, IDLWrapperType): - dictionary = dictionary.inner - types = [] - curDict = dictionary - while curDict: - types.extend([getUnwrappedType(m.type) for m in curDict.members]) - curDict = curDict.parent - return types - - -def getTypesFromCallback(callback): - """ - Get the types this callback depends on: its return type and the - types of its arguments. - """ - sig = callback.signatures()[0] - types = [sig[0]] # Return type - types.extend(arg.type for arg in sig[1]) # Arguments - return types - - -def getUnwrappedType(type): - while isinstance(type, IDLSequenceType): - type = type.inner - return type - - -def iteratorNativeType(descriptor, infer=False): - iterableDecl = descriptor.interface.maplikeOrSetlikeOrIterable - assert (iterableDecl.isIterable() and iterableDecl.isPairIterator()) \ - or iterableDecl.isSetlike() or iterableDecl.isMaplike() - res = "IterableIterator%s" % ("" if infer else '<%s>' % descriptor.interface.identifier.name) - # todo: this hack is telling us that something is still wrong in codegen - if iterableDecl.isSetlike() or iterableDecl.isMaplike(): - res = f"crate::dom::bindings::iterable::{res}" - return res diff --git a/components/script/dom/bindings/codegen/api.html.template b/components/script/dom/bindings/codegen/api.html.template deleted file mode 100644 index 807392693a4..00000000000 --- a/components/script/dom/bindings/codegen/api.html.template +++ /dev/null @@ -1,6 +0,0 @@ -<table id="${interface}"> -<tr> -<th>${interface}</th> -</tr> -${properties} -</table> diff --git a/components/script/dom/bindings/codegen/apis.html.template b/components/script/dom/bindings/codegen/apis.html.template deleted file mode 100644 index a6f1e59d4ab..00000000000 --- a/components/script/dom/bindings/codegen/apis.html.template +++ /dev/null @@ -1,35 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="generator" content="rustdoc"> - <meta name="description" content="API documentation for the Rust `servo` crate."> - <meta name="keywords" content="rust, rustlang, rust-lang, servo"> - <title>Supported DOM APIs - servo - Rust</title> - <link rel="stylesheet" type="text/css" href="../rustdoc.css"> - <link rel="stylesheet" type="text/css" href="../main.css"> -</head> -<body class="rustdoc"> - <!--[if lte IE 8]> - <div class="warning"> - This old browser is unsupported and will most likely display funky - things. - </div> - <![endif]--> - <nav class='sidebar'> - <div class='block crate'> - <h3>Interfaces</h3> - <ul> - ${interfaces} - </ul> - </div> - </nav> - <section id='main' class="content mod"> - <h1 class='fqn'><span class='in-band'>DOM APIs currently supported in <a class='mod' href=''>Servo</a></span></h1> - <div id='properties' class='docblock'> - ${apis} - </div> - </section> -</body> -</html> diff --git a/components/script/dom/bindings/codegen/interface.html.template b/components/script/dom/bindings/codegen/interface.html.template deleted file mode 100644 index 92b023165e2..00000000000 --- a/components/script/dom/bindings/codegen/interface.html.template +++ /dev/null @@ -1 +0,0 @@ -<li><a href="#${interface}">${interface}</a></li> diff --git a/components/script/dom/bindings/codegen/property.html.template b/components/script/dom/bindings/codegen/property.html.template deleted file mode 100644 index 7b16aa78d0f..00000000000 --- a/components/script/dom/bindings/codegen/property.html.template +++ /dev/null @@ -1,3 +0,0 @@ -<tr> - <td>${name}</td> -</tr> diff --git a/components/script/dom/bindings/codegen/run.py b/components/script/dom/bindings/codegen/run.py deleted file mode 100644 index d60cff896da..00000000000 --- a/components/script/dom/bindings/codegen/run.py +++ /dev/null @@ -1,159 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -import os -import sys -import json -import re - -SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) -SERVO_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", "..", "..", "..", "..")) - -FILTER_PATTERN = re.compile("// skip-unless ([A-Z_]+)\n") - - -def main(): - os.chdir(os.path.join(os.path.dirname(__file__))) - sys.path.insert(0, os.path.join(SERVO_ROOT, "third_party", "WebIDL")) - sys.path.insert(0, os.path.join(SERVO_ROOT, "third_party", "ply")) - - css_properties_json, out_dir = sys.argv[1:] - # Four dotdots: /path/to/target(4)/debug(3)/build(2)/style-*(1)/out - # Do not ascend above the target dir, because it may not be called target - # or even have a parent (see CARGO_TARGET_DIR). - doc_servo = os.path.join(out_dir, "..", "..", "..", "..", "doc") - webidls_dir = os.path.join(SCRIPT_PATH, "..", "..", "webidls") - config_file = "Bindings.conf" - - import WebIDL - from Configuration import Configuration - from CodegenRust import CGBindingRoot - - parser = WebIDL.Parser(make_dir(os.path.join(out_dir, "cache"))) - webidls = [name for name in os.listdir(webidls_dir) if name.endswith(".webidl")] - for webidl in webidls: - filename = os.path.join(webidls_dir, webidl) - with open(filename, "r", encoding="utf-8") as f: - contents = f.read() - filter_match = FILTER_PATTERN.search(contents) - if filter_match: - env_var = filter_match.group(1) - if not os.environ.get(env_var): - continue - - parser.parse(contents, filename) - - add_css_properties_attributes(css_properties_json, parser) - parser_results = parser.finish() - config = Configuration(config_file, parser_results) - make_dir(os.path.join(out_dir, "Bindings")) - - for name, filename in [ - ("PrototypeList", "PrototypeList.rs"), - ("RegisterBindings", "RegisterBindings.rs"), - ("InterfaceObjectMap", "InterfaceObjectMap.rs"), - ("InterfaceObjectMapData", "InterfaceObjectMapData.json"), - ("InterfaceTypes", "InterfaceTypes.rs"), - ("InheritTypes", "InheritTypes.rs"), - ("Bindings", "Bindings/mod.rs"), - ("UnionTypes", "UnionTypes.rs"), - ("DomTypes", "DomTypes.rs"), - ("DomTypeHolder", "DomTypeHolder.rs"), - ]: - generate(config, name, os.path.join(out_dir, filename)) - make_dir(doc_servo) - generate(config, "SupportedDomApis", os.path.join(doc_servo, "apis.html")) - - for webidl in webidls: - filename = os.path.join(webidls_dir, webidl) - prefix = "Bindings/%sBinding" % webidl[:-len(".webidl")] - module = CGBindingRoot(config, prefix, filename).define() - if module: - with open(os.path.join(out_dir, prefix + ".rs"), "wb") as f: - f.write(module.encode("utf-8")) - - -def make_dir(path): - if not os.path.exists(path): - os.makedirs(path) - return path - - -def generate(config, name, filename): - from CodegenRust import GlobalGenRoots - root = getattr(GlobalGenRoots, name)(config) - code = root.define() - with open(filename, "wb") as f: - f.write(code.encode("utf-8")) - - -def add_css_properties_attributes(css_properties_json, parser): - def map_preference_name(preference_name: str): - """Map between Stylo preference names and Servo preference names as the - `css-properties.json` file is generated by Stylo. This should be kept in sync with the - preference mapping done in `components/servo_config/prefs.rs`, which handles the runtime version of - these preferences.""" - MAPPING = [ - ["layout.unimplemented", "layout_unimplemented"], - ["layout.threads", "layout_threads"], - ["layout.legacy_layout", "layout_legacy_layout"], - ["layout.flexbox.enabled", "layout_flexbox_enabled"], - ["layout.columns.enabled", "layout_columns_enabled"], - ["layout.grid.enabled", "layout_grid_enabled"], - ["layout.css.transition-behavior.enabled", "layout_css_transition_behavior_enabled"], - ["layout.writing-mode.enabled", "layout_writing_mode_enabled"], - ["layout.container-queries.enabled", "layout_container_queries_enabled"], - ] - for mapping in MAPPING: - if mapping[0] == preference_name: - return mapping[1] - return preference_name - - css_properties = json.load(open(css_properties_json, "rb")) - idl = "partial interface CSSStyleDeclaration {\n%s\n};\n" % "\n".join( - " [%sCEReactions, SetterThrows] attribute [LegacyNullToEmptyString] DOMString %s;" % ( - (f'Pref="{map_preference_name(data["pref"])}", ' if data["pref"] else ""), - attribute_name - ) - for (kind, properties_list) in sorted(css_properties.items()) - for (property_name, data) in sorted(properties_list.items()) - for attribute_name in attribute_names(property_name) - ) - parser.parse(idl, "CSSStyleDeclaration_generated.webidl") - - -def attribute_names(property_name): - # https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-dashed-attribute - if property_name != "float": - yield property_name - else: - yield "_float" - - # https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-camel-cased-attribute - if "-" in property_name: - yield "".join(camel_case(property_name)) - - # https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-webkit-cased-attribute - if property_name.startswith("-webkit-"): - yield "".join(camel_case(property_name), True) - - -# https://drafts.csswg.org/cssom/#css-property-to-idl-attribute -def camel_case(chars, webkit_prefixed=False): - if webkit_prefixed: - chars = chars[1:] - next_is_uppercase = False - for c in chars: - if c == '-': - next_is_uppercase = True - elif next_is_uppercase: - next_is_uppercase = False - # Should be ASCII-uppercase, but all non-custom CSS property names are within ASCII - yield c.upper() - else: - yield c - - -if __name__ == "__main__": - main() diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs index 62d99487bbd..3512b59724a 100644 --- a/components/script/dom/bindings/mod.rs +++ b/components/script/dom/bindings/mod.rs @@ -174,28 +174,28 @@ pub(crate) mod xmlname; #[allow(missing_docs, non_snake_case)] pub(crate) mod codegen { pub(crate) mod DomTypeHolder { - include!(concat!(env!("OUT_DIR"), "/DomTypeHolder.rs")); + include!(concat!(env!("BINDINGS_OUT_DIR"), "/DomTypeHolder.rs")); } pub(crate) mod DomTypes { - include!(concat!(env!("OUT_DIR"), "/DomTypes.rs")); + include!(concat!(env!("BINDINGS_OUT_DIR"), "/DomTypes.rs")); } #[allow(dead_code)] pub(crate) mod Bindings { - include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs")); + include!(concat!(env!("BINDINGS_OUT_DIR"), "/Bindings/mod.rs")); } pub(crate) mod InterfaceObjectMap { - include!(concat!(env!("OUT_DIR"), "/InterfaceObjectMap.rs")); + include!(concat!(env!("BINDINGS_OUT_DIR"), "/InterfaceObjectMap.rs")); } #[allow(dead_code, unused_imports, clippy::enum_variant_names)] pub(crate) mod InheritTypes { - include!(concat!(env!("OUT_DIR"), "/InheritTypes.rs")); + include!(concat!(env!("BINDINGS_OUT_DIR"), "/InheritTypes.rs")); } #[allow(clippy::upper_case_acronyms)] pub(crate) mod PrototypeList { - include!(concat!(env!("OUT_DIR"), "/PrototypeList.rs")); + include!(concat!(env!("BINDINGS_OUT_DIR"), "/PrototypeList.rs")); } pub(crate) mod RegisterBindings { - include!(concat!(env!("OUT_DIR"), "/RegisterBindings.rs")); + include!(concat!(env!("BINDINGS_OUT_DIR"), "/RegisterBindings.rs")); } #[allow( non_camel_case_types, @@ -206,6 +206,6 @@ pub(crate) mod codegen { clippy::enum_variant_names )] pub(crate) mod UnionTypes { - include!(concat!(env!("OUT_DIR"), "/UnionTypes.rs")); + include!(concat!(env!("BINDINGS_OUT_DIR"), "/UnionTypes.rs")); } } diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 4d31684cfb4..9b59657ad9e 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -206,7 +206,7 @@ pub(crate) mod macros; pub(crate) mod types { - include!(concat!(env!("OUT_DIR"), "/InterfaceTypes.rs")); + include!(concat!(env!("BINDINGS_OUT_DIR"), "/InterfaceTypes.rs")); } pub(crate) mod abortcontroller; diff --git a/components/script/dom/webidls/ANGLEInstancedArrays.webidl b/components/script/dom/webidls/ANGLEInstancedArrays.webidl deleted file mode 100644 index 22ef2ee0d0e..00000000000 --- a/components/script/dom/webidls/ANGLEInstancedArrays.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface ANGLEInstancedArrays { - const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE; - undefined drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount); - undefined drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount); - undefined vertexAttribDivisorANGLE(GLuint index, GLuint divisor); -}; diff --git a/components/script/dom/webidls/ARIAMixin.webidl b/components/script/dom/webidls/ARIAMixin.webidl deleted file mode 100644 index 3377b09e619..00000000000 --- a/components/script/dom/webidls/ARIAMixin.webidl +++ /dev/null @@ -1,57 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/aria/#dom-ariamixin - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -interface mixin ARIAMixin { - [CEReactions] attribute DOMString? role; - [CEReactions] attribute DOMString? ariaAtomic; - [CEReactions] attribute DOMString? ariaAutoComplete; - [CEReactions] attribute DOMString? ariaBrailleLabel; - [CEReactions] attribute DOMString? ariaBrailleRoleDescription; - [CEReactions] attribute DOMString? ariaBusy; - [CEReactions] attribute DOMString? ariaChecked; - [CEReactions] attribute DOMString? ariaColCount; - [CEReactions] attribute DOMString? ariaColIndex; - [CEReactions] attribute DOMString? ariaColIndexText; - [CEReactions] attribute DOMString? ariaColSpan; - [CEReactions] attribute DOMString? ariaCurrent; - [CEReactions] attribute DOMString? ariaDescription; - [CEReactions] attribute DOMString? ariaDisabled; - [CEReactions] attribute DOMString? ariaExpanded; - [CEReactions] attribute DOMString? ariaHasPopup; - [CEReactions] attribute DOMString? ariaHidden; - [CEReactions] attribute DOMString? ariaInvalid; - [CEReactions] attribute DOMString? ariaKeyShortcuts; - [CEReactions] attribute DOMString? ariaLabel; - [CEReactions] attribute DOMString? ariaLevel; - [CEReactions] attribute DOMString? ariaLive; - [CEReactions] attribute DOMString? ariaModal; - [CEReactions] attribute DOMString? ariaMultiLine; - [CEReactions] attribute DOMString? ariaMultiSelectable; - [CEReactions] attribute DOMString? ariaOrientation; - [CEReactions] attribute DOMString? ariaPlaceholder; - [CEReactions] attribute DOMString? ariaPosInSet; - [CEReactions] attribute DOMString? ariaPressed; - [CEReactions] attribute DOMString? ariaReadOnly; - [CEReactions] attribute DOMString? ariaRelevant; - [CEReactions] attribute DOMString? ariaRequired; - [CEReactions] attribute DOMString? ariaRoleDescription; - [CEReactions] attribute DOMString? ariaRowCount; - [CEReactions] attribute DOMString? ariaRowIndex; - [CEReactions] attribute DOMString? ariaRowIndexText; - [CEReactions] attribute DOMString? ariaRowSpan; - [CEReactions] attribute DOMString? ariaSelected; - [CEReactions] attribute DOMString? ariaSetSize; - [CEReactions] attribute DOMString? ariaSort; - [CEReactions] attribute DOMString? ariaValueMax; - [CEReactions] attribute DOMString? ariaValueMin; - [CEReactions] attribute DOMString? ariaValueNow; - [CEReactions] attribute DOMString? ariaValueText; -}; diff --git a/components/script/dom/webidls/AbortController.webidl b/components/script/dom/webidls/AbortController.webidl deleted file mode 100644 index cef49010d3c..00000000000 --- a/components/script/dom/webidls/AbortController.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#interface-abortcontroller -[Exposed=*, Pref="dom_abort_controller_enabled"] -interface AbortController { - constructor(); - - //[SameObject] readonly attribute AbortSignal signal; - - undefined abort(optional any reason); -}; diff --git a/components/script/dom/webidls/AbstractRange.webidl b/components/script/dom/webidls/AbstractRange.webidl deleted file mode 100644 index 4472d27fc20..00000000000 --- a/components/script/dom/webidls/AbstractRange.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#interface-abstractrange - */ - -[Exposed=Window] -interface AbstractRange { - [Pure] - readonly attribute Node startContainer; - [Pure] - readonly attribute unsigned long startOffset; - [Pure] - readonly attribute Node endContainer; - [Pure] - readonly attribute unsigned long endOffset; - [Pure] - readonly attribute boolean collapsed; -}; diff --git a/components/script/dom/webidls/ActivatableElement.webidl b/components/script/dom/webidls/ActivatableElement.webidl deleted file mode 100644 index 99a250a4b55..00000000000 --- a/components/script/dom/webidls/ActivatableElement.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// Interface for testing element activation -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. -[Exposed=(Window,Worker)] -interface mixin ActivatableElement { - [Throws, Pref="dom_testing_element_activation_enabled"] - undefined enterFormalActivationState(); - - [Throws, Pref="dom_testing_element_activation_enabled"] - undefined exitFormalActivationState(); -}; diff --git a/components/script/dom/webidls/AnalyserNode.webidl b/components/script/dom/webidls/AnalyserNode.webidl deleted file mode 100644 index 5bde7c7eb5e..00000000000 --- a/components/script/dom/webidls/AnalyserNode.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#analysernode - */ - -dictionary AnalyserOptions : AudioNodeOptions { - unsigned long fftSize = 2048; - double maxDecibels = -30; - double minDecibels = -100; - double smoothingTimeConstant = 0.8; -}; - -[Exposed=Window] -interface AnalyserNode : AudioNode { - [Throws] constructor(BaseAudioContext context, optional AnalyserOptions options = {}); - undefined getFloatFrequencyData (Float32Array array); - undefined getByteFrequencyData (Uint8Array array); - undefined getFloatTimeDomainData (Float32Array array); - undefined getByteTimeDomainData (Uint8Array array); - [SetterThrows] attribute unsigned long fftSize; - readonly attribute unsigned long frequencyBinCount; - [SetterThrows] attribute double minDecibels; - [SetterThrows] attribute double maxDecibels; - [SetterThrows] attribute double smoothingTimeConstant; -}; diff --git a/components/script/dom/webidls/AnimationEvent.webidl b/components/script/dom/webidls/AnimationEvent.webidl deleted file mode 100644 index fd9d6c47f7e..00000000000 --- a/components/script/dom/webidls/AnimationEvent.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * http://www.w3.org/TR/css3-animations/#animation-events- - * http://dev.w3.org/csswg/css3-animations/#animation-events- - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -[Exposed=Window] -interface AnimationEvent : Event { - constructor(DOMString type, optional AnimationEventInit eventInitDict = {}); - - readonly attribute DOMString animationName; - readonly attribute float elapsedTime; - readonly attribute DOMString pseudoElement; -}; - -dictionary AnimationEventInit : EventInit { - DOMString animationName = ""; - float elapsedTime = 0; - DOMString pseudoElement = ""; -}; diff --git a/components/script/dom/webidls/Attr.webidl b/components/script/dom/webidls/Attr.webidl deleted file mode 100644 index f56f9104e65..00000000000 --- a/components/script/dom/webidls/Attr.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#interface-attr - * - */ - -[Exposed=Window] -interface Attr : Node { - [Constant] - readonly attribute DOMString? namespaceURI; - [Constant] - readonly attribute DOMString? prefix; - [Constant] - readonly attribute DOMString localName; - [Constant] - readonly attribute DOMString name; - [CEReactions, Pure] - attribute DOMString value; - - [Pure] - readonly attribute Element? ownerElement; - - [Constant] - readonly attribute boolean specified; // useless; always returns true -}; diff --git a/components/script/dom/webidls/AudioBuffer.webidl b/components/script/dom/webidls/AudioBuffer.webidl deleted file mode 100644 index 56a735ec3f3..00000000000 --- a/components/script/dom/webidls/AudioBuffer.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#audiobuffer - */ - -dictionary AudioBufferOptions { - unsigned long numberOfChannels = 1; - required unsigned long length; - required float sampleRate; -}; - -[Exposed=Window] -interface AudioBuffer { - [Throws] constructor(AudioBufferOptions options); - readonly attribute float sampleRate; - readonly attribute unsigned long length; - readonly attribute double duration; - readonly attribute unsigned long numberOfChannels; - [Throws] Float32Array getChannelData(unsigned long channel); - [Throws] undefined copyFromChannel(Float32Array destination, - unsigned long channelNumber, - optional unsigned long startInChannel = 0); - [Throws] undefined copyToChannel(Float32Array source, - unsigned long channelNumber, - optional unsigned long startInChannel = 0); -}; diff --git a/components/script/dom/webidls/AudioBufferSourceNode.webidl b/components/script/dom/webidls/AudioBufferSourceNode.webidl deleted file mode 100644 index 7c0d3538b1d..00000000000 --- a/components/script/dom/webidls/AudioBufferSourceNode.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#AudioBufferSourceNode - */ - -dictionary AudioBufferSourceOptions { - AudioBuffer? buffer; - float detune = 0; - boolean loop = false; - double loopEnd = 0; - double loopStart = 0; - float playbackRate = 1; -}; - -[Exposed=Window] -interface AudioBufferSourceNode : AudioScheduledSourceNode { - [Throws] constructor(BaseAudioContext context, optional AudioBufferSourceOptions options = {}); - [Throws] attribute AudioBuffer? buffer; - readonly attribute AudioParam playbackRate; - readonly attribute AudioParam detune; - attribute boolean loop; - attribute double loopStart; - attribute double loopEnd; - [Throws] undefined start(optional double when = 0, - optional double offset, - optional double duration); -}; diff --git a/components/script/dom/webidls/AudioContext.webidl b/components/script/dom/webidls/AudioContext.webidl deleted file mode 100644 index 8f36c54d0fc..00000000000 --- a/components/script/dom/webidls/AudioContext.webidl +++ /dev/null @@ -1,40 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#dom-audiocontext - */ - -enum AudioContextLatencyCategory { - "balanced", - "interactive", - "playback" -}; - -dictionary AudioContextOptions { - (AudioContextLatencyCategory or double) latencyHint = "interactive"; - float sampleRate; -}; - -dictionary AudioTimestamp { - double contextTime; - DOMHighResTimeStamp performanceTime; -}; - -[Exposed=Window] -interface AudioContext : BaseAudioContext { - [Throws] constructor(optional AudioContextOptions contextOptions = {}); - readonly attribute double baseLatency; - readonly attribute double outputLatency; - - AudioTimestamp getOutputTimestamp(); - - Promise<undefined> suspend(); - Promise<undefined> close(); - - [Throws] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); - [Throws] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); - [Throws] MediaStreamTrackAudioSourceNode createMediaStreamTrackSource(MediaStreamTrack mediaStreamTrack); - [Throws] MediaStreamAudioDestinationNode createMediaStreamDestination(); -}; diff --git a/components/script/dom/webidls/AudioDestinationNode.webidl b/components/script/dom/webidls/AudioDestinationNode.webidl deleted file mode 100644 index 572c7d954f0..00000000000 --- a/components/script/dom/webidls/AudioDestinationNode.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#dom-audiodestinationnode - */ - -[Exposed=Window] -interface AudioDestinationNode : AudioNode { - readonly attribute unsigned long maxChannelCount; -}; diff --git a/components/script/dom/webidls/AudioListener.webidl b/components/script/dom/webidls/AudioListener.webidl deleted file mode 100644 index d625740802f..00000000000 --- a/components/script/dom/webidls/AudioListener.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#audiolistener - */ - -[Exposed=Window] -interface AudioListener { - readonly attribute AudioParam positionX; - readonly attribute AudioParam positionY; - readonly attribute AudioParam positionZ; - readonly attribute AudioParam forwardX; - readonly attribute AudioParam forwardY; - readonly attribute AudioParam forwardZ; - readonly attribute AudioParam upX; - readonly attribute AudioParam upY; - readonly attribute AudioParam upZ; - [Throws] AudioListener setPosition (float x, float y, float z); - [Throws] AudioListener setOrientation (float x, float y, float z, float xUp, float yUp, float zUp); -}; diff --git a/components/script/dom/webidls/AudioNode.webidl b/components/script/dom/webidls/AudioNode.webidl deleted file mode 100644 index 45d97bc5762..00000000000 --- a/components/script/dom/webidls/AudioNode.webidl +++ /dev/null @@ -1,62 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#dom-audionode - */ - -enum ChannelCountMode { - "max", - "clamped-max", - "explicit" -}; - -enum ChannelInterpretation { - "speakers", - "discrete" -}; - -dictionary AudioNodeOptions { - unsigned long channelCount; - ChannelCountMode channelCountMode; - ChannelInterpretation channelInterpretation; -}; - -[Exposed=Window] -interface AudioNode : EventTarget { - [Throws] - AudioNode connect(AudioNode destinationNode, - optional unsigned long output = 0, - optional unsigned long input = 0); - [Throws] - undefined connect(AudioParam destinationParam, - optional unsigned long output = 0); - [Throws] - undefined disconnect(); - [Throws] - undefined disconnect(unsigned long output); - [Throws] - undefined disconnect(AudioNode destination); - [Throws] - undefined disconnect(AudioNode destination, unsigned long output); - [Throws] - undefined disconnect(AudioNode destination, - unsigned long output, - unsigned long input); - [Throws] - undefined disconnect(AudioParam destination); - [Throws] - undefined disconnect(AudioParam destination, unsigned long output); - - readonly attribute BaseAudioContext context; - readonly attribute unsigned long numberOfInputs; - readonly attribute unsigned long numberOfOutputs; - - [SetterThrows] - attribute unsigned long channelCount; - [SetterThrows] - attribute ChannelCountMode channelCountMode; - [SetterThrows] - attribute ChannelInterpretation channelInterpretation; -}; diff --git a/components/script/dom/webidls/AudioParam.webidl b/components/script/dom/webidls/AudioParam.webidl deleted file mode 100644 index 4f44d54224c..00000000000 --- a/components/script/dom/webidls/AudioParam.webidl +++ /dev/null @@ -1,32 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#dom-audioparam - */ - -enum AutomationRate { - "a-rate", - "k-rate" -}; - -[Exposed=Window] -interface AudioParam { - attribute float value; - [SetterThrows] attribute AutomationRate automationRate; - readonly attribute float defaultValue; - readonly attribute float minValue; - readonly attribute float maxValue; - [Throws] AudioParam setValueAtTime(float value, double startTime); - [Throws] AudioParam linearRampToValueAtTime(float value, double endTime); - [Throws] AudioParam exponentialRampToValueAtTime(float value, double endTime); - [Throws] AudioParam setTargetAtTime(float target, - double startTime, - float timeConstant); - [Throws] AudioParam setValueCurveAtTime(sequence<float> values, - double startTime, - double duration); - [Throws] AudioParam cancelScheduledValues(double cancelTime); - [Throws] AudioParam cancelAndHoldAtTime(double cancelTime); -}; diff --git a/components/script/dom/webidls/AudioScheduledSourceNode.webidl b/components/script/dom/webidls/AudioScheduledSourceNode.webidl deleted file mode 100644 index 32542cbfa51..00000000000 --- a/components/script/dom/webidls/AudioScheduledSourceNode.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#AudioScheduledSourceNode - */ - -[Exposed=Window] -interface AudioScheduledSourceNode : AudioNode { - attribute EventHandler onended; - [Throws] undefined start(optional double when = 0); - [Throws] undefined stop(optional double when = 0); -}; diff --git a/components/script/dom/webidls/AudioTrack.webidl b/components/script/dom/webidls/AudioTrack.webidl deleted file mode 100644 index 2fa2ec9a5fa..00000000000 --- a/components/script/dom/webidls/AudioTrack.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#audiotrack - -[Exposed=Window] -interface AudioTrack { - readonly attribute DOMString id; - readonly attribute DOMString kind; - readonly attribute DOMString label; - readonly attribute DOMString language; - attribute boolean enabled; -}; diff --git a/components/script/dom/webidls/AudioTrackList.webidl b/components/script/dom/webidls/AudioTrackList.webidl deleted file mode 100644 index 4428776972c..00000000000 --- a/components/script/dom/webidls/AudioTrackList.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#audiotracklist - -[Exposed=Window] -interface AudioTrackList : EventTarget { - readonly attribute unsigned long length; - getter AudioTrack (unsigned long index); - AudioTrack? getTrackById(DOMString id); - - attribute EventHandler onchange; - attribute EventHandler onaddtrack; - attribute EventHandler onremovetrack; -}; diff --git a/components/script/dom/webidls/BaseAudioContext.webidl b/components/script/dom/webidls/BaseAudioContext.webidl deleted file mode 100644 index 271aa802e32..00000000000 --- a/components/script/dom/webidls/BaseAudioContext.webidl +++ /dev/null @@ -1,55 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#BaseAudioContext - */ - -enum AudioContextState { - "suspended", - "running", - "closed" -}; - -callback DecodeErrorCallback = undefined (DOMException error); -callback DecodeSuccessCallback = undefined (AudioBuffer decodedData); - -[Exposed=Window] -interface BaseAudioContext : EventTarget { - readonly attribute AudioDestinationNode destination; - readonly attribute float sampleRate; - readonly attribute double currentTime; - readonly attribute AudioListener listener; - readonly attribute AudioContextState state; - Promise<undefined> resume(); - attribute EventHandler onstatechange; - [Throws] AudioBuffer createBuffer(unsigned long numberOfChannels, - unsigned long length, - float sampleRate); - Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, - optional DecodeSuccessCallback successCallback, - optional DecodeErrorCallback errorCallback); - [Throws] AudioBufferSourceNode createBufferSource(); - [Throws] ConstantSourceNode createConstantSource(); - // ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, - // optional unsigned long numberOfInputChannels = 2, - // optional unsigned long numberOfOutputChannels = 2); - [Throws] AnalyserNode createAnalyser(); - [Throws] GainNode createGain(); - // DelayNode createDelay(optional double maxDelayTime = 1); - [Throws] BiquadFilterNode createBiquadFilter(); - [Throws] IIRFilterNode createIIRFilter(sequence<double> feedforward, - sequence<double> feedback); - // WaveShaperNode createWaveShaper(); - [Throws] PannerNode createPanner(); - [Throws] StereoPannerNode createStereoPanner(); - // ConvolverNode createConvolver(); - [Throws] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); - [Throws] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); - // DynamicsCompressorNode createDynamicsCompressor(); - [Throws] OscillatorNode createOscillator(); - // PeriodicWave createPeriodicWave(sequence<float> real, - // sequence<float> imag, - // optional PeriodicWaveConstraints constraints); -}; diff --git a/components/script/dom/webidls/BeforeUnloadEvent.webidl b/components/script/dom/webidls/BeforeUnloadEvent.webidl deleted file mode 100644 index d5aee92901c..00000000000 --- a/components/script/dom/webidls/BeforeUnloadEvent.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * For more information on this interface please see - * https://html.spec.whatwg.org/multipage/#beforeunloadevent - */ - -[Exposed=Window] -interface BeforeUnloadEvent : Event { - attribute DOMString returnValue; -}; diff --git a/components/script/dom/webidls/BiquadFilterNode.webidl b/components/script/dom/webidls/BiquadFilterNode.webidl deleted file mode 100644 index d1b5450338c..00000000000 --- a/components/script/dom/webidls/BiquadFilterNode.webidl +++ /dev/null @@ -1,39 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#biquadfilternode - */ - -enum BiquadFilterType { - "lowpass", - "highpass", - "bandpass", - "lowshelf", - "highshelf", - "peaking", - "notch", - "allpass" -}; - -dictionary BiquadFilterOptions : AudioNodeOptions { - BiquadFilterType type = "lowpass"; - float Q = 1; - float detune = 0; - float frequency = 350; - float gain = 0; -}; - -[Exposed=Window] -interface BiquadFilterNode : AudioNode { - [Throws] constructor(BaseAudioContext context, optional BiquadFilterOptions options = {}); - attribute BiquadFilterType type; - readonly attribute AudioParam frequency; - readonly attribute AudioParam detune; - readonly attribute AudioParam Q; - readonly attribute AudioParam gain; - // the AudioParam model of https://github.com/servo/servo/issues/21659 needs to - // be implemented before we implement this - // void getFrequencyResponse (Float32Array frequencyHz, Float32Array magResponse, Float32Array phaseResponse); -}; diff --git a/components/script/dom/webidls/Blob.webidl b/components/script/dom/webidls/Blob.webidl deleted file mode 100644 index 14af967c2f0..00000000000 --- a/components/script/dom/webidls/Blob.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/FileAPI/#blob - -[Exposed=(Window,Worker)] -interface Blob { - [Throws] constructor(optional sequence<BlobPart> blobParts, - optional BlobPropertyBag options = {}); - - readonly attribute unsigned long long size; - readonly attribute DOMString type; - - // slice Blob into byte-ranged chunks - Blob slice(optional [Clamp] long long start, - optional [Clamp] long long end, - optional DOMString contentType); - - [NewObject, Throws] ReadableStream stream(); - [NewObject] Promise<DOMString> text(); - [NewObject] Promise<ArrayBuffer> arrayBuffer(); -}; - -dictionary BlobPropertyBag { - DOMString type = ""; -}; - -typedef (ArrayBuffer or ArrayBufferView or Blob or DOMString) BlobPart; diff --git a/components/script/dom/webidls/Bluetooth.webidl b/components/script/dom/webidls/Bluetooth.webidl deleted file mode 100644 index 65ce8ea79b3..00000000000 --- a/components/script/dom/webidls/Bluetooth.webidl +++ /dev/null @@ -1,42 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://webbluetoothcg.github.io/web-bluetooth/#bluetooth - -dictionary BluetoothDataFilterInit { - BufferSource dataPrefix; - BufferSource mask; -}; - -dictionary BluetoothLEScanFilterInit { - sequence<BluetoothServiceUUID> services; - DOMString name; - DOMString namePrefix; - // Maps unsigned shorts to BluetoothDataFilters. - record<DOMString, BluetoothDataFilterInit> manufacturerData; - // Maps BluetoothServiceUUIDs to BluetoothDataFilters. - record<DOMString, BluetoothDataFilterInit> serviceData; -}; - -dictionary RequestDeviceOptions { - sequence<BluetoothLEScanFilterInit> filters; - sequence<BluetoothServiceUUID> optionalServices = []; - boolean acceptAllDevices = false; -}; - -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface Bluetooth : EventTarget { - [SecureContext] - Promise<boolean> getAvailability(); - [SecureContext] - attribute EventHandler onavailabilitychanged; - // [SecureContext, SameObject] - // readonly attribute BluetoothDevice? referringDevice; - [SecureContext] - Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options = {}); -}; - -// Bluetooth includes BluetoothDeviceEventHandlers; -// Bluetooth includes CharacteristicEventHandlers; -// Bluetooth includes ServiceEventHandlers; diff --git a/components/script/dom/webidls/BluetoothAdvertisingEvent.webidl b/components/script/dom/webidls/BluetoothAdvertisingEvent.webidl deleted file mode 100644 index c6f3c6a8480..00000000000 --- a/components/script/dom/webidls/BluetoothAdvertisingEvent.webidl +++ /dev/null @@ -1,37 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://webbluetoothcg.github.io/web-bluetooth/#advertising-events - -/*interface BluetoothManufacturerDataMap { - readonly maplike<unsigned short, DataView>; -}; -interface BluetoothServiceDataMap { - readonly maplike<UUID, DataView>; -};*/ -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface BluetoothAdvertisingEvent : Event { - [Throws] constructor(DOMString type, BluetoothAdvertisingEventInit init); - [SameObject] - readonly attribute BluetoothDevice device; - // readonly attribute FrozenArray<UUID> uuids; - readonly attribute DOMString? name; - readonly attribute unsigned short? appearance; - readonly attribute byte? txPower; - readonly attribute byte? rssi; - // [SameObject] - // readonly attribute BluetoothManufacturerDataMap manufacturerData; - // [SameObject] - // readonly attribute BluetoothServiceDataMap serviceData; -}; -dictionary BluetoothAdvertisingEventInit : EventInit { - required BluetoothDevice device; - // sequence<(DOMString or unsigned long)> uuids; - DOMString name; - unsigned short appearance; - byte txPower; - byte rssi; - // Map manufacturerData; - // Map serviceData; -}; diff --git a/components/script/dom/webidls/BluetoothCharacteristicProperties.webidl b/components/script/dom/webidls/BluetoothCharacteristicProperties.webidl deleted file mode 100644 index fb812ff7c46..00000000000 --- a/components/script/dom/webidls/BluetoothCharacteristicProperties.webidl +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://webbluetoothcg.github.io/web-bluetooth/#characteristicproperties - -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface BluetoothCharacteristicProperties { - readonly attribute boolean broadcast; - readonly attribute boolean read; - readonly attribute boolean writeWithoutResponse; - readonly attribute boolean write; - readonly attribute boolean notify; - readonly attribute boolean indicate; - readonly attribute boolean authenticatedSignedWrites; - readonly attribute boolean reliableWrite; - readonly attribute boolean writableAuxiliaries; -}; diff --git a/components/script/dom/webidls/BluetoothDevice.webidl b/components/script/dom/webidls/BluetoothDevice.webidl deleted file mode 100644 index f9cb44dda5a..00000000000 --- a/components/script/dom/webidls/BluetoothDevice.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdevice - -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface BluetoothDevice : EventTarget { - readonly attribute DOMString id; - readonly attribute DOMString? name; - readonly attribute BluetoothRemoteGATTServer? gatt; - - Promise<undefined> watchAdvertisements(); - undefined unwatchAdvertisements(); - readonly attribute boolean watchingAdvertisements; -}; - -interface mixin BluetoothDeviceEventHandlers { - attribute EventHandler ongattserverdisconnected; -}; - -// BluetoothDevice includes EventTarget; -BluetoothDevice includes BluetoothDeviceEventHandlers; -// BluetoothDevice includes CharacteristicEventHandlers; -// BluetoothDevice includes ServiceEventHandlers; diff --git a/components/script/dom/webidls/BluetoothPermissionResult.webidl b/components/script/dom/webidls/BluetoothPermissionResult.webidl deleted file mode 100644 index 67822fc55cf..00000000000 --- a/components/script/dom/webidls/BluetoothPermissionResult.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothpermissionresult - -dictionary BluetoothPermissionDescriptor : PermissionDescriptor { - DOMString deviceId; - // These match RequestDeviceOptions. - sequence<BluetoothLEScanFilterInit> filters; - sequence<BluetoothServiceUUID> optionalServices = []; - boolean acceptAllDevices = false; -}; - -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface BluetoothPermissionResult : PermissionStatus { - // attribute FrozenArray<BluetoothDevice> devices; - // Workaround until FrozenArray get implemented. - sequence<BluetoothDevice> devices(); -}; diff --git a/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl b/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl deleted file mode 100644 index 9e0140d8129..00000000000 --- a/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattcharacteristic - -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface BluetoothRemoteGATTCharacteristic : EventTarget { - [SameObject] - readonly attribute BluetoothRemoteGATTService service; - readonly attribute DOMString uuid; - readonly attribute BluetoothCharacteristicProperties properties; - readonly attribute ByteString? value; - Promise<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor); - Promise<sequence<BluetoothRemoteGATTDescriptor>> - getDescriptors(optional BluetoothDescriptorUUID descriptor); - Promise<ByteString> readValue(); - //Promise<DataView> readValue(); - Promise<undefined> writeValue(BufferSource value); - Promise<BluetoothRemoteGATTCharacteristic> startNotifications(); - Promise<BluetoothRemoteGATTCharacteristic> stopNotifications(); -}; - -interface mixin CharacteristicEventHandlers { - attribute EventHandler oncharacteristicvaluechanged; -}; - -// BluetoothRemoteGATTCharacteristic includes EventTarget; -BluetoothRemoteGATTCharacteristic includes CharacteristicEventHandlers; diff --git a/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl b/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl deleted file mode 100644 index 31e19a850fc..00000000000 --- a/components/script/dom/webidls/BluetoothRemoteGATTDescriptor.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// http://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattdescriptor - -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface BluetoothRemoteGATTDescriptor { - [SameObject] - readonly attribute BluetoothRemoteGATTCharacteristic characteristic; - readonly attribute DOMString uuid; - readonly attribute ByteString? value; - Promise<ByteString> readValue(); - //Promise<DataView> readValue(); - Promise<undefined> writeValue(BufferSource value); -}; diff --git a/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl b/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl deleted file mode 100644 index 3d60ace070f..00000000000 --- a/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -//https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattserver - -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface BluetoothRemoteGATTServer { - [SameObject] - readonly attribute BluetoothDevice device; - readonly attribute boolean connected; - Promise<BluetoothRemoteGATTServer> connect(); - [Throws] - undefined disconnect(); - Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service); - Promise<sequence<BluetoothRemoteGATTService>> getPrimaryServices(optional BluetoothServiceUUID service); -}; diff --git a/components/script/dom/webidls/BluetoothRemoteGATTService.webidl b/components/script/dom/webidls/BluetoothRemoteGATTService.webidl deleted file mode 100644 index e505ae3aabe..00000000000 --- a/components/script/dom/webidls/BluetoothRemoteGATTService.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattservice - -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface BluetoothRemoteGATTService : EventTarget { - [SameObject] - readonly attribute BluetoothDevice device; - readonly attribute DOMString uuid; - readonly attribute boolean isPrimary; - Promise<BluetoothRemoteGATTCharacteristic> getCharacteristic(BluetoothCharacteristicUUID characteristic); - Promise<sequence<BluetoothRemoteGATTCharacteristic>> - getCharacteristics(optional BluetoothCharacteristicUUID characteristic); - Promise<BluetoothRemoteGATTService> getIncludedService(BluetoothServiceUUID service); - Promise<sequence<BluetoothRemoteGATTService>> getIncludedServices(optional BluetoothServiceUUID service); -}; - -interface mixin ServiceEventHandlers { - attribute EventHandler onserviceadded; - attribute EventHandler onservicechanged; - attribute EventHandler onserviceremoved; -}; - -// BluetoothRemoteGATTService includes EventTarget; -// BluetoothRemoteGATTService includes CharacteristicEventHandlers; -BluetoothRemoteGATTService includes ServiceEventHandlers; diff --git a/components/script/dom/webidls/BluetoothUUID.webidl b/components/script/dom/webidls/BluetoothUUID.webidl deleted file mode 100644 index 5ee501bf6e6..00000000000 --- a/components/script/dom/webidls/BluetoothUUID.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothuuid - -[Exposed=Window, Pref="dom_bluetooth_enabled"] -interface BluetoothUUID { - [Throws] - static UUID getService(BluetoothServiceUUID name); - [Throws] - static UUID getCharacteristic(BluetoothCharacteristicUUID name); - [Throws] - static UUID getDescriptor(BluetoothDescriptorUUID name); - static UUID canonicalUUID([EnforceRange] unsigned long alias); -}; - -typedef DOMString UUID; -typedef (DOMString or unsigned long) BluetoothServiceUUID; -typedef (DOMString or unsigned long) BluetoothCharacteristicUUID; -typedef (DOMString or unsigned long) BluetoothDescriptorUUID; diff --git a/components/script/dom/webidls/Body.webidl b/components/script/dom/webidls/Body.webidl deleted file mode 100644 index 1c730f499c1..00000000000 --- a/components/script/dom/webidls/Body.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://fetch.spec.whatwg.org/#body - -[Exposed=(Window,Worker)] -interface mixin Body { - readonly attribute boolean bodyUsed; - readonly attribute ReadableStream? body; - - [NewObject] Promise<ArrayBuffer> arrayBuffer(); - [NewObject] Promise<Blob> blob(); - [NewObject] Promise<FormData> formData(); - [NewObject] Promise<any> json(); - [NewObject] Promise<USVString> text(); -}; diff --git a/components/script/dom/webidls/BroadcastChannel.webidl b/components/script/dom/webidls/BroadcastChannel.webidl deleted file mode 100644 index 886ea5761c6..00000000000 --- a/components/script/dom/webidls/BroadcastChannel.webidl +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://html.spec.whatwg.org/multipage/#broadcastchannel - */ - -[Exposed=(Window,Worker)] -interface BroadcastChannel : EventTarget { - constructor(DOMString name); - - readonly attribute DOMString name; - [Throws] undefined postMessage(any message); - undefined close(); - attribute EventHandler onmessage; - attribute EventHandler onmessageerror; -}; diff --git a/components/script/dom/webidls/CDATASection.webidl b/components/script/dom/webidls/CDATASection.webidl deleted file mode 100644 index 28cb4a85003..00000000000 --- a/components/script/dom/webidls/CDATASection.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#interface-cdatasection - */ - -[Exposed=Window] -interface CDATASection : Text { -}; diff --git a/components/script/dom/webidls/CSS.webidl b/components/script/dom/webidls/CSS.webidl deleted file mode 100644 index 2a199569cd8..00000000000 --- a/components/script/dom/webidls/CSS.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * http://dev.w3.org/csswg/cssom/#the-css-interface - */ - -[Abstract, Exposed=Window] -interface CSS { - [Throws] - static DOMString escape(DOMString ident); -}; - -// https://drafts.csswg.org/css-conditional-3/#the-css-interface -partial interface CSS { - static boolean supports(DOMString property, DOMString value); - static boolean supports(DOMString conditionText); -}; - -// https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet -partial interface CSS { - [SameObject, Pref="dom_worklet_enabled"] static readonly attribute Worklet paintWorklet; -}; diff --git a/components/script/dom/webidls/CSSConditionRule.webidl b/components/script/dom/webidls/CSSConditionRule.webidl deleted file mode 100644 index 2f0aa270c1e..00000000000 --- a/components/script/dom/webidls/CSSConditionRule.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/css-conditional/#cssconditionrule -[Abstract, Exposed=Window] -interface CSSConditionRule : CSSGroupingRule { - readonly attribute DOMString conditionText; -}; diff --git a/components/script/dom/webidls/CSSFontFaceRule.webidl b/components/script/dom/webidls/CSSFontFaceRule.webidl deleted file mode 100644 index 0e159a4b4ec..00000000000 --- a/components/script/dom/webidls/CSSFontFaceRule.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/css-fonts/#cssfontfacerule is unfortunately not web-compatible: -// https://github.com/w3c/csswg-drafts/issues/825 - -// https://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-CSSFontFaceRule , -// plus extended attributes matching CSSStyleRule -[Exposed=Window] -interface CSSFontFaceRule : CSSRule { - // [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; -}; - diff --git a/components/script/dom/webidls/CSSGroupingRule.webidl b/components/script/dom/webidls/CSSGroupingRule.webidl deleted file mode 100644 index 7707f38d984..00000000000 --- a/components/script/dom/webidls/CSSGroupingRule.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#the-cssgroupingrule-interface -[Abstract, Exposed=Window] -interface CSSGroupingRule : CSSRule { - [SameObject] readonly attribute CSSRuleList cssRules; - [Throws] unsigned long insertRule(DOMString rule, unsigned long index); - [Throws] undefined deleteRule(unsigned long index); -}; - diff --git a/components/script/dom/webidls/CSSImportRule.webidl b/components/script/dom/webidls/CSSImportRule.webidl deleted file mode 100644 index 31340776f25..00000000000 --- a/components/script/dom/webidls/CSSImportRule.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#cssimportrule -[Exposed=Window] -interface CSSImportRule : CSSRule { - // readonly attribute DOMString href; - // [SameObject, PutForwards=mediaText] readonly attribute MediaList media; - // [SameObject] readonly attribute CSSStyleSheet styleSheet; - readonly attribute DOMString? layerName; -}; diff --git a/components/script/dom/webidls/CSSKeyframeRule.webidl b/components/script/dom/webidls/CSSKeyframeRule.webidl deleted file mode 100644 index 92195320767..00000000000 --- a/components/script/dom/webidls/CSSKeyframeRule.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/css-animations/#interface-csskeyframerule -[Exposed=Window] -interface CSSKeyframeRule : CSSRule { - // attribute DOMString keyText; - readonly attribute CSSStyleDeclaration style; -}; diff --git a/components/script/dom/webidls/CSSKeyframesRule.webidl b/components/script/dom/webidls/CSSKeyframesRule.webidl deleted file mode 100644 index b812d124733..00000000000 --- a/components/script/dom/webidls/CSSKeyframesRule.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/css-animations/#interface-csskeyframesrule -[Exposed=Window] -interface CSSKeyframesRule : CSSRule { - [SetterThrows] - attribute DOMString name; - readonly attribute CSSRuleList cssRules; - - undefined appendRule(DOMString rule); - undefined deleteRule(DOMString select); - CSSKeyframeRule? findRule(DOMString select); -}; diff --git a/components/script/dom/webidls/CSSLayerBlockRule.webidl b/components/script/dom/webidls/CSSLayerBlockRule.webidl deleted file mode 100644 index 714fc075087..00000000000 --- a/components/script/dom/webidls/CSSLayerBlockRule.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/css-cascade-5/#the-csslayerblockrule-interface -[Exposed=Window] -interface CSSLayerBlockRule : CSSGroupingRule { - readonly attribute DOMString name; -}; diff --git a/components/script/dom/webidls/CSSLayerStatementRule.webidl b/components/script/dom/webidls/CSSLayerStatementRule.webidl deleted file mode 100644 index 22de1ffd27e..00000000000 --- a/components/script/dom/webidls/CSSLayerStatementRule.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/css-cascade-5/#the-csslayerstatementrule-interface -[Exposed=Window] -interface CSSLayerStatementRule : CSSRule { - readonly attribute /*FrozenArray<ResizeObserverSize>*/any nameList; -}; diff --git a/components/script/dom/webidls/CSSMediaRule.webidl b/components/script/dom/webidls/CSSMediaRule.webidl deleted file mode 100644 index 13b0cbafe76..00000000000 --- a/components/script/dom/webidls/CSSMediaRule.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#the-cssmediarule-interface -// https://drafts.csswg.org/css-conditional/#cssmediarule -[Exposed=Window] -interface CSSMediaRule : CSSConditionRule { - [SameObject, PutForwards=mediaText] readonly attribute MediaList media; -}; diff --git a/components/script/dom/webidls/CSSNamespaceRule.webidl b/components/script/dom/webidls/CSSNamespaceRule.webidl deleted file mode 100644 index 082d53833e9..00000000000 --- a/components/script/dom/webidls/CSSNamespaceRule.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#the-cssnamespacerule-interface -[Exposed=Window] -interface CSSNamespaceRule : CSSRule { - readonly attribute DOMString namespaceURI; - readonly attribute DOMString prefix; -}; diff --git a/components/script/dom/webidls/CSSRule.webidl b/components/script/dom/webidls/CSSRule.webidl deleted file mode 100644 index 72cbdd54f86..00000000000 --- a/components/script/dom/webidls/CSSRule.webidl +++ /dev/null @@ -1,32 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#the-cssrule-interface -[Abstract, Exposed=Window] -interface CSSRule { - const unsigned short STYLE_RULE = 1; - const unsigned short CHARSET_RULE = 2; // historical - const unsigned short IMPORT_RULE = 3; - const unsigned short MEDIA_RULE = 4; - const unsigned short FONT_FACE_RULE = 5; - const unsigned short PAGE_RULE = 6; - const unsigned short MARGIN_RULE = 9; - const unsigned short NAMESPACE_RULE = 10; - - readonly attribute unsigned short type; - attribute DOMString cssText; - // readonly attribute CSSRule? parentRule; - readonly attribute CSSStyleSheet? parentStyleSheet; -}; - -// https://drafts.csswg.org/css-animations/#interface-cssrule-idl -partial interface CSSRule { - const unsigned short KEYFRAMES_RULE = 7; - const unsigned short KEYFRAME_RULE = 8; -}; - -// https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface -partial interface CSSRule { - const unsigned short SUPPORTS_RULE = 12; -}; diff --git a/components/script/dom/webidls/CSSRuleList.webidl b/components/script/dom/webidls/CSSRuleList.webidl deleted file mode 100644 index e411930589b..00000000000 --- a/components/script/dom/webidls/CSSRuleList.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#cssrulelist -// [LegacyArrayClass] -[Exposed=Window] -interface CSSRuleList { - getter CSSRule? item(unsigned long index); - readonly attribute unsigned long length; -}; diff --git a/components/script/dom/webidls/CSSStyleDeclaration.webidl b/components/script/dom/webidls/CSSStyleDeclaration.webidl deleted file mode 100644 index 73ee152a4ac..00000000000 --- a/components/script/dom/webidls/CSSStyleDeclaration.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface - * - * Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. - */ - -[Exposed=Window] -interface CSSStyleDeclaration { - [CEReactions, SetterThrows] - attribute DOMString cssText; - readonly attribute unsigned long length; - getter DOMString item(unsigned long index); - DOMString getPropertyValue(DOMString property); - DOMString getPropertyPriority(DOMString property); - [CEReactions, Throws] - undefined setProperty(DOMString property, [LegacyNullToEmptyString] DOMString value, - optional [LegacyNullToEmptyString] DOMString priority = ""); - [CEReactions, Throws] - DOMString removeProperty(DOMString property); - // readonly attribute CSSRule? parentRule; - [CEReactions, SetterThrows] - attribute DOMString cssFloat; -}; - -// Auto-generated in GlobalGen.py: accessors for each CSS property diff --git a/components/script/dom/webidls/CSSStyleRule.webidl b/components/script/dom/webidls/CSSStyleRule.webidl deleted file mode 100644 index 48bf819bb89..00000000000 --- a/components/script/dom/webidls/CSSStyleRule.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#the-cssstylerule-interface -[Exposed=Window] -interface CSSStyleRule : CSSRule { - attribute DOMString selectorText; - [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; -}; diff --git a/components/script/dom/webidls/CSSStyleSheet.webidl b/components/script/dom/webidls/CSSStyleSheet.webidl deleted file mode 100644 index 0133eefd8a1..00000000000 --- a/components/script/dom/webidls/CSSStyleSheet.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#the-cssstylesheet-interface -[Exposed=Window] -interface CSSStyleSheet : StyleSheet { - // readonly attribute CSSRule? ownerRule; - [Throws, SameObject] readonly attribute CSSRuleList cssRules; - [Throws] unsigned long insertRule(DOMString rule, optional unsigned long index = 0); - [Throws] undefined deleteRule(unsigned long index); -}; diff --git a/components/script/dom/webidls/CSSStyleValue.webidl b/components/script/dom/webidls/CSSStyleValue.webidl deleted file mode 100644 index a87c2b29910..00000000000 --- a/components/script/dom/webidls/CSSStyleValue.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.css-houdini.org/css-typed-om-1/#cssstylevalue -// NOTE: should this be exposed to Window? -[Pref="dom_worklet_enabled", Exposed=(Worklet)] -interface CSSStyleValue { - stringifier; -}; diff --git a/components/script/dom/webidls/CSSSupportsRule.webidl b/components/script/dom/webidls/CSSSupportsRule.webidl deleted file mode 100644 index a726f101e41..00000000000 --- a/components/script/dom/webidls/CSSSupportsRule.webidl +++ /dev/null @@ -1,8 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/css-conditional/#csssupportsrule -[Exposed=Window] -interface CSSSupportsRule : CSSConditionRule { -}; diff --git a/components/script/dom/webidls/CanvasRenderingContext2D.webidl b/components/script/dom/webidls/CanvasRenderingContext2D.webidl deleted file mode 100644 index 4479d068186..00000000000 --- a/components/script/dom/webidls/CanvasRenderingContext2D.webidl +++ /dev/null @@ -1,264 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#2dcontext - -// typedef (HTMLImageElement or -// SVGImageElement) HTMLOrSVGImageElement; -typedef HTMLImageElement HTMLOrSVGImageElement; - -typedef (HTMLOrSVGImageElement or - /*HTMLVideoElement or*/ - HTMLCanvasElement or - /*ImageBitmap or*/ - OffscreenCanvas or - /*VideoFrame or*/ - /*CSSImageValue*/ CSSStyleValue) CanvasImageSource; - -enum CanvasFillRule { "nonzero", "evenodd" }; - -[Exposed=Window] -interface CanvasRenderingContext2D { - // back-reference to the canvas - readonly attribute HTMLCanvasElement canvas; -}; -CanvasRenderingContext2D includes CanvasState; -CanvasRenderingContext2D includes CanvasTransform; -CanvasRenderingContext2D includes CanvasCompositing; -CanvasRenderingContext2D includes CanvasImageSmoothing; -CanvasRenderingContext2D includes CanvasFillStrokeStyles; -CanvasRenderingContext2D includes CanvasShadowStyles; -CanvasRenderingContext2D includes CanvasFilters; -CanvasRenderingContext2D includes CanvasRect; -CanvasRenderingContext2D includes CanvasDrawPath; -CanvasRenderingContext2D includes CanvasUserInterface; -CanvasRenderingContext2D includes CanvasText; -CanvasRenderingContext2D includes CanvasDrawImage; -CanvasRenderingContext2D includes CanvasImageData; -CanvasRenderingContext2D includes CanvasPathDrawingStyles; -CanvasRenderingContext2D includes CanvasTextDrawingStyles; -CanvasRenderingContext2D includes CanvasPath; - -interface mixin CanvasState { - // state - undefined save(); // push state on state stack - undefined restore(); // pop state stack and restore state - undefined reset(); -}; - -interface mixin CanvasTransform { - // transformations (default transform is the identity matrix) - undefined scale(unrestricted double x, unrestricted double y); - undefined rotate(unrestricted double angle); - undefined translate(unrestricted double x, unrestricted double y); - undefined transform(unrestricted double a, - unrestricted double b, - unrestricted double c, - unrestricted double d, - unrestricted double e, - unrestricted double f); - - [NewObject] DOMMatrix getTransform(); - undefined setTransform(unrestricted double a, - unrestricted double b, - unrestricted double c, - unrestricted double d, - unrestricted double e, - unrestricted double f); - // void setTransform(optional DOMMatrixInit matrix); - undefined resetTransform(); -}; - -interface mixin CanvasCompositing { - // compositing - attribute unrestricted double globalAlpha; // (default 1.0) - attribute DOMString globalCompositeOperation; // (default source-over) -}; - -interface mixin CanvasImageSmoothing { - // image smoothing - attribute boolean imageSmoothingEnabled; // (default true) - // attribute ImageSmoothingQuality imageSmoothingQuality; // (default low) -}; - -interface mixin CanvasFillStrokeStyles { - // colours and styles (see also the CanvasDrawingStyles interface) - attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black) - attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black) - CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1); - [Throws] - CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1); - [Throws] - CanvasPattern? createPattern(CanvasImageSource image, [LegacyNullToEmptyString] DOMString repetition); -}; - -interface mixin CanvasShadowStyles { - // shadows - attribute unrestricted double shadowOffsetX; // (default 0) - attribute unrestricted double shadowOffsetY; // (default 0) - attribute unrestricted double shadowBlur; // (default 0) - attribute DOMString shadowColor; // (default transparent black) -}; - -interface mixin CanvasFilters { - // filters - //attribute DOMString filter; // (default "none") -}; - -interface mixin CanvasRect { - // rects - undefined clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); - undefined fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); - undefined strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); -}; - -interface mixin CanvasDrawPath { - // path API (see also CanvasPath) - undefined beginPath(); - undefined fill(optional CanvasFillRule fillRule = "nonzero"); - //void fill(Path2D path, optional CanvasFillRule fillRule = "nonzero"); - undefined stroke(); - //void stroke(Path2D path); - undefined clip(optional CanvasFillRule fillRule = "nonzero"); - //void clip(Path2D path, optional CanvasFillRule fillRule = "nonzero"); - boolean isPointInPath(unrestricted double x, unrestricted double y, - optional CanvasFillRule fillRule = "nonzero"); - //boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y, - // optional CanvasFillRule fillRule = "nonzero"); - //boolean isPointInStroke(unrestricted double x, unrestricted double y); - //boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y); -}; - -interface mixin CanvasUserInterface { - //void drawFocusIfNeeded(Element element); - //void drawFocusIfNeeded(Path2D path, Element element); - //void scrollPathIntoView(); - //void scrollPathIntoView(Path2D path); -}; - -interface mixin CanvasText { - // text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces) - [Pref="dom_canvas_text_enabled"] - undefined fillText(DOMString text, unrestricted double x, unrestricted double y, - optional unrestricted double maxWidth); - //void strokeText(DOMString text, unrestricted double x, unrestricted double y, - // optional unrestricted double maxWidth); - [Pref="dom_canvas_text_enabled"] - TextMetrics measureText(DOMString text); -}; - -interface mixin CanvasDrawImage { - // drawing images - [Throws] - undefined drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy); - [Throws] - undefined drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy, - unrestricted double dw, unrestricted double dh); - [Throws] - undefined drawImage(CanvasImageSource image, unrestricted double sx, unrestricted double sy, - unrestricted double sw, unrestricted double sh, - unrestricted double dx, unrestricted double dy, - unrestricted double dw, unrestricted double dh); -}; - -interface mixin CanvasImageData { - // pixel manipulation - [Throws] - ImageData createImageData(long sw, long sh); - [Throws] - ImageData createImageData(ImageData imagedata); - [Throws] - ImageData getImageData(long sx, long sy, long sw, long sh); - undefined putImageData(ImageData imagedata, long dx, long dy); - undefined putImageData(ImageData imagedata, - long dx, long dy, - long dirtyX, long dirtyY, - long dirtyWidth, long dirtyHeight); -}; - -enum CanvasLineCap { "butt", "round", "square" }; -enum CanvasLineJoin { "round", "bevel", "miter"}; -enum CanvasTextAlign { "start", "end", "left", "right", "center" }; -enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" }; -enum CanvasDirection { "ltr", "rtl", "inherit" }; - -interface mixin CanvasPathDrawingStyles { - // line caps/joins - attribute unrestricted double lineWidth; // (default 1) - attribute CanvasLineCap lineCap; // (default "butt") - attribute CanvasLineJoin lineJoin; // (default "miter") - attribute unrestricted double miterLimit; // (default 10) - - // dashed lines - //void setLineDash(sequence<unrestricted double> segments); // default empty - //sequence<unrestricted double> getLineDash(); - //attribute unrestricted double lineDashOffset; -}; - -interface mixin CanvasTextDrawingStyles { - // text - attribute DOMString font; // (default 10px sans-serif) - attribute CanvasTextAlign textAlign; // "start", "end", "left", "right", "center" (default: "start") - attribute CanvasTextBaseline textBaseline; // "top", "hanging", "middle", "alphabetic", - // "ideographic", "bottom" (default: "alphabetic") - attribute CanvasDirection direction; // "ltr", "rtl", "inherit" (default: "inherit") -}; - -interface mixin CanvasPath { - // shared path API methods - undefined closePath(); - undefined moveTo(unrestricted double x, unrestricted double y); - undefined lineTo(unrestricted double x, unrestricted double y); - undefined quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, - unrestricted double x, unrestricted double y); - - undefined bezierCurveTo(unrestricted double cp1x, - unrestricted double cp1y, - unrestricted double cp2x, - unrestricted double cp2y, - unrestricted double x, - unrestricted double y); - - [Throws] - undefined arcTo(unrestricted double x1, unrestricted double y1, - unrestricted double x2, unrestricted double y2, - unrestricted double radius); - - undefined rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); - - [Throws] - undefined arc(unrestricted double x, unrestricted double y, unrestricted double radius, - unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false); - - [Throws] - undefined ellipse(unrestricted double x, unrestricted double y, unrestricted double radius_x, - unrestricted double radius_y, unrestricted double rotation, unrestricted double startAngle, - unrestricted double endAngle, optional boolean anticlockwise = false); -}; - -[Exposed=(Window, PaintWorklet, Worker)] -interface CanvasGradient { - // opaque object - [Throws] - undefined addColorStop(double offset, DOMString color); -}; - -[Exposed=(Window, PaintWorklet, Worker)] -interface CanvasPattern { - // opaque object - //undefined setTransform(optional DOMMatrix2DInit transform = {}); -}; - -[Exposed=(Window,Worker), - Serializable] -interface ImageData { - [Throws] constructor(unsigned long sw, unsigned long sh/*, optional ImageDataSettings settings = {}*/); - [Throws] constructor(/* Uint8ClampedArray */ object data, unsigned long sw, optional unsigned long sh - /*, optional ImageDataSettings settings = {}*/); - - readonly attribute unsigned long width; - readonly attribute unsigned long height; - [Throws] readonly attribute Uint8ClampedArray data; - //readonly attribute PredefinedColorSpace colorSpace; -}; diff --git a/components/script/dom/webidls/ChannelMergerNode.webidl b/components/script/dom/webidls/ChannelMergerNode.webidl deleted file mode 100644 index c6eaad8bb55..00000000000 --- a/components/script/dom/webidls/ChannelMergerNode.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#channelmergernode - */ - -dictionary ChannelMergerOptions : AudioNodeOptions { - unsigned long numberOfInputs = 6; -}; - -[Exposed=Window] -interface ChannelMergerNode : AudioNode { - [Throws] constructor(BaseAudioContext context, optional ChannelMergerOptions options = {}); -}; diff --git a/components/script/dom/webidls/ChannelSplitterNode.webidl b/components/script/dom/webidls/ChannelSplitterNode.webidl deleted file mode 100644 index e867f7a9181..00000000000 --- a/components/script/dom/webidls/ChannelSplitterNode.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#channelsplitternode - */ - -dictionary ChannelSplitterOptions : AudioNodeOptions { - unsigned long numberOfOutputs = 6; -}; - -[Exposed=Window] -interface ChannelSplitterNode : AudioNode { - [Throws] constructor(BaseAudioContext context, optional ChannelSplitterOptions options = {}); -}; diff --git a/components/script/dom/webidls/CharacterData.webidl b/components/script/dom/webidls/CharacterData.webidl deleted file mode 100644 index 3f3d1fda356..00000000000 --- a/components/script/dom/webidls/CharacterData.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#characterdata - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -[Exposed=Window, Abstract] -interface CharacterData : Node { - [Pure] attribute [LegacyNullToEmptyString] DOMString data; - [Pure] readonly attribute unsigned long length; - [Pure, Throws] - DOMString substringData(unsigned long offset, unsigned long count); - undefined appendData(DOMString data); - [Throws] - undefined insertData(unsigned long offset, DOMString data); - [Throws] - undefined deleteData(unsigned long offset, unsigned long count); - [Throws] - undefined replaceData(unsigned long offset, unsigned long count, DOMString data); -}; - -CharacterData includes ChildNode; -CharacterData includes NonDocumentTypeChildNode; diff --git a/components/script/dom/webidls/ChildNode.webidl b/components/script/dom/webidls/ChildNode.webidl deleted file mode 100644 index ec8ad17aa2f..00000000000 --- a/components/script/dom/webidls/ChildNode.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://dom.spec.whatwg.org/#interface-childnode - */ - -interface mixin ChildNode { - [Throws, CEReactions, Unscopable] - undefined before((Node or DOMString)... nodes); - [Throws, CEReactions, Unscopable] - undefined after((Node or DOMString)... nodes); - [Throws, CEReactions, Unscopable] - undefined replaceWith((Node or DOMString)... nodes); - [CEReactions, Unscopable] - undefined remove(); -}; - -interface mixin NonDocumentTypeChildNode { - [Pure] - readonly attribute Element? previousElementSibling; - [Pure] - readonly attribute Element? nextElementSibling; -}; diff --git a/components/script/dom/webidls/Client.webidl b/components/script/dom/webidls/Client.webidl deleted file mode 100644 index f2b144ffa07..00000000000 --- a/components/script/dom/webidls/Client.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/ServiceWorker/#client - -[Pref="dom_serviceworker_enabled", Exposed=ServiceWorker] -interface Client { - readonly attribute USVString url; - readonly attribute FrameType frameType; - readonly attribute DOMString id; - //void postMessage(any message, optional sequence<Transferable> transfer); -}; - -enum FrameType { - "auxiliary", - "top-level", - "nested", - "none" -}; diff --git a/components/script/dom/webidls/ClipboardEvent.webidl b/components/script/dom/webidls/ClipboardEvent.webidl deleted file mode 100644 index d23700d8415..00000000000 --- a/components/script/dom/webidls/ClipboardEvent.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/clipboard-apis/ - -[Exposed=Window, Pref="dom_clipboardevent_enabled"] -interface ClipboardEvent : Event { - constructor (DOMString type, optional ClipboardEventInit eventInitDict = {}); - readonly attribute DataTransfer? clipboardData; -}; - -dictionary ClipboardEventInit : EventInit { - DataTransfer? clipboardData = null; -}; diff --git a/components/script/dom/webidls/CloseEvent.webidl b/components/script/dom/webidls/CloseEvent.webidl deleted file mode 100644 index 712f8848df0..00000000000 --- a/components/script/dom/webidls/CloseEvent.webidl +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -//https://html.spec.whatwg.org/multipage/#the-closeevent-interfaces -[Exposed=(Window,Worker)] -interface CloseEvent : Event { - [Throws] constructor(DOMString type, optional CloseEventInit eventInitDict = {}); - readonly attribute boolean wasClean; - readonly attribute unsigned short code; - readonly attribute DOMString reason; -}; - -dictionary CloseEventInit : EventInit { - boolean wasClean = false; - unsigned short code = 0; - DOMString reason = ""; -}; diff --git a/components/script/dom/webidls/Comment.webidl b/components/script/dom/webidls/Comment.webidl deleted file mode 100644 index 0ccda9ee991..00000000000 --- a/components/script/dom/webidls/Comment.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#comment - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -[Exposed=Window] -interface Comment : CharacterData { - [Throws] constructor(optional DOMString data = ""); -}; diff --git a/components/script/dom/webidls/CompositionEvent.webidl b/components/script/dom/webidls/CompositionEvent.webidl deleted file mode 100644 index 3eeba65e29a..00000000000 --- a/components/script/dom/webidls/CompositionEvent.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/uievents/#idl-compositionevent - * - */ - -// https://w3c.github.io/uievents/#idl-compositionevent -[Exposed=Window, Pref="dom_composition_event_enabled"] -interface CompositionEvent : UIEvent { - [Throws] constructor(DOMString type, optional CompositionEventInit eventInitDict = {}); - readonly attribute DOMString data; -}; - -// https://w3c.github.io/uievents/#idl-compositioneventinit -dictionary CompositionEventInit : UIEventInit { - DOMString data = ""; -}; - diff --git a/components/script/dom/webidls/Console.webidl b/components/script/dom/webidls/Console.webidl deleted file mode 100644 index 2565b6a409c..00000000000 --- a/components/script/dom/webidls/Console.webidl +++ /dev/null @@ -1,36 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://console.spec.whatwg.org/ - -[ClassString="Console", - Exposed=*] -namespace console { - // Logging - undefined assert(optional boolean condition = false, any... data); - undefined clear(); - undefined debug(any... messages); - undefined error(any... messages); - undefined info(any... messages); - undefined log(any... messages); - // undefined table(optional any tabularData, optional sequence<DOMString> properties); - undefined trace(any... data); - undefined warn(any... messages); - // undefined dir(optional any item, optional object? options); - // undefined dirxml(any... data); - - // Counting - undefined count(optional DOMString label = "default"); - undefined countReset(optional DOMString label = "default"); - - // Grouping - undefined group(any... data); - undefined groupCollapsed(any... data); - undefined groupEnd(); - - // Timing - undefined time(optional DOMString label = "default"); - undefined timeLog(optional DOMString label = "default", any... data); - undefined timeEnd(optional DOMString label = "default"); -}; diff --git a/components/script/dom/webidls/ConstantSourceNode.webidl b/components/script/dom/webidls/ConstantSourceNode.webidl deleted file mode 100644 index e3a5a174250..00000000000 --- a/components/script/dom/webidls/ConstantSourceNode.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#ConstantSourceNode - */ - -dictionary ConstantSourceOptions: AudioNodeOptions { - float offset = 1; -}; - -[Exposed=Window] -interface ConstantSourceNode : AudioScheduledSourceNode { - [Throws] constructor(BaseAudioContext context, optional ConstantSourceOptions options = {}); - readonly attribute AudioParam offset; -}; diff --git a/components/script/dom/webidls/Crypto.webidl b/components/script/dom/webidls/Crypto.webidl deleted file mode 100644 index cdda53e27ac..00000000000 --- a/components/script/dom/webidls/Crypto.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/webcrypto/#crypto-interface - * - */ - -partial interface mixin WindowOrWorkerGlobalScope { - [SameObject] readonly attribute Crypto crypto; -}; - -[Exposed=(Window,Worker)] -interface Crypto { - [SecureContext, Pref="dom_crypto_subtle_enabled"] readonly attribute SubtleCrypto subtle; - [Throws] ArrayBufferView getRandomValues(ArrayBufferView array); - [SecureContext] DOMString randomUUID(); -}; diff --git a/components/script/dom/webidls/CryptoKey.webidl b/components/script/dom/webidls/CryptoKey.webidl deleted file mode 100644 index 4387ef75d98..00000000000 --- a/components/script/dom/webidls/CryptoKey.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webcrypto/#cryptokey-interface - -enum KeyType { "public", "private", "secret" }; - -enum KeyUsage { "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey", "unwrapKey" }; - -[SecureContext, Exposed=(Window,Worker), Serializable, Pref="dom_crypto_subtle_enabled"] -interface CryptoKey { - readonly attribute KeyType type; - readonly attribute boolean extractable; - readonly attribute object algorithm; - readonly attribute object usages; -}; diff --git a/components/script/dom/webidls/CustomElementRegistry.webidl b/components/script/dom/webidls/CustomElementRegistry.webidl deleted file mode 100644 index 818e8892461..00000000000 --- a/components/script/dom/webidls/CustomElementRegistry.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#customelementregistry -[Exposed=Window, Pref="dom_customelements_enabled"] -interface CustomElementRegistry { - [Throws, CEReactions] - undefined define( - DOMString name, - CustomElementConstructor constructor_, - optional ElementDefinitionOptions options = {} - ); - - any get(DOMString name); - - DOMString? getName(CustomElementConstructor constructor); - - Promise<CustomElementConstructor> whenDefined(DOMString name); - - [CEReactions] undefined upgrade(Node root); -}; - -callback CustomElementConstructor = HTMLElement(); - -dictionary ElementDefinitionOptions { - DOMString extends; -}; diff --git a/components/script/dom/webidls/CustomEvent.webidl b/components/script/dom/webidls/CustomEvent.webidl deleted file mode 100644 index af57bfdf1a2..00000000000 --- a/components/script/dom/webidls/CustomEvent.webidl +++ /dev/null @@ -1,33 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * For more information on this interface please see - * https://dom.spec.whatwg.org/#interface-customevent - * - * To the extent possible under law, the editors have waived - * all copyright and related or neighboring rights to this work. - * In addition, as of 1 May 2014, the editors have made this specification - * available under the Open Web Foundation Agreement Version 1.0, - * which is available at - * http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. - */ - -// https://dom.spec.whatwg.org/#dom-customevent-initcustomevent -[Exposed=*] -interface CustomEvent : Event { - constructor(DOMString type, optional CustomEventInit eventInitDict = {}); - - readonly attribute any detail; - - undefined initCustomEvent( - DOMString type, - optional boolean bubbles = false, - optional boolean cancelable = false, - optional any detail = null - ); // legacy -}; - -dictionary CustomEventInit : EventInit { - any detail = null; -}; diff --git a/components/script/dom/webidls/DOMException.webidl b/components/script/dom/webidls/DOMException.webidl deleted file mode 100644 index d61d30151fa..00000000000 --- a/components/script/dom/webidls/DOMException.webidl +++ /dev/null @@ -1,50 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - -/* https://heycam.github.io/webidl/#es-DOMException - * https://heycam.github.io/webidl/#es-DOMException-constructor-object - */ - -[ - ExceptionClass, - Exposed=(Window,Worker,Worklet,DissimilarOriginWindow) -] -interface DOMException { - [Throws] constructor(optional DOMString message="", optional DOMString name="Error"); - const unsigned short INDEX_SIZE_ERR = 1; - const unsigned short DOMSTRING_SIZE_ERR = 2; // historical - const unsigned short HIERARCHY_REQUEST_ERR = 3; - const unsigned short WRONG_DOCUMENT_ERR = 4; - const unsigned short INVALID_CHARACTER_ERR = 5; - const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical - const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; - const unsigned short NOT_FOUND_ERR = 8; - const unsigned short NOT_SUPPORTED_ERR = 9; - const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical - const unsigned short INVALID_STATE_ERR = 11; - const unsigned short SYNTAX_ERR = 12; - const unsigned short INVALID_MODIFICATION_ERR = 13; - const unsigned short NAMESPACE_ERR = 14; - const unsigned short INVALID_ACCESS_ERR = 15; - const unsigned short VALIDATION_ERR = 16; // historical - const unsigned short TYPE_MISMATCH_ERR = 17; // historical; use JavaScript's TypeError instead - const unsigned short SECURITY_ERR = 18; - const unsigned short NETWORK_ERR = 19; - const unsigned short ABORT_ERR = 20; - const unsigned short URL_MISMATCH_ERR = 21; - const unsigned short QUOTA_EXCEEDED_ERR = 22; - const unsigned short TIMEOUT_ERR = 23; - const unsigned short INVALID_NODE_TYPE_ERR = 24; - const unsigned short DATA_CLONE_ERR = 25; - - // Error code as u16 - readonly attribute unsigned short code; - - // The name of the error code (ie, a string repr of |code|) - readonly attribute DOMString name; - - // A custom message set by the thrower. - readonly attribute DOMString message; -}; diff --git a/components/script/dom/webidls/DOMImplementation.webidl b/components/script/dom/webidls/DOMImplementation.webidl deleted file mode 100644 index af744e3a08c..00000000000 --- a/components/script/dom/webidls/DOMImplementation.webidl +++ /dev/null @@ -1,27 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#interface-domimplementation - * - * Copyright: - * To the extent possible under law, the editors have waived all copyright and - * related or neighboring rights to this work. - */ - -[Exposed=Window] -interface DOMImplementation { - [NewObject, Throws] - DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, - DOMString systemId); - [NewObject, Throws] - XMLDocument createDocument(DOMString? namespace, - [LegacyNullToEmptyString] DOMString qualifiedName, - optional DocumentType? doctype = null); - [NewObject] - Document createHTMLDocument(optional DOMString title); - - [Pure] - boolean hasFeature(); // useless, always return true -}; diff --git a/components/script/dom/webidls/DOMMatrix.webidl b/components/script/dom/webidls/DOMMatrix.webidl deleted file mode 100644 index e0518bce659..00000000000 --- a/components/script/dom/webidls/DOMMatrix.webidl +++ /dev/null @@ -1,100 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.fxtf.org/geometry/#dommatrix - -[Exposed=(Window,Worker,PaintWorklet), - LegacyWindowAlias=WebKitCSSMatrix] -interface DOMMatrix : DOMMatrixReadOnly { - [Throws] constructor(optional (DOMString or sequence<unrestricted double>) init); - - [NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other = {}); - [NewObject, Throws] static DOMMatrix fromFloat32Array(Float32Array array32); - [NewObject, Throws] static DOMMatrix fromFloat64Array(Float64Array array64); - - // These attributes are simple aliases for certain elements of the 4x4 matrix - inherit attribute unrestricted double a; - inherit attribute unrestricted double b; - inherit attribute unrestricted double c; - inherit attribute unrestricted double d; - inherit attribute unrestricted double e; - inherit attribute unrestricted double f; - - inherit attribute unrestricted double m11; - inherit attribute unrestricted double m12; - inherit attribute unrestricted double m13; - inherit attribute unrestricted double m14; - inherit attribute unrestricted double m21; - inherit attribute unrestricted double m22; - inherit attribute unrestricted double m23; - inherit attribute unrestricted double m24; - inherit attribute unrestricted double m31; - inherit attribute unrestricted double m32; - inherit attribute unrestricted double m33; - inherit attribute unrestricted double m34; - inherit attribute unrestricted double m41; - inherit attribute unrestricted double m42; - inherit attribute unrestricted double m43; - inherit attribute unrestricted double m44; - - // Mutable transform methods - [Throws] DOMMatrix multiplySelf(optional DOMMatrixInit other = {}); - [Throws] DOMMatrix preMultiplySelf(optional DOMMatrixInit other = {}); - DOMMatrix translateSelf(optional unrestricted double tx = 0, - optional unrestricted double ty = 0, - optional unrestricted double tz = 0); - DOMMatrix scaleSelf(optional unrestricted double scaleX = 1, - optional unrestricted double scaleY, - optional unrestricted double scaleZ = 1, - optional unrestricted double originX = 0, - optional unrestricted double originY = 0, - optional unrestricted double originZ = 0); - DOMMatrix scale3dSelf(optional unrestricted double scale = 1, - optional unrestricted double originX = 0, - optional unrestricted double originY = 0, - optional unrestricted double originZ = 0); - DOMMatrix rotateSelf(optional unrestricted double rotX = 0, - optional unrestricted double rotY, - optional unrestricted double rotZ); - DOMMatrix rotateFromVectorSelf(optional unrestricted double x = 0, - optional unrestricted double y = 0); - DOMMatrix rotateAxisAngleSelf(optional unrestricted double x = 0, - optional unrestricted double y = 0, - optional unrestricted double z = 0, - optional unrestricted double angle = 0); - DOMMatrix skewXSelf(optional unrestricted double sx = 0); - DOMMatrix skewYSelf(optional unrestricted double sy = 0); - DOMMatrix invertSelf(); - -// DOMMatrix setMatrixValue(DOMString transformList); -}; - -dictionary DOMMatrix2DInit { - unrestricted double a; - unrestricted double b; - unrestricted double c; - unrestricted double d; - unrestricted double e; - unrestricted double f; - unrestricted double m11; - unrestricted double m12; - unrestricted double m21; - unrestricted double m22; - unrestricted double m41; - unrestricted double m42; -}; - -dictionary DOMMatrixInit : DOMMatrix2DInit { - unrestricted double m13 = 0; - unrestricted double m14 = 0; - unrestricted double m23 = 0; - unrestricted double m24 = 0; - unrestricted double m31 = 0; - unrestricted double m32 = 0; - unrestricted double m33 = 1; - unrestricted double m34 = 0; - unrestricted double m43 = 0; - unrestricted double m44 = 1; - boolean is2D; -}; diff --git a/components/script/dom/webidls/DOMMatrixReadOnly.webidl b/components/script/dom/webidls/DOMMatrixReadOnly.webidl deleted file mode 100644 index 92993905db4..00000000000 --- a/components/script/dom/webidls/DOMMatrixReadOnly.webidl +++ /dev/null @@ -1,86 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://drafts.fxtf.org/geometry-1/#DOMMatrix - * - * Copyright: - * To the extent possible under law, the editors have waived all copyright and - * related or neighboring rights to this work. - */ - -[Exposed=(Window,Worker,PaintWorklet)] -interface DOMMatrixReadOnly { - [Throws] constructor(optional (DOMString or sequence<unrestricted double>) init); - - [NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other = {}); - [NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32); - [NewObject, Throws] static DOMMatrixReadOnly fromFloat64Array(Float64Array array64); - - // These attributes are simple aliases for certain elements of the 4x4 matrix - readonly attribute unrestricted double a; - readonly attribute unrestricted double b; - readonly attribute unrestricted double c; - readonly attribute unrestricted double d; - readonly attribute unrestricted double e; - readonly attribute unrestricted double f; - - readonly attribute unrestricted double m11; - readonly attribute unrestricted double m12; - readonly attribute unrestricted double m13; - readonly attribute unrestricted double m14; - readonly attribute unrestricted double m21; - readonly attribute unrestricted double m22; - readonly attribute unrestricted double m23; - readonly attribute unrestricted double m24; - readonly attribute unrestricted double m31; - readonly attribute unrestricted double m32; - readonly attribute unrestricted double m33; - readonly attribute unrestricted double m34; - readonly attribute unrestricted double m41; - readonly attribute unrestricted double m42; - readonly attribute unrestricted double m43; - readonly attribute unrestricted double m44; - - readonly attribute boolean is2D; - readonly attribute boolean isIdentity; - - // Immutable transform methods - DOMMatrix translate(optional unrestricted double tx = 0, - optional unrestricted double ty = 0, - optional unrestricted double tz = 0); - DOMMatrix scale(optional unrestricted double scaleX = 1, - optional unrestricted double scaleY, - optional unrestricted double scaleZ = 1, - optional unrestricted double originX = 0, - optional unrestricted double originY = 0, - optional unrestricted double originZ = 0); - [NewObject] DOMMatrix scaleNonUniform(optional unrestricted double scaleX = 1, - optional unrestricted double scaleY = 1); - DOMMatrix scale3d(optional unrestricted double scale = 1, - optional unrestricted double originX = 0, - optional unrestricted double originY = 0, - optional unrestricted double originZ = 0); - DOMMatrix rotate(optional unrestricted double rotX = 0, - optional unrestricted double rotY, - optional unrestricted double rotZ); - DOMMatrix rotateFromVector(optional unrestricted double x = 0, - optional unrestricted double y = 0); - DOMMatrix rotateAxisAngle(optional unrestricted double x = 0, - optional unrestricted double y = 0, - optional unrestricted double z = 0, - optional unrestricted double angle = 0); - DOMMatrix skewX(optional unrestricted double sx = 0); - DOMMatrix skewY(optional unrestricted double sy = 0); - [Throws] DOMMatrix multiply(optional DOMMatrixInit other = {}); - DOMMatrix flipX(); - DOMMatrix flipY(); - DOMMatrix inverse(); - - DOMPoint transformPoint(optional DOMPointInit point = {}); - Float32Array toFloat32Array(); - Float64Array toFloat64Array(); - [Exposed=Window, Throws] stringifier; - [Default] object toJSON(); -}; diff --git a/components/script/dom/webidls/DOMParser.webidl b/components/script/dom/webidls/DOMParser.webidl deleted file mode 100644 index 90b3b6a8ff6..00000000000 --- a/components/script/dom/webidls/DOMParser.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/DOM-Parsing/#the-domparser-interface - */ - -enum SupportedType { - "text/html", - "text/xml", - "application/xml", - "application/xhtml+xml", - "image/svg+xml" -}; - -[Exposed=Window] -interface DOMParser { - [Throws] constructor(); - [Throws] - Document parseFromString(DOMString str, SupportedType type); -}; diff --git a/components/script/dom/webidls/DOMPoint.webidl b/components/script/dom/webidls/DOMPoint.webidl deleted file mode 100644 index 765c62df573..00000000000 --- a/components/script/dom/webidls/DOMPoint.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * http://dev.w3.org/fxtf/geometry/ - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint -[Exposed=(Window,Worker,PaintWorklet)] -interface DOMPoint : DOMPointReadOnly { - [Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, - optional unrestricted double z = 0, optional unrestricted double w = 1); - [NewObject] static DOMPoint fromPoint(optional DOMPointInit other = {}); - - inherit attribute unrestricted double x; - inherit attribute unrestricted double y; - inherit attribute unrestricted double z; - inherit attribute unrestricted double w; -}; - -dictionary DOMPointInit { - unrestricted double x = 0; - unrestricted double y = 0; - unrestricted double z = 0; - unrestricted double w = 1; -}; diff --git a/components/script/dom/webidls/DOMPointReadOnly.webidl b/components/script/dom/webidls/DOMPointReadOnly.webidl deleted file mode 100644 index 98940ed3f08..00000000000 --- a/components/script/dom/webidls/DOMPointReadOnly.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * http://dev.w3.org/fxtf/geometry/ - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly -[Exposed=(Window,Worker,PaintWorklet)] -interface DOMPointReadOnly { - [Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, - optional unrestricted double z = 0, optional unrestricted double w = 1); - [NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = {}); - - readonly attribute unrestricted double x; - readonly attribute unrestricted double y; - readonly attribute unrestricted double z; - readonly attribute unrestricted double w; - - [Default] object toJSON(); -}; diff --git a/components/script/dom/webidls/DOMQuad.webidl b/components/script/dom/webidls/DOMQuad.webidl deleted file mode 100644 index ba58ccffc48..00000000000 --- a/components/script/dom/webidls/DOMQuad.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://drafts.fxtf.org/geometry/#DOMQuad - * - * Copyright: - * To the extent possible under law, the editors have waived all copyright and - * related or neighboring rights to this work. - */ - -[Exposed=(Window,Worker)] -interface DOMQuad { - [Throws] constructor(optional DOMPointInit p1 = {}, optional DOMPointInit p2 = {}, - optional DOMPointInit p3 = {}, optional DOMPointInit p4 = {}); - [NewObject] static DOMQuad fromRect(optional DOMRectInit other = {}); - [NewObject] static DOMQuad fromQuad(optional DOMQuadInit other = {}); - - [SameObject] readonly attribute DOMPoint p1; - [SameObject] readonly attribute DOMPoint p2; - [SameObject] readonly attribute DOMPoint p3; - [SameObject] readonly attribute DOMPoint p4; - [NewObject] DOMRect getBounds(); - - [Default] object toJSON(); -}; - -dictionary DOMQuadInit { - DOMPointInit p1 = {}; - DOMPointInit p2 = {}; - DOMPointInit p3 = {}; - DOMPointInit p4 = {}; -}; diff --git a/components/script/dom/webidls/DOMRect.webidl b/components/script/dom/webidls/DOMRect.webidl deleted file mode 100644 index aee406502fc..00000000000 --- a/components/script/dom/webidls/DOMRect.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.fxtf.org/geometry/#domrect - -[Exposed=(Window,Worker), - Serializable, - LegacyWindowAlias=SVGRect] -interface DOMRect : DOMRectReadOnly { - [Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, - optional unrestricted double width = 0, optional unrestricted double height = 0); - - [NewObject] static DOMRect fromRect(optional DOMRectInit other = {}); - - inherit attribute unrestricted double x; - inherit attribute unrestricted double y; - inherit attribute unrestricted double width; - inherit attribute unrestricted double height; -}; diff --git a/components/script/dom/webidls/DOMRectList.webidl b/components/script/dom/webidls/DOMRectList.webidl deleted file mode 100644 index 0d11c07e7fc..00000000000 --- a/components/script/dom/webidls/DOMRectList.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.fxtf.org/geometry-1/#domrectlist - -[Exposed=Window] -interface DOMRectList { - readonly attribute unsigned long length; - getter DOMRect? item(unsigned long index); -}; diff --git a/components/script/dom/webidls/DOMRectReadOnly.webidl b/components/script/dom/webidls/DOMRectReadOnly.webidl deleted file mode 100644 index b8bc3057675..00000000000 --- a/components/script/dom/webidls/DOMRectReadOnly.webidl +++ /dev/null @@ -1,33 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.fxtf.org/geometry/#domrect - -[Exposed=(Window,Worker), - Serializable] -interface DOMRectReadOnly { - [Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, - optional unrestricted double width = 0, optional unrestricted double height = 0); - - [NewObject] static DOMRectReadOnly fromRect(optional DOMRectInit other = {}); - - readonly attribute unrestricted double x; - readonly attribute unrestricted double y; - readonly attribute unrestricted double width; - readonly attribute unrestricted double height; - readonly attribute unrestricted double top; - readonly attribute unrestricted double right; - readonly attribute unrestricted double bottom; - readonly attribute unrestricted double left; - - [Default] object toJSON(); -}; - -// https://drafts.fxtf.org/geometry/#dictdef-domrectinit -dictionary DOMRectInit { - unrestricted double x = 0; - unrestricted double y = 0; - unrestricted double width = 0; - unrestricted double height = 0; -}; diff --git a/components/script/dom/webidls/DOMStringList.webidl b/components/script/dom/webidls/DOMStringList.webidl deleted file mode 100644 index c2d1f235b63..00000000000 --- a/components/script/dom/webidls/DOMStringList.webidl +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://html.spec.whatwg.org/multipage/#domstringlist - * - * Copyright: - * To the extent possible under law, the editors have waived all copyright and - * related or neighboring rights to this work. - */ - -[Exposed=(Window,Worker)] -interface DOMStringList { - readonly attribute unsigned long length; - getter DOMString? item(unsigned long index); - boolean contains(DOMString string); -}; diff --git a/components/script/dom/webidls/DOMStringMap.webidl b/components/script/dom/webidls/DOMStringMap.webidl deleted file mode 100644 index 1ac525325f7..00000000000 --- a/components/script/dom/webidls/DOMStringMap.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-domstringmap-interface -[Exposed=Window, LegacyOverrideBuiltIns] -interface DOMStringMap { - getter DOMString (DOMString name); - [CEReactions, Throws] - setter undefined (DOMString name, DOMString value); - [CEReactions] - deleter undefined (DOMString name); -}; diff --git a/components/script/dom/webidls/DOMTokenList.webidl b/components/script/dom/webidls/DOMTokenList.webidl deleted file mode 100644 index 6be5eb4f232..00000000000 --- a/components/script/dom/webidls/DOMTokenList.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#domtokenlist -[Exposed=Window] -interface DOMTokenList { - [Pure] - readonly attribute unsigned long length; - [Pure] - getter DOMString? item(unsigned long index); - - [Pure] - boolean contains(DOMString token); - [CEReactions, Throws] - undefined add(DOMString... tokens); - [CEReactions, Throws] - undefined remove(DOMString... tokens); - [CEReactions, Throws] - boolean toggle(DOMString token, optional boolean force); - [CEReactions, Throws] - boolean replace(DOMString token, DOMString newToken); - [Pure, Throws] - boolean supports(DOMString token); - - [CEReactions, Pure] - stringifier attribute DOMString value; - - iterable<DOMString?>; -}; diff --git a/components/script/dom/webidls/DataTransfer.webidl b/components/script/dom/webidls/DataTransfer.webidl deleted file mode 100644 index 2e546f0c579..00000000000 --- a/components/script/dom/webidls/DataTransfer.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#datatransfer - -[Exposed=Window] -interface DataTransfer { - constructor(); - - attribute DOMString dropEffect; - attribute DOMString effectAllowed; - - [SameObject] readonly attribute DataTransferItemList items; - - undefined setDragImage(Element image, long x, long y); - - /* old interface */ - readonly attribute /* FrozenArray<DOMString> */ any types; - DOMString getData(DOMString format); - undefined setData(DOMString format, DOMString data); - undefined clearData(optional DOMString format); - [SameObject] readonly attribute FileList files; -}; diff --git a/components/script/dom/webidls/DataTransferItem.webidl b/components/script/dom/webidls/DataTransferItem.webidl deleted file mode 100644 index 56008f13715..00000000000 --- a/components/script/dom/webidls/DataTransferItem.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#datatransferitem - -[Exposed=Window] -interface DataTransferItem { - readonly attribute DOMString kind; - readonly attribute DOMString type; - undefined getAsString(FunctionStringCallback? _callback); - File? getAsFile(); -}; - -callback FunctionStringCallback = undefined (DOMString data); diff --git a/components/script/dom/webidls/DataTransferItemList.webidl b/components/script/dom/webidls/DataTransferItemList.webidl deleted file mode 100644 index efdcb72806e..00000000000 --- a/components/script/dom/webidls/DataTransferItemList.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#datatransferitemlist - -[Exposed=Window] -interface DataTransferItemList { - readonly attribute unsigned long length; - getter DataTransferItem (unsigned long index); - [Throws] DataTransferItem? add(DOMString data, DOMString type); - [Throws] DataTransferItem? add(File data); - [Throws] undefined remove(unsigned long index); - undefined clear(); -}; diff --git a/components/script/dom/webidls/DedicatedWorkerGlobalScope.webidl b/components/script/dom/webidls/DedicatedWorkerGlobalScope.webidl deleted file mode 100644 index ad5c36e29b4..00000000000 --- a/components/script/dom/webidls/DedicatedWorkerGlobalScope.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#dedicatedworkerglobalscope -[Global=(Worker,DedicatedWorker), Exposed=DedicatedWorker] -/*sealed*/ interface DedicatedWorkerGlobalScope : WorkerGlobalScope { - [Throws] undefined postMessage(any message, sequence<object> transfer); - [Throws] undefined postMessage(any message, optional StructuredSerializeOptions options = {}); - attribute EventHandler onmessage; - - undefined close(); -}; diff --git a/components/script/dom/webidls/DissimilarOriginLocation.webidl b/components/script/dom/webidls/DissimilarOriginLocation.webidl deleted file mode 100644 index e4101bd35e7..00000000000 --- a/components/script/dom/webidls/DissimilarOriginLocation.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - - -// This is a Servo-specific interface, used to represent locations -// that are not similar-origin, so live in another script thread. -// It is based on the interface for Window, but only contains the -// accessors that do not throw security exceptions when called -// cross-origin. -// -// Note that similar-origin locations are kept in the same script -// thread, so this mechanism cannot be relied upon as the only -// way to enforce security policy. - -// https://html.spec.whatwg.org/multipage/#location -[Exposed=(Window,DissimilarOriginWindow), LegacyUnforgeable, LegacyNoInterfaceObject] -interface DissimilarOriginLocation { - [Throws] attribute USVString href; - [Throws] undefined assign(USVString url); - [Throws] undefined replace(USVString url); - [Throws] undefined reload(); - [Throws] stringifier; - - // TODO: finish this interface -}; diff --git a/components/script/dom/webidls/DissimilarOriginWindow.webidl b/components/script/dom/webidls/DissimilarOriginWindow.webidl deleted file mode 100644 index bce8bddb572..00000000000 --- a/components/script/dom/webidls/DissimilarOriginWindow.webidl +++ /dev/null @@ -1,33 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This is a Servo-specific interface, used to represent windows -// that are not similar-origin, so live in another script thread. -// It is based on the interface for Window, but only contains the -// accessors that do not throw security exceptions when called -// cross-origin. -// -// Note that similar-origin windows are kept in the same script -// thread, so this mechanism cannot be relied upon as the only -// way to enforce security policy. - -// https://html.spec.whatwg.org/multipage/#window -[Global=DissimilarOriginWindow, Exposed=(Window,DissimilarOriginWindow), LegacyNoInterfaceObject] -interface DissimilarOriginWindow : GlobalScope { - [LegacyUnforgeable] readonly attribute WindowProxy window; - [BinaryName="Self_", Replaceable] readonly attribute WindowProxy self; - [LegacyUnforgeable] readonly attribute WindowProxy? parent; - [LegacyUnforgeable] readonly attribute WindowProxy? top; - [Replaceable] readonly attribute WindowProxy frames; - [Replaceable] readonly attribute unsigned long length; - [LegacyUnforgeable] readonly attribute DissimilarOriginLocation location; - - undefined close(); - readonly attribute boolean closed; - [Throws] undefined postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []); - [Throws] undefined postMessage(any message, optional WindowPostMessageOptions options = {}); - attribute any opener; - undefined blur(); - undefined focus(); -}; diff --git a/components/script/dom/webidls/Document.webidl b/components/script/dom/webidls/Document.webidl deleted file mode 100644 index 6131dbd15c7..00000000000 --- a/components/script/dom/webidls/Document.webidl +++ /dev/null @@ -1,220 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://dom.spec.whatwg.org/#interface-document - * https://html.spec.whatwg.org/multipage/#the-document-object - */ - -// https://dom.spec.whatwg.org/#interface-document -[Exposed=Window] -interface Document : Node { - [Throws] constructor(); - [SameObject] - readonly attribute DOMImplementation implementation; - [Constant] - readonly attribute USVString URL; - [Constant] - readonly attribute USVString documentURI; - // readonly attribute USVString origin; - readonly attribute DOMString compatMode; - readonly attribute DOMString characterSet; - readonly attribute DOMString charset; // legacy alias of .characterSet - readonly attribute DOMString inputEncoding; // legacy alias of .characterSet - [Constant] - readonly attribute DOMString contentType; - - [Pure] - readonly attribute DocumentType? doctype; - [Pure] - readonly attribute Element? documentElement; - HTMLCollection getElementsByTagName(DOMString qualifiedName); - HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString qualifiedName); - HTMLCollection getElementsByClassName(DOMString classNames); - - [CEReactions, NewObject, Throws] - Element createElement(DOMString localName, optional (DOMString or ElementCreationOptions) options = {}); - [CEReactions, NewObject, Throws] - Element createElementNS(DOMString? namespace, DOMString qualifiedName, - optional (DOMString or ElementCreationOptions) options = {}); - [NewObject] - DocumentFragment createDocumentFragment(); - [NewObject] - Text createTextNode(DOMString data); - [NewObject, Throws] - CDATASection createCDATASection(DOMString data); - [NewObject] - Comment createComment(DOMString data); - [NewObject, Throws] - ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); - - [CEReactions, NewObject, Throws] - Node importNode(Node node, optional boolean deep = false); - [CEReactions, Throws] - Node adoptNode(Node node); - - [NewObject, Throws] - Attr createAttribute(DOMString localName); - [NewObject, Throws] - Attr createAttributeNS(DOMString? namespace, DOMString qualifiedName); - - [NewObject, Throws] - Event createEvent(DOMString interface_); - - [NewObject] - Range createRange(); - - // NodeFilter.SHOW_ALL = 0xFFFFFFFF - [NewObject] - NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, - optional NodeFilter? filter = null); - [NewObject] - TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, - optional NodeFilter? filter = null); -}; - -Document includes NonElementParentNode; -Document includes ParentNode; - -enum DocumentReadyState { "loading", "interactive", "complete" }; -enum DocumentVisibilityState { "visible", "hidden" }; - -dictionary ElementCreationOptions { - DOMString is; -}; - -// https://html.spec.whatwg.org/multipage/#the-document-object -// [LegacyOverrideBuiltIns] -partial /*sealed*/ interface Document { - // resource metadata management - [PutForwards=href, LegacyUnforgeable] - readonly attribute Location? location; - [SetterThrows] attribute DOMString domain; - readonly attribute DOMString referrer; - [Throws] - attribute DOMString cookie; - readonly attribute DOMString lastModified; - readonly attribute DocumentReadyState readyState; - - // DOM tree accessors - getter NamedPropertyValue (DOMString name); - [CEReactions] - attribute DOMString title; - // [CEReactions] - // attribute DOMString dir; - [CEReactions, SetterThrows] - attribute HTMLElement? body; - readonly attribute HTMLHeadElement? head; - [SameObject] - readonly attribute HTMLCollection images; - [SameObject] - readonly attribute HTMLCollection embeds; - [SameObject] - readonly attribute HTMLCollection plugins; - [SameObject] - readonly attribute HTMLCollection links; - [SameObject] - readonly attribute HTMLCollection forms; - [SameObject] - readonly attribute HTMLCollection scripts; - NodeList getElementsByName(DOMString elementName); - readonly attribute HTMLScriptElement? currentScript; - - // dynamic markup insertion - [CEReactions, Throws] - Document open(optional DOMString unused1, optional DOMString unused2); - [CEReactions, Throws] - WindowProxy? open(USVString url, DOMString name, DOMString features); - [CEReactions, Throws] - undefined close(); - [CEReactions, Throws] - undefined write(DOMString... text); - [CEReactions, Throws] - undefined writeln(DOMString... text); - - // user interaction - readonly attribute Window?/*Proxy?*/ defaultView; - boolean hasFocus(); - // [CEReactions] - // attribute DOMString designMode; - // [CEReactions] - // boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString value = ""); - // boolean queryCommandEnabled(DOMString commandId); - // boolean queryCommandIndeterm(DOMString commandId); - // boolean queryCommandState(DOMString commandId); - boolean queryCommandSupported(DOMString commandId); - // DOMString queryCommandValue(DOMString commandId); - readonly attribute boolean hidden; - readonly attribute DocumentVisibilityState visibilityState; - - // special event handler IDL attributes that only apply to Document objects - [LegacyLenientThis] attribute EventHandler onreadystatechange; - - // also has obsolete members -}; -Document includes GlobalEventHandlers; -Document includes DocumentAndElementEventHandlers; - -// https://html.spec.whatwg.org/multipage/#Document-partial -partial interface Document { - [CEReactions] - attribute [LegacyNullToEmptyString] DOMString fgColor; - - // https://github.com/servo/servo/issues/8715 - // [CEReactions, LegacyNullToEmptyString] - // attribute DOMString linkColor; - - // https://github.com/servo/servo/issues/8716 - // [CEReactions, LegacyNullToEmptyString] - // attribute DOMString vlinkColor; - - // https://github.com/servo/servo/issues/8717 - // [CEReactions, LegacyNullToEmptyString] - // attribute DOMString alinkColor; - - [CEReactions] - attribute [LegacyNullToEmptyString] DOMString bgColor; - - [SameObject] - readonly attribute HTMLCollection anchors; - - [SameObject] - readonly attribute HTMLCollection applets; - - undefined clear(); - undefined captureEvents(); - undefined releaseEvents(); - - // Tracking issue for document.all: https://github.com/servo/servo/issues/7396 - // readonly attribute HTMLAllCollection all; -}; - -// https://fullscreen.spec.whatwg.org/#api -partial interface Document { - [LegacyLenientSetter] readonly attribute boolean fullscreenEnabled; - [LegacyLenientSetter] readonly attribute Element? fullscreenElement; - [LegacyLenientSetter] readonly attribute boolean fullscreen; // historical - - Promise<undefined> exitFullscreen(); - - attribute EventHandler onfullscreenchange; - attribute EventHandler onfullscreenerror; -}; - -Document includes DocumentOrShadowRoot; - -// https://w3c.github.io/selection-api/#dom-document -partial interface Document { - Selection? getSelection(); -}; - - -// Servo internal API. -partial interface Document { - [Throws] - ShadowRoot servoGetMediaControls(DOMString id); -}; - -// https://html.spec.whatwg.org/multipage/#dom-document-nameditem-filter -typedef (WindowProxy or Element or HTMLCollection) NamedPropertyValue; diff --git a/components/script/dom/webidls/DocumentFragment.webidl b/components/script/dom/webidls/DocumentFragment.webidl deleted file mode 100644 index ec97caecf93..00000000000 --- a/components/script/dom/webidls/DocumentFragment.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#interface-documentfragment -[Exposed=Window] -interface DocumentFragment : Node { - [Throws] constructor(); -}; - -DocumentFragment includes NonElementParentNode; -DocumentFragment includes ParentNode; diff --git a/components/script/dom/webidls/DocumentOrShadowRoot.webidl b/components/script/dom/webidls/DocumentOrShadowRoot.webidl deleted file mode 100644 index c833299482b..00000000000 --- a/components/script/dom/webidls/DocumentOrShadowRoot.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#documentorshadowroot - * https://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin - */ - -interface mixin DocumentOrShadowRoot { - // Selection? getSelection(); - Element? elementFromPoint (double x, double y); - sequence<Element> elementsFromPoint (double x, double y); - // CaretPosition? caretPositionFromPoint (double x, double y); - readonly attribute Element? activeElement; - readonly attribute StyleSheetList styleSheets; -}; diff --git a/components/script/dom/webidls/DocumentType.webidl b/components/script/dom/webidls/DocumentType.webidl deleted file mode 100644 index 8d00b6df451..00000000000 --- a/components/script/dom/webidls/DocumentType.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#documenttype - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -[Exposed=Window] -interface DocumentType : Node { - [Constant] - readonly attribute DOMString name; - [Constant] - readonly attribute DOMString publicId; - [Constant] - readonly attribute DOMString systemId; -}; - -DocumentType includes ChildNode; diff --git a/components/script/dom/webidls/DynamicModuleOwner.webidl b/components/script/dom/webidls/DynamicModuleOwner.webidl deleted file mode 100644 index 20ad0e3367b..00000000000 --- a/components/script/dom/webidls/DynamicModuleOwner.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -/** - * This is defined for [`Dynamic Module`](https://html.spec.whatwg.org/multipage/#fetch-an-import()-module-script-graph) - * so that we can hold a traceable owner for those dynamic modules which don't hold a owner. - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface DynamicModuleOwner { - readonly attribute Promise<any> promise; -}; diff --git a/components/script/dom/webidls/EXTBlendMinmax.webidl b/components/script/dom/webidls/EXTBlendMinmax.webidl deleted file mode 100644 index b9f9f09fe9a..00000000000 --- a/components/script/dom/webidls/EXTBlendMinmax.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions scraped from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/EXT_blend_minmax/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface EXTBlendMinmax { - const GLenum MIN_EXT = 0x8007; - const GLenum MAX_EXT = 0x8008; -}; diff --git a/components/script/dom/webidls/EXTColorBufferHalfFloat.webidl b/components/script/dom/webidls/EXTColorBufferHalfFloat.webidl deleted file mode 100644 index 0844ec6c328..00000000000 --- a/components/script/dom/webidls/EXTColorBufferHalfFloat.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/EXT_color_buffer_half_float/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface EXTColorBufferHalfFloat { - const GLenum RGBA16F_EXT = 0x881A; - const GLenum RGB16F_EXT = 0x881B; - const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211; - const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17; -}; // interface EXT_color_buffer_half_float diff --git a/components/script/dom/webidls/EXTFragDepth.webidl b/components/script/dom/webidls/EXTFragDepth.webidl deleted file mode 100644 index 22c8d25b214..00000000000 --- a/components/script/dom/webidls/EXTFragDepth.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/EXT_frag_depth/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface EXTFragDepth { -}; // interface EXT_frag_depth diff --git a/components/script/dom/webidls/EXTShaderTextureLod.webidl b/components/script/dom/webidls/EXTShaderTextureLod.webidl deleted file mode 100644 index a05370b42b2..00000000000 --- a/components/script/dom/webidls/EXTShaderTextureLod.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions scraped from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/EXT_shader_texture_lod/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface EXTShaderTextureLod { -}; diff --git a/components/script/dom/webidls/EXTTextureFilterAnisotropic.webidl b/components/script/dom/webidls/EXTTextureFilterAnisotropic.webidl deleted file mode 100644 index 812ae3d8a8b..00000000000 --- a/components/script/dom/webidls/EXTTextureFilterAnisotropic.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotropic/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface EXTTextureFilterAnisotropic { - const GLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; - const GLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; -}; diff --git a/components/script/dom/webidls/Element.webidl b/components/script/dom/webidls/Element.webidl deleted file mode 100644 index 60a6db4e4e1..00000000000 --- a/components/script/dom/webidls/Element.webidl +++ /dev/null @@ -1,137 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#element and - * https://w3c.github.io/DOM-Parsing/ and - * http://dev.w3.org/csswg/cssom-view/ and - * http://www.w3.org/TR/selectors-api/ - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -[Exposed=Window] -interface Element : Node { - [Constant] - readonly attribute DOMString? namespaceURI; - [Constant] - readonly attribute DOMString? prefix; - [Constant] - readonly attribute DOMString localName; - // Not [Constant] because it depends on which document we're in - [Pure] - readonly attribute DOMString tagName; - - [CEReactions, Pure] - attribute DOMString id; - [CEReactions, Pure] - attribute DOMString className; - [SameObject, PutForwards=value] - readonly attribute DOMTokenList classList; - - [Pure] - boolean hasAttributes(); - [SameObject] - readonly attribute NamedNodeMap attributes; - [Pure] - sequence<DOMString> getAttributeNames(); - [Pure] - DOMString? getAttribute(DOMString name); - [Pure] - DOMString? getAttributeNS(DOMString? namespace, DOMString localName); - [CEReactions, Throws] - boolean toggleAttribute(DOMString name, optional boolean force); - [CEReactions, Throws] - undefined setAttribute(DOMString name, DOMString value); - [CEReactions, Throws] - undefined setAttributeNS(DOMString? namespace, DOMString name, DOMString value); - [CEReactions] - undefined removeAttribute(DOMString name); - [CEReactions] - undefined removeAttributeNS(DOMString? namespace, DOMString localName); - boolean hasAttribute(DOMString name); - boolean hasAttributeNS(DOMString? namespace, DOMString localName); - - [Pure] - Attr? getAttributeNode(DOMString name); - [Pure] - Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName); - [CEReactions, Throws] - Attr? setAttributeNode(Attr attr); - [CEReactions, Throws] - Attr? setAttributeNodeNS(Attr attr); - [CEReactions, Throws] - Attr removeAttributeNode(Attr oldAttr); - - [Pure, Throws] - Element? closest(DOMString selectors); - [Pure, Throws] - boolean matches(DOMString selectors); - [Pure, Throws] - boolean webkitMatchesSelector(DOMString selectors); // historical alias of .matches - - HTMLCollection getElementsByTagName(DOMString localName); - HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); - HTMLCollection getElementsByClassName(DOMString classNames); - - [CEReactions, Throws] - Element? insertAdjacentElement(DOMString where_, Element element); // historical - [Throws] - undefined insertAdjacentText(DOMString where_, DOMString data); - [CEReactions, Throws] - undefined insertAdjacentHTML(DOMString position, DOMString html); - - [Throws, Pref="dom_shadowdom_enabled"] ShadowRoot attachShadow(ShadowRootInit init); - readonly attribute ShadowRoot? shadowRoot; -}; - -dictionary ShadowRootInit { - required ShadowRootMode mode; - // boolean delegatesFocus = false; - SlotAssignmentMode slotAssignment = "named"; - boolean clonable = false; - // boolean serializable = false; -}; - -// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface -partial interface Element { - DOMRectList getClientRects(); - [NewObject] - DOMRect getBoundingClientRect(); - - undefined scroll(optional ScrollToOptions options = {}); - undefined scroll(unrestricted double x, unrestricted double y); - - undefined scrollTo(optional ScrollToOptions options = {}); - undefined scrollTo(unrestricted double x, unrestricted double y); - undefined scrollBy(optional ScrollToOptions options = {}); - undefined scrollBy(unrestricted double x, unrestricted double y); - attribute unrestricted double scrollTop; - attribute unrestricted double scrollLeft; - readonly attribute long scrollWidth; - readonly attribute long scrollHeight; - - readonly attribute long clientTop; - readonly attribute long clientLeft; - readonly attribute long clientWidth; - readonly attribute long clientHeight; -}; - -// https://w3c.github.io/DOM-Parsing/#extensions-to-the-element-interface -partial interface Element { - [CEReactions, Throws] attribute [LegacyNullToEmptyString] DOMString innerHTML; - [CEReactions, Throws] attribute [LegacyNullToEmptyString] DOMString outerHTML; -}; - -// https://fullscreen.spec.whatwg.org/#api -partial interface Element { - Promise<undefined> requestFullscreen(); -}; - -Element includes ChildNode; -Element includes NonDocumentTypeChildNode; -Element includes ParentNode; -Element includes ActivatableElement; -Element includes ARIAMixin; diff --git a/components/script/dom/webidls/ElementCSSInlineStyle.webidl b/components/script/dom/webidls/ElementCSSInlineStyle.webidl deleted file mode 100644 index 3e5696c7e8d..00000000000 --- a/components/script/dom/webidls/ElementCSSInlineStyle.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -//http://dev.w3.org/csswg/cssom/#elementcssinlinestyle - -[Exposed=Window] -interface mixin ElementCSSInlineStyle { - [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; -}; diff --git a/components/script/dom/webidls/ElementContentEditable.webidl b/components/script/dom/webidls/ElementContentEditable.webidl deleted file mode 100644 index 8429700e93e..00000000000 --- a/components/script/dom/webidls/ElementContentEditable.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#elementcontenteditable -[Exposed=Window] -interface mixin ElementContentEditable { - [CEReactions] - attribute DOMString contentEditable; - readonly attribute boolean isContentEditable; -}; diff --git a/components/script/dom/webidls/ElementInternals.webidl b/components/script/dom/webidls/ElementInternals.webidl deleted file mode 100644 index fbb0e720733..00000000000 --- a/components/script/dom/webidls/ElementInternals.webidl +++ /dev/null @@ -1,41 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#elementinternals -[Exposed=Window] -interface ElementInternals { - // Form-associated custom elements - - [Throws] undefined setFormValue((File or USVString or FormData)? value, - optional (File or USVString or FormData)? state); - - [Throws] readonly attribute HTMLFormElement? form; - - // flags shouldn't be optional here, #25704 - [Throws] undefined setValidity(optional ValidityStateFlags flags = {}, - optional DOMString message, - optional HTMLElement anchor); - [Throws] readonly attribute boolean willValidate; - [Throws] readonly attribute ValidityState validity; - [Throws] readonly attribute DOMString validationMessage; - [Throws] boolean checkValidity(); - [Throws] boolean reportValidity(); - - [Throws] readonly attribute NodeList labels; -}; - -// https://html.spec.whatwg.org/multipage/#elementinternals -dictionary ValidityStateFlags { - boolean valueMissing = false; - boolean typeMismatch = false; - boolean patternMismatch = false; - boolean tooLong = false; - boolean tooShort = false; - boolean rangeUnderflow = false; - boolean rangeOverflow = false; - boolean stepMismatch = false; - boolean badInput = false; - boolean customError = false; -}; - diff --git a/components/script/dom/webidls/ErrorEvent.webidl b/components/script/dom/webidls/ErrorEvent.webidl deleted file mode 100644 index 6f0782f4653..00000000000 --- a/components/script/dom/webidls/ErrorEvent.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-errorevent-interface - -[Exposed=(Window,Worker)] -interface ErrorEvent : Event { - [Throws] constructor(DOMString type, optional ErrorEventInit eventInitDict = {}); - readonly attribute DOMString message; - readonly attribute DOMString filename; - readonly attribute unsigned long lineno; - readonly attribute unsigned long colno; - readonly attribute any error; -}; - -dictionary ErrorEventInit : EventInit { - DOMString message; - DOMString filename; - unsigned long lineno; - unsigned long colno; - any error; -}; diff --git a/components/script/dom/webidls/Event.webidl b/components/script/dom/webidls/Event.webidl deleted file mode 100644 index bc5c3d2abdd..00000000000 --- a/components/script/dom/webidls/Event.webidl +++ /dev/null @@ -1,51 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * For more information on this interface please see - * https://dom.spec.whatwg.org/#event - */ - -[Exposed=*] -interface Event { - [Throws] constructor(DOMString type, optional EventInit eventInitDict = {}); - [Pure] - readonly attribute DOMString type; - readonly attribute EventTarget? target; - readonly attribute EventTarget? srcElement; - readonly attribute EventTarget? currentTarget; - sequence<EventTarget> composedPath(); - - const unsigned short NONE = 0; - const unsigned short CAPTURING_PHASE = 1; - const unsigned short AT_TARGET = 2; - const unsigned short BUBBLING_PHASE = 3; - readonly attribute unsigned short eventPhase; - - undefined stopPropagation(); - attribute boolean cancelBubble; - undefined stopImmediatePropagation(); - - [Pure] - readonly attribute boolean bubbles; - [Pure] - readonly attribute boolean cancelable; - attribute boolean returnValue; // historical - undefined preventDefault(); - [Pure] - readonly attribute boolean defaultPrevented; - readonly attribute boolean composed; - - [LegacyUnforgeable] - readonly attribute boolean isTrusted; - [Constant] - readonly attribute DOMHighResTimeStamp timeStamp; - - undefined initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); -}; - -dictionary EventInit { - boolean bubbles = false; - boolean cancelable = false; - boolean composed = false; -}; diff --git a/components/script/dom/webidls/EventHandler.webidl b/components/script/dom/webidls/EventHandler.webidl deleted file mode 100644 index f597ce237d3..00000000000 --- a/components/script/dom/webidls/EventHandler.webidl +++ /dev/null @@ -1,140 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://html.spec.whatwg.org/multipage/#eventhandler - * - * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and - * Opera Software ASA. You are granted a license to use, reproduce - * and create derivative works of this document. - */ - -[LegacyTreatNonObjectAsNull] -callback EventHandlerNonNull = any (Event event); -typedef EventHandlerNonNull? EventHandler; - -[LegacyTreatNonObjectAsNull] -callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, - optional unsigned long lineno, optional unsigned long column, - optional any error); -typedef OnErrorEventHandlerNonNull? OnErrorEventHandler; - -[LegacyTreatNonObjectAsNull] -callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event); -typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler; - -// https://html.spec.whatwg.org/multipage/#globaleventhandlers -[Exposed=Window] -interface mixin GlobalEventHandlers { - attribute EventHandler onabort; - attribute EventHandler onblur; - attribute EventHandler oncancel; - attribute EventHandler oncanplay; - attribute EventHandler oncanplaythrough; - attribute EventHandler onchange; - attribute EventHandler onclick; - attribute EventHandler onclose; - attribute EventHandler oncontextmenu; - attribute EventHandler oncuechange; - attribute EventHandler ondblclick; - attribute EventHandler ondrag; - attribute EventHandler ondragend; - attribute EventHandler ondragenter; - attribute EventHandler ondragexit; - attribute EventHandler ondragleave; - attribute EventHandler ondragover; - attribute EventHandler ondragstart; - attribute EventHandler ondrop; - attribute EventHandler ondurationchange; - attribute EventHandler onemptied; - attribute EventHandler onended; - attribute OnErrorEventHandler onerror; - attribute EventHandler onfocus; - attribute EventHandler onformdata; - attribute EventHandler oninput; - attribute EventHandler oninvalid; - attribute EventHandler onkeydown; - attribute EventHandler onkeypress; - attribute EventHandler onkeyup; - attribute EventHandler onload; - attribute EventHandler onloadeddata; - attribute EventHandler onloadedmetadata; - attribute EventHandler onloadstart; - attribute EventHandler onmousedown; - [LegacyLenientThis] attribute EventHandler onmouseenter; - [LegacyLenientThis] attribute EventHandler onmouseleave; - attribute EventHandler onmousemove; - attribute EventHandler onmouseout; - attribute EventHandler onmouseover; - attribute EventHandler onmouseup; - attribute EventHandler onwheel; - attribute EventHandler onpause; - attribute EventHandler onplay; - attribute EventHandler onplaying; - attribute EventHandler onprogress; - attribute EventHandler onratechange; - attribute EventHandler onreset; - attribute EventHandler onresize; - attribute EventHandler onscroll; - attribute EventHandler onsecuritypolicyviolation; - attribute EventHandler onseeked; - attribute EventHandler onseeking; - attribute EventHandler onselect; - attribute EventHandler onshow; - attribute EventHandler onstalled; - attribute EventHandler onsubmit; - attribute EventHandler onsuspend; - attribute EventHandler ontimeupdate; - attribute EventHandler ontoggle; - attribute EventHandler onvolumechange; - attribute EventHandler onwaiting; -}; - -// https://drafts.csswg.org/css-animations/#interface-globaleventhandlers-idl -partial interface mixin GlobalEventHandlers { - attribute EventHandler onanimationend; - attribute EventHandler onanimationiteration; -}; - -// https://drafts.csswg.org/css-transitions/#interface-globaleventhandlers-idl -partial interface mixin GlobalEventHandlers { - attribute EventHandler ontransitionrun; - attribute EventHandler ontransitionend; - attribute EventHandler ontransitioncancel; -}; - -// https://w3c.github.io/selection-api/#extensions-to-globaleventhandlers-interface -partial interface mixin GlobalEventHandlers { - attribute EventHandler onselectstart; - attribute EventHandler onselectionchange; -}; - -// https://html.spec.whatwg.org/multipage/#windoweventhandlers -[Exposed=Window] -interface mixin WindowEventHandlers { - attribute EventHandler onafterprint; - attribute EventHandler onbeforeprint; - attribute OnBeforeUnloadEventHandler onbeforeunload; - attribute EventHandler onhashchange; - attribute EventHandler onlanguagechange; - attribute EventHandler onmessage; - attribute EventHandler onmessageerror; - attribute EventHandler onoffline; - attribute EventHandler ononline; - attribute EventHandler onpagehide; - attribute EventHandler onpageshow; - attribute EventHandler onpopstate; - attribute EventHandler onrejectionhandled; - attribute EventHandler onstorage; - attribute EventHandler onunhandledrejection; - attribute EventHandler onunload; -}; - -// https://html.spec.whatwg.org/multipage/#documentandelementeventhandlers -[Exposed=Window] -interface mixin DocumentAndElementEventHandlers { - attribute EventHandler oncopy; - attribute EventHandler oncut; - attribute EventHandler onpaste; -}; diff --git a/components/script/dom/webidls/EventListener.webidl b/components/script/dom/webidls/EventListener.webidl deleted file mode 100644 index 13ed93be5ad..00000000000 --- a/components/script/dom/webidls/EventListener.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * https://dom.spec.whatwg.org/#callbackdef-eventlistener - */ - -[Exposed=Window] -callback interface EventListener { - undefined handleEvent(Event event); -}; - diff --git a/components/script/dom/webidls/EventModifierInit.webidl b/components/script/dom/webidls/EventModifierInit.webidl deleted file mode 100644 index c8abfcbddda..00000000000 --- a/components/script/dom/webidls/EventModifierInit.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/uievents/#dictdef-eventmodifierinit -dictionary EventModifierInit : UIEventInit { - boolean ctrlKey = false; - boolean shiftKey = false; - boolean altKey = false; - boolean metaKey = false; - boolean keyModifierStateAltGraph = false; - boolean keyModifierStateCapsLock = false; - boolean keyModifierStateFn = false; - boolean keyModifierStateFnLock = false; - boolean keyModifierStateHyper = false; - boolean keyModifierStateNumLock = false; - boolean keyModifierStateOS = false; - boolean keyModifierStateScrollLock = false; - boolean keyModifierStateSuper = false; - boolean keyModifierStateSymbol = false; - boolean keyModifierStateSymbolLock = false; -}; diff --git a/components/script/dom/webidls/EventSource.webidl b/components/script/dom/webidls/EventSource.webidl deleted file mode 100644 index c76885bd2e0..00000000000 --- a/components/script/dom/webidls/EventSource.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://html.spec.whatwg.org/multipage/#eventsource - */ - -[Exposed=(Window,Worker)] -interface EventSource : EventTarget { - [Throws] constructor(DOMString url, optional EventSourceInit eventSourceInitDict = {}); - readonly attribute DOMString url; - readonly attribute boolean withCredentials; - - // ready state - const unsigned short CONNECTING = 0; - const unsigned short OPEN = 1; - const unsigned short CLOSED = 2; - readonly attribute unsigned short readyState; - - // networking - attribute EventHandler onopen; - attribute EventHandler onmessage; - attribute EventHandler onerror; - undefined close(); -}; - -dictionary EventSourceInit { - boolean withCredentials = false; -}; diff --git a/components/script/dom/webidls/EventTarget.webidl b/components/script/dom/webidls/EventTarget.webidl deleted file mode 100644 index 82e8c967483..00000000000 --- a/components/script/dom/webidls/EventTarget.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * https://dom.spec.whatwg.org/#interface-eventtarget - */ - -[Exposed=(Window,Worker,Worklet,DissimilarOriginWindow)] -interface EventTarget { - [Throws] constructor(); - undefined addEventListener( - DOMString type, - EventListener? callback, - optional (AddEventListenerOptions or boolean) options = {} - ); - - undefined removeEventListener( - DOMString type, - EventListener? callback, - optional (EventListenerOptions or boolean) options = {} - ); - - [Throws] - boolean dispatchEvent(Event event); -}; - -dictionary EventListenerOptions { - boolean capture = false; -}; - -dictionary AddEventListenerOptions : EventListenerOptions { - // boolean passive = false; - boolean once = false; -}; diff --git a/components/script/dom/webidls/ExtendableEvent.webidl b/components/script/dom/webidls/ExtendableEvent.webidl deleted file mode 100644 index cf8a42169a0..00000000000 --- a/components/script/dom/webidls/ExtendableEvent.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/ServiceWorker/#extendable-event - -[Exposed=ServiceWorker, - Pref="dom_serviceworker_enabled"] -interface ExtendableEvent : Event { - [Throws] constructor(DOMString type, - optional ExtendableEventInit eventInitDict = {}); - [Throws] undefined waitUntil(/*Promise<*/any/*>*/ f); -}; - -dictionary ExtendableEventInit : EventInit { - // Defined for the forward compatibility across the derived events -}; diff --git a/components/script/dom/webidls/ExtendableMessageEvent.webidl b/components/script/dom/webidls/ExtendableMessageEvent.webidl deleted file mode 100644 index 66fbb46371e..00000000000 --- a/components/script/dom/webidls/ExtendableMessageEvent.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/ServiceWorker/#extendablemessage-event-section - -[Exposed=ServiceWorker, - Pref="dom_serviceworker_enabled"] -interface ExtendableMessageEvent : ExtendableEvent { - [Throws] constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict = {}); - readonly attribute any data; - readonly attribute DOMString origin; - readonly attribute DOMString lastEventId; - // [SameObject] readonly attribute (Client or ServiceWorker /*or MessagePort*/)? source; - readonly attribute /*FrozenArray<MessagePort>*/any ports; -}; - -dictionary ExtendableMessageEventInit : ExtendableEventInit { - any data = null; - DOMString origin = ""; - DOMString lastEventId = ""; - // (Client or ServiceWorker /*or MessagePort*/)? source; - sequence<MessagePort> ports = []; -}; diff --git a/components/script/dom/webidls/FakeXRDevice.webidl b/components/script/dom/webidls/FakeXRDevice.webidl deleted file mode 100644 index dd0bb24b8a4..00000000000 --- a/components/script/dom/webidls/FakeXRDevice.webidl +++ /dev/null @@ -1,94 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://github.com/immersive-web/webxr-test-api/ - -[Exposed=Window, Pref="dom_webxr_test"] -interface FakeXRDevice { - // Sets the values to be used for subsequent requestAnimationFrame() callbacks. - [Throws] undefined setViews(sequence<FakeXRViewInit> views, optional sequence<FakeXRViewInit> secondaryViews); - - // behaves as if device was disconnected - Promise<undefined> disconnect(); - - [Throws] undefined setViewerOrigin(FakeXRRigidTransformInit origin, optional boolean emulatedPosition = false); - undefined clearViewerOrigin(); - [Throws] undefined setFloorOrigin(FakeXRRigidTransformInit origin); - undefined clearFloorOrigin(); - [Throws] undefined setBoundsGeometry(sequence<FakeXRBoundsPoint> boundsCoodinates); - undefined simulateResetPose(); - - // Simulates devices focusing and blurring sessions. - undefined simulateVisibilityChange(XRVisibilityState state); - - [Throws] FakeXRInputController simulateInputSourceConnection(FakeXRInputSourceInit init); - - // Hit test extensions: - [Throws] undefined setWorld(FakeXRWorldInit world); - undefined clearWorld(); - - // Depth sensing extensions: - // undefined setDepthSensingData(FakeXRDepthSensingDataInit depthSensingData); - // undefined clearDepthSensingData(); -}; - -// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-getviewport -dictionary FakeXRViewInit { - required XREye eye; - // https://immersive-web.github.io/webxr/#view-projection-matrix - required sequence<float> projectionMatrix; - // https://immersive-web.github.io/webxr/#view-offset - required FakeXRRigidTransformInit viewOffset; - // https://immersive-web.github.io/webxr/#dom-xrwebgllayer-getviewport - required FakeXRDeviceResolution resolution; - - FakeXRFieldOfViewInit fieldOfView; -}; - -// https://immersive-web.github.io/webxr/#xrviewport -dictionary FakeXRDeviceResolution { - required long width; - required long height; -}; - -dictionary FakeXRBoundsPoint { - double x; double z; -}; - -dictionary FakeXRRigidTransformInit { - required sequence<float> position; - required sequence<float> orientation; -}; - -dictionary FakeXRFieldOfViewInit { - required float upDegrees; - required float downDegrees; - required float leftDegrees; - required float rightDegrees; -}; - -// hit testing -dictionary FakeXRWorldInit { - required sequence<FakeXRRegionInit> hitTestRegions; -}; - - -dictionary FakeXRRegionInit { - required sequence<FakeXRTriangleInit> faces; - required FakeXRRegionType type; -}; - - -dictionary FakeXRTriangleInit { - required sequence<DOMPointInit> vertices; // size = 3 -}; - - -enum FakeXRRegionType { - "point", - "plane", - "mesh" -}; diff --git a/components/script/dom/webidls/FakeXRInputController.webidl b/components/script/dom/webidls/FakeXRInputController.webidl deleted file mode 100644 index 25237f54c7d..00000000000 --- a/components/script/dom/webidls/FakeXRInputController.webidl +++ /dev/null @@ -1,58 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr-test-api/#fakexrinputcontroller - -[Exposed=Window, Pref="dom_webxr_test"] -interface FakeXRInputController { - undefined setHandedness(XRHandedness handedness); - undefined setTargetRayMode(XRTargetRayMode targetRayMode); - undefined setProfiles(sequence<DOMString> profiles); - [Throws] undefined setGripOrigin(FakeXRRigidTransformInit gripOrigin, optional boolean emulatedPosition = false); - undefined clearGripOrigin(); - [Throws] undefined setPointerOrigin( - FakeXRRigidTransformInit pointerOrigin, - optional boolean emulatedPosition = false - ); - - undefined disconnect(); - undefined reconnect(); - - undefined startSelection(); - undefined endSelection(); - undefined simulateSelect(); - - undefined setSupportedButtons(sequence<FakeXRButtonStateInit> supportedButtons); - [Throws] undefined updateButtonState(FakeXRButtonStateInit buttonState); -}; - -dictionary FakeXRInputSourceInit { - required XRHandedness handedness; - required XRTargetRayMode targetRayMode; - required FakeXRRigidTransformInit pointerOrigin; - required sequence<DOMString> profiles; - boolean selectionStarted = false; - boolean selectionClicked = false; - sequence<FakeXRButtonStateInit> supportedButtons; - FakeXRRigidTransformInit gripOrigin; -}; - -enum FakeXRButtonType { - "grip", - "touchpad", - "thumbstick", - "optional-button", - "optional-thumbstick" -}; - -dictionary FakeXRButtonStateInit { - required FakeXRButtonType buttonType; - required boolean pressed; - required boolean touched; - required float pressedValue; - float xValue = 0.0; - float yValue = 0.0; -}; diff --git a/components/script/dom/webidls/Fetch.webidl b/components/script/dom/webidls/Fetch.webidl deleted file mode 100644 index abedcf620ea..00000000000 --- a/components/script/dom/webidls/Fetch.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://fetch.spec.whatwg.org/#fetch-method - -[Exposed=(Window,Worker)] - -partial interface mixin WindowOrWorkerGlobalScope { - [NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init = {}); -}; diff --git a/components/script/dom/webidls/File.webidl b/components/script/dom/webidls/File.webidl deleted file mode 100644 index 143df2f8f13..00000000000 --- a/components/script/dom/webidls/File.webidl +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/FileAPI/#file - -[Exposed=(Window,Worker)] -interface File : Blob { - [Throws] constructor(sequence<BlobPart> fileBits, - DOMString fileName, - optional FilePropertyBag options = {}); - readonly attribute DOMString name; - readonly attribute long long lastModified; -}; - -dictionary FilePropertyBag : BlobPropertyBag { - long long lastModified; -}; diff --git a/components/script/dom/webidls/FileList.webidl b/components/script/dom/webidls/FileList.webidl deleted file mode 100644 index d849bd323ef..00000000000 --- a/components/script/dom/webidls/FileList.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/FileAPI/#dfn-filelist - -[Exposed=(Window,Worker)] -interface FileList { - getter File? item(unsigned long index); - readonly attribute unsigned long length; -}; diff --git a/components/script/dom/webidls/FileReader.webidl b/components/script/dom/webidls/FileReader.webidl deleted file mode 100644 index 414958c625b..00000000000 --- a/components/script/dom/webidls/FileReader.webidl +++ /dev/null @@ -1,41 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - - // http://dev.w3.org/2006/webapi/FileAPI/#APIASynch - -typedef (DOMString or object) FileReaderResult; -[Exposed=(Window,Worker)] -interface FileReader: EventTarget { - [Throws] constructor(); - - // async read methods - [Throws] - undefined readAsArrayBuffer(Blob blob); - [Throws] - undefined readAsText(Blob blob, optional DOMString label); - [Throws] - undefined readAsDataURL(Blob blob); - - undefined abort(); - - // states - const unsigned short EMPTY = 0; - const unsigned short LOADING = 1; - const unsigned short DONE = 2; - readonly attribute unsigned short readyState; - - // File or Blob data - readonly attribute FileReaderResult? result; - - readonly attribute DOMException? error; - - // event handler attributes - attribute EventHandler onloadstart; - attribute EventHandler onprogress; - attribute EventHandler onload; - attribute EventHandler onabort; - attribute EventHandler onerror; - attribute EventHandler onloadend; - -}; diff --git a/components/script/dom/webidls/FileReaderSync.webidl b/components/script/dom/webidls/FileReaderSync.webidl deleted file mode 100644 index 08248839958..00000000000 --- a/components/script/dom/webidls/FileReaderSync.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/FileAPI/#FileReaderSync - -[Exposed=Worker] -interface FileReaderSync { - [Throws] constructor(); - // Synchronously return strings - - [Throws] - ArrayBuffer readAsArrayBuffer(Blob blob); - [Throws] - DOMString readAsBinaryString(Blob blob); - [Throws] - DOMString readAsText(Blob blob, optional DOMString label); - [Throws] - DOMString readAsDataURL(Blob blob); -}; diff --git a/components/script/dom/webidls/FocusEvent.webidl b/components/script/dom/webidls/FocusEvent.webidl deleted file mode 100644 index 1d5e4ee4bea..00000000000 --- a/components/script/dom/webidls/FocusEvent.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/uievents/#interface-FocusEvent -[Exposed=Window] -interface FocusEvent : UIEvent { - [Throws] constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict = {}); - readonly attribute EventTarget? relatedTarget; -}; - -dictionary FocusEventInit : UIEventInit { - EventTarget? relatedTarget = null; -}; diff --git a/components/script/dom/webidls/FontFaceSet.webidl b/components/script/dom/webidls/FontFaceSet.webidl deleted file mode 100644 index f114b2ac9b4..00000000000 --- a/components/script/dom/webidls/FontFaceSet.webidl +++ /dev/null @@ -1,49 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -/* -dictionary FontFaceSetLoadEventInit : EventInit { - sequence<FontFace> fontfaces = []; -}; - -[Exposed=(Window,Worker)] -interface FontFaceSetLoadEvent : Event { - constructor(DOMString type, optional FontFaceSetLoadEventInit eventInitDict = {}); - // WebIDL needs to support FrozenArray & SameObject - // [SameObject] readonly attribute FrozenArray<FontFace> fontfaces; - readonly attribute any fontfaces; -}; - -enum FontFaceSetLoadStatus { "loading" , "loaded" }; -*/ - -// https://drafts.csswg.org/css-font-loading/#FontFaceSet-interface -[Exposed=(Window,Worker)] -interface FontFaceSet : EventTarget { - // constructor(sequence<FontFace> initialFaces); - - // setlike<FontFace>; - // FontFaceSet add(FontFace font); - // boolean delete(FontFace font); - // undefined clear(); - - // events for when loading state changes - // attribute EventHandler onloading; - // attribute EventHandler onloadingdone; - // attribute EventHandler onloadingerror; - - // check and start loads if appropriate - // and fulfill promise when all loads complete - // Promise<sequence<FontFace>> load(DOMString font, optional DOMString text = " "); - - // return whether all fonts in the fontlist are loaded - // (does not initiate load if not available) - // boolean check(DOMString font, optional DOMString text = " "); - - // async notification that font loading and layout operations are done - readonly attribute Promise<FontFaceSet> ready; - - // loading state, "loading" while one or more fonts loading, "loaded" otherwise - // readonly attribute FontFaceSetLoadStatus status; -}; diff --git a/components/script/dom/webidls/FontFaceSource.webidl b/components/script/dom/webidls/FontFaceSource.webidl deleted file mode 100644 index bdc286d9af7..00000000000 --- a/components/script/dom/webidls/FontFaceSource.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/css-font-loading/#font-face-source -interface mixin FontFaceSource { - readonly attribute FontFaceSet fonts; -}; - -Document includes FontFaceSource; -// WorkerGlobalScope includes FontFaceSource; diff --git a/components/script/dom/webidls/FormData.webidl b/components/script/dom/webidls/FormData.webidl deleted file mode 100644 index 49d62aff182..00000000000 --- a/components/script/dom/webidls/FormData.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://xhr.spec.whatwg.org/#interface-formdata - */ - -typedef (File or USVString) FormDataEntryValue; - -[Exposed=(Window,Worker)] -interface FormData { - [Throws] constructor(optional HTMLFormElement form, optional HTMLElement? submitter = null); - undefined append(USVString name, USVString value); - undefined append(USVString name, Blob value, optional USVString filename); - undefined delete(USVString name); - FormDataEntryValue? get(USVString name); - sequence<FormDataEntryValue> getAll(USVString name); - boolean has(USVString name); - undefined set(USVString name, USVString value); - undefined set(USVString name, Blob value, optional USVString filename); - iterable<USVString, FormDataEntryValue>; -}; diff --git a/components/script/dom/webidls/FormDataEvent.webidl b/components/script/dom/webidls/FormDataEvent.webidl deleted file mode 100644 index 0cb81b93962..00000000000 --- a/components/script/dom/webidls/FormDataEvent.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-formdataevent-interface -[Exposed=Window] -interface FormDataEvent : Event { - [Throws] constructor(DOMString type, FormDataEventInit eventInitDict); - readonly attribute FormData formData; -}; - -dictionary FormDataEventInit : EventInit { - required FormData formData; -}; diff --git a/components/script/dom/webidls/Function.webidl b/components/script/dom/webidls/Function.webidl deleted file mode 100644 index 4694df61999..00000000000 --- a/components/script/dom/webidls/Function.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://heycam.github.io/webidl/#common-Function - * - * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and - * Opera Software ASA. You are granted a license to use, reproduce - * and create derivative works of this document. - */ - -callback Function = any(any... arguments); diff --git a/components/script/dom/webidls/GPUCanvasContext.webidl b/components/script/dom/webidls/GPUCanvasContext.webidl deleted file mode 100644 index e83421fa5ea..00000000000 --- a/components/script/dom/webidls/GPUCanvasContext.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlcanvaselement -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUCanvasContext { - readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; -}; diff --git a/components/script/dom/webidls/GainNode.webidl b/components/script/dom/webidls/GainNode.webidl deleted file mode 100644 index 1247aeda95d..00000000000 --- a/components/script/dom/webidls/GainNode.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#gainnode - */ - -dictionary GainOptions : AudioNodeOptions { - float gain = 1.0; -}; - -[Exposed=Window] - interface GainNode : AudioNode { - [Throws] constructor(BaseAudioContext context, optional GainOptions options = {}); - readonly attribute AudioParam gain; - }; diff --git a/components/script/dom/webidls/Gamepad.webidl b/components/script/dom/webidls/Gamepad.webidl deleted file mode 100644 index bef601c5c7c..00000000000 --- a/components/script/dom/webidls/Gamepad.webidl +++ /dev/null @@ -1,36 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/gamepad/#gamepad-interface -[Exposed=Window, Pref="dom_gamepad_enabled"] -interface Gamepad { - readonly attribute DOMString id; - readonly attribute long index; - readonly attribute boolean connected; - readonly attribute DOMHighResTimeStamp timestamp; - readonly attribute DOMString mapping; - readonly attribute Float64Array axes; - [SameObject] readonly attribute GamepadButtonList buttons; - [SameObject] readonly attribute GamepadHapticActuator vibrationActuator; -}; - -// https://w3c.github.io/gamepad/extensions.html#partial-gamepad-interface -partial interface Gamepad { - readonly attribute GamepadHand hand; - // readonly attribute FrozenArray<GamepadHapticActuator> hapticActuators; - readonly attribute GamepadPose? pose; -}; - -// https://w3c.github.io/gamepad/extensions.html#gamepadhand-enum -enum GamepadHand { - "", /* unknown, both hands, or not applicable */ - "left", - "right" -}; - -// https://www.w3.org/TR/gamepad/#extensions-to-the-windoweventhandlers-interface-mixin -partial interface mixin WindowEventHandlers { - attribute EventHandler ongamepadconnected; - attribute EventHandler ongamepaddisconnected; -}; diff --git a/components/script/dom/webidls/GamepadButton.webidl b/components/script/dom/webidls/GamepadButton.webidl deleted file mode 100644 index d4aa41be8d9..00000000000 --- a/components/script/dom/webidls/GamepadButton.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/gamepad/#gamepadbutton-interface -[Exposed=Window, Pref="dom_gamepad_enabled"] -interface GamepadButton { - readonly attribute boolean pressed; - readonly attribute boolean touched; - readonly attribute double value; -}; diff --git a/components/script/dom/webidls/GamepadButtonList.webidl b/components/script/dom/webidls/GamepadButtonList.webidl deleted file mode 100644 index 24a82a4b322..00000000000 --- a/components/script/dom/webidls/GamepadButtonList.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/gamepad/#dom-gamepad-buttons -[Exposed=Window, Pref="dom_gamepad_enabled"] -interface GamepadButtonList { - getter GamepadButton? item(unsigned long index); - readonly attribute unsigned long length; -}; diff --git a/components/script/dom/webidls/GamepadEvent.webidl b/components/script/dom/webidls/GamepadEvent.webidl deleted file mode 100644 index 0dc82e4083b..00000000000 --- a/components/script/dom/webidls/GamepadEvent.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/gamepad/#gamepadevent-interface -[Exposed=Window, Pref="dom_gamepad_enabled"] -interface GamepadEvent : Event { - [Throws] constructor(DOMString type, GamepadEventInit eventInitDict); - readonly attribute Gamepad gamepad; -}; - -dictionary GamepadEventInit : EventInit { - required Gamepad gamepad; -}; diff --git a/components/script/dom/webidls/GamepadHapticActuator.webidl b/components/script/dom/webidls/GamepadHapticActuator.webidl deleted file mode 100644 index db6f6eb5f8b..00000000000 --- a/components/script/dom/webidls/GamepadHapticActuator.webidl +++ /dev/null @@ -1,38 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/gamepad/#gamepadhapticactuator-interface -[Exposed=Window, Pref="dom_gamepad_enabled"] -interface GamepadHapticActuator { - /* [SameObject] */ readonly attribute /* FrozenArray<GamepadHapticEffectType> */ any effects; - [NewObject] - Promise<GamepadHapticsResult> playEffect( - GamepadHapticEffectType type, - optional GamepadEffectParameters params = {} - ); - [NewObject] - Promise<GamepadHapticsResult> reset(); -}; - -// https://w3c.github.io/gamepad/#gamepadhapticsresult-enum -enum GamepadHapticsResult { - "complete", - "preempted" -}; - -// https://w3c.github.io/gamepad/#dom-gamepadhapticeffecttype -enum GamepadHapticEffectType { - "dual-rumble", - "trigger-rumble" -}; - -// https://w3c.github.io/gamepad/#dom-gamepadeffectparameters -dictionary GamepadEffectParameters { - unsigned long long duration = 0; - unsigned long long startDelay = 0; - double strongMagnitude = 0.0; - double weakMagnitude = 0.0; - double leftTrigger = 0.0; - double rightTrigger = 0.0; -}; diff --git a/components/script/dom/webidls/GamepadPose.webidl b/components/script/dom/webidls/GamepadPose.webidl deleted file mode 100644 index aeb5411b12b..00000000000 --- a/components/script/dom/webidls/GamepadPose.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/gamepad/extensions.html#gamepadpose-interface -[Exposed=Window, Pref="dom_gamepad_enabled"] -interface GamepadPose { - readonly attribute boolean hasOrientation; - readonly attribute boolean hasPosition; - - readonly attribute Float32Array? position; - readonly attribute Float32Array? linearVelocity; - readonly attribute Float32Array? linearAcceleration; - readonly attribute Float32Array? orientation; - readonly attribute Float32Array? angularVelocity; - readonly attribute Float32Array? angularAcceleration; -}; diff --git a/components/script/dom/webidls/GlobalScope.webidl b/components/script/dom/webidls/GlobalScope.webidl deleted file mode 100644 index 57206d13e6a..00000000000 --- a/components/script/dom/webidls/GlobalScope.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[Exposed=(Window,Worker,Worklet,DissimilarOriginWindow), - Inline] -interface GlobalScope : EventTarget {}; diff --git a/components/script/dom/webidls/HTMLAnchorElement.webidl b/components/script/dom/webidls/HTMLAnchorElement.webidl deleted file mode 100644 index ed867a6a9a2..00000000000 --- a/components/script/dom/webidls/HTMLAnchorElement.webidl +++ /dev/null @@ -1,53 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://html.spec.whatwg.org/multipage/#the-a-element - * https://html.spec.whatwg.org/multipage/#other-elements,-attributes-and-apis - * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and - * Opera Software ASA. You are granted a license to use, reproduce - * and create derivative works of this document. - */ - -// https://html.spec.whatwg.org/multipage/#htmlanchorelement -[Exposed=Window] -interface HTMLAnchorElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString target; - // [CEReactions] - // attribute DOMString download; - // [CEReactions] - // attribute USVString ping; - [CEReactions] - attribute DOMString rel; - [SameObject, PutForwards=value] readonly attribute DOMTokenList relList; - // [CEReactions] - // attribute DOMString hreflang; - // [CEReactions] - // attribute DOMString type; - - [CEReactions, Pure] - attribute DOMString text; - - [CEReactions] attribute DOMString referrerPolicy; - - // also has obsolete members -}; -HTMLAnchorElement includes HTMLHyperlinkElementUtils; - -// https://html.spec.whatwg.org/multipage/#HTMLAnchorElement-partial -partial interface HTMLAnchorElement { - [CEReactions] - attribute DOMString coords; - // [CEReactions] - // attribute DOMString charset; - [CEReactions] - attribute DOMString name; - [CEReactions] - attribute DOMString rev; - [CEReactions] - attribute DOMString shape; -}; diff --git a/components/script/dom/webidls/HTMLAreaElement.webidl b/components/script/dom/webidls/HTMLAreaElement.webidl deleted file mode 100644 index 222eef4962c..00000000000 --- a/components/script/dom/webidls/HTMLAreaElement.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlareaelement -[Exposed=Window] -interface HTMLAreaElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute DOMString alt; - // [CEReactions] - // attribute DOMString coords; - // [CEReactions] - // attribute DOMString shape; - [CEReactions] - attribute DOMString target; - // [CEReactions] - // attribute DOMString download; - // [CEReactions] - // attribute USVString ping; - [CEReactions] - attribute DOMString rel; - [SameObject, PutForwards=value] readonly attribute DOMTokenList relList; - [CEReactions] attribute DOMString referrerPolicy; - // hreflang and type are not reflected -}; -//HTMLAreaElement includes HTMLHyperlinkElementUtils; - -// https://html.spec.whatwg.org/multipage/#HTMLAreaElement-partial -partial interface HTMLAreaElement { - // [CEReactions] - // attribute boolean noHref; -}; diff --git a/components/script/dom/webidls/HTMLAudioElement.webidl b/components/script/dom/webidls/HTMLAudioElement.webidl deleted file mode 100644 index ad22f727668..00000000000 --- a/components/script/dom/webidls/HTMLAudioElement.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlaudioelement -[Exposed=Window, LegacyFactoryFunction=Audio(optional DOMString src)] -interface HTMLAudioElement : HTMLMediaElement { - [HTMLConstructor] constructor(); -}; diff --git a/components/script/dom/webidls/HTMLBRElement.webidl b/components/script/dom/webidls/HTMLBRElement.webidl deleted file mode 100644 index 367f3bd36a9..00000000000 --- a/components/script/dom/webidls/HTMLBRElement.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlbrelement -[Exposed=Window] -interface HTMLBRElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLBRElement-partial -partial interface HTMLBRElement { - // attribute DOMString clear; -}; diff --git a/components/script/dom/webidls/HTMLBaseElement.webidl b/components/script/dom/webidls/HTMLBaseElement.webidl deleted file mode 100644 index 813a4cffbd1..00000000000 --- a/components/script/dom/webidls/HTMLBaseElement.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlbaseelement -[Exposed=Window] -interface HTMLBaseElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString href; - // [CEReactions] - // attribute DOMString target; -}; diff --git a/components/script/dom/webidls/HTMLBodyElement.webidl b/components/script/dom/webidls/HTMLBodyElement.webidl deleted file mode 100644 index 102f5bec41a..00000000000 --- a/components/script/dom/webidls/HTMLBodyElement.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-body-element -[Exposed=Window] -interface HTMLBodyElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; -HTMLBodyElement includes WindowEventHandlers; - -// https://html.spec.whatwg.org/multipage/#HTMLBodyElement-partial -partial interface HTMLBodyElement { - [CEReactions] attribute [LegacyNullToEmptyString] DOMString text; - - // https://github.com/servo/servo/issues/8715 - //[CEReactions, LegacyNullToEmptyString] attribute DOMString link; - - // https://github.com/servo/servo/issues/8716 - //[CEReactions, LegacyNullToEmptyString] attribute DOMString vLink; - - // https://github.com/servo/servo/issues/8717 - //[CEReactions, LegacyNullToEmptyString] attribute DOMString aLink; - - [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor; - [CEReactions] attribute DOMString background; -}; diff --git a/components/script/dom/webidls/HTMLButtonElement.webidl b/components/script/dom/webidls/HTMLButtonElement.webidl deleted file mode 100644 index 178c7bd3a94..00000000000 --- a/components/script/dom/webidls/HTMLButtonElement.webidl +++ /dev/null @@ -1,41 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlbuttonelement -[Exposed=Window] -interface HTMLButtonElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute boolean autofocus; - [CEReactions] - attribute boolean disabled; - readonly attribute HTMLFormElement? form; - [CEReactions] - attribute DOMString formAction; - [CEReactions] - attribute DOMString formEnctype; - [CEReactions] - attribute DOMString formMethod; - [CEReactions] - attribute boolean formNoValidate; - [CEReactions] - attribute DOMString formTarget; - [CEReactions] - attribute DOMString name; - [CEReactions] - attribute DOMString type; - [CEReactions] - attribute DOMString value; - // attribute HTMLMenuElement? menu; - - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - boolean reportValidity(); - undefined setCustomValidity(DOMString error); - - readonly attribute NodeList labels; -}; diff --git a/components/script/dom/webidls/HTMLCanvasElement.webidl b/components/script/dom/webidls/HTMLCanvasElement.webidl deleted file mode 100644 index 2e7be0389be..00000000000 --- a/components/script/dom/webidls/HTMLCanvasElement.webidl +++ /dev/null @@ -1,36 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlcanvaselement -typedef (CanvasRenderingContext2D - or WebGLRenderingContext - or WebGL2RenderingContext - or GPUCanvasContext) RenderingContext; - -[Exposed=Window] -interface HTMLCanvasElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions, Pure, SetterThrows] attribute unsigned long width; - [CEReactions, Pure, SetterThrows] attribute unsigned long height; - - [Throws] - RenderingContext? getContext(DOMString contextId, optional any options = null); - - [Throws] - USVString toDataURL(optional DOMString type = "image/png", optional any quality); - - [Throws] - undefined toBlob(BlobCallback callback, optional DOMString type = "image/png", optional any quality); - - [Throws] - OffscreenCanvas transferControlToOffscreen(); -}; - -partial interface HTMLCanvasElement { - [Pref="dom_canvas_capture_enabled"] - MediaStream captureStream (optional double frameRequestRate); -}; - -callback BlobCallback = undefined(Blob? blob); diff --git a/components/script/dom/webidls/HTMLCollection.webidl b/components/script/dom/webidls/HTMLCollection.webidl deleted file mode 100644 index ac0962a5d10..00000000000 --- a/components/script/dom/webidls/HTMLCollection.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#interface-htmlcollection - -[Exposed=Window, LegacyUnenumerableNamedProperties] -interface HTMLCollection { - [Pure] - readonly attribute unsigned long length; - [Pure] - getter Element? item(unsigned long index); - [Pure] - getter Element? namedItem(DOMString name); -}; diff --git a/components/script/dom/webidls/HTMLDListElement.webidl b/components/script/dom/webidls/HTMLDListElement.webidl deleted file mode 100644 index 76cf662620e..00000000000 --- a/components/script/dom/webidls/HTMLDListElement.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmldlistelement -[Exposed=Window] -interface HTMLDListElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLDListElement-partial -partial interface HTMLDListElement { - // [CEReactions] - // attribute boolean compact; -}; diff --git a/components/script/dom/webidls/HTMLDataElement.webidl b/components/script/dom/webidls/HTMLDataElement.webidl deleted file mode 100644 index b11368f3de2..00000000000 --- a/components/script/dom/webidls/HTMLDataElement.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmldataelement -[Exposed=Window] -interface HTMLDataElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString value; -}; diff --git a/components/script/dom/webidls/HTMLDataListElement.webidl b/components/script/dom/webidls/HTMLDataListElement.webidl deleted file mode 100644 index 5bd9ac9d362..00000000000 --- a/components/script/dom/webidls/HTMLDataListElement.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmldatalistelement -[Exposed=Window] -interface HTMLDataListElement : HTMLElement { - [HTMLConstructor] constructor(); - - readonly attribute HTMLCollection options; -}; diff --git a/components/script/dom/webidls/HTMLDetailsElement.webidl b/components/script/dom/webidls/HTMLDetailsElement.webidl deleted file mode 100644 index e860186a8ce..00000000000 --- a/components/script/dom/webidls/HTMLDetailsElement.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmldetailselement -[Exposed=Window] -interface HTMLDetailsElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute boolean open; -}; diff --git a/components/script/dom/webidls/HTMLDialogElement.webidl b/components/script/dom/webidls/HTMLDialogElement.webidl deleted file mode 100644 index e52d3caf077..00000000000 --- a/components/script/dom/webidls/HTMLDialogElement.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmldialogelement -[Exposed=Window] -interface HTMLDialogElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute boolean open; - attribute DOMString returnValue; - [CEReactions] - undefined show(); - // [CEReactions] - // void showModal(); - [CEReactions] - undefined close(optional DOMString returnValue); -}; diff --git a/components/script/dom/webidls/HTMLDirectoryElement.webidl b/components/script/dom/webidls/HTMLDirectoryElement.webidl deleted file mode 100644 index 0fc1a65949c..00000000000 --- a/components/script/dom/webidls/HTMLDirectoryElement.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmldirectoryelement -[Exposed=Window] -interface HTMLDirectoryElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute boolean compact; -}; diff --git a/components/script/dom/webidls/HTMLDivElement.webidl b/components/script/dom/webidls/HTMLDivElement.webidl deleted file mode 100644 index c38127c87eb..00000000000 --- a/components/script/dom/webidls/HTMLDivElement.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmldivelement -[Exposed=Window] -interface HTMLDivElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLDivElement-partial -partial interface HTMLDivElement { - [CEReactions] - attribute DOMString align; -}; diff --git a/components/script/dom/webidls/HTMLElement.webidl b/components/script/dom/webidls/HTMLElement.webidl deleted file mode 100644 index 76bfada1b94..00000000000 --- a/components/script/dom/webidls/HTMLElement.webidl +++ /dev/null @@ -1,79 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlelement -[Exposed=Window] -interface HTMLElement : Element { - [HTMLConstructor] constructor(); - - // metadata attributes - [CEReactions] - attribute DOMString title; - [CEReactions] - attribute DOMString lang; - [CEReactions] - attribute boolean translate; - [CEReactions] - attribute DOMString dir; - readonly attribute DOMStringMap dataset; - - // microdata - // attribute boolean itemScope; - - // attribute DOMString itemId; - //readonly attribute HTMLPropertiesCollection properties; - // attribute any itemValue; // acts as DOMString on setting - [Pref="dom_microdata_testing_enabled"] - sequence<DOMString>? propertyNames(); - [Pref="dom_microdata_testing_enabled"] - sequence<DOMString>? itemtypes(); - - // user interaction - [CEReactions] - attribute boolean hidden; - undefined click(); - // [CEReactions] - // attribute long tabIndex; - undefined focus(); - undefined blur(); - // [CEReactions] - // attribute DOMString accessKey; - //readonly attribute DOMString accessKeyLabel; - // [CEReactions] - // attribute boolean draggable; - // [SameObject, PutForwards=value] readonly attribute DOMTokenList dropzone; - // attribute HTMLMenuElement? contextMenu; - // [CEReactions] - // attribute boolean spellcheck; - // void forceSpellCheck(); - - [CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText; - [CEReactions, Throws] attribute [LegacyNullToEmptyString] DOMString outerText; - - [Throws] ElementInternals attachInternals(); - - // command API - // readonly attribute DOMString? commandType; - // readonly attribute DOMString? commandLabel; - // readonly attribute DOMString? commandIcon; - // readonly attribute boolean? commandHidden; - // readonly attribute boolean? commandDisabled; - // readonly attribute boolean? commandChecked; -}; - -// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interface -partial interface HTMLElement { - // CSSOM things are not [Pure] because they can flush - readonly attribute Element? offsetParent; - readonly attribute long offsetTop; - readonly attribute long offsetLeft; - readonly attribute long offsetWidth; - readonly attribute long offsetHeight; -}; - -HTMLElement includes GlobalEventHandlers; -HTMLElement includes DocumentAndElementEventHandlers; -HTMLElement includes ElementContentEditable; -HTMLElement includes ElementCSSInlineStyle; -HTMLElement includes HTMLOrSVGElement; diff --git a/components/script/dom/webidls/HTMLEmbedElement.webidl b/components/script/dom/webidls/HTMLEmbedElement.webidl deleted file mode 100644 index 50d8ce1a16a..00000000000 --- a/components/script/dom/webidls/HTMLEmbedElement.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlembedelement -[Exposed=Window] -interface HTMLEmbedElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute DOMString src; - // [CEReactions] - // attribute DOMString type; - // [CEReactions] - // attribute DOMString width; - // [CEReactions] - // attribute DOMString height; - //legacycaller any (any... arguments); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLEmbedElement-partial -partial interface HTMLEmbedElement { - // [CEReactions] - // attribute DOMString align; - // [CEReactions] - // attribute DOMString name; -}; diff --git a/components/script/dom/webidls/HTMLFieldSetElement.webidl b/components/script/dom/webidls/HTMLFieldSetElement.webidl deleted file mode 100644 index 494dae3a5a2..00000000000 --- a/components/script/dom/webidls/HTMLFieldSetElement.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlfieldsetelement -[Exposed=Window] -interface HTMLFieldSetElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute boolean disabled; - readonly attribute HTMLFormElement? form; - [CEReactions] - attribute DOMString name; - - readonly attribute DOMString type; - - [SameObject] readonly attribute HTMLCollection elements; - - readonly attribute boolean willValidate; - [SameObject] readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - boolean reportValidity(); - undefined setCustomValidity(DOMString error); -}; diff --git a/components/script/dom/webidls/HTMLFontElement.webidl b/components/script/dom/webidls/HTMLFontElement.webidl deleted file mode 100644 index ca1a8680e5d..00000000000 --- a/components/script/dom/webidls/HTMLFontElement.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlfontelement -[Exposed=Window] -interface HTMLFontElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute [LegacyNullToEmptyString] DOMString color; - [CEReactions] - attribute DOMString face; - [CEReactions] - attribute DOMString size; -}; diff --git a/components/script/dom/webidls/HTMLFormControlsCollection.webidl b/components/script/dom/webidls/HTMLFormControlsCollection.webidl deleted file mode 100644 index c1b222dee23..00000000000 --- a/components/script/dom/webidls/HTMLFormControlsCollection.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlformcontrolscollection -[Exposed=Window] -interface HTMLFormControlsCollection : HTMLCollection { - // inherits length and item() - getter (RadioNodeList or Element)? namedItem(DOMString name); // shadows inherited namedItem() -}; diff --git a/components/script/dom/webidls/HTMLFormElement.webidl b/components/script/dom/webidls/HTMLFormElement.webidl deleted file mode 100644 index 21d23b68d9b..00000000000 --- a/components/script/dom/webidls/HTMLFormElement.webidl +++ /dev/null @@ -1,51 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlformelement -[Exposed=Window, LegacyUnenumerableNamedProperties] -interface HTMLFormElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString acceptCharset; - [CEReactions] - attribute DOMString action; - [CEReactions] - attribute DOMString autocomplete; - [CEReactions] - attribute DOMString enctype; - [CEReactions] - attribute DOMString encoding; - [CEReactions] - attribute DOMString method; - [CEReactions] - attribute DOMString name; - [CEReactions] - attribute boolean noValidate; - [CEReactions] - attribute DOMString target; - [CEReactions] - attribute DOMString rel; - [SameObject, PutForwards=value] readonly attribute DOMTokenList relList; - - [SameObject] readonly attribute HTMLFormControlsCollection elements; - readonly attribute unsigned long length; - getter Element? (unsigned long index); - getter (RadioNodeList or Element) (DOMString name); - - undefined submit(); - [Throws] undefined requestSubmit(optional HTMLElement? submitter = null); - [CEReactions] - undefined reset(); - boolean checkValidity(); - boolean reportValidity(); -}; - -// https://html.spec.whatwg.org/multipage/#selectionmode -enum SelectionMode { - "preserve", // default - "select", - "start", - "end" -}; diff --git a/components/script/dom/webidls/HTMLFrameElement.webidl b/components/script/dom/webidls/HTMLFrameElement.webidl deleted file mode 100644 index 913ed9c0325..00000000000 --- a/components/script/dom/webidls/HTMLFrameElement.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlframeelement -[Exposed=Window] -interface HTMLFrameElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute DOMString name; - // [CEReactions] - // attribute DOMString scrolling; - // [CEReactions] - // attribute DOMString src; - // [CEReactions] - // attribute DOMString frameBorder; - // [CEReactions] - // attribute DOMString longDesc; - // [CEReactions] - // attribute boolean noResize; - // readonly attribute Document? contentDocument; - // readonly attribute WindowProxy? contentWindow; - - // [CEReactions, LegacyNullToEmptyString] - // attribute DOMString marginHeight; - // [CEReactions, LegacyNullToEmptyString] - // attribute DOMString marginWidth; -}; diff --git a/components/script/dom/webidls/HTMLFrameSetElement.webidl b/components/script/dom/webidls/HTMLFrameSetElement.webidl deleted file mode 100644 index 24aa80dca28..00000000000 --- a/components/script/dom/webidls/HTMLFrameSetElement.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlframesetelement -[Exposed=Window] -interface HTMLFrameSetElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute DOMString cols; - // [CEReactions] - // attribute DOMString rows; -}; - -HTMLFrameSetElement includes WindowEventHandlers; diff --git a/components/script/dom/webidls/HTMLHRElement.webidl b/components/script/dom/webidls/HTMLHRElement.webidl deleted file mode 100644 index 8963d5e8901..00000000000 --- a/components/script/dom/webidls/HTMLHRElement.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlhrelement -[Exposed=Window] -interface HTMLHRElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLHRElement-partial -partial interface HTMLHRElement { - [CEReactions] - attribute DOMString align; - [CEReactions] - attribute DOMString color; - // [CEReactions] - // attribute boolean noShade; - // [CEReactions] - // attribute DOMString size; - [CEReactions] - attribute DOMString width; -}; diff --git a/components/script/dom/webidls/HTMLHeadElement.webidl b/components/script/dom/webidls/HTMLHeadElement.webidl deleted file mode 100644 index 72fd1f7eb6d..00000000000 --- a/components/script/dom/webidls/HTMLHeadElement.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlheadelement -[Exposed=Window] -interface HTMLHeadElement : HTMLElement { - [HTMLConstructor] constructor(); -}; diff --git a/components/script/dom/webidls/HTMLHeadingElement.webidl b/components/script/dom/webidls/HTMLHeadingElement.webidl deleted file mode 100644 index b2e6be1ca8f..00000000000 --- a/components/script/dom/webidls/HTMLHeadingElement.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlheadingelement -[Exposed=Window] -interface HTMLHeadingElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLHeadingElement-partial -partial interface HTMLHeadingElement { - // [CEReactions] - // attribute DOMString align; -}; diff --git a/components/script/dom/webidls/HTMLHtmlElement.webidl b/components/script/dom/webidls/HTMLHtmlElement.webidl deleted file mode 100644 index 6b25a41ca8d..00000000000 --- a/components/script/dom/webidls/HTMLHtmlElement.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlhtmlelement -[Exposed=Window] -interface HTMLHtmlElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLHtmlElement-partial -partial interface HTMLHtmlElement { - // [CEReactions] - // attribute DOMString version; -}; diff --git a/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl b/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl deleted file mode 100644 index 2f0f0ae68c0..00000000000 --- a/components/script/dom/webidls/HTMLHyperlinkElementUtils.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlhyperlinkelementutils -interface mixin HTMLHyperlinkElementUtils { - [CEReactions] - stringifier attribute USVString href; - readonly attribute USVString origin; - [CEReactions] - attribute USVString protocol; - [CEReactions] - attribute USVString username; - [CEReactions] - attribute USVString password; - [CEReactions] - attribute USVString host; - [CEReactions] - attribute USVString hostname; - [CEReactions] - attribute USVString port; - [CEReactions] - attribute USVString pathname; - [CEReactions] - attribute USVString search; - [CEReactions] - attribute USVString hash; -}; diff --git a/components/script/dom/webidls/HTMLIFrameElement.webidl b/components/script/dom/webidls/HTMLIFrameElement.webidl deleted file mode 100644 index 8ba58a20f33..00000000000 --- a/components/script/dom/webidls/HTMLIFrameElement.webidl +++ /dev/null @@ -1,51 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmliframeelement -[Exposed=Window] -interface HTMLIFrameElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute USVString src; - [CEReactions] - attribute DOMString srcdoc; - - [CEReactions] - attribute DOMString name; - - [SameObject, PutForwards=value] - readonly attribute DOMTokenList sandbox; - // [CEReactions] - // attribute boolean seamless; - [CEReactions] - attribute boolean allowFullscreen; - [CEReactions] - attribute DOMString width; - [CEReactions] - attribute DOMString referrerPolicy; - [CEReactions] - attribute DOMString height; - readonly attribute Document? contentDocument; - readonly attribute WindowProxy? contentWindow; - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLIFrameElement-partial -partial interface HTMLIFrameElement { - // [CEReactions] - // attribute DOMString align; - // [CEReactions] - // attribute DOMString scrolling; - [CEReactions] - attribute DOMString frameBorder; - // [CEReactions] - // attribute DOMString longDesc; - - // [CEReactions, LegacyNullToEmptyString] - // attribute DOMString marginHeight; - // [CEReactions, LegacyNullToEmptyString] - // attribute DOMString marginWidth; -}; diff --git a/components/script/dom/webidls/HTMLImageElement.webidl b/components/script/dom/webidls/HTMLImageElement.webidl deleted file mode 100644 index faae1c8992b..00000000000 --- a/components/script/dom/webidls/HTMLImageElement.webidl +++ /dev/null @@ -1,61 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlimageelement -[Exposed=Window, LegacyFactoryFunction=Image(optional unsigned long width, optional unsigned long height)] -interface HTMLImageElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString alt; - [CEReactions] - attribute USVString src; - [CEReactions] - attribute USVString srcset; - [CEReactions] - attribute DOMString? crossOrigin; - [CEReactions] - attribute DOMString useMap; - [CEReactions] - attribute boolean isMap; - [CEReactions] - attribute unsigned long width; - [CEReactions] - attribute unsigned long height; - readonly attribute unsigned long naturalWidth; - readonly attribute unsigned long naturalHeight; - readonly attribute boolean complete; - readonly attribute USVString currentSrc; - [CEReactions] - attribute DOMString referrerPolicy; - - Promise<undefined> decode(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLImageElement-partial -partial interface HTMLImageElement { - [CEReactions] - attribute DOMString name; - // [CEReactions] - // attribute DOMString lowsrc; - [CEReactions] - attribute DOMString align; - [CEReactions] - attribute unsigned long hspace; - [CEReactions] - attribute unsigned long vspace; - [CEReactions] - attribute DOMString longDesc; - - [CEReactions] - attribute [LegacyNullToEmptyString] DOMString border; -}; - -// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlimageelement-interface -partial interface HTMLImageElement { - // readonly attribute long x; - // readonly attribute long y; -}; diff --git a/components/script/dom/webidls/HTMLInputElement.webidl b/components/script/dom/webidls/HTMLInputElement.webidl deleted file mode 100644 index 724f2cff9b5..00000000000 --- a/components/script/dom/webidls/HTMLInputElement.webidl +++ /dev/null @@ -1,120 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlinputelement -[Exposed=Window] -interface HTMLInputElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString accept; - [CEReactions] - attribute DOMString alt; - // [CEReactions] - // attribute DOMString autocomplete; - // [CEReactions] - // attribute boolean autofocus; - [CEReactions] - attribute boolean defaultChecked; - attribute boolean checked; - [CEReactions] - attribute DOMString dirName; - [CEReactions] - attribute boolean disabled; - readonly attribute HTMLFormElement? form; - attribute FileList? files; - [CEReactions] - attribute DOMString formAction; - [CEReactions] - attribute DOMString formEnctype; - [CEReactions] - attribute DOMString formMethod; - [CEReactions] - attribute boolean formNoValidate; - [CEReactions] - attribute DOMString formTarget; - // [CEReactions] - // attribute unsigned long height; - attribute boolean indeterminate; - // [CEReactions] - // attribute DOMString inputMode; - readonly attribute HTMLDataListElement? list; - [CEReactions] - attribute DOMString max; - [CEReactions, SetterThrows] - attribute long maxLength; - [CEReactions] - attribute DOMString min; - [CEReactions, SetterThrows] - attribute long minLength; - [CEReactions] - attribute boolean multiple; - [CEReactions] - attribute DOMString name; - [CEReactions] - attribute DOMString pattern; - [CEReactions] - attribute DOMString placeholder; - [CEReactions] - attribute boolean readOnly; - [CEReactions] - attribute boolean required; - [CEReactions, SetterThrows] - attribute unsigned long size; - [CEReactions] - attribute USVString src; - [CEReactions] - attribute DOMString step; - [CEReactions] - attribute DOMString type; - [CEReactions] - attribute DOMString defaultValue; - [CEReactions, SetterThrows] - attribute [LegacyNullToEmptyString] DOMString value; - [SetterThrows] - attribute object? valueAsDate; - [SetterThrows] - attribute unrestricted double valueAsNumber; - // [CEReactions] - // attribute unsigned long width; - - [Throws] undefined stepUp(optional long n = 1); - [Throws] undefined stepDown(optional long n = 1); - - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - boolean reportValidity(); - undefined setCustomValidity(DOMString error); - - readonly attribute NodeList? labels; - - undefined select(); - [SetterThrows] - attribute unsigned long? selectionStart; - [SetterThrows] - attribute unsigned long? selectionEnd; - [SetterThrows] - attribute DOMString? selectionDirection; - [Throws] - undefined setRangeText(DOMString replacement); - [Throws] - undefined setRangeText(DOMString replacement, unsigned long start, unsigned long end, - optional SelectionMode selectionMode = "preserve"); - [Throws] - undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); - - // also has obsolete members - - // Select with file-system paths for testing purpose - [Pref="dom_testing_html_input_element_select_files_enabled"] - undefined selectFiles(sequence<DOMString> path); -}; - -// https://html.spec.whatwg.org/multipage/#HTMLInputElement-partial -partial interface HTMLInputElement { - // attribute DOMString align; - // attribute DOMString useMap; -}; diff --git a/components/script/dom/webidls/HTMLLIElement.webidl b/components/script/dom/webidls/HTMLLIElement.webidl deleted file mode 100644 index e5c7e68c874..00000000000 --- a/components/script/dom/webidls/HTMLLIElement.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmllielement -[Exposed=Window] -interface HTMLLIElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute long value; - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLLIElement-partial -partial interface HTMLLIElement { - // [CEReactions] - // attribute DOMString type; -}; diff --git a/components/script/dom/webidls/HTMLLabelElement.webidl b/components/script/dom/webidls/HTMLLabelElement.webidl deleted file mode 100644 index 228e45fc7c4..00000000000 --- a/components/script/dom/webidls/HTMLLabelElement.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmllabelelement -[Exposed=Window] -interface HTMLLabelElement : HTMLElement { - [HTMLConstructor] constructor(); - - readonly attribute HTMLFormElement? form; - [CEReactions] - attribute DOMString htmlFor; - readonly attribute HTMLElement? control; -}; diff --git a/components/script/dom/webidls/HTMLLegendElement.webidl b/components/script/dom/webidls/HTMLLegendElement.webidl deleted file mode 100644 index 1ef2a8fd701..00000000000 --- a/components/script/dom/webidls/HTMLLegendElement.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmllegendelement -[Exposed=Window] -interface HTMLLegendElement : HTMLElement { - [HTMLConstructor] constructor(); - - readonly attribute HTMLFormElement? form; - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLLegendElement-partial -partial interface HTMLLegendElement { - // [CEReactions] - // attribute DOMString align; -}; diff --git a/components/script/dom/webidls/HTMLLinkElement.webidl b/components/script/dom/webidls/HTMLLinkElement.webidl deleted file mode 100644 index 31590a8dc04..00000000000 --- a/components/script/dom/webidls/HTMLLinkElement.webidl +++ /dev/null @@ -1,40 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmllinkelement -[Exposed=Window] -interface HTMLLinkElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute USVString href; - [CEReactions] - attribute DOMString? crossOrigin; - [CEReactions] - attribute DOMString rel; - [SameObject, PutForwards=value] readonly attribute DOMTokenList relList; - [CEReactions] - attribute DOMString media; - [CEReactions] - attribute DOMString hreflang; - [CEReactions] - attribute DOMString type; - [CEReactions] - attribute DOMString integrity; - [CEReactions] - attribute DOMString referrerPolicy; - - // also has obsolete members -}; -HTMLLinkElement includes LinkStyle; - -// https://html.spec.whatwg.org/multipage/#HTMLLinkElement-partial -partial interface HTMLLinkElement { - [CEReactions] - attribute DOMString charset; - [CEReactions] - attribute DOMString rev; - [CEReactions] - attribute DOMString target; -}; diff --git a/components/script/dom/webidls/HTMLMapElement.webidl b/components/script/dom/webidls/HTMLMapElement.webidl deleted file mode 100644 index 44c397948fd..00000000000 --- a/components/script/dom/webidls/HTMLMapElement.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlmapelement -[Exposed=Window] -interface HTMLMapElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute DOMString name; - // readonly attribute HTMLCollection areas; - // readonly attribute HTMLCollection images; -}; diff --git a/components/script/dom/webidls/HTMLMediaElement.webidl b/components/script/dom/webidls/HTMLMediaElement.webidl deleted file mode 100644 index a2c7866a3fe..00000000000 --- a/components/script/dom/webidls/HTMLMediaElement.webidl +++ /dev/null @@ -1,66 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlmediaelement - -enum CanPlayTypeResult { "" /* empty string */, "maybe", "probably" }; -typedef (MediaStream /*or MediaSource */ or Blob) MediaProvider; - -[Exposed=Window, Abstract] -interface HTMLMediaElement : HTMLElement { - // error state - readonly attribute MediaError? error; - - // network state - [CEReactions] attribute USVString src; - attribute MediaProvider? srcObject; - readonly attribute USVString currentSrc; - [CEReactions] attribute DOMString? crossOrigin; - const unsigned short NETWORK_EMPTY = 0; - const unsigned short NETWORK_IDLE = 1; - const unsigned short NETWORK_LOADING = 2; - const unsigned short NETWORK_NO_SOURCE = 3; - readonly attribute unsigned short networkState; - [CEReactions] attribute DOMString preload; - readonly attribute TimeRanges buffered; - undefined load(); - CanPlayTypeResult canPlayType(DOMString type); - - // ready state - const unsigned short HAVE_NOTHING = 0; - const unsigned short HAVE_METADATA = 1; - const unsigned short HAVE_CURRENT_DATA = 2; - const unsigned short HAVE_FUTURE_DATA = 3; - const unsigned short HAVE_ENOUGH_DATA = 4; - readonly attribute unsigned short readyState; - readonly attribute boolean seeking; - - // playback state - attribute double currentTime; - undefined fastSeek(double time); - readonly attribute unrestricted double duration; - // Date getStartDate(); - readonly attribute boolean paused; - [Throws] attribute double defaultPlaybackRate; - [Throws] attribute double playbackRate; - readonly attribute TimeRanges played; - // readonly attribute TimeRanges seekable; - readonly attribute boolean ended; - [CEReactions] attribute boolean autoplay; - [CEReactions] attribute boolean loop; - Promise<undefined> play(); - undefined pause(); - - // controls - [CEReactions] attribute boolean controls; - [Throws] attribute double volume; - attribute boolean muted; - [CEReactions] attribute boolean defaultMuted; - - // tracks - readonly attribute AudioTrackList audioTracks; - readonly attribute VideoTrackList videoTracks; - readonly attribute TextTrackList textTracks; - TextTrack addTextTrack(TextTrackKind kind, optional DOMString label = "", optional DOMString language = ""); -}; diff --git a/components/script/dom/webidls/HTMLMenuElement.webidl b/components/script/dom/webidls/HTMLMenuElement.webidl deleted file mode 100644 index be638bd4d88..00000000000 --- a/components/script/dom/webidls/HTMLMenuElement.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlmenuelement -[Exposed=Window] -interface HTMLMenuElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLMenuElement-partial -partial interface HTMLMenuElement { - [CEReactions] - attribute boolean compact; -}; diff --git a/components/script/dom/webidls/HTMLMetaElement.webidl b/components/script/dom/webidls/HTMLMetaElement.webidl deleted file mode 100644 index b1544245a75..00000000000 --- a/components/script/dom/webidls/HTMLMetaElement.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlmetaelement -[Exposed=Window] -interface HTMLMetaElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString name; - [CEReactions] - attribute DOMString httpEquiv; - [CEReactions] - attribute DOMString content; - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLMetaElement-partial -partial interface HTMLMetaElement { - // [CEReactions] - // attribute DOMString scheme; -}; diff --git a/components/script/dom/webidls/HTMLMeterElement.webidl b/components/script/dom/webidls/HTMLMeterElement.webidl deleted file mode 100644 index 23e6bc16b3e..00000000000 --- a/components/script/dom/webidls/HTMLMeterElement.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlmeterelement -[Exposed=Window] -interface HTMLMeterElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute double value; - [CEReactions] - attribute double min; - [CEReactions] - attribute double max; - [CEReactions] - attribute double low; - [CEReactions] - attribute double high; - [CEReactions] - attribute double optimum; - readonly attribute NodeList labels; -}; diff --git a/components/script/dom/webidls/HTMLModElement.webidl b/components/script/dom/webidls/HTMLModElement.webidl deleted file mode 100644 index 6d26249c447..00000000000 --- a/components/script/dom/webidls/HTMLModElement.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlmodelement -[Exposed=Window] -interface HTMLModElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute DOMString cite; - // [CEReactions] - // attribute DOMString dateTime; -}; diff --git a/components/script/dom/webidls/HTMLOListElement.webidl b/components/script/dom/webidls/HTMLOListElement.webidl deleted file mode 100644 index 3739d6d98af..00000000000 --- a/components/script/dom/webidls/HTMLOListElement.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlolistelement -[Exposed=Window] -interface HTMLOListElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute boolean reversed; - // [CEReactions] - // attribute long start; - // [CEReactions] - // attribute DOMString type; - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLOListElement-partial -partial interface HTMLOListElement { - // [CEReactions] - // attribute boolean compact; -}; diff --git a/components/script/dom/webidls/HTMLObjectElement.webidl b/components/script/dom/webidls/HTMLObjectElement.webidl deleted file mode 100644 index fc7db3fe43f..00000000000 --- a/components/script/dom/webidls/HTMLObjectElement.webidl +++ /dev/null @@ -1,53 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlobjectelement -[Exposed=Window] -interface HTMLObjectElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute DOMString data; - [CEReactions] - attribute DOMString type; - // [CEReactions] - // attribute boolean typeMustMatch; - // [CEReactions] - // attribute DOMString name; - // [CEReactions] - // attribute DOMString useMap; - readonly attribute HTMLFormElement? form; - // [CEReactions] - // attribute DOMString width; - // [CEReactions] - // attribute DOMString height; - //readonly attribute Document? contentDocument; - //readonly attribute WindowProxy? contentWindow; - - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - boolean reportValidity(); - undefined setCustomValidity(DOMString error); - - //legacycaller any (any... arguments); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLObjectElement-partial -partial interface HTMLObjectElement { - // attribute DOMString align; - // attribute DOMString archive; - // attribute DOMString code; - // attribute boolean declare; - // attribute unsigned long hspace; - // attribute DOMString standby; - // attribute unsigned long vspace; - // attribute DOMString codeBase; - // attribute DOMString codeType; - - //[LegacyNullToEmptyString] attribute DOMString border; -}; diff --git a/components/script/dom/webidls/HTMLOptGroupElement.webidl b/components/script/dom/webidls/HTMLOptGroupElement.webidl deleted file mode 100644 index afa11148cd5..00000000000 --- a/components/script/dom/webidls/HTMLOptGroupElement.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmloptgroupelement -[Exposed=Window] -interface HTMLOptGroupElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute boolean disabled; - // [CEReactions] - // attribute DOMString label; -}; diff --git a/components/script/dom/webidls/HTMLOptionElement.webidl b/components/script/dom/webidls/HTMLOptionElement.webidl deleted file mode 100644 index a10761c2428..00000000000 --- a/components/script/dom/webidls/HTMLOptionElement.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmloptionelement -[Exposed=Window, LegacyFactoryFunction=Option(optional DOMString text = "", optional DOMString value, - optional boolean defaultSelected = false, - optional boolean selected = false)] -interface HTMLOptionElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute boolean disabled; - readonly attribute HTMLFormElement? form; - [CEReactions] - attribute DOMString label; - [CEReactions] - attribute boolean defaultSelected; - attribute boolean selected; - [CEReactions] - attribute DOMString value; - - [CEReactions] - attribute DOMString text; - readonly attribute long index; -}; diff --git a/components/script/dom/webidls/HTMLOptionsCollection.webidl b/components/script/dom/webidls/HTMLOptionsCollection.webidl deleted file mode 100644 index c2b8baa24d6..00000000000 --- a/components/script/dom/webidls/HTMLOptionsCollection.webidl +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmloptionscollection -[Exposed=Window] -interface HTMLOptionsCollection : HTMLCollection { - // inherits item(), namedItem() - [CEReactions] - attribute unsigned long length; // shadows inherited length - [CEReactions, Throws] - setter undefined (unsigned long index, HTMLOptionElement? option); - [CEReactions, Throws] - undefined add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null); - [CEReactions] - undefined remove(long index); - attribute long selectedIndex; -}; diff --git a/components/script/dom/webidls/HTMLOrSVGElement.webidl b/components/script/dom/webidls/HTMLOrSVGElement.webidl deleted file mode 100644 index 634dd3bc6bb..00000000000 --- a/components/script/dom/webidls/HTMLOrSVGElement.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://html.spec.whatwg.org/multipage/#htmlorsvgelement - * - * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -interface mixin HTMLOrSVGElement { - // [SameObject] readonly attribute DOMStringMap dataset; - // attribute DOMString nonce; // intentionally no [CEReactions] - - [CEReactions] attribute boolean autofocus; - // [CEReactions] attribute long tabIndex; - // undefined focus(optional FocusOptions options = {}); - // undefined blur(); -}; diff --git a/components/script/dom/webidls/HTMLOutputElement.webidl b/components/script/dom/webidls/HTMLOutputElement.webidl deleted file mode 100644 index 403938ad8f8..00000000000 --- a/components/script/dom/webidls/HTMLOutputElement.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmloutputelement -[Exposed=Window] -interface HTMLOutputElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [SameObject, PutForwards=value] readonly attribute DOMTokenList htmlFor; - readonly attribute HTMLFormElement? form; - [CEReactions] - attribute DOMString name; - - [Pure] readonly attribute DOMString type; - [CEReactions] - attribute DOMString defaultValue; - [CEReactions] - attribute DOMString value; - - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - boolean reportValidity(); - undefined setCustomValidity(DOMString error); - - readonly attribute NodeList labels; -}; diff --git a/components/script/dom/webidls/HTMLParagraphElement.webidl b/components/script/dom/webidls/HTMLParagraphElement.webidl deleted file mode 100644 index d42533b9ef9..00000000000 --- a/components/script/dom/webidls/HTMLParagraphElement.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlparagraphelement -[Exposed=Window] -interface HTMLParagraphElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLParagraphElement-partial -partial interface HTMLParagraphElement { - // [CEReactions] - // attribute DOMString align; -}; diff --git a/components/script/dom/webidls/HTMLParamElement.webidl b/components/script/dom/webidls/HTMLParamElement.webidl deleted file mode 100644 index 4539b3b8474..00000000000 --- a/components/script/dom/webidls/HTMLParamElement.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlparamelement -[Exposed=Window] -interface HTMLParamElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute DOMString name; - // [CEReactions] - // attribute DOMString value; - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLParamElement-partial -partial interface HTMLParamElement { - // [CEReactions] - // attribute DOMString type; - // [CEReactions] - // attribute DOMString valueType; -}; diff --git a/components/script/dom/webidls/HTMLPictureElement.webidl b/components/script/dom/webidls/HTMLPictureElement.webidl deleted file mode 100644 index d03377ee541..00000000000 --- a/components/script/dom/webidls/HTMLPictureElement.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlpictureelement -[Exposed=Window] -interface HTMLPictureElement : HTMLElement { - [HTMLConstructor] constructor(); -}; diff --git a/components/script/dom/webidls/HTMLPreElement.webidl b/components/script/dom/webidls/HTMLPreElement.webidl deleted file mode 100644 index b159f0c76ae..00000000000 --- a/components/script/dom/webidls/HTMLPreElement.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlpreelement -[Exposed=Window] -interface HTMLPreElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLPreElement-partial -partial interface HTMLPreElement { - [CEReactions] attribute long width; -}; diff --git a/components/script/dom/webidls/HTMLProgressElement.webidl b/components/script/dom/webidls/HTMLProgressElement.webidl deleted file mode 100644 index 0c25d86977a..00000000000 --- a/components/script/dom/webidls/HTMLProgressElement.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlprogresselement -[Exposed=Window] -interface HTMLProgressElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute double value; - [CEReactions] - attribute double max; - readonly attribute double position; - readonly attribute NodeList labels; -}; diff --git a/components/script/dom/webidls/HTMLQuoteElement.webidl b/components/script/dom/webidls/HTMLQuoteElement.webidl deleted file mode 100644 index 8bc30cdb4c1..00000000000 --- a/components/script/dom/webidls/HTMLQuoteElement.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlquoteelement -[Exposed=Window] -interface HTMLQuoteElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute USVString cite; -}; diff --git a/components/script/dom/webidls/HTMLScriptElement.webidl b/components/script/dom/webidls/HTMLScriptElement.webidl deleted file mode 100644 index b79382dbbb8..00000000000 --- a/components/script/dom/webidls/HTMLScriptElement.webidl +++ /dev/null @@ -1,40 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlscriptelement -[Exposed=Window] -interface HTMLScriptElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute USVString src; - [CEReactions] - attribute DOMString type; - [CEReactions] - attribute boolean noModule; - [CEReactions] - attribute DOMString charset; - [CEReactions] - attribute boolean async; - [CEReactions] - attribute boolean defer; - [CEReactions] - attribute DOMString? crossOrigin; - [CEReactions, Pure] - attribute DOMString text; - [CEReactions] - attribute DOMString integrity; - [CEReactions] - attribute DOMString referrerPolicy; - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLScriptElement-partial -partial interface HTMLScriptElement { - [CEReactions] - attribute DOMString event; - [CEReactions] - attribute DOMString htmlFor; -}; diff --git a/components/script/dom/webidls/HTMLSelectElement.webidl b/components/script/dom/webidls/HTMLSelectElement.webidl deleted file mode 100644 index d73c1737c8d..00000000000 --- a/components/script/dom/webidls/HTMLSelectElement.webidl +++ /dev/null @@ -1,52 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlselectelement -[Exposed=Window] -interface HTMLSelectElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute boolean autofocus; - [CEReactions] - attribute boolean disabled; - readonly attribute HTMLFormElement? form; - [CEReactions] - attribute boolean multiple; - [CEReactions] - attribute DOMString name; - [CEReactions] - attribute boolean required; - [CEReactions] - attribute unsigned long size; - - readonly attribute DOMString type; - - readonly attribute HTMLOptionsCollection options; - [CEReactions] - attribute unsigned long length; - getter Element? item(unsigned long index); - HTMLOptionElement? namedItem(DOMString name); - - [CEReactions, Throws] - undefined add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null); - [CEReactions] - undefined remove(); // ChildNode overload - [CEReactions] - undefined remove(long index); - [CEReactions, Throws] setter undefined (unsigned long index, HTMLOptionElement? option); - - // readonly attribute HTMLCollection selectedOptions; - attribute long selectedIndex; - attribute DOMString value; - - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - boolean reportValidity(); - undefined setCustomValidity(DOMString error); - - readonly attribute NodeList labels; -}; diff --git a/components/script/dom/webidls/HTMLSlotElement.webidl b/components/script/dom/webidls/HTMLSlotElement.webidl deleted file mode 100644 index bec872ab1fc..00000000000 --- a/components/script/dom/webidls/HTMLSlotElement.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-slot-element -[Exposed=Window] -interface HTMLSlotElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] attribute DOMString name; - sequence<Node> assignedNodes(optional AssignedNodesOptions options = {}); - sequence<Element> assignedElements(optional AssignedNodesOptions options = {}); - undefined assign((Element or Text)... nodes); -}; - -dictionary AssignedNodesOptions { - boolean flatten = false; -}; - -// https://dom.spec.whatwg.org/#mixin-slotable -interface mixin Slottable { - readonly attribute HTMLSlotElement? assignedSlot; -}; -Element includes Slottable; -Text includes Slottable; diff --git a/components/script/dom/webidls/HTMLSourceElement.webidl b/components/script/dom/webidls/HTMLSourceElement.webidl deleted file mode 100644 index 92f75ff5995..00000000000 --- a/components/script/dom/webidls/HTMLSourceElement.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlsourceelement -[Exposed=Window] -interface HTMLSourceElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString src; - [CEReactions] - attribute DOMString type; - [CEReactions] - attribute DOMString srcset; - [CEReactions] - attribute DOMString sizes; - [CEReactions] - attribute DOMString media; -}; diff --git a/components/script/dom/webidls/HTMLSpanElement.webidl b/components/script/dom/webidls/HTMLSpanElement.webidl deleted file mode 100644 index 2645cd7678b..00000000000 --- a/components/script/dom/webidls/HTMLSpanElement.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlspanelement -[Exposed=Window] -interface HTMLSpanElement : HTMLElement { - [HTMLConstructor] constructor(); -}; diff --git a/components/script/dom/webidls/HTMLStyleElement.webidl b/components/script/dom/webidls/HTMLStyleElement.webidl deleted file mode 100644 index a5ed437de19..00000000000 --- a/components/script/dom/webidls/HTMLStyleElement.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlstyleelement -[Exposed=Window] -interface HTMLStyleElement : HTMLElement { - [HTMLConstructor] constructor(); - - attribute boolean disabled; - // [CEReactions] - // attribute DOMString media; - - [CEReactions] attribute DOMString type; - - // [CEReactions] - // attribute boolean scoped; -}; -HTMLStyleElement includes LinkStyle; diff --git a/components/script/dom/webidls/HTMLTableCaptionElement.webidl b/components/script/dom/webidls/HTMLTableCaptionElement.webidl deleted file mode 100644 index e834be183c8..00000000000 --- a/components/script/dom/webidls/HTMLTableCaptionElement.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltablecaptionelement -[Exposed=Window] -interface HTMLTableCaptionElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLTableCaptionElement-partial -partial interface HTMLTableCaptionElement { - // [CEReactions] - // attribute DOMString align; -}; diff --git a/components/script/dom/webidls/HTMLTableCellElement.webidl b/components/script/dom/webidls/HTMLTableCellElement.webidl deleted file mode 100644 index 7ec277d5bda..00000000000 --- a/components/script/dom/webidls/HTMLTableCellElement.webidl +++ /dev/null @@ -1,47 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltablecellelement -[Exposed=Window] -interface HTMLTableCellElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute unsigned long colSpan; - [CEReactions] - attribute unsigned long rowSpan; - // [CEReactions] - // attribute DOMString headers; - readonly attribute long cellIndex; - - // [CEReactions] - // attribute DOMString scope; // only conforming for th elements - // [CEReactions] - // attribute DOMString abbr; // only conforming for th elements - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLTableCellElement-partial -partial interface HTMLTableCellElement { - // [CEReactions] - // attribute DOMString align; - // [CEReactions] - // attribute DOMString axis; - // [CEReactions] - // attribute DOMString height; - [CEReactions] - attribute DOMString width; - - // attribute DOMString ch; - // [CEReactions] - // attribute DOMString chOff; - // [CEReactions] - // attribute boolean noWrap; - // [CEReactions] - // attribute DOMString vAlign; - - [CEReactions] - attribute [LegacyNullToEmptyString] DOMString bgColor; -}; diff --git a/components/script/dom/webidls/HTMLTableColElement.webidl b/components/script/dom/webidls/HTMLTableColElement.webidl deleted file mode 100644 index efb50baaa21..00000000000 --- a/components/script/dom/webidls/HTMLTableColElement.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltablecolelement -[Exposed=Window] -interface HTMLTableColElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute unsigned long span; - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLTableColElement-partial -partial interface HTMLTableColElement { - // [CEReactions] - // attribute DOMString align; - // [CEReactions] - // attribute DOMString ch; - // [CEReactions] - // attribute DOMString chOff; - // [CEReactions] - // attribute DOMString vAlign; - // [CEReactions] - // attribute DOMString width; -}; diff --git a/components/script/dom/webidls/HTMLTableElement.webidl b/components/script/dom/webidls/HTMLTableElement.webidl deleted file mode 100644 index c9342cc2722..00000000000 --- a/components/script/dom/webidls/HTMLTableElement.webidl +++ /dev/null @@ -1,59 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltableelement -[Exposed=Window] -interface HTMLTableElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions, SetterThrows] - attribute HTMLTableCaptionElement? caption; - HTMLTableCaptionElement createCaption(); - [CEReactions] - undefined deleteCaption(); - - [CEReactions, SetterThrows] - attribute HTMLTableSectionElement? tHead; - HTMLTableSectionElement createTHead(); - [CEReactions] - undefined deleteTHead(); - - [CEReactions, SetterThrows] - attribute HTMLTableSectionElement? tFoot; - HTMLTableSectionElement createTFoot(); - [CEReactions] - undefined deleteTFoot(); - - readonly attribute HTMLCollection tBodies; - HTMLTableSectionElement createTBody(); - - readonly attribute HTMLCollection rows; - [Throws] HTMLTableRowElement insertRow(optional long index = -1); - [CEReactions, Throws] undefined deleteRow(long index); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLTableElement-partial -partial interface HTMLTableElement { - // [CEReactions] - // attribute DOMString align; - // [CEReactions] - // attribute DOMString border; - // [CEReactions] - // attribute DOMString frame; - // [CEReactions] - // attribute DOMString rules; - // [CEReactions] - // attribute DOMString summary; - [CEReactions] - attribute DOMString width; - - [CEReactions] - attribute [LegacyNullToEmptyString] DOMString bgColor; - // [CEReactions, LegacyNullToEmptyString] - // attribute DOMString cellPadding; - // [CEReactions, LegacyNullToEmptyString] - // attribute DOMString cellSpacing; -}; diff --git a/components/script/dom/webidls/HTMLTableRowElement.webidl b/components/script/dom/webidls/HTMLTableRowElement.webidl deleted file mode 100644 index 00d3fecd9e1..00000000000 --- a/components/script/dom/webidls/HTMLTableRowElement.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltablerowelement -[Exposed=Window] -interface HTMLTableRowElement : HTMLElement { - [HTMLConstructor] constructor(); - - readonly attribute long rowIndex; - readonly attribute long sectionRowIndex; - readonly attribute HTMLCollection cells; - [Throws] - HTMLElement insertCell(optional long index = -1); - [CEReactions, Throws] - undefined deleteCell(long index); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLTableRowElement-partial -partial interface HTMLTableRowElement { - // [CEReactions] - // attribute DOMString align; - // [CEReactions] - // attribute DOMString ch; - // [CEReactions] - // attribute DOMString chOff; - // [CEReactions] - // attribute DOMString vAlign; - - [CEReactions] - attribute [LegacyNullToEmptyString] DOMString bgColor; -}; diff --git a/components/script/dom/webidls/HTMLTableSectionElement.webidl b/components/script/dom/webidls/HTMLTableSectionElement.webidl deleted file mode 100644 index acb8f89865e..00000000000 --- a/components/script/dom/webidls/HTMLTableSectionElement.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltablesectionelement -[Exposed=Window] -interface HTMLTableSectionElement : HTMLElement { - [HTMLConstructor] constructor(); - - readonly attribute HTMLCollection rows; - [Throws] - HTMLElement insertRow(optional long index = -1); - [CEReactions, Throws] - undefined deleteRow(long index); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLTableSectionElement-partial -partial interface HTMLTableSectionElement { - // [CEReactions] - // attribute DOMString align; - // [CEReactions] - // attribute DOMString ch; - // [CEReactions] - // attribute DOMString chOff; - // [CEReactions] - // attribute DOMString vAlign; -}; diff --git a/components/script/dom/webidls/HTMLTemplateElement.webidl b/components/script/dom/webidls/HTMLTemplateElement.webidl deleted file mode 100644 index b71d37f4914..00000000000 --- a/components/script/dom/webidls/HTMLTemplateElement.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltemplateelement -[Exposed=Window] -interface HTMLTemplateElement : HTMLElement { - [HTMLConstructor] constructor(); - - readonly attribute DocumentFragment content; -}; diff --git a/components/script/dom/webidls/HTMLTextAreaElement.webidl b/components/script/dom/webidls/HTMLTextAreaElement.webidl deleted file mode 100644 index a8e79095680..00000000000 --- a/components/script/dom/webidls/HTMLTextAreaElement.webidl +++ /dev/null @@ -1,69 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltextareaelement -[Exposed=Window] -interface HTMLTextAreaElement : HTMLElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute DOMString autocomplete; - // [CEReactions] - // attribute boolean autofocus; - [CEReactions, SetterThrows] - attribute unsigned long cols; - [CEReactions] - attribute DOMString dirName; - [CEReactions] - attribute boolean disabled; - readonly attribute HTMLFormElement? form; - // [CEReactions] - // attribute DOMString inputMode; - [CEReactions, SetterThrows] - attribute long maxLength; - [CEReactions, SetterThrows] - attribute long minLength; - [CEReactions] - attribute DOMString name; - [CEReactions] - attribute DOMString placeholder; - [CEReactions] - attribute boolean readOnly; - [CEReactions] - attribute boolean required; - [CEReactions, SetterThrows] - attribute unsigned long rows; - [CEReactions] - attribute DOMString wrap; - - readonly attribute DOMString type; - [CEReactions] - attribute DOMString defaultValue; - attribute [LegacyNullToEmptyString] DOMString value; - readonly attribute unsigned long textLength; - - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - boolean reportValidity(); - undefined setCustomValidity(DOMString error); - - readonly attribute NodeList labels; - - undefined select(); - [SetterThrows] - attribute unsigned long? selectionStart; - [SetterThrows] - attribute unsigned long? selectionEnd; - [SetterThrows] - attribute DOMString? selectionDirection; - [Throws] - undefined setRangeText(DOMString replacement); - [Throws] - undefined setRangeText(DOMString replacement, unsigned long start, unsigned long end, - optional SelectionMode selectionMode = "preserve"); - [Throws] - undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); -}; diff --git a/components/script/dom/webidls/HTMLTimeElement.webidl b/components/script/dom/webidls/HTMLTimeElement.webidl deleted file mode 100644 index 27dbf26cb88..00000000000 --- a/components/script/dom/webidls/HTMLTimeElement.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltimeelement -[Exposed=Window] -interface HTMLTimeElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString dateTime; -}; diff --git a/components/script/dom/webidls/HTMLTitleElement.webidl b/components/script/dom/webidls/HTMLTitleElement.webidl deleted file mode 100644 index 49fc9e0daf4..00000000000 --- a/components/script/dom/webidls/HTMLTitleElement.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltitleelement -[Exposed=Window] -interface HTMLTitleElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions, Pure] - attribute DOMString text; -}; diff --git a/components/script/dom/webidls/HTMLTrackElement.webidl b/components/script/dom/webidls/HTMLTrackElement.webidl deleted file mode 100644 index 350901cf2e9..00000000000 --- a/components/script/dom/webidls/HTMLTrackElement.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmltrackelement -[Exposed=Window] -interface HTMLTrackElement : HTMLElement { - [HTMLConstructor] constructor(); - - [CEReactions] - attribute DOMString kind; - [CEReactions] - attribute USVString src; - [CEReactions] - attribute DOMString srclang; - [CEReactions] - attribute DOMString label; - [CEReactions] - attribute boolean default; - - const unsigned short NONE = 0; - const unsigned short LOADING = 1; - const unsigned short LOADED = 2; - const unsigned short ERROR = 3; - readonly attribute unsigned short readyState; - - readonly attribute TextTrack track; -}; diff --git a/components/script/dom/webidls/HTMLUListElement.webidl b/components/script/dom/webidls/HTMLUListElement.webidl deleted file mode 100644 index ac5f172a010..00000000000 --- a/components/script/dom/webidls/HTMLUListElement.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlulistelement -[Exposed=Window] -interface HTMLUListElement : HTMLElement { - [HTMLConstructor] constructor(); - - // also has obsolete members -}; - -// https://html.spec.whatwg.org/multipage/#HTMLUListElement-partial -partial interface HTMLUListElement { - [CEReactions] - attribute boolean compact; - [CEReactions] - attribute DOMString type; -}; diff --git a/components/script/dom/webidls/HTMLUnknownElement.webidl b/components/script/dom/webidls/HTMLUnknownElement.webidl deleted file mode 100644 index 5e26b34468f..00000000000 --- a/components/script/dom/webidls/HTMLUnknownElement.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://html.spec.whatwg.org/multipage/#htmlunknownelement and - * http://dev.w3.org/csswg/cssom-view/ - * - * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and - * Opera Software ASA. You are granted a license to use, reproduce - * and create derivative works of this document. - */ - -[Exposed=Window] -interface HTMLUnknownElement : HTMLElement { -}; diff --git a/components/script/dom/webidls/HTMLVideoElement.webidl b/components/script/dom/webidls/HTMLVideoElement.webidl deleted file mode 100644 index f4550e9857b..00000000000 --- a/components/script/dom/webidls/HTMLVideoElement.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#htmlvideoelement -[Exposed=Window] -interface HTMLVideoElement : HTMLMediaElement { - [HTMLConstructor] constructor(); - - // [CEReactions] - // attribute unsigned long width; - // [CEReactions] - // attribute unsigned long height; - readonly attribute unsigned long videoWidth; - readonly attribute unsigned long videoHeight; - [CEReactions] attribute DOMString poster; -}; - -partial interface HTMLVideoElement { - [Pref="media_testing_enabled"] - attribute EventHandler onpostershown; -}; diff --git a/components/script/dom/webidls/HashChangeEvent.webidl b/components/script/dom/webidls/HashChangeEvent.webidl deleted file mode 100644 index f225967a138..00000000000 --- a/components/script/dom/webidls/HashChangeEvent.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#hashchangeevent -[Exposed=Window] -interface HashChangeEvent : Event { - [Throws] constructor(DOMString type, optional HashChangeEventInit eventInitDict = {}); - readonly attribute USVString oldURL; - readonly attribute USVString newURL; -}; - -dictionary HashChangeEventInit : EventInit { - USVString oldURL = ""; - USVString newURL = ""; -}; diff --git a/components/script/dom/webidls/Headers.webidl b/components/script/dom/webidls/Headers.webidl deleted file mode 100644 index 5def3e7011e..00000000000 --- a/components/script/dom/webidls/Headers.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://fetch.spec.whatwg.org/#headers-class - -typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit; - -[Exposed=(Window,Worker)] -interface Headers { - [Throws] constructor(optional HeadersInit init); - [Throws] - undefined append(ByteString name, ByteString value); - [Throws] - undefined delete(ByteString name); - [Throws] - ByteString? get(ByteString name); - sequence<ByteString> getSetCookie(); - [Throws] - boolean has(ByteString name); - [Throws] - undefined set(ByteString name, ByteString value); - iterable<ByteString, ByteString>; -}; diff --git a/components/script/dom/webidls/History.webidl b/components/script/dom/webidls/History.webidl deleted file mode 100644 index b54ec98723f..00000000000 --- a/components/script/dom/webidls/History.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// enum ScrollRestoration { "auto", "manual" }; - -// https://html.spec.whatwg.org/multipage/#the-history-interface -[Exposed=(Window,Worker)] -interface History { - [Throws] - readonly attribute unsigned long length; - // [Throws] - // attribute ScrollRestoration scrollRestoration; - [Throws] - readonly attribute any state; - [Throws] - undefined go(optional long delta = 0); - [Throws] - undefined back(); - [Throws] - undefined forward(); - [Throws] - undefined pushState(any data, DOMString title, optional USVString? url = null); - [Throws] - undefined replaceState(any data, DOMString title, optional USVString? url = null); -}; diff --git a/components/script/dom/webidls/IIRFilterNode.webidl b/components/script/dom/webidls/IIRFilterNode.webidl deleted file mode 100644 index 55b15c06f0e..00000000000 --- a/components/script/dom/webidls/IIRFilterNode.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#IIRFilterNode - */ - -[Exposed=Window] -interface IIRFilterNode : AudioNode { - [Throws] constructor (BaseAudioContext context, IIRFilterOptions options); - [Throws] undefined getFrequencyResponse ( - Float32Array frequencyHz, - Float32Array magResponse, - Float32Array phaseResponse - ); -}; - -dictionary IIRFilterOptions : AudioNodeOptions { - required sequence<double> feedforward; - required sequence<double> feedback; -}; diff --git a/components/script/dom/webidls/ImageBitmap.webidl b/components/script/dom/webidls/ImageBitmap.webidl deleted file mode 100644 index aaa35c67995..00000000000 --- a/components/script/dom/webidls/ImageBitmap.webidl +++ /dev/null @@ -1,36 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://html.spec.whatwg.org/multipage/#imagebitmap - * - * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA. - * You are granted a license to use, reproduce and create derivative works of this document. - */ - -//[Exposed=(Window,Worker), Serializable, Transferable] -[Exposed=(Window,Worker), Pref="dom_imagebitmap_enabled"] -interface ImageBitmap { - readonly attribute unsigned long width; - readonly attribute unsigned long height; - undefined close(); -}; - -typedef (CanvasImageSource or - Blob or - ImageData) ImageBitmapSource; - -enum ImageOrientation { "from-image", "flipY" }; -enum PremultiplyAlpha { "none", "premultiply", "default" }; -enum ColorSpaceConversion { "none", "default" }; -enum ResizeQuality { "pixelated", "low", "medium", "high" }; - -dictionary ImageBitmapOptions { - ImageOrientation imageOrientation = "from-image"; - PremultiplyAlpha premultiplyAlpha = "default"; - ColorSpaceConversion colorSpaceConversion = "default"; - [EnforceRange] unsigned long resizeWidth; - [EnforceRange] unsigned long resizeHeight; - ResizeQuality resizeQuality = "low"; -}; diff --git a/components/script/dom/webidls/InputEvent.webidl b/components/script/dom/webidls/InputEvent.webidl deleted file mode 100644 index 58699b643fa..00000000000 --- a/components/script/dom/webidls/InputEvent.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/uievents/#idl-inputevent - * - */ - -// https://w3c.github.io/uievents/#idl-inputevent -[Exposed=Window] -interface InputEvent : UIEvent { - [Throws] constructor(DOMString type, optional InputEventInit eventInitDict = {}); - readonly attribute DOMString? data; - readonly attribute boolean isComposing; -}; - -// https://w3c.github.io/uievents/#idl-inputeventinit -dictionary InputEventInit : UIEventInit { - DOMString? data = null; - boolean isComposing = false; -}; diff --git a/components/script/dom/webidls/IntersectionObserver.webidl b/components/script/dom/webidls/IntersectionObserver.webidl deleted file mode 100644 index 9607864408e..00000000000 --- a/components/script/dom/webidls/IntersectionObserver.webidl +++ /dev/null @@ -1,32 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/IntersectionObserver/#intersection-observer-interface - -callback IntersectionObserverCallback = - undefined (sequence<IntersectionObserverEntry> entries, IntersectionObserver observer); - -dictionary IntersectionObserverInit { - (Element or Document)? root = null; - DOMString rootMargin; - DOMString scrollMargin; - (double or sequence<double>) threshold; - long delay; - boolean trackVisibility = false; -}; - -[Pref="dom_intersection_observer_enabled", Exposed=(Window)] -interface IntersectionObserver { - constructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options = {}); - readonly attribute (Element or Document)? root; - readonly attribute DOMString rootMargin; - readonly attribute DOMString scrollMargin; - readonly attribute /* FrozenArray<double> */ any thresholds; - readonly attribute long delay; - readonly attribute boolean trackVisibility; - undefined observe(Element target); - undefined unobserve(Element target); - undefined disconnect(); - sequence<IntersectionObserverEntry> takeRecords(); -}; diff --git a/components/script/dom/webidls/IntersectionObserverEntry.webidl b/components/script/dom/webidls/IntersectionObserverEntry.webidl deleted file mode 100644 index 5e9423a965c..00000000000 --- a/components/script/dom/webidls/IntersectionObserverEntry.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/IntersectionObserver/#intersection-observer-entry - -[Pref="dom_intersection_observer_enabled", Exposed=(Window)] -interface IntersectionObserverEntry { - constructor(IntersectionObserverEntryInit intersectionObserverEntryInit); - readonly attribute DOMHighResTimeStamp time; - readonly attribute DOMRectReadOnly? rootBounds; - readonly attribute DOMRectReadOnly boundingClientRect; - readonly attribute DOMRectReadOnly intersectionRect; - readonly attribute boolean isIntersecting; - readonly attribute boolean isVisible; - readonly attribute double intersectionRatio; - readonly attribute Element target; -}; - -dictionary IntersectionObserverEntryInit { - required DOMHighResTimeStamp time; - required DOMRectInit rootBounds; - required DOMRectInit boundingClientRect; - required DOMRectInit intersectionRect; - required boolean isIntersecting; - required boolean isVisible; - required double intersectionRatio; - required Element target; -}; diff --git a/components/script/dom/webidls/IterableIterator.webidl b/components/script/dom/webidls/IterableIterator.webidl deleted file mode 100644 index 25b8aae881e..00000000000 --- a/components/script/dom/webidls/IterableIterator.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -dictionary IterableKeyOrValueResult { - any value; - boolean done = false; -}; - -dictionary IterableKeyAndValueResult { - sequence<any> value; - boolean done = false; -}; diff --git a/components/script/dom/webidls/KeyboardEvent.webidl b/components/script/dom/webidls/KeyboardEvent.webidl deleted file mode 100644 index 9bddcb03a56..00000000000 --- a/components/script/dom/webidls/KeyboardEvent.webidl +++ /dev/null @@ -1,60 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/uievents/#interface-keyboardevent - * - */ - -[Exposed=Window] -interface KeyboardEvent : UIEvent { - [Throws] constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict = {}); - // KeyLocationCode - const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00; - const unsigned long DOM_KEY_LOCATION_LEFT = 0x01; - const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02; - const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03; - readonly attribute DOMString key; - readonly attribute DOMString code; - readonly attribute unsigned long location; - readonly attribute boolean ctrlKey; - readonly attribute boolean shiftKey; - readonly attribute boolean altKey; - readonly attribute boolean metaKey; - readonly attribute boolean repeat; - readonly attribute boolean isComposing; - boolean getModifierState (DOMString keyArg); -}; - -// https://w3c.github.io/uievents/#idl-interface-KeyboardEvent-initializers -partial interface KeyboardEvent { - // Originally introduced (and deprecated) in DOM Level 3 - undefined initKeyboardEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, - DOMString keyArg, unsigned long locationArg, DOMString modifiersListArg, - boolean repeat, DOMString locale); -}; - -// https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent -partial interface KeyboardEvent { - // The following support legacy user agents - readonly attribute unsigned long charCode; - readonly attribute unsigned long keyCode; - readonly attribute unsigned long which; -}; - -// https://w3c.github.io/uievents/#dictdef-keyboardeventinit -dictionary KeyboardEventInit : EventModifierInit { - DOMString key = ""; - DOMString code = ""; - unsigned long location = 0; - boolean repeat = false; - boolean isComposing = false; -}; - -// https://w3c.github.io/uievents/#legacy-dictionary-KeyboardEventInit -/*partial dictionary KeyboardEventInit { - unsigned long charCode = 0; - unsigned long keyCode = 0; - unsigned long which = 0; -};*/ diff --git a/components/script/dom/webidls/Location.webidl b/components/script/dom/webidls/Location.webidl deleted file mode 100644 index 6c5833cfdcf..00000000000 --- a/components/script/dom/webidls/Location.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#location -[Exposed=Window, LegacyUnforgeable] interface Location { - [Throws, CrossOriginWritable] - stringifier attribute USVString href; - [Throws] readonly attribute USVString origin; - [Throws] attribute USVString protocol; - [Throws] attribute USVString host; - [Throws] attribute USVString hostname; - [Throws] attribute USVString port; - [Throws] attribute USVString pathname; - [Throws] attribute USVString search; - [Throws] attribute USVString hash; - - [Throws] undefined assign(USVString url); - [Throws, CrossOriginCallable] - undefined replace(USVString url); - [Throws] undefined reload(); - - //[SameObject] readonly attribute USVString[] ancestorOrigins; -}; diff --git a/components/script/dom/webidls/MediaDeviceInfo.webidl b/components/script/dom/webidls/MediaDeviceInfo.webidl deleted file mode 100644 index d6caaa43499..00000000000 --- a/components/script/dom/webidls/MediaDeviceInfo.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - - // https://w3c.github.io/mediacapture-main/#device-info - -[Exposed=Window, -SecureContext, Pref="dom_webrtc_enabled"] -interface MediaDeviceInfo { - readonly attribute DOMString deviceId; - readonly attribute MediaDeviceKind kind; - readonly attribute DOMString label; - readonly attribute DOMString groupId; - [Default] object toJSON(); -}; - -enum MediaDeviceKind { - "audioinput", - "audiooutput", - "videoinput" -}; diff --git a/components/script/dom/webidls/MediaDevices.webidl b/components/script/dom/webidls/MediaDevices.webidl deleted file mode 100644 index 8d14e60abb5..00000000000 --- a/components/script/dom/webidls/MediaDevices.webidl +++ /dev/null @@ -1,86 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/mediacapture-main/#dom-mediadevices - -[Exposed=Window, -SecureContext, Pref="dom_webrtc_enabled"] -interface MediaDevices : EventTarget { - // attribute EventHandler ondevicechange; - Promise<sequence<MediaDeviceInfo>> enumerateDevices(); -}; - -partial interface Navigator { - // [SameObject, SecureContext] - [Pref="dom_webrtc_enabled"] readonly attribute MediaDevices mediaDevices; -}; - -partial interface MediaDevices { - // MediaTrackSupportedConstraints getSupportedConstraints(); - Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints = {}); -}; - - -dictionary MediaStreamConstraints { - (boolean or MediaTrackConstraints) video = false; - (boolean or MediaTrackConstraints) audio = false; -}; - -dictionary DoubleRange { - double max; - double min; -}; - -dictionary ConstrainDoubleRange : DoubleRange { - double exact; - double ideal; -}; - -dictionary ULongRange { - [Clamp] unsigned long max; - [Clamp] unsigned long min; -}; - -dictionary ConstrainULongRange : ULongRange { - [Clamp] unsigned long exact; - [Clamp] unsigned long ideal; -}; - -// dictionary ConstrainBooleanParameters { -// boolean exact; -// boolean ideal; -// }; - -// dictionary ConstrainDOMStringParameters { -// (DOMString or sequence<DOMString>) exact; -// (DOMString or sequence<DOMString>) ideal; -// }; - -dictionary MediaTrackConstraints : MediaTrackConstraintSet { - sequence<MediaTrackConstraintSet> advanced; -}; - -typedef ([Clamp] unsigned long or ConstrainULongRange) ConstrainULong; -typedef (double or ConstrainDoubleRange) ConstrainDouble; -// typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean; -// typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString; - -dictionary MediaTrackConstraintSet { - ConstrainULong width; - ConstrainULong height; - ConstrainDouble aspectRatio; - ConstrainDouble frameRate; - // ConstrainDOMString facingMode; - // ConstrainDOMString resizeMode; - // ConstrainDouble volume; - ConstrainULong sampleRate; - // ConstrainULong sampleSize; - // ConstrainBoolean echoCancellation; - // ConstrainBoolean autoGainControl; - // ConstrainBoolean noiseSuppression; - // ConstrainDouble latency; - // ConstrainULong channelCount; - // ConstrainDOMString deviceId; - // ConstrainDOMString groupId; -}; diff --git a/components/script/dom/webidls/MediaElementAudioSourceNode.webidl b/components/script/dom/webidls/MediaElementAudioSourceNode.webidl deleted file mode 100644 index 5afe7775caa..00000000000 --- a/components/script/dom/webidls/MediaElementAudioSourceNode.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#mediaelementaudiosourcenode - */ - -dictionary MediaElementAudioSourceOptions { - required HTMLMediaElement mediaElement; -}; - -[Exposed=Window] -interface MediaElementAudioSourceNode : AudioNode { - [Throws] constructor (AudioContext context, MediaElementAudioSourceOptions options); - [SameObject] readonly attribute HTMLMediaElement mediaElement; -}; diff --git a/components/script/dom/webidls/MediaError.webidl b/components/script/dom/webidls/MediaError.webidl deleted file mode 100644 index bff99c786f4..00000000000 --- a/components/script/dom/webidls/MediaError.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#mediaerror - -[Exposed=Window] -interface MediaError { - const unsigned short MEDIA_ERR_ABORTED = 1; - const unsigned short MEDIA_ERR_NETWORK = 2; - const unsigned short MEDIA_ERR_DECODE = 3; - const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4; - readonly attribute unsigned short code; - readonly attribute DOMString message; -}; diff --git a/components/script/dom/webidls/MediaList.webidl b/components/script/dom/webidls/MediaList.webidl deleted file mode 100644 index d3a5527130f..00000000000 --- a/components/script/dom/webidls/MediaList.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#the-medialist-interface -[Exposed=Window] -interface MediaList { - stringifier attribute [LegacyNullToEmptyString] DOMString mediaText; - readonly attribute unsigned long length; - getter DOMString? item(unsigned long index); - undefined appendMedium(DOMString medium); - undefined deleteMedium(DOMString medium); -}; diff --git a/components/script/dom/webidls/MediaMetadata.webidl b/components/script/dom/webidls/MediaMetadata.webidl deleted file mode 100644 index 495aeef8e35..00000000000 --- a/components/script/dom/webidls/MediaMetadata.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/mediasession/#mediametadata - */ - -dictionary MediaImage { - required USVString src; - DOMString sizes = ""; - DOMString type = ""; -}; - -[Exposed=Window] -interface MediaMetadata { - [Throws] constructor(optional MediaMetadataInit init = {}); - attribute DOMString title; - attribute DOMString artist; - attribute DOMString album; - // TODO: https://github.com/servo/servo/issues/10072 - // attribute FrozenArray<MediaImage> artwork; -}; - -dictionary MediaMetadataInit { - DOMString title = ""; - DOMString artist = ""; - DOMString album = ""; - sequence<MediaImage> artwork = []; -}; diff --git a/components/script/dom/webidls/MediaQueryList.webidl b/components/script/dom/webidls/MediaQueryList.webidl deleted file mode 100644 index 2a5c0ac2db0..00000000000 --- a/components/script/dom/webidls/MediaQueryList.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom-view/#mediaquerylist - -[Exposed=(Window)] -interface MediaQueryList : EventTarget { - readonly attribute DOMString media; - readonly attribute boolean matches; - undefined addListener(EventListener? listener); - undefined removeListener(EventListener? listener); - attribute EventHandler onchange; -}; diff --git a/components/script/dom/webidls/MediaQueryListEvent.webidl b/components/script/dom/webidls/MediaQueryListEvent.webidl deleted file mode 100644 index f1837ee2750..00000000000 --- a/components/script/dom/webidls/MediaQueryListEvent.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom-view/#dom-mediaquerylistevent-mediaquerylistevent -[Exposed=(Window)] -interface MediaQueryListEvent : Event { - [Throws] constructor(DOMString type, optional MediaQueryListEventInit eventInitDict = {}); - readonly attribute DOMString media; - readonly attribute boolean matches; -}; - -dictionary MediaQueryListEventInit : EventInit { - DOMString media = ""; - boolean matches = false; -}; diff --git a/components/script/dom/webidls/MediaSession.webidl b/components/script/dom/webidls/MediaSession.webidl deleted file mode 100644 index f8954fb4a06..00000000000 --- a/components/script/dom/webidls/MediaSession.webidl +++ /dev/null @@ -1,62 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/mediasession/#mediasession - */ - -[Exposed=Window] -partial interface Navigator { - [SameObject] readonly attribute MediaSession mediaSession; -}; - -enum MediaSessionPlaybackState { - "none", - "paused", - "playing" -}; - -enum MediaSessionAction { - "play", - "pause", - "seekbackward", - "seekforward", - "previoustrack", - "nexttrack", - "skipad", - "stop", - "seekto" -}; - -dictionary MediaSessionActionDetails { - required MediaSessionAction action; -}; - -dictionary MediaSessionSeekActionDetails : MediaSessionActionDetails { - double? seekOffset; -}; - -dictionary MediaSessionSeekToActionDetails : MediaSessionActionDetails { - required double seekTime; - boolean? fastSeek; -}; - -dictionary MediaPositionState { - double duration; - double playbackRate; - double position; -}; - -callback MediaSessionActionHandler = undefined(/*MediaSessionActionDetails details*/); - -[Exposed=Window] -interface MediaSession { - attribute MediaMetadata? metadata; - - attribute MediaSessionPlaybackState playbackState; - - undefined setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler); - - [Throws] undefined setPositionState(optional MediaPositionState state = {}); -}; diff --git a/components/script/dom/webidls/MediaStream.webidl b/components/script/dom/webidls/MediaStream.webidl deleted file mode 100644 index 0fd5a6a846d..00000000000 --- a/components/script/dom/webidls/MediaStream.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/mediacapture-main/#dom-mediastream - -[Exposed=Window] -interface MediaStream : EventTarget { - [Throws] constructor(); - [Throws] constructor(MediaStream stream); - [Throws] constructor(sequence<MediaStreamTrack> tracks); - // readonly attribute DOMString id; - sequence<MediaStreamTrack> getAudioTracks(); - sequence<MediaStreamTrack> getVideoTracks(); - sequence<MediaStreamTrack> getTracks(); - MediaStreamTrack? getTrackById(DOMString trackId); - undefined addTrack(MediaStreamTrack track); - undefined removeTrack(MediaStreamTrack track); - MediaStream clone(); - // readonly attribute boolean active; - // attribute EventHandler onaddtrack; - // attribute EventHandler onremovetrack; -}; diff --git a/components/script/dom/webidls/MediaStreamAudioDestinationNode.webidl b/components/script/dom/webidls/MediaStreamAudioDestinationNode.webidl deleted file mode 100644 index 93d5f86ebc5..00000000000 --- a/components/script/dom/webidls/MediaStreamAudioDestinationNode.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#mediastreamaudiodestinationnode - */ - -[Exposed=Window] -interface MediaStreamAudioDestinationNode : AudioNode { - [Throws] constructor (AudioContext context, optional AudioNodeOptions options = {}); - readonly attribute MediaStream stream; -}; diff --git a/components/script/dom/webidls/MediaStreamAudioSourceNode.webidl b/components/script/dom/webidls/MediaStreamAudioSourceNode.webidl deleted file mode 100644 index 655e2443081..00000000000 --- a/components/script/dom/webidls/MediaStreamAudioSourceNode.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#mediastreamaudiosourcenode - */ - -dictionary MediaStreamAudioSourceOptions { - required MediaStream mediaStream; -}; - -[Exposed=Window] -interface MediaStreamAudioSourceNode : AudioNode { - [Throws] constructor (AudioContext context, MediaStreamAudioSourceOptions options); - [SameObject] readonly attribute MediaStream mediaStream; -}; diff --git a/components/script/dom/webidls/MediaStreamTrack.webidl b/components/script/dom/webidls/MediaStreamTrack.webidl deleted file mode 100644 index b514360622a..00000000000 --- a/components/script/dom/webidls/MediaStreamTrack.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack - -[Exposed=Window] -interface MediaStreamTrack : EventTarget { - readonly attribute DOMString kind; - readonly attribute DOMString id; - // readonly attribute DOMString label; - // attribute boolean enabled; - // readonly attribute boolean muted; - // attribute EventHandler onmute; - // attribute EventHandler onunmute; - // readonly attribute MediaStreamTrackState readyState; - // attribute EventHandler onended; - MediaStreamTrack clone(); - // void stop(); - // MediaTrackCapabilities getCapabilities(); - // MediaTrackConstraints getConstraints(); - // MediaTrackSettings getSettings(); - // Promise<void> applyConstraints(optional MediaTrackConstraints constraints); -}; diff --git a/components/script/dom/webidls/MediaStreamTrackAudioSourceNode.webidl b/components/script/dom/webidls/MediaStreamTrackAudioSourceNode.webidl deleted file mode 100644 index 354b8fa8c85..00000000000 --- a/components/script/dom/webidls/MediaStreamTrackAudioSourceNode.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#mediastreamtrackaudiosourcenode - */ - -dictionary MediaStreamTrackAudioSourceOptions { - required MediaStreamTrack mediaStreamTrack; -}; - -[Exposed=Window] -interface MediaStreamTrackAudioSourceNode : AudioNode { - [Throws] constructor (AudioContext context, MediaStreamTrackAudioSourceOptions options); -}; diff --git a/components/script/dom/webidls/MessageChannel.webidl b/components/script/dom/webidls/MessageChannel.webidl deleted file mode 100644 index f48fe643353..00000000000 --- a/components/script/dom/webidls/MessageChannel.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://html.spec.whatwg.org/multipage/#messagechannel - */ - -[Exposed=(Window,Worker)] -interface MessageChannel { - constructor(); - readonly attribute MessagePort port1; - readonly attribute MessagePort port2; -}; diff --git a/components/script/dom/webidls/MessageEvent.webidl b/components/script/dom/webidls/MessageEvent.webidl deleted file mode 100644 index 3b546cc1b93..00000000000 --- a/components/script/dom/webidls/MessageEvent.webidl +++ /dev/null @@ -1,36 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#messageevent -[Exposed=(Window,Worker)] -interface MessageEvent : Event { - [Throws] constructor(DOMString type, optional MessageEventInit eventInitDict = {}); - readonly attribute any data; - readonly attribute DOMString origin; - readonly attribute DOMString lastEventId; - readonly attribute MessageEventSource? source; - readonly attribute /*FrozenArray<MessagePort>*/any ports; - - undefined initMessageEvent( - DOMString type, - optional boolean bubbles = false, - optional boolean cancelable = false, - optional any data = null, - optional DOMString origin = "", - optional DOMString lastEventId = "", - optional MessageEventSource? source = null, - optional sequence<MessagePort> ports = [] - ); -}; - -dictionary MessageEventInit : EventInit { - any data = null; - DOMString origin = ""; - DOMString lastEventId = ""; - //DOMString channel; - MessageEventSource? source = null; - sequence<MessagePort> ports = []; -}; - -typedef (WindowProxy or MessagePort or ServiceWorker) MessageEventSource; diff --git a/components/script/dom/webidls/MessagePort.webidl b/components/script/dom/webidls/MessagePort.webidl deleted file mode 100644 index 6fc1f432b38..00000000000 --- a/components/script/dom/webidls/MessagePort.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://html.spec.whatwg.org/multipage/#messageport - */ - -[Exposed=(Window,Worker)] -interface MessagePort : EventTarget { - [Throws] undefined postMessage(any message, sequence<object> transfer); - [Throws] undefined postMessage(any message, optional StructuredSerializeOptions options = {}); - undefined start(); - undefined close(); - - // event handlers - attribute EventHandler onmessage; - attribute EventHandler onmessageerror; -}; - -dictionary StructuredSerializeOptions { - sequence<object> transfer = []; -}; diff --git a/components/script/dom/webidls/MimeType.webidl b/components/script/dom/webidls/MimeType.webidl deleted file mode 100644 index 0f971a858cc..00000000000 --- a/components/script/dom/webidls/MimeType.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#mimetype -[Exposed=Window] -interface MimeType { - readonly attribute DOMString type; - readonly attribute DOMString description; - readonly attribute DOMString suffixes; // comma-separated - readonly attribute Plugin enabledPlugin; -}; diff --git a/components/script/dom/webidls/MimeTypeArray.webidl b/components/script/dom/webidls/MimeTypeArray.webidl deleted file mode 100644 index c7f724c5fbf..00000000000 --- a/components/script/dom/webidls/MimeTypeArray.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#mimetypearray -[LegacyUnenumerableNamedProperties, Exposed=Window] -interface MimeTypeArray { - readonly attribute unsigned long length; - getter MimeType? item(unsigned long index); - getter MimeType? namedItem(DOMString name); -}; diff --git a/components/script/dom/webidls/MouseEvent.webidl b/components/script/dom/webidls/MouseEvent.webidl deleted file mode 100644 index 0a3c5c015fd..00000000000 --- a/components/script/dom/webidls/MouseEvent.webidl +++ /dev/null @@ -1,54 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/uievents/#interface-mouseevent -[Exposed=Window] -interface MouseEvent : UIEvent { - [Throws] constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict = {}); - readonly attribute long screenX; - readonly attribute long screenY; - readonly attribute long clientX; - readonly attribute long clientY; - readonly attribute long pageX; - readonly attribute long pageY; - readonly attribute long x; - readonly attribute long y; - readonly attribute long offsetX; - readonly attribute long offsetY; - readonly attribute boolean ctrlKey; - readonly attribute boolean shiftKey; - readonly attribute boolean altKey; - readonly attribute boolean metaKey; - readonly attribute short button; - readonly attribute EventTarget? relatedTarget; - // Introduced in DOM Level 3 - readonly attribute unsigned short buttons; - //boolean getModifierState (DOMString keyArg); - - [Pref="dom_mouse_event_which_enabled"] - readonly attribute long which; -}; - -// https://w3c.github.io/uievents/#dictdef-eventmodifierinit -dictionary MouseEventInit : EventModifierInit { - long screenX = 0; - long screenY = 0; - long clientX = 0; - long clientY = 0; - short button = 0; - unsigned short buttons = 0; - EventTarget? relatedTarget = null; -}; - -// https://w3c.github.io/uievents/#idl-interface-MouseEvent-initializers -partial interface MouseEvent { - // Deprecated in DOM Level 3 - undefined initMouseEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, - Window? viewArg, long detailArg, - long screenXArg, long screenYArg, - long clientXArg, long clientYArg, - boolean ctrlKeyArg, boolean altKeyArg, - boolean shiftKeyArg, boolean metaKeyArg, - short buttonArg, EventTarget? relatedTargetArg); -}; diff --git a/components/script/dom/webidls/MutationObserver.webidl b/components/script/dom/webidls/MutationObserver.webidl deleted file mode 100644 index 4f643c7b222..00000000000 --- a/components/script/dom/webidls/MutationObserver.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://dom.spec.whatwg.org/#mutationobserver - */ - -// https://dom.spec.whatwg.org/#mutationobserver -[Exposed=Window, Pref="dom_mutation_observer_enabled"] -interface MutationObserver { - [Throws] constructor(MutationCallback callback); - [Throws] - undefined observe(Node target, optional MutationObserverInit options = {}); - undefined disconnect(); - sequence<MutationRecord> takeRecords(); -}; - -callback MutationCallback = undefined (sequence<MutationRecord> mutations, MutationObserver observer); - -dictionary MutationObserverInit { - boolean childList = false; - boolean attributes; - boolean characterData; - boolean subtree = false; - boolean attributeOldValue; - boolean characterDataOldValue; - sequence<DOMString> attributeFilter; -}; diff --git a/components/script/dom/webidls/MutationRecord.webidl b/components/script/dom/webidls/MutationRecord.webidl deleted file mode 100644 index edc5c9e8825..00000000000 --- a/components/script/dom/webidls/MutationRecord.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://dom.spec.whatwg.org/#mutationrecord - */ - -// https://dom.spec.whatwg.org/#mutationrecord -[Pref="dom_mutation_observer_enabled", Exposed=Window] -interface MutationRecord { - readonly attribute DOMString type; - [SameObject] - readonly attribute Node target; - [SameObject] - readonly attribute NodeList addedNodes; - [SameObject] - readonly attribute NodeList removedNodes; - readonly attribute Node? previousSibling; - readonly attribute Node? nextSibling; - readonly attribute DOMString? attributeName; - readonly attribute DOMString? attributeNamespace; - readonly attribute DOMString? oldValue; -}; diff --git a/components/script/dom/webidls/NamedNodeMap.webidl b/components/script/dom/webidls/NamedNodeMap.webidl deleted file mode 100644 index 15adeac6852..00000000000 --- a/components/script/dom/webidls/NamedNodeMap.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#interface-namednodemap - -[Exposed=Window, LegacyUnenumerableNamedProperties] -interface NamedNodeMap { - [Pure] - readonly attribute unsigned long length; - [Pure] - getter Attr? item(unsigned long index); - [Pure] - getter Attr? getNamedItem(DOMString qualifiedName); - [Pure] - Attr? getNamedItemNS(DOMString? namespace, DOMString localName); - [CEReactions, Throws] - Attr? setNamedItem(Attr attr); - [CEReactions, Throws] - Attr? setNamedItemNS(Attr attr); - [CEReactions, Throws] - Attr removeNamedItem(DOMString qualifiedName); - [CEReactions, Throws] - Attr removeNamedItemNS(DOMString? namespace, DOMString localName); -}; diff --git a/components/script/dom/webidls/NavigationPreloadManager.webidl b/components/script/dom/webidls/NavigationPreloadManager.webidl deleted file mode 100644 index 026bcafea13..00000000000 --- a/components/script/dom/webidls/NavigationPreloadManager.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/ServiceWorker/#navigation-preload-manager -[Pref="dom_serviceworker_enabled", SecureContext, Exposed=(Window,Worker)] -interface NavigationPreloadManager { - Promise<undefined> enable(); - Promise<undefined> disable(); - Promise<undefined> setHeaderValue(ByteString value); - Promise<NavigationPreloadState> getState(); -}; - -dictionary NavigationPreloadState { - boolean enabled = false; - ByteString headerValue; -}; diff --git a/components/script/dom/webidls/Navigator.webidl b/components/script/dom/webidls/Navigator.webidl deleted file mode 100644 index 05fbdf62024..00000000000 --- a/components/script/dom/webidls/Navigator.webidl +++ /dev/null @@ -1,77 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#navigator -[Exposed=Window] -interface Navigator { - // objects implementing this interface also implement the interfaces given below -}; -Navigator includes NavigatorID; -Navigator includes NavigatorLanguage; -//Navigator includes NavigatorOnLine; -//Navigator includes NavigatorContentUtils; -//Navigator includes NavigatorStorageUtils; -Navigator includes NavigatorPlugins; -Navigator includes NavigatorCookies; -Navigator includes NavigatorConcurrentHardware; - -// https://html.spec.whatwg.org/multipage/#navigatorid -[Exposed=(Window,Worker)] -interface mixin NavigatorID { - readonly attribute DOMString appCodeName; // constant "Mozilla" - readonly attribute DOMString appName; - readonly attribute DOMString appVersion; - readonly attribute DOMString platform; - readonly attribute DOMString product; // constant "Gecko" - [Exposed=Window] readonly attribute DOMString productSub; - boolean taintEnabled(); // constant false - readonly attribute DOMString userAgent; - [Exposed=Window] readonly attribute DOMString vendor; - [Exposed=Window] readonly attribute DOMString vendorSub; // constant "" -}; - -// https://webbluetoothcg.github.io/web-bluetooth/#navigator-extensions -partial interface Navigator { - [SameObject, Pref="dom_bluetooth_enabled"] readonly attribute Bluetooth bluetooth; -}; - -// https://w3c.github.io/ServiceWorker/#navigator-service-worker -partial interface Navigator { - [SameObject, Pref="dom_serviceworker_enabled"] readonly attribute ServiceWorkerContainer serviceWorker; -}; - -// https://html.spec.whatwg.org/multipage/#navigatorlanguage -[Exposed=(Window,Worker)] -interface mixin NavigatorLanguage { - readonly attribute DOMString language; - readonly attribute any languages; -}; - -// https://html.spec.whatwg.org/multipage/#navigatorplugins -interface mixin NavigatorPlugins { - [SameObject] readonly attribute PluginArray plugins; - [SameObject] readonly attribute MimeTypeArray mimeTypes; - boolean javaEnabled(); -}; - -// https://html.spec.whatwg.org/multipage/#navigatorcookies -interface mixin NavigatorCookies { - readonly attribute boolean cookieEnabled; -}; - -// https://w3c.github.io/permissions/#navigator-and-workernavigator-extension -[Exposed=(Window)] -partial interface Navigator { - [Pref="dom_permissions_enabled"] readonly attribute Permissions permissions; -}; - -// https://w3c.github.io/gamepad/#navigator-interface-extension -partial interface Navigator { - [Pref="dom_gamepad_enabled"] sequence<Gamepad?> getGamepads(); -}; - -// https://html.spec.whatwg.org/multipage/#navigatorconcurrenthardware -interface mixin NavigatorConcurrentHardware { - readonly attribute unsigned long long hardwareConcurrency; -}; diff --git a/components/script/dom/webidls/Node.webidl b/components/script/dom/webidls/Node.webidl deleted file mode 100644 index 0e5624a34f9..00000000000 --- a/components/script/dom/webidls/Node.webidl +++ /dev/null @@ -1,101 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://dom.spec.whatwg.org/#interface-node - */ - -[Exposed=Window, Abstract] -interface Node : EventTarget { - const unsigned short ELEMENT_NODE = 1; - const unsigned short ATTRIBUTE_NODE = 2; // historical - const unsigned short TEXT_NODE = 3; - const unsigned short CDATA_SECTION_NODE = 4; // historical - const unsigned short ENTITY_REFERENCE_NODE = 5; // historical - const unsigned short ENTITY_NODE = 6; // historical - const unsigned short PROCESSING_INSTRUCTION_NODE = 7; - const unsigned short COMMENT_NODE = 8; - const unsigned short DOCUMENT_NODE = 9; - const unsigned short DOCUMENT_TYPE_NODE = 10; - const unsigned short DOCUMENT_FRAGMENT_NODE = 11; - const unsigned short NOTATION_NODE = 12; // historical - [Constant] - readonly attribute unsigned short nodeType; - [Pure] - readonly attribute DOMString nodeName; - - [Pure] - readonly attribute USVString baseURI; - - [Pure] - readonly attribute boolean isConnected; - - [Pure] - readonly attribute Document? ownerDocument; - - [Pure] - Node getRootNode(optional GetRootNodeOptions options = {}); - - [Pure] - readonly attribute Node? parentNode; - [Pure] - readonly attribute Element? parentElement; - [Pure] - boolean hasChildNodes(); - [SameObject] - readonly attribute NodeList childNodes; - [Pure] - readonly attribute Node? firstChild; - [Pure] - readonly attribute Node? lastChild; - [Pure] - readonly attribute Node? previousSibling; - [Pure] - readonly attribute Node? nextSibling; - - [CEReactions, Pure] - attribute DOMString? nodeValue; - [CEReactions, Pure] - attribute DOMString? textContent; - [CEReactions] - undefined normalize(); - - [CEReactions, Throws] - Node cloneNode(optional boolean deep = false); - [Pure] - boolean isEqualNode(Node? node); - [Pure] - boolean isSameNode(Node? otherNode); // historical alias of === - - const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; - const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; - const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; - const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; - const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; - const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; - [Pure] - unsigned short compareDocumentPosition(Node other); - [Pure] - boolean contains(Node? other); - - [Pure] - DOMString? lookupPrefix(DOMString? namespace); - [Pure] - DOMString? lookupNamespaceURI(DOMString? prefix); - [Pure] - boolean isDefaultNamespace(DOMString? namespace); - - [CEReactions, Throws] - Node insertBefore(Node node, Node? child); - [CEReactions, Throws] - Node appendChild(Node node); - [CEReactions, Throws] - Node replaceChild(Node node, Node child); - [CEReactions, Throws] - Node removeChild(Node child); -}; - -dictionary GetRootNodeOptions { - boolean composed = false; -}; diff --git a/components/script/dom/webidls/NodeFilter.webidl b/components/script/dom/webidls/NodeFilter.webidl deleted file mode 100644 index 95e718ff771..00000000000 --- a/components/script/dom/webidls/NodeFilter.webidl +++ /dev/null @@ -1,33 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#interface-nodefilter - */ -// Import from http://hg.mozilla.org/mozilla-central/file/a5a720259d79/dom/webidl/NodeFilter.webidl - -[Exposed=Window] -callback interface NodeFilter { - // Constants for acceptNode() - const unsigned short FILTER_ACCEPT = 1; - const unsigned short FILTER_REJECT = 2; - const unsigned short FILTER_SKIP = 3; - - // Constants for whatToShow - const unsigned long SHOW_ALL = 0xFFFFFFFF; - const unsigned long SHOW_ELEMENT = 0x1; - const unsigned long SHOW_ATTRIBUTE = 0x2; // historical - const unsigned long SHOW_TEXT = 0x4; - const unsigned long SHOW_CDATA_SECTION = 0x8; // historical - const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical - const unsigned long SHOW_ENTITY = 0x20; // historical - const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40; - const unsigned long SHOW_COMMENT = 0x80; - const unsigned long SHOW_DOCUMENT = 0x100; - const unsigned long SHOW_DOCUMENT_TYPE = 0x200; - const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400; - const unsigned long SHOW_NOTATION = 0x800; // historical - - unsigned short acceptNode(Node node); -}; diff --git a/components/script/dom/webidls/NodeIterator.webidl b/components/script/dom/webidls/NodeIterator.webidl deleted file mode 100644 index ca433fbcfe7..00000000000 --- a/components/script/dom/webidls/NodeIterator.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * https://dom.spec.whatwg.org/#nodeiterator - */ -// Import from http://hg.mozilla.org/mozilla-central/raw-file/a5a720259d79/dom/webidl/NodeIterator.webidl - -[Exposed=Window] -interface NodeIterator { - [SameObject] - readonly attribute Node root; - [Pure] - readonly attribute Node referenceNode; - [Pure] - readonly attribute boolean pointerBeforeReferenceNode; - [Constant] - readonly attribute unsigned long whatToShow; - [Constant] - readonly attribute NodeFilter? filter; - - [Throws] - Node? nextNode(); - [Throws] - Node? previousNode(); - - [Pure] - undefined detach(); -}; diff --git a/components/script/dom/webidls/NodeList.webidl b/components/script/dom/webidls/NodeList.webidl deleted file mode 100644 index 8ce65efb802..00000000000 --- a/components/script/dom/webidls/NodeList.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://dom.spec.whatwg.org/#interface-nodelist - */ - -[Exposed=Window] -interface NodeList { - [Pure] - getter Node? item(unsigned long index); - [Pure] - readonly attribute unsigned long length; - iterable<Node?>; -}; diff --git a/components/script/dom/webidls/NonElementParentNode.webidl b/components/script/dom/webidls/NonElementParentNode.webidl deleted file mode 100644 index 2d2c18c368e..00000000000 --- a/components/script/dom/webidls/NonElementParentNode.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#nonelementparentnode -interface mixin NonElementParentNode { - [Pure] - Element? getElementById(DOMString elementId); -}; diff --git a/components/script/dom/webidls/OESElementIndexUint.webidl b/components/script/dom/webidls/OESElementIndexUint.webidl deleted file mode 100644 index a1e631e47b8..00000000000 --- a/components/script/dom/webidls/OESElementIndexUint.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/OES_element_index_uint/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface OESElementIndexUint { -}; diff --git a/components/script/dom/webidls/OESStandardDerivatives.webidl b/components/script/dom/webidls/OESStandardDerivatives.webidl deleted file mode 100644 index e0190a4075a..00000000000 --- a/components/script/dom/webidls/OESStandardDerivatives.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/OES_standard_derivatives/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface OESStandardDerivatives { - const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; -}; diff --git a/components/script/dom/webidls/OESTextureFloat.webidl b/components/script/dom/webidls/OESTextureFloat.webidl deleted file mode 100644 index 63d968522d5..00000000000 --- a/components/script/dom/webidls/OESTextureFloat.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/OES_texture_float/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface OESTextureFloat { -}; diff --git a/components/script/dom/webidls/OESTextureFloatLinear.webidl b/components/script/dom/webidls/OESTextureFloatLinear.webidl deleted file mode 100644 index 84a21cbfe65..00000000000 --- a/components/script/dom/webidls/OESTextureFloatLinear.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/OES_texture_float_linear/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface OESTextureFloatLinear { -}; diff --git a/components/script/dom/webidls/OESTextureHalfFloat.webidl b/components/script/dom/webidls/OESTextureHalfFloat.webidl deleted file mode 100644 index 55045ba7b4e..00000000000 --- a/components/script/dom/webidls/OESTextureHalfFloat.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/OES_texture_half_float/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface OESTextureHalfFloat { - const GLenum HALF_FLOAT_OES = 0x8D61; -}; diff --git a/components/script/dom/webidls/OESTextureHalfFloatLinear.webidl b/components/script/dom/webidls/OESTextureHalfFloatLinear.webidl deleted file mode 100644 index fe8d44e8752..00000000000 --- a/components/script/dom/webidls/OESTextureHalfFloatLinear.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/OES_texture_half_float_linear/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface OESTextureHalfFloatLinear { -}; diff --git a/components/script/dom/webidls/OESVertexArrayObject.webidl b/components/script/dom/webidls/OESVertexArrayObject.webidl deleted file mode 100644 index 48e2daeb31a..00000000000 --- a/components/script/dom/webidls/OESVertexArrayObject.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/OES_vertex_array_object/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface OESVertexArrayObject { - const unsigned long VERTEX_ARRAY_BINDING_OES = 0x85B5; - - WebGLVertexArrayObjectOES? createVertexArrayOES(); - undefined deleteVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject); - boolean isVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject); - undefined bindVertexArrayOES(WebGLVertexArrayObjectOES? arrayObject); -}; diff --git a/components/script/dom/webidls/OfflineAudioCompletionEvent.webidl b/components/script/dom/webidls/OfflineAudioCompletionEvent.webidl deleted file mode 100644 index aa63fe22156..00000000000 --- a/components/script/dom/webidls/OfflineAudioCompletionEvent.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * For more information on this interface please see - * https://webaudio.github.io/web-audio-api/#offlineaudiocompletionevent - */ - -dictionary OfflineAudioCompletionEventInit : EventInit { - required AudioBuffer renderedBuffer; -}; - -[Exposed=Window] -interface OfflineAudioCompletionEvent : Event { - [Throws] constructor(DOMString type, OfflineAudioCompletionEventInit eventInitDict); - readonly attribute AudioBuffer renderedBuffer; -}; diff --git a/components/script/dom/webidls/OfflineAudioContext.webidl b/components/script/dom/webidls/OfflineAudioContext.webidl deleted file mode 100644 index ff2d923a096..00000000000 --- a/components/script/dom/webidls/OfflineAudioContext.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#OfflineAudioContext - */ - -dictionary OfflineAudioContextOptions { - unsigned long numberOfChannels = 1; - required unsigned long length; - required float sampleRate; -}; - -[Exposed=Window] -interface OfflineAudioContext : BaseAudioContext { - [Throws] constructor(OfflineAudioContextOptions contextOptions); - [Throws] constructor(unsigned long numberOfChannels, unsigned long length, float sampleRate); - readonly attribute unsigned long length; - attribute EventHandler oncomplete; - - Promise<AudioBuffer> startRendering(); -// Promise<void> suspend(double suspendTime); -}; diff --git a/components/script/dom/webidls/OffscreenCanvas.webidl b/components/script/dom/webidls/OffscreenCanvas.webidl deleted file mode 100644 index cc19cefa868..00000000000 --- a/components/script/dom/webidls/OffscreenCanvas.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-offscreencanvas-interface -typedef (OffscreenCanvasRenderingContext2D or WebGLRenderingContext or WebGL2RenderingContext) -OffscreenRenderingContext; - -dictionary ImageEncodeOptions { - DOMString type = "image/png"; - unrestricted double quality = 1.0; -}; - -//enum OffscreenRenderingContextId { "2d", "webgl", "webgl2" }; - -[Exposed=(Window,Worker)/*, Transferable*/, Pref="dom_offscreen_canvas_enabled"] -interface OffscreenCanvas : EventTarget { - [Throws] constructor([EnforceRange] unsigned long long width, [EnforceRange] unsigned long long height); - attribute [EnforceRange] unsigned long long width; - attribute [EnforceRange] unsigned long long height; - - [Throws] OffscreenRenderingContext? getContext(DOMString contextId, optional any options = null); - //ImageBitmap transferToImageBitmap(); - //Promise<Blob> convertToBlob(optional ImageEncodeOptions options); -}; diff --git a/components/script/dom/webidls/OffscreenCanvasRenderingContext2D.webidl b/components/script/dom/webidls/OffscreenCanvasRenderingContext2D.webidl deleted file mode 100644 index 5d6aef5e014..00000000000 --- a/components/script/dom/webidls/OffscreenCanvasRenderingContext2D.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-offscreen-2d-rendering-context -[Exposed=(Window,Worker), Pref="dom_offscreen_canvas_enabled"] -interface OffscreenCanvasRenderingContext2D { - //void commit(); - readonly attribute OffscreenCanvas canvas; -}; -OffscreenCanvasRenderingContext2D includes CanvasState; -OffscreenCanvasRenderingContext2D includes CanvasCompositing; -OffscreenCanvasRenderingContext2D includes CanvasImageSmoothing; -OffscreenCanvasRenderingContext2D includes CanvasFillStrokeStyles; -OffscreenCanvasRenderingContext2D includes CanvasShadowStyles; -OffscreenCanvasRenderingContext2D includes CanvasFilters; -OffscreenCanvasRenderingContext2D includes CanvasRect; - -OffscreenCanvasRenderingContext2D includes CanvasTransform; -OffscreenCanvasRenderingContext2D includes CanvasDrawPath; -OffscreenCanvasRenderingContext2D includes CanvasText; -OffscreenCanvasRenderingContext2D includes CanvasDrawImage; -OffscreenCanvasRenderingContext2D includes CanvasImageData; -OffscreenCanvasRenderingContext2D includes CanvasPathDrawingStyles; -OffscreenCanvasRenderingContext2D includes CanvasTextDrawingStyles; -OffscreenCanvasRenderingContext2D includes CanvasPath; - - - - diff --git a/components/script/dom/webidls/OscillatorNode.webidl b/components/script/dom/webidls/OscillatorNode.webidl deleted file mode 100644 index f2b4c215561..00000000000 --- a/components/script/dom/webidls/OscillatorNode.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#oscillatornode - */ - -enum OscillatorType { - "sine", - "square", - "sawtooth", - "triangle", - "custom" -}; - -dictionary OscillatorOptions : AudioNodeOptions { - OscillatorType type = "sine"; - float frequency = 440; - float detune = 0; - // PeriodicWave periodicWave; -}; - -[Exposed=Window] -interface OscillatorNode : AudioScheduledSourceNode { - [Throws] constructor(BaseAudioContext context, optional OscillatorOptions options = {}); - [SetterThrows] - attribute OscillatorType type; - - readonly attribute AudioParam frequency; - readonly attribute AudioParam detune; - -// void setPeriodicWave (PeriodicWave periodicWave); -}; diff --git a/components/script/dom/webidls/PageTransitionEvent.webidl b/components/script/dom/webidls/PageTransitionEvent.webidl deleted file mode 100644 index 000818f1a30..00000000000 --- a/components/script/dom/webidls/PageTransitionEvent.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-pagetransitionevent-interface -[Exposed=Window] -interface PageTransitionEvent : Event { - [Throws] constructor(DOMString type, optional PageTransitionEventInit eventInitDict = {}); - readonly attribute boolean persisted; -}; - -dictionary PageTransitionEventInit : EventInit { - boolean persisted = false; -}; diff --git a/components/script/dom/webidls/PaintRenderingContext2D.webidl b/components/script/dom/webidls/PaintRenderingContext2D.webidl deleted file mode 100644 index 8361c298866..00000000000 --- a/components/script/dom/webidls/PaintRenderingContext2D.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.css-houdini.org/css-paint-api/#paintrenderingcontext2d -[Pref="dom_worklet_enabled", Exposed=PaintWorklet] -interface PaintRenderingContext2D { -}; -PaintRenderingContext2D includes CanvasState; -PaintRenderingContext2D includes CanvasTransform; -PaintRenderingContext2D includes CanvasCompositing; -PaintRenderingContext2D includes CanvasImageSmoothing; -PaintRenderingContext2D includes CanvasFillStrokeStyles; -PaintRenderingContext2D includes CanvasShadowStyles; -PaintRenderingContext2D includes CanvasRect; -PaintRenderingContext2D includes CanvasDrawPath; -PaintRenderingContext2D includes CanvasDrawImage; -PaintRenderingContext2D includes CanvasPathDrawingStyles; -PaintRenderingContext2D includes CanvasPath; diff --git a/components/script/dom/webidls/PaintSize.webidl b/components/script/dom/webidls/PaintSize.webidl deleted file mode 100644 index 2c3e669d32e..00000000000 --- a/components/script/dom/webidls/PaintSize.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.css-houdini.org/css-paint-api/#paintsize -[Pref="dom_worklet_enabled", Exposed=PaintWorklet] -interface PaintSize { - readonly attribute double width; - readonly attribute double height; -}; diff --git a/components/script/dom/webidls/PaintWorkletGlobalScope.webidl b/components/script/dom/webidls/PaintWorkletGlobalScope.webidl deleted file mode 100644 index a5918c06616..00000000000 --- a/components/script/dom/webidls/PaintWorkletGlobalScope.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.css-houdini.org/css-paint-api/#paintworkletglobalscope -[Global=(Worklet,PaintWorklet), Pref="dom_worklet_enabled", Exposed=PaintWorklet] -interface PaintWorkletGlobalScope : WorkletGlobalScope { - [Throws] undefined registerPaint(DOMString name, VoidFunction paintCtor); - // This function is to be used only for testing, and should not be - // accessible outside of that use. - [Pref="dom_worklet_blockingsleep_enabled"] - undefined sleep(unsigned long long ms); -}; diff --git a/components/script/dom/webidls/PannerNode.webidl b/components/script/dom/webidls/PannerNode.webidl deleted file mode 100644 index a5119040b64..00000000000 --- a/components/script/dom/webidls/PannerNode.webidl +++ /dev/null @@ -1,56 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#pannernode - */ - -dictionary PannerOptions : AudioNodeOptions { - PanningModelType panningModel = "equalpower"; - DistanceModelType distanceModel = "inverse"; - float positionX = 0; - float positionY = 0; - float positionZ = 0; - float orientationX = 1; - float orientationY = 0; - float orientationZ = 0; - double refDistance = 1; - double maxDistance = 10000; - double rolloffFactor = 1; - double coneInnerAngle = 360; - double coneOuterAngle = 360; - double coneOuterGain = 0; -}; - -enum DistanceModelType { - "linear", - "inverse", - "exponential" -}; - -enum PanningModelType { - "equalpower", - "HRTF" -}; - -[Exposed=Window] -interface PannerNode : AudioNode { - [Throws] constructor(BaseAudioContext context, optional PannerOptions options = {}); - attribute PanningModelType panningModel; - readonly attribute AudioParam positionX; - readonly attribute AudioParam positionY; - readonly attribute AudioParam positionZ; - readonly attribute AudioParam orientationX; - readonly attribute AudioParam orientationY; - readonly attribute AudioParam orientationZ; - attribute DistanceModelType distanceModel; - [SetterThrows] attribute double refDistance; - [SetterThrows] attribute double maxDistance; - [SetterThrows] attribute double rolloffFactor; - attribute double coneInnerAngle; - attribute double coneOuterAngle; - [SetterThrows] attribute double coneOuterGain; - undefined setPosition (float x, float y, float z); - undefined setOrientation (float x, float y, float z); -}; diff --git a/components/script/dom/webidls/ParentNode.webidl b/components/script/dom/webidls/ParentNode.webidl deleted file mode 100644 index 3a35b77dc13..00000000000 --- a/components/script/dom/webidls/ParentNode.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#interface-parentnode - */ - -interface mixin ParentNode { - [SameObject] - readonly attribute HTMLCollection children; - [Pure] - readonly attribute Element? firstElementChild; - [Pure] - readonly attribute Element? lastElementChild; - [Pure] - readonly attribute unsigned long childElementCount; - - [CEReactions, Throws, Unscopable] - undefined prepend((Node or DOMString)... nodes); - [CEReactions, Throws, Unscopable] - undefined append((Node or DOMString)... nodes); - [CEReactions, Throws, Unscopable] - undefined replaceChildren((Node or DOMString)... nodes); - - [Pure, Throws] - Element? querySelector(DOMString selectors); - [NewObject, Throws] - NodeList querySelectorAll(DOMString selectors); -}; diff --git a/components/script/dom/webidls/Performance.webidl b/components/script/dom/webidls/Performance.webidl deleted file mode 100644 index 46f751cb4ab..00000000000 --- a/components/script/dom/webidls/Performance.webidl +++ /dev/null @@ -1,53 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/hr-time/#sec-performance - */ - -typedef double DOMHighResTimeStamp; -typedef sequence<PerformanceEntry> PerformanceEntryList; - -[Exposed=(Window, Worker)] -interface Performance : EventTarget { - DOMHighResTimeStamp now(); - readonly attribute DOMHighResTimeStamp timeOrigin; - [Default] object toJSON(); -}; - -// https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface -[Exposed=(Window, Worker)] -partial interface Performance { - PerformanceEntryList getEntries(); - PerformanceEntryList getEntriesByType(DOMString type); - PerformanceEntryList getEntriesByName(DOMString name, - optional DOMString type); -}; - -// https://w3c.github.io/user-timing/#extensions-performance-interface -[Exposed=(Window,Worker)] -partial interface Performance { - [Throws] - undefined mark(DOMString markName); - undefined clearMarks(optional DOMString markName); - [Throws] - undefined measure(DOMString measureName, optional DOMString startMark, optional DOMString endMark); - undefined clearMeasures(optional DOMString measureName); -}; - -//https://w3c.github.io/resource-timing/#sec-extensions-performance-interface -partial interface Performance { - undefined clearResourceTimings (); - undefined setResourceTimingBufferSize (unsigned long maxSize); - attribute EventHandler onresourcetimingbufferfull; -}; - -// https://w3c.github.io/navigation-timing/#extensions-to-the-performance-interface -[Exposed=Window] -partial interface Performance { - [SameObject] - readonly attribute PerformanceNavigationTiming timing; - [SameObject] - readonly attribute PerformanceNavigation navigation; -}; diff --git a/components/script/dom/webidls/PerformanceEntry.webidl b/components/script/dom/webidls/PerformanceEntry.webidl deleted file mode 100644 index 5f6fee1cabd..00000000000 --- a/components/script/dom/webidls/PerformanceEntry.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/performance-timeline/#the-performanceentry-interface - */ - -[Exposed=(Window,Worker)] -interface PerformanceEntry { - readonly attribute DOMString name; - readonly attribute DOMString entryType; - readonly attribute DOMHighResTimeStamp startTime; - readonly attribute DOMHighResTimeStamp duration; - [Default] object toJSON(); -}; diff --git a/components/script/dom/webidls/PerformanceMark.webidl b/components/script/dom/webidls/PerformanceMark.webidl deleted file mode 100644 index 43783454865..00000000000 --- a/components/script/dom/webidls/PerformanceMark.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/user-timing/#performancemark - */ - -[Exposed=(Window,Worker)] -interface PerformanceMark : PerformanceEntry { -}; diff --git a/components/script/dom/webidls/PerformanceMeasure.webidl b/components/script/dom/webidls/PerformanceMeasure.webidl deleted file mode 100644 index 8a1469fa68d..00000000000 --- a/components/script/dom/webidls/PerformanceMeasure.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/user-timing/#performancemeasure - */ - -[Exposed=(Window,Worker)] -interface PerformanceMeasure : PerformanceEntry { -}; diff --git a/components/script/dom/webidls/PerformanceNavigation.webidl b/components/script/dom/webidls/PerformanceNavigation.webidl deleted file mode 100644 index 3e5cba196f6..00000000000 --- a/components/script/dom/webidls/PerformanceNavigation.webidl +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/navigation-timing/#the-performancenavigation-interface - */ - -[Exposed=Window] -interface PerformanceNavigation { - const unsigned short TYPE_NAVIGATE = 0; - const unsigned short TYPE_RELOAD = 1; - const unsigned short TYPE_BACK_FORWARD = 2; - const unsigned short TYPE_RESERVED = 255; - readonly attribute unsigned short type; - readonly attribute unsigned short redirectCount; - [Default] object toJSON(); -}; diff --git a/components/script/dom/webidls/PerformanceNavigationTiming.webidl b/components/script/dom/webidls/PerformanceNavigationTiming.webidl deleted file mode 100644 index 4757e7fd7d0..00000000000 --- a/components/script/dom/webidls/PerformanceNavigationTiming.webidl +++ /dev/null @@ -1,32 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/navigation-timing/#dom-performancenavigationtiming - */ - -enum NavigationTimingType { - "navigate", - "reload", - "back_forward", - "prerender" -}; - -[Exposed=Window] -interface PerformanceNavigationTiming : PerformanceResourceTiming { - readonly attribute DOMHighResTimeStamp unloadEventStart; - readonly attribute DOMHighResTimeStamp unloadEventEnd; - readonly attribute DOMHighResTimeStamp domInteractive; - readonly attribute DOMHighResTimeStamp domContentLoadedEventStart; - readonly attribute DOMHighResTimeStamp domContentLoadedEventEnd; - readonly attribute DOMHighResTimeStamp domComplete; - readonly attribute DOMHighResTimeStamp loadEventStart; - readonly attribute DOMHighResTimeStamp loadEventEnd; - readonly attribute NavigationTimingType type; - readonly attribute unsigned short redirectCount; - [Default] object toJSON(); - /* Servo-only attribute for measuring when the top-level document (not iframes) is complete. */ - [Pref="dom_testperf_enabled"] - readonly attribute DOMHighResTimeStamp topLevelDomComplete; -}; diff --git a/components/script/dom/webidls/PerformanceObserver.webidl b/components/script/dom/webidls/PerformanceObserver.webidl deleted file mode 100644 index 806020eb70f..00000000000 --- a/components/script/dom/webidls/PerformanceObserver.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/performance-timeline/#the-performanceobserver-interface - */ - -dictionary PerformanceObserverInit { - sequence<DOMString> entryTypes; - DOMString type; - boolean buffered; -}; - -callback PerformanceObserverCallback = undefined (PerformanceObserverEntryList entries, PerformanceObserver observer); - -[Exposed=(Window,Worker)] -interface PerformanceObserver { - [Throws] constructor(PerformanceObserverCallback callback); - [Throws] - undefined observe(optional PerformanceObserverInit options = {}); - undefined disconnect(); - PerformanceEntryList takeRecords(); - // codegen doesn't like SameObject+static and doesn't know FrozenArray - /*[SameObject]*/ static readonly attribute /*FrozenArray<DOMString>*/ any supportedEntryTypes; -}; diff --git a/components/script/dom/webidls/PerformanceObserverEntryList.webidl b/components/script/dom/webidls/PerformanceObserverEntryList.webidl deleted file mode 100644 index fc29226714c..00000000000 --- a/components/script/dom/webidls/PerformanceObserverEntryList.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/performance-timeline/#performanceobserverentrylist-interface - */ - -[Exposed=(Window,Worker)] -interface PerformanceObserverEntryList { - PerformanceEntryList getEntries(); - PerformanceEntryList getEntriesByType(DOMString entryType); - PerformanceEntryList getEntriesByName(DOMString name, - optional DOMString entryType); -}; diff --git a/components/script/dom/webidls/PerformancePaintTiming.webidl b/components/script/dom/webidls/PerformancePaintTiming.webidl deleted file mode 100644 index 207e5c405ad..00000000000 --- a/components/script/dom/webidls/PerformancePaintTiming.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://wicg.github.io/paint-timing/#sec-PerformancePaintTiming - */ - -[Exposed=(Window,Worker)] -interface PerformancePaintTiming : PerformanceEntry { -}; diff --git a/components/script/dom/webidls/PerformanceResourceTiming.webidl b/components/script/dom/webidls/PerformanceResourceTiming.webidl deleted file mode 100644 index 50a6dba1416..00000000000 --- a/components/script/dom/webidls/PerformanceResourceTiming.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/resource-timing/ - */ - -// https://w3c.github.io/resource-timing/#sec-performanceresourcetiming -[Exposed=(Window,Worker)] -interface PerformanceResourceTiming : PerformanceEntry { - readonly attribute DOMString initiatorType; - readonly attribute DOMString nextHopProtocol; - // readonly attribute DOMHighResTimeStamp workerStart; - readonly attribute DOMHighResTimeStamp redirectStart; - readonly attribute DOMHighResTimeStamp redirectEnd; - readonly attribute DOMHighResTimeStamp fetchStart; - readonly attribute DOMHighResTimeStamp domainLookupStart; - readonly attribute DOMHighResTimeStamp domainLookupEnd; - readonly attribute DOMHighResTimeStamp connectStart; - readonly attribute DOMHighResTimeStamp connectEnd; - readonly attribute DOMHighResTimeStamp secureConnectionStart; - readonly attribute DOMHighResTimeStamp requestStart; - readonly attribute DOMHighResTimeStamp responseStart; - readonly attribute DOMHighResTimeStamp responseEnd; - readonly attribute unsigned long long transferSize; - readonly attribute unsigned long long encodedBodySize; - readonly attribute unsigned long long decodedBodySize; - [Default] object toJSON(); -}; diff --git a/components/script/dom/webidls/PermissionStatus.webidl b/components/script/dom/webidls/PermissionStatus.webidl deleted file mode 100644 index a5aebda20dd..00000000000 --- a/components/script/dom/webidls/PermissionStatus.webidl +++ /dev/null @@ -1,47 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - - // https://w3c.github.io/permissions/#permissionstatus - -dictionary PermissionDescriptor { - required PermissionName name; -}; - -enum PermissionState { - "granted", - "denied", - "prompt", -}; - -enum PermissionName { - "geolocation", - "notifications", - "push", - "midi", - "camera", - "microphone", - "speaker", - "device-info", - "background-sync", - "bluetooth", - "persistent-storage", -}; - -[Pref="dom_permissions_enabled", Exposed=(Window,Worker)] -interface PermissionStatus : EventTarget { - readonly attribute PermissionState state; - attribute EventHandler onchange; -}; - -dictionary PushPermissionDescriptor : PermissionDescriptor { - boolean userVisibleOnly = false; -}; - -dictionary MidiPermissionDescriptor : PermissionDescriptor { - boolean sysex = false; -}; - -dictionary DevicePermissionDescriptor : PermissionDescriptor { - DOMString deviceId; -}; diff --git a/components/script/dom/webidls/Permissions.webidl b/components/script/dom/webidls/Permissions.webidl deleted file mode 100644 index 21e20eb2bf5..00000000000 --- a/components/script/dom/webidls/Permissions.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/permissions/#permissions-interface - -[Pref="dom_permissions_enabled", Exposed=(Window,Worker)] -interface Permissions { - Promise<PermissionStatus> query(object permissionDesc); - - Promise<PermissionStatus> request(object permissionDesc); - - Promise<PermissionStatus> revoke(object permissionDesc); -}; diff --git a/components/script/dom/webidls/Plugin.webidl b/components/script/dom/webidls/Plugin.webidl deleted file mode 100644 index 4c03636fabe..00000000000 --- a/components/script/dom/webidls/Plugin.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#dom-plugin -[LegacyUnenumerableNamedProperties, Exposed=Window] -interface Plugin { - readonly attribute DOMString name; - readonly attribute DOMString description; - readonly attribute DOMString filename; - readonly attribute unsigned long length; - getter MimeType? item(unsigned long index); - getter MimeType? namedItem(DOMString name); -}; diff --git a/components/script/dom/webidls/PluginArray.webidl b/components/script/dom/webidls/PluginArray.webidl deleted file mode 100644 index 53abc12b027..00000000000 --- a/components/script/dom/webidls/PluginArray.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#pluginarray -[LegacyUnenumerableNamedProperties, Exposed=Window] -interface PluginArray { - undefined refresh(optional boolean reload = false); - readonly attribute unsigned long length; - getter Plugin? item(unsigned long index); - getter Plugin? namedItem(DOMString name); -}; diff --git a/components/script/dom/webidls/PointerEvent.webidl b/components/script/dom/webidls/PointerEvent.webidl deleted file mode 100644 index b798aeda457..00000000000 --- a/components/script/dom/webidls/PointerEvent.webidl +++ /dev/null @@ -1,46 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/pointerevents/#pointerevent-interface -[Exposed=Window] -interface PointerEvent : MouseEvent -{ - constructor(DOMString type, optional PointerEventInit eventInitDict = {}); - - readonly attribute long pointerId; - - readonly attribute long width; - readonly attribute long height; - readonly attribute float pressure; - readonly attribute float tangentialPressure; - readonly attribute long tiltX; - readonly attribute long tiltY; - readonly attribute long twist; - readonly attribute double altitudeAngle; - readonly attribute double azimuthAngle; - - readonly attribute DOMString pointerType; - readonly attribute boolean isPrimary; - - sequence<PointerEvent> getCoalescedEvents(); - sequence<PointerEvent> getPredictedEvents(); -}; - -dictionary PointerEventInit : MouseEventInit -{ - long pointerId = 0; - long width = 1; - long height = 1; - float pressure = 0; - float tangentialPressure = 0; - long tiltX; - long tiltY; - long twist = 0; - double altitudeAngle; - double azimuthAngle; - DOMString pointerType = ""; - boolean isPrimary = false; - sequence<PointerEvent> coalescedEvents = []; - sequence<PointerEvent> predictedEvents = []; -}; diff --git a/components/script/dom/webidls/PopStateEvent.webidl b/components/script/dom/webidls/PopStateEvent.webidl deleted file mode 100644 index deb398abb3d..00000000000 --- a/components/script/dom/webidls/PopStateEvent.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-popstateevent-interface -[Exposed=Window] -interface PopStateEvent : Event { - [Throws] constructor(DOMString type, optional PopStateEventInit eventInitDict = {}); - readonly attribute any state; -}; - -dictionary PopStateEventInit : EventInit { - any state = null; -}; diff --git a/components/script/dom/webidls/ProcessingInstruction.webidl b/components/script/dom/webidls/ProcessingInstruction.webidl deleted file mode 100644 index b3641badf1f..00000000000 --- a/components/script/dom/webidls/ProcessingInstruction.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#interface-processinginstruction - */ - -[Exposed=Window] -interface ProcessingInstruction : CharacterData { - [Constant] - readonly attribute DOMString target; -}; diff --git a/components/script/dom/webidls/ProgressEvent.webidl b/components/script/dom/webidls/ProgressEvent.webidl deleted file mode 100644 index 17d066ef187..00000000000 --- a/components/script/dom/webidls/ProgressEvent.webidl +++ /dev/null @@ -1,27 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://xhr.spec.whatwg.org/#interface-progressevent - * - * To the extent possible under law, the editor has waived all copyright - * and related or neighboring rights to this work. In addition, as of 1 May 2014, - * the editor has made this specification available under the Open Web Foundation - * Agreement Version 1.0, which is available at - * http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. - */ - -[Exposed=(Window,Worker)] -interface ProgressEvent : Event { - [Throws] constructor(DOMString type, optional ProgressEventInit eventInitDict = {}); - readonly attribute boolean lengthComputable; - readonly attribute unsigned long long loaded; - readonly attribute unsigned long long total; -}; - -dictionary ProgressEventInit : EventInit { - boolean lengthComputable = false; - unsigned long long loaded = 0; - unsigned long long total = 0; -}; diff --git a/components/script/dom/webidls/Promise.webidl b/components/script/dom/webidls/Promise.webidl deleted file mode 100644 index 2e402d1a54e..00000000000 --- a/components/script/dom/webidls/Promise.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -callback PromiseJobCallback = undefined(); - -[TreatNonCallableAsNull] -callback AnyCallback = any (any value); - -[LegacyNoInterfaceObject, Exposed=(Window,Worker)] -// Need to escape "Promise" so it's treated as an identifier. -interface _Promise { -}; diff --git a/components/script/dom/webidls/PromiseNativeHandler.webidl b/components/script/dom/webidls/PromiseNativeHandler.webidl deleted file mode 100644 index aff2e43a855..00000000000 --- a/components/script/dom/webidls/PromiseNativeHandler.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -// Hack to allow us to have JS owning and properly tracing/CCing/etc a -// PromiseNativeHandler. -[LegacyNoInterfaceObject, - Exposed=(Window,Worker)] -interface PromiseNativeHandler { -}; diff --git a/components/script/dom/webidls/PromiseRejectionEvent.webidl b/components/script/dom/webidls/PromiseRejectionEvent.webidl deleted file mode 100644 index 46ecbc21718..00000000000 --- a/components/script/dom/webidls/PromiseRejectionEvent.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-promiserejectionevent-interface - -[Exposed=(Window,Worker)] -interface PromiseRejectionEvent : Event { - [Throws] constructor(DOMString type, PromiseRejectionEventInit eventInitDict); - readonly attribute object promise; - readonly attribute any reason; -}; - -dictionary PromiseRejectionEventInit : EventInit { - required object promise; - any reason; -}; diff --git a/components/script/dom/webidls/QueuingStrategy.webidl b/components/script/dom/webidls/QueuingStrategy.webidl deleted file mode 100644 index 66870289de9..00000000000 --- a/components/script/dom/webidls/QueuingStrategy.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://streams.spec.whatwg.org/#qs - -dictionary QueuingStrategy { - unrestricted double highWaterMark; - QueuingStrategySize size; -}; - -callback QueuingStrategySize = unrestricted double (any chunk); - -dictionary QueuingStrategyInit { - required unrestricted double highWaterMark; -}; - -[Exposed=*] -interface ByteLengthQueuingStrategy { - constructor(QueuingStrategyInit init); - - readonly attribute unrestricted double highWaterMark; - [Throws] - readonly attribute Function size; -}; - -[Exposed=*] -interface CountQueuingStrategy { - constructor(QueuingStrategyInit init); - - readonly attribute unrestricted double highWaterMark; - [Throws] - readonly attribute Function size; -}; diff --git a/components/script/dom/webidls/RTCDataChannel.webidl b/components/script/dom/webidls/RTCDataChannel.webidl deleted file mode 100644 index 419b05bd3f9..00000000000 --- a/components/script/dom/webidls/RTCDataChannel.webidl +++ /dev/null @@ -1,49 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#dom-rtcdatachannel - -[Exposed=Window, Pref="dom_webrtc_enabled"] -interface RTCDataChannel : EventTarget { - readonly attribute USVString label; - readonly attribute boolean ordered; - readonly attribute unsigned short? maxPacketLifeTime; - readonly attribute unsigned short? maxRetransmits; - readonly attribute USVString protocol; - readonly attribute boolean negotiated; - readonly attribute unsigned short? id; - readonly attribute RTCDataChannelState readyState; - //readonly attribute unsigned long bufferedAmount; - //attribute unsigned long bufferedAmountLowThreshold; - attribute EventHandler onopen; - attribute EventHandler onbufferedamountlow; - attribute EventHandler onerror; - attribute EventHandler onclosing; - attribute EventHandler onclose; - undefined close(); - attribute EventHandler onmessage; - [SetterThrows] attribute DOMString binaryType; - [Throws] undefined send(USVString data); - [Throws] undefined send(Blob data); - [Throws] undefined send(ArrayBuffer data); - [Throws] undefined send(ArrayBufferView data); -}; - -// https://www.w3.org/TR/webrtc/#dom-rtcdatachannelinit -dictionary RTCDataChannelInit { - boolean ordered = true; - unsigned short maxPacketLifeTime; - unsigned short maxRetransmits; - USVString protocol = ""; - boolean negotiated = false; - unsigned short id; -}; - -// https://www.w3.org/TR/webrtc/#dom-rtcdatachannelstate -enum RTCDataChannelState { - "connecting", - "open", - "closing", - "closed" -}; diff --git a/components/script/dom/webidls/RTCDataChannelEvent.webidl b/components/script/dom/webidls/RTCDataChannelEvent.webidl deleted file mode 100644 index 5d2a8e6df24..00000000000 --- a/components/script/dom/webidls/RTCDataChannelEvent.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelevent - -[Exposed=Window, Pref="dom_webrtc_enabled"] -interface RTCDataChannelEvent : Event { - constructor(DOMString type, RTCDataChannelEventInit eventInitDict); - readonly attribute RTCDataChannel channel; -}; - -dictionary RTCDataChannelEventInit : EventInit { - required RTCDataChannel channel; -}; diff --git a/components/script/dom/webidls/RTCError.webidl b/components/script/dom/webidls/RTCError.webidl deleted file mode 100644 index a745cf5e77f..00000000000 --- a/components/script/dom/webidls/RTCError.webidl +++ /dev/null @@ -1,35 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#dom-rtcerror - -[Exposed=Window, Pref="dom_webrtc_enabled"] -interface RTCError : DOMException { - constructor(RTCErrorInit init, optional DOMString message = ""); - readonly attribute RTCErrorDetailType errorDetail; - readonly attribute long? sdpLineNumber; - readonly attribute long? httpRequestStatusCode; - readonly attribute long? sctpCauseCode; - readonly attribute unsigned long? receivedAlert; - readonly attribute unsigned long? sentAlert; -}; - -dictionary RTCErrorInit { - required RTCErrorDetailType errorDetail; - long sdpLineNumber; - long httpRequestStatusCode; - long sctpCauseCode; - unsigned long receivedAlert; - unsigned long sentAlert; -}; - -enum RTCErrorDetailType { - "data-channel-failure", - "dtls-failure", - "fingerprint-failure", - "sctp-failure", - "sdp-syntax-error", - "hardware-encoder-not-available", - "hardware-encoder-error" -}; diff --git a/components/script/dom/webidls/RTCErrorEvent.webidl b/components/script/dom/webidls/RTCErrorEvent.webidl deleted file mode 100644 index c5b7c3e9cc8..00000000000 --- a/components/script/dom/webidls/RTCErrorEvent.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#dom-rtcerrorevent - -[Exposed=Window, Pref="dom_webrtc_enabled"] -interface RTCErrorEvent : Event { - constructor(DOMString type, RTCErrorEventInit eventInitDict); - [SameObject] readonly attribute RTCError error; -}; - -dictionary RTCErrorEventInit : EventInit { - required RTCError error; -}; diff --git a/components/script/dom/webidls/RTCIceCandidate.webidl b/components/script/dom/webidls/RTCIceCandidate.webidl deleted file mode 100644 index 266fe353f37..00000000000 --- a/components/script/dom/webidls/RTCIceCandidate.webidl +++ /dev/null @@ -1,33 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface - - -[Exposed=Window, Pref="dom_webrtc_enabled"] -interface RTCIceCandidate { - [Throws] constructor(optional RTCIceCandidateInit candidateInitDict = {}); - readonly attribute DOMString candidate; - readonly attribute DOMString? sdpMid; - readonly attribute unsigned short? sdpMLineIndex; - // readonly attribute DOMString? foundation; - // readonly attribute RTCIceComponent? component; - // readonly attribute unsigned long? priority; - // readonly attribute DOMString? address; - // readonly attribute RTCIceProtocol? protocol; - // readonly attribute unsigned short? port; - // readonly attribute RTCIceCandidateType? type; - // readonly attribute RTCIceTcpCandidateType? tcpType; - // readonly attribute DOMString? relatedAddress; - // readonly attribute unsigned short? relatedPort; - readonly attribute DOMString? usernameFragment; - RTCIceCandidateInit toJSON(); -}; - -dictionary RTCIceCandidateInit { - DOMString candidate = ""; - DOMString? sdpMid = null; - unsigned short? sdpMLineIndex = null; - DOMString usernameFragment; -}; diff --git a/components/script/dom/webidls/RTCPeerConnection.webidl b/components/script/dom/webidls/RTCPeerConnection.webidl deleted file mode 100644 index 24ced7bcce6..00000000000 --- a/components/script/dom/webidls/RTCPeerConnection.webidl +++ /dev/null @@ -1,153 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#interface-definition - -[Exposed=Window, Pref="dom_webrtc_enabled"] -interface RTCPeerConnection : EventTarget { - [Throws] constructor(optional RTCConfiguration configuration = {}); - Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {}); - Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {}); - Promise<undefined> setLocalDescription(RTCSessionDescriptionInit description); - readonly attribute RTCSessionDescription? localDescription; - // readonly attribute RTCSessionDescription? currentLocalDescription; - // readonly attribute RTCSessionDescription? pendingLocalDescription; - Promise<undefined> setRemoteDescription(RTCSessionDescriptionInit description); - readonly attribute RTCSessionDescription? remoteDescription; - // readonly attribute RTCSessionDescription? currentRemoteDescription; - // readonly attribute RTCSessionDescription? pendingRemoteDescription; - Promise<undefined> addIceCandidate(optional RTCIceCandidateInit candidate = {}); - readonly attribute RTCSignalingState signalingState; - readonly attribute RTCIceGatheringState iceGatheringState; - readonly attribute RTCIceConnectionState iceConnectionState; - // readonly attribute RTCPeerConnectionState connectionState; - // readonly attribute boolean? canTrickleIceCandidates; - // static sequence<RTCIceServer> getDefaultIceServers(); - // RTCConfiguration getConfiguration(); - // void setConfiguration(RTCConfiguration configuration); - undefined close(); - attribute EventHandler onnegotiationneeded; - attribute EventHandler onicecandidate; - // attribute EventHandler onicecandidateerror; - attribute EventHandler onsignalingstatechange; - attribute EventHandler oniceconnectionstatechange; - attribute EventHandler onicegatheringstatechange; - // attribute EventHandler onconnectionstatechange; - - // removed from spec, but still shipped by browsers - undefined addStream (MediaStream stream); -}; - -dictionary RTCConfiguration { - sequence<RTCIceServer> iceServers; - RTCIceTransportPolicy iceTransportPolicy = "all"; - RTCBundlePolicy bundlePolicy = "balanced"; - RTCRtcpMuxPolicy rtcpMuxPolicy = "require"; - DOMString peerIdentity; - // sequence<RTCCertificate> certificates; - [EnforceRange] - octet iceCandidatePoolSize = 0; -}; - -enum RTCIceTransportPolicy { - "relay", - "all" -}; - -enum RTCBundlePolicy { - "balanced", - "max-compat", - "max-bundle" -}; - -enum RTCRtcpMuxPolicy { - // At risk due to lack of implementers' interest. - "negotiate", - "require" -}; - -dictionary RTCIceServer { - required (DOMString or sequence<DOMString>) urls; - DOMString username; - DOMString /*(DOMString or RTCOAuthCredential)*/ credential; - RTCIceCredentialType credentialType = "password"; -}; - -enum RTCIceCredentialType { - "password", - "oauth" -}; - -dictionary RTCOfferAnswerOptions { - boolean voiceActivityDetection = true; -}; - -dictionary RTCOfferOptions : RTCOfferAnswerOptions { - boolean iceRestart = false; -}; - -dictionary RTCAnswerOptions : RTCOfferAnswerOptions { -}; - -enum RTCIceGatheringState { - "new", - "gathering", - "complete" -}; - -enum RTCIceConnectionState { - "new", - "checking", - "connected", - "completed", - "disconnected", - "failed", - "closed" -}; - -enum RTCSignalingState { - "stable", - "have-local-offer", - "have-remote-offer", - "have-local-pranswer", - "have-remote-pranswer", - "closed" -}; - -dictionary RTCRtpCodingParameters { - DOMString rid; -}; - -dictionary RTCRtpEncodingParameters : RTCRtpCodingParameters { - boolean active = true; - unsigned long maxBitrate; - double scaleResolutionDownBy; -}; - -dictionary RTCRtpTransceiverInit { - RTCRtpTransceiverDirection direction = "sendrecv"; - sequence<MediaStream> streams = []; - sequence<RTCRtpEncodingParameters> sendEncodings = []; -}; - -partial interface RTCPeerConnection { - // sequence<RTCRtpSender> getSenders(); - // sequence<RTCRtpReceiver> getReceivers(); - // sequence<RTCRtpTransceiver> getTransceivers(); - // RTCRtpSender addTrack(MediaStreamTrack track, - // MediaStream... streams); - // void removeTrack(RTCRtpSender sender); - [Pref="dom_webrtc_transceiver_enabled"] - RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind, - optional RTCRtpTransceiverInit init = {}); - attribute EventHandler ontrack; -}; - -// https://www.w3.org/TR/webrtc/#rtcpeerconnection-interface-extensions-0 -partial interface RTCPeerConnection { - // readonly attribute RTCSctpTransport? sctp; - RTCDataChannel createDataChannel(USVString label, - optional RTCDataChannelInit dataChannelDict = {}); - attribute EventHandler ondatachannel; -}; diff --git a/components/script/dom/webidls/RTCPeerConnectionIceEvent.webidl b/components/script/dom/webidls/RTCPeerConnectionIceEvent.webidl deleted file mode 100644 index 95094c45f3b..00000000000 --- a/components/script/dom/webidls/RTCPeerConnectionIceEvent.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#rtcpeerconnectioniceevent - -[Exposed=Window, Pref="dom_webrtc_enabled"] -interface RTCPeerConnectionIceEvent : Event { - [Throws] constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict = {}); - readonly attribute RTCIceCandidate? candidate; - readonly attribute DOMString? url; -}; - -dictionary RTCPeerConnectionIceEventInit : EventInit { - RTCIceCandidate? candidate; - DOMString? url; -}; diff --git a/components/script/dom/webidls/RTCRtpSender.webidl b/components/script/dom/webidls/RTCRtpSender.webidl deleted file mode 100644 index 938ca9e8a63..00000000000 --- a/components/script/dom/webidls/RTCRtpSender.webidl +++ /dev/null @@ -1,47 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#dom-rtcrtpsender - -dictionary RTCRtpHeaderExtensionParameters { - required DOMString uri; - required unsigned short id; - boolean encrypted = false; -}; - -dictionary RTCRtcpParameters { - DOMString cname; - boolean reducedSize; -}; - -dictionary RTCRtpCodecParameters { - required octet payloadType; - required DOMString mimeType; - required unsigned long clockRate; - unsigned short channels; - DOMString sdpFmtpLine; -}; - -dictionary RTCRtpParameters { - required sequence<RTCRtpHeaderExtensionParameters> headerExtensions; - required RTCRtcpParameters rtcp; - required sequence<RTCRtpCodecParameters> codecs; -}; - -dictionary RTCRtpSendParameters : RTCRtpParameters { - required DOMString transactionId; - required sequence<RTCRtpEncodingParameters> encodings; -}; - -[Exposed=Window, Pref="dom_webrtc_transceiver_enabled"] -interface RTCRtpSender { - //readonly attribute MediaStreamTrack? track; - //readonly attribute RTCDtlsTransport? transport; - //static RTCRtpCapabilities? getCapabilities(DOMString kind); - Promise<undefined> setParameters(RTCRtpSendParameters parameters); - RTCRtpSendParameters getParameters(); - //Promise<void> replaceTrack(MediaStreamTrack? withTrack); - //void setStreams(MediaStream... streams); - //Promise<RTCStatsReport> getStats(); -}; diff --git a/components/script/dom/webidls/RTCRtpTransceiver.webidl b/components/script/dom/webidls/RTCRtpTransceiver.webidl deleted file mode 100644 index f11b9853682..00000000000 --- a/components/script/dom/webidls/RTCRtpTransceiver.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#rtcrtptransceiver-interface - -[Exposed=Window, Pref="dom_webrtc_transceiver_enabled"] -interface RTCRtpTransceiver { - //readonly attribute DOMString? mid; - [SameObject] readonly attribute RTCRtpSender sender; - //[SameObject] readonly attribute RTCRtpReceiver receiver; - attribute RTCRtpTransceiverDirection direction; - //readonly attribute RTCRtpTransceiverDirection? currentDirection; - //void stop(); - //void setCodecPreferences(sequence<RTCRtpCodecCapability> codecs); -}; - -enum RTCRtpTransceiverDirection { - "sendrecv", - "sendonly", - "recvonly", - "inactive", - "stopped" -}; diff --git a/components/script/dom/webidls/RTCSessionDescription.webidl b/components/script/dom/webidls/RTCSessionDescription.webidl deleted file mode 100644 index 0fb325eae41..00000000000 --- a/components/script/dom/webidls/RTCSessionDescription.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#rtcsessiondescription-class - -[Exposed=Window, Pref="dom_webrtc_enabled"] -interface RTCSessionDescription { - [Throws] constructor(RTCSessionDescriptionInit descriptionInitDict); - readonly attribute RTCSdpType type; - readonly attribute DOMString sdp; - [Default] object toJSON(); -}; - -dictionary RTCSessionDescriptionInit { - required RTCSdpType type; - DOMString sdp = ""; -}; - -enum RTCSdpType { - "offer", - "pranswer", - "answer", - "rollback" -}; diff --git a/components/script/dom/webidls/RTCTrackEvent.webidl b/components/script/dom/webidls/RTCTrackEvent.webidl deleted file mode 100644 index c43b86710b4..00000000000 --- a/components/script/dom/webidls/RTCTrackEvent.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webrtc-pc/#dom-rtctrackevent - -[Exposed=Window, Pref="dom_webrtc_enabled"] -interface RTCTrackEvent : Event { - [Throws] constructor(DOMString type, RTCTrackEventInit eventInitDict); - // readonly attribute RTCRtpReceiver receiver; - readonly attribute MediaStreamTrack track; - // [SameObject] - // readonly attribute FrozenArray<MediaStream> streams; - // readonly attribute RTCRtpTransceiver transceiver; -}; - -// https://www.w3.org/TR/webrtc/#dom-rtctrackeventinit -dictionary RTCTrackEventInit : EventInit { - // required RTCRtpReceiver receiver; - required MediaStreamTrack track; - // sequence<MediaStream> streams = []; - // required RTCRtpTransceiver transceiver; -}; diff --git a/components/script/dom/webidls/RadioNodeList.webidl b/components/script/dom/webidls/RadioNodeList.webidl deleted file mode 100644 index 6db8d2af353..00000000000 --- a/components/script/dom/webidls/RadioNodeList.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#radionodelist -[Exposed=Window] -interface RadioNodeList : NodeList { - attribute DOMString value; -}; diff --git a/components/script/dom/webidls/Range.webidl b/components/script/dom/webidls/Range.webidl deleted file mode 100644 index 7ba168ddb05..00000000000 --- a/components/script/dom/webidls/Range.webidl +++ /dev/null @@ -1,79 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#range - * https://w3c.github.io/DOM-Parsing/#dom-range-createcontextualfragment - * http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface - */ - -[Exposed=Window] -interface Range : AbstractRange { - [Throws] constructor(); - [Pure] - readonly attribute Node commonAncestorContainer; - - [Throws] - undefined setStart(Node refNode, unsigned long offset); - [Throws] - undefined setEnd(Node refNode, unsigned long offset); - [Throws] - undefined setStartBefore(Node refNode); - [Throws] - undefined setStartAfter(Node refNode); - [Throws] - undefined setEndBefore(Node refNode); - [Throws] - undefined setEndAfter(Node refNode); - undefined collapse(optional boolean toStart = false); - [Throws] - undefined selectNode(Node refNode); - [Throws] - undefined selectNodeContents(Node refNode); - - const unsigned short START_TO_START = 0; - const unsigned short START_TO_END = 1; - const unsigned short END_TO_END = 2; - const unsigned short END_TO_START = 3; - [Pure, Throws] - short compareBoundaryPoints(unsigned short how, Range sourceRange); - [CEReactions, Throws] - undefined deleteContents(); - [CEReactions, NewObject, Throws] - DocumentFragment extractContents(); - [CEReactions, NewObject, Throws] - DocumentFragment cloneContents(); - [CEReactions, Throws] - undefined insertNode(Node node); - [CEReactions, Throws] - undefined surroundContents(Node newParent); - - [NewObject] - Range cloneRange(); - [Pure] - undefined detach(); - - [Pure, Throws] - boolean isPointInRange(Node node, unsigned long offset); - [Pure, Throws] - short comparePoint(Node node, unsigned long offset); - - [Pure] - boolean intersectsNode(Node node); - - stringifier; -}; - -// https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#extensions-to-the-range-interface -partial interface Range { - [CEReactions, NewObject, Throws] - DocumentFragment createContextualFragment(DOMString fragment); -}; - -// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-range-interface -partial interface Range { - // sequence<DOMRect> getClientRects(); - // [NewObject] - // DOMRect getBoundingClientRect(); -}; diff --git a/components/script/dom/webidls/ReadableByteStreamController.webidl b/components/script/dom/webidls/ReadableByteStreamController.webidl deleted file mode 100644 index 2734bd1e4c2..00000000000 --- a/components/script/dom/webidls/ReadableByteStreamController.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://streams.spec.whatwg.org/#rbs-controller-class-definition - -[Exposed=*] -interface ReadableByteStreamController { - [Throws] // Throws on OOM - readonly attribute ReadableStreamBYOBRequest? byobRequest; - readonly attribute unrestricted double? desiredSize; - - [Throws] - undefined close(); - [Throws] - undefined enqueue(ArrayBufferView chunk); - [Throws] - undefined error(optional any e); -}; diff --git a/components/script/dom/webidls/ReadableStream.webidl b/components/script/dom/webidls/ReadableStream.webidl deleted file mode 100644 index 6378dc2ba87..00000000000 --- a/components/script/dom/webidls/ReadableStream.webidl +++ /dev/null @@ -1,60 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://streams.spec.whatwg.org/#readablestream - -[Exposed=*] // [Transferable] - See Bug 1562065 -interface _ReadableStream { - [Throws] - constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); - - // [Throws] - // static ReadableStream from(any asyncIterable); - - readonly attribute boolean locked; - - [NewObject] - Promise<undefined> cancel(optional any reason); - - [Throws] - ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); - - // [Throws] - // ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); - - // [NewObject] - // Promise<undefined> pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); - - [Throws] - sequence<ReadableStream> tee(); - - // [GenerateReturnMethod] - // async iterable<any>(optional ReadableStreamIteratorOptions options = {}); -}; - -enum ReadableStreamType { "bytes" }; - -enum ReadableStreamReaderMode { "byob" }; - -dictionary ReadableStreamGetReaderOptions { - ReadableStreamReaderMode mode; -}; - -/* -dictionary ReadableStreamIteratorOptions { - boolean preventCancel = false; -}; - -dictionary ReadableWritablePair { - required ReadableStream readable; - required WritableStream writable; -}; - -dictionary StreamPipeOptions { - boolean preventClose = false; - boolean preventAbort = false; - boolean preventCancel = false; - AbortSignal signal; -}; -*/ diff --git a/components/script/dom/webidls/ReadableStreamBYOBReader.webidl b/components/script/dom/webidls/ReadableStreamBYOBReader.webidl deleted file mode 100644 index cae85b43350..00000000000 --- a/components/script/dom/webidls/ReadableStreamBYOBReader.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://streams.spec.whatwg.org/#byob-reader-class-definition - -[Exposed=*] -interface ReadableStreamBYOBReader { - [Throws] - constructor(ReadableStream stream); - - [NewObject] - Promise<ReadableStreamReadResult> read(ArrayBufferView view); - - [Throws] - undefined releaseLock(); -}; -ReadableStreamBYOBReader includes ReadableStreamGenericReader; - diff --git a/components/script/dom/webidls/ReadableStreamBYOBRequest.webidl b/components/script/dom/webidls/ReadableStreamBYOBRequest.webidl deleted file mode 100644 index dad656c98e1..00000000000 --- a/components/script/dom/webidls/ReadableStreamBYOBRequest.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://streams.spec.whatwg.org/#rs-byob-request-class-definition - -[Exposed=*] -interface ReadableStreamBYOBRequest { - readonly attribute ArrayBufferView? view; - - [Throws] - undefined respond([EnforceRange] unsigned long long bytesWritten); - [Throws] - undefined respondWithNewView(ArrayBufferView view); -}; diff --git a/components/script/dom/webidls/ReadableStreamDefaultController.webidl b/components/script/dom/webidls/ReadableStreamDefaultController.webidl deleted file mode 100644 index 6e3e1546dc8..00000000000 --- a/components/script/dom/webidls/ReadableStreamDefaultController.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://streams.spec.whatwg.org/#rs-default-controller-class-definition - -[Exposed=*] -interface ReadableStreamDefaultController { - readonly attribute unrestricted double? desiredSize; - - [Throws] - undefined close(); - [Throws] - undefined enqueue(optional any chunk); - [Throws] - undefined error(optional any e); -}; diff --git a/components/script/dom/webidls/ReadableStreamDefaultReader.webidl b/components/script/dom/webidls/ReadableStreamDefaultReader.webidl deleted file mode 100644 index df5d9691654..00000000000 --- a/components/script/dom/webidls/ReadableStreamDefaultReader.webidl +++ /dev/null @@ -1,48 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://streams.spec.whatwg.org/#generic-reader-mixin-definition -// https://streams.spec.whatwg.org/#default-reader-class-definition - -typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader; - -interface mixin ReadableStreamGenericReader { - readonly attribute Promise<undefined> closed; - - [NewObject] - Promise<undefined> cancel(optional any reason); -}; - -[Exposed=*] -interface ReadableStreamDefaultReader { - [Throws] - constructor(ReadableStream stream); - - [NewObject] - Promise<ReadableStreamReadResult> read(); - - [Throws] - undefined releaseLock(); -}; -ReadableStreamDefaultReader includes ReadableStreamGenericReader; - - -dictionary ReadableStreamReadResult { - any value; - boolean done; -}; - -// The DefaultTeeReadRequest interface is entirely internal to Servo, and should not be accessible to -// web pages. -[LegacyNoInterfaceObject, Exposed=(Window,Worker)] -// Need to escape "DefaultTeeReadRequest" so it's treated as an identifier. -interface _DefaultTeeReadRequest { -}; - -// The DefaultTeeUnderlyingSource interface is entirely internal to Servo, and should not be accessible to -// web pages. -[LegacyNoInterfaceObject, Exposed=(Window,Worker)] -// Need to escape "DefaultTeeUnderlyingSource" so it's treated as an identifier. -interface _DefaultTeeUnderlyingSource { -}; diff --git a/components/script/dom/webidls/Request.webidl b/components/script/dom/webidls/Request.webidl deleted file mode 100644 index 78a45de208e..00000000000 --- a/components/script/dom/webidls/Request.webidl +++ /dev/null @@ -1,104 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://fetch.spec.whatwg.org/#request-class - -typedef (Request or USVString) RequestInfo; - -[Exposed=(Window,Worker)] -interface Request { - [Throws] constructor(RequestInfo input, optional RequestInit init = {}); - readonly attribute ByteString method; - readonly attribute USVString url; - [SameObject] readonly attribute Headers headers; - - readonly attribute RequestDestination destination; - readonly attribute USVString referrer; - readonly attribute ReferrerPolicy referrerPolicy; - readonly attribute RequestMode mode; - readonly attribute RequestCredentials credentials; - readonly attribute RequestCache cache; - readonly attribute RequestRedirect redirect; - readonly attribute DOMString integrity; - - [NewObject, Throws] Request clone(); -}; - -Request includes Body; - -dictionary RequestInit { - ByteString method; - HeadersInit headers; - BodyInit? body; - USVString referrer; - ReferrerPolicy referrerPolicy; - RequestMode mode; - RequestCredentials credentials; - RequestCache cache; - RequestRedirect redirect; - DOMString integrity; - any window; // can only be set to null -}; - -enum RequestDestination { - "", - "audio", - "document", - "embed", - "font", - "frame", - "iframe", - "image", - "json", - "manifest", - "object", - "report", - "script", - "sharedworker", - "style", - "track", - "video", - "worker", - "xslt" -}; - -enum RequestMode { - "navigate", - "same-origin", - "no-cors", - "cors" -}; - -enum RequestCredentials { - "omit", - "same-origin", - "include" -}; - -enum RequestCache { - "default", - "no-store", - "reload", - "no-cache", - "force-cache", - "only-if-cached" -}; - -enum RequestRedirect { - "follow", - "error", - "manual" -}; - -enum ReferrerPolicy { - "", - "no-referrer", - "no-referrer-when-downgrade", - "origin", - "origin-when-cross-origin", - "unsafe-url", - "same-origin", - "strict-origin", - "strict-origin-when-cross-origin" -}; diff --git a/components/script/dom/webidls/ResizeObserver.webidl b/components/script/dom/webidls/ResizeObserver.webidl deleted file mode 100644 index 2f3b9064477..00000000000 --- a/components/script/dom/webidls/ResizeObserver.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/resize-observer/#resize-observer-interface - -[Pref="dom_resize_observer_enabled", Exposed=(Window)] -interface ResizeObserver { - constructor(ResizeObserverCallback callback); - undefined observe(Element target, optional ResizeObserverOptions options = {}); - undefined unobserve(Element target); - undefined disconnect(); -}; - -enum ResizeObserverBoxOptions { - "border-box", "content-box", "device-pixel-content-box" -}; - -dictionary ResizeObserverOptions { - ResizeObserverBoxOptions box = "content-box"; -}; - -callback ResizeObserverCallback = undefined (sequence<ResizeObserverEntry> entries, ResizeObserver observer); diff --git a/components/script/dom/webidls/ResizeObserverEntry.webidl b/components/script/dom/webidls/ResizeObserverEntry.webidl deleted file mode 100644 index 0b7b5c2f5a9..00000000000 --- a/components/script/dom/webidls/ResizeObserverEntry.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - - // https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface - -[Pref="dom_resize_observer_enabled", Exposed=Window] -interface ResizeObserverEntry { - readonly attribute Element target; - readonly attribute DOMRectReadOnly contentRect; - readonly attribute /*FrozenArray<ResizeObserverSize>*/any borderBoxSize; - readonly attribute /*FrozenArray<ResizeObserverSize>*/any contentBoxSize; - readonly attribute /*FrozenArray<ResizeObserverSize>*/any devicePixelContentBoxSize; -}; diff --git a/components/script/dom/webidls/ResizeObserverSize.webidl b/components/script/dom/webidls/ResizeObserverSize.webidl deleted file mode 100644 index e4bcb1ace78..00000000000 --- a/components/script/dom/webidls/ResizeObserverSize.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/resize-observer/#resizeobserversize - -[Pref="dom_resize_observer_enabled", Exposed=Window] -interface ResizeObserverSize { - readonly attribute unrestricted double inlineSize; - readonly attribute unrestricted double blockSize; -}; diff --git a/components/script/dom/webidls/Response.webidl b/components/script/dom/webidls/Response.webidl deleted file mode 100644 index 0ced0c13794..00000000000 --- a/components/script/dom/webidls/Response.webidl +++ /dev/null @@ -1,36 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://fetch.spec.whatwg.org/#response-class - - [Exposed=(Window,Worker)] -interface Response { - [Throws] constructor(optional BodyInit? body = null, optional ResponseInit init = {}); - [NewObject] static Response error(); - [NewObject, Throws] static Response redirect(USVString url, optional unsigned short status = 302); - - readonly attribute ResponseType type; - - readonly attribute USVString url; - readonly attribute boolean redirected; - readonly attribute unsigned short status; - readonly attribute boolean ok; - readonly attribute ByteString statusText; - [SameObject] readonly attribute Headers headers; - // readonly attribute ReadableStream? body; - // [SameObject] readonly attribute Promise<Headers> trailer; - - [NewObject, Throws] Response clone(); -}; -Response includes Body; - -dictionary ResponseInit { - unsigned short status = 200; - ByteString statusText = ""; - HeadersInit headers; -}; - -enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" }; - -// typedef (BodyInit or ReadableStream) ResponseBodyInit; diff --git a/components/script/dom/webidls/SVGElement.webidl b/components/script/dom/webidls/SVGElement.webidl deleted file mode 100644 index e6bc468d5dc..00000000000 --- a/components/script/dom/webidls/SVGElement.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://svgwg.org/svg2-draft/types.html#InterfaceSVGElement -[Exposed=Window, Pref="dom_svg_enabled"] -interface SVGElement : Element { - - //[SameObject] readonly attribute SVGAnimatedString className; - - //[SameObject] readonly attribute DOMStringMap dataset; - - //readonly attribute SVGSVGElement? ownerSVGElement; - //readonly attribute SVGElement? viewportElement; - - //attribute long tabIndex; - //void focus(); - //void blur(); -}; - -//SVGElement includes GlobalEventHandlers; -//SVGElement includes SVGElementInstance; -SVGElement includes ElementCSSInlineStyle; -SVGElement includes HTMLOrSVGElement; diff --git a/components/script/dom/webidls/SVGGraphicsElement.webidl b/components/script/dom/webidls/SVGGraphicsElement.webidl deleted file mode 100644 index ab08503e7ef..00000000000 --- a/components/script/dom/webidls/SVGGraphicsElement.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://svgwg.org/svg2-draft/types.html#InterfaceSVGGraphicsElement -//dictionary SVGBoundingBoxOptions { -// boolean fill = true; -// boolean stroke = false; -// boolean markers = false; -// boolean clipped = false; -//}; - -[Exposed=Window, Abstract, Pref="dom_svg_enabled"] -interface SVGGraphicsElement : SVGElement { - //[SameObject] readonly attribute SVGAnimatedTransformList transform; - - //DOMRect getBBox(optional SVGBoundingBoxOptions options); - //DOMMatrix? getCTM(); - //DOMMatrix? getScreenCTM(); -}; - -//SVGGraphicsElement includes SVGTests; diff --git a/components/script/dom/webidls/SVGSVGElement.webidl b/components/script/dom/webidls/SVGSVGElement.webidl deleted file mode 100644 index 25b390cf15a..00000000000 --- a/components/script/dom/webidls/SVGSVGElement.webidl +++ /dev/null @@ -1,45 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://svgwg.org/svg2-draft/struct.html#InterfaceSVGSVGElement -[Exposed=Window, Pref="dom_svg_enabled"] -interface SVGSVGElement : SVGGraphicsElement { - - //[SameObject] readonly attribute SVGAnimatedLength x; - //[SameObject] readonly attribute SVGAnimatedLength y; - //[SameObject] readonly attribute SVGAnimatedLength width; - //[SameObject] readonly attribute SVGAnimatedLength height; - - //attribute float currentScale; - //[SameObject] readonly attribute DOMPointReadOnly currentTranslate; - - //NodeList getIntersectionList(DOMRectReadOnly rect, SVGElement? referenceElement); - //NodeList getEnclosureList(DOMRectReadOnly rect, SVGElement? referenceElement); - //boolean checkIntersection(SVGElement element, DOMRectReadOnly rect); - //boolean checkEnclosure(SVGElement element, DOMRectReadOnly rect); - - //void deselectAll(); - - //SVGNumber createSVGNumber(); - //SVGLength createSVGLength(); - //SVGAngle createSVGAngle(); - //DOMPoint createSVGPoint(); - //DOMMatrix createSVGMatrix(); - //DOMRect createSVGRect(); - //SVGTransform createSVGTransform(); - //SVGTransform createSVGTransformFromMatrix(DOMMatrixReadOnly matrix); - - //Element getElementById(DOMString elementId); - - // Deprecated methods that have no effect when called, - // but which are kept for compatibility reasons. - //unsigned long suspendRedraw(unsigned long maxWaitMilliseconds); - //void unsuspendRedraw(unsigned long suspendHandleID); - //void unsuspendRedrawAll(); - //void forceRedraw(); -}; - -//SVGSVGElement includes SVGFitToViewBox; -//SVGSVGElement includes SVGZoomAndPan; -//SVGSVGElement includes WindowEventHandlers; diff --git a/components/script/dom/webidls/Screen.webidl b/components/script/dom/webidls/Screen.webidl deleted file mode 100644 index 9160560b8c1..00000000000 --- a/components/script/dom/webidls/Screen.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// http://dev.w3.org/csswg/cssom-view/#the-screen-interface -[Exposed=Window] -interface Screen { - readonly attribute double availWidth; - readonly attribute double availHeight; - readonly attribute double width; - readonly attribute double height; - readonly attribute unsigned long colorDepth; - readonly attribute unsigned long pixelDepth; -}; diff --git a/components/script/dom/webidls/SecurityPolicyViolationEvent.webidl b/components/script/dom/webidls/SecurityPolicyViolationEvent.webidl deleted file mode 100644 index 6b34c30f719..00000000000 --- a/components/script/dom/webidls/SecurityPolicyViolationEvent.webidl +++ /dev/null @@ -1,41 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webappsec-csp/#securitypolicyviolationevent - -enum SecurityPolicyViolationEventDisposition { - "enforce", "report" -}; - -[Exposed=(Window,Worker)] -interface SecurityPolicyViolationEvent : Event { - constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict = {}); - readonly attribute USVString documentURI; - readonly attribute USVString referrer; - readonly attribute USVString blockedURI; - readonly attribute DOMString effectiveDirective; - readonly attribute DOMString violatedDirective; // historical alias of effectiveDirective - readonly attribute DOMString originalPolicy; - readonly attribute USVString sourceFile; - readonly attribute DOMString sample; - readonly attribute SecurityPolicyViolationEventDisposition disposition; - readonly attribute unsigned short statusCode; - readonly attribute unsigned long lineNumber; - readonly attribute unsigned long columnNumber; -}; - -dictionary SecurityPolicyViolationEventInit : EventInit { - USVString documentURI = ""; - USVString referrer = ""; - USVString blockedURI = ""; - DOMString violatedDirective = ""; - DOMString effectiveDirective = ""; - DOMString originalPolicy = ""; - USVString sourceFile = ""; - DOMString sample = ""; - SecurityPolicyViolationEventDisposition disposition = "enforce"; - unsigned short statusCode = 0; - unsigned long lineNumber = 0; - unsigned long columnNumber = 0; -}; diff --git a/components/script/dom/webidls/Selection.webidl b/components/script/dom/webidls/Selection.webidl deleted file mode 100644 index b51181286c1..00000000000 --- a/components/script/dom/webidls/Selection.webidl +++ /dev/null @@ -1,32 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/selection-api/#selection-interface -[Exposed=Window] -interface Selection { -readonly attribute Node? anchorNode; - readonly attribute unsigned long anchorOffset; - readonly attribute Node? focusNode; - readonly attribute unsigned long focusOffset; - readonly attribute boolean isCollapsed; - readonly attribute unsigned long rangeCount; - readonly attribute DOMString type; - [Throws] Range getRangeAt(unsigned long index); - undefined addRange(Range range); - [Throws] undefined removeRange(Range range); - undefined removeAllRanges(); - undefined empty(); - [Throws] undefined collapse(Node? node, optional unsigned long offset = 0); - [Throws] undefined setPosition(Node? node, optional unsigned long offset = 0); - [Throws] undefined collapseToStart(); - [Throws] undefined collapseToEnd(); - [Throws] undefined extend(Node node, optional unsigned long offset = 0); - [Throws] - undefined setBaseAndExtent(Node anchorNode, unsigned long anchorOffset, Node focusNode, unsigned long focusOffset); - [Throws] undefined selectAllChildren(Node node); - [CEReactions, Throws] - undefined deleteFromDocument(); - boolean containsNode(Node node, optional boolean allowPartialContainment = false); - stringifier DOMString (); -}; diff --git a/components/script/dom/webidls/ServiceWorker.webidl b/components/script/dom/webidls/ServiceWorker.webidl deleted file mode 100644 index ee12c92b6e2..00000000000 --- a/components/script/dom/webidls/ServiceWorker.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/ServiceWorker/#serviceworker-interface -[Pref="dom_serviceworker_enabled", SecureContext, Exposed=(Window,Worker)] -interface ServiceWorker : EventTarget { - readonly attribute USVString scriptURL; - readonly attribute ServiceWorkerState state; - [Throws] undefined postMessage(any message, sequence<object> transfer); - [Throws] undefined postMessage(any message, optional StructuredSerializeOptions options = {}); - - // event - attribute EventHandler onstatechange; -}; - -ServiceWorker includes AbstractWorker; - -enum ServiceWorkerState { - "installing", - "installed", - "activating", - "activated", - "redundant" -}; diff --git a/components/script/dom/webidls/ServiceWorkerContainer.webidl b/components/script/dom/webidls/ServiceWorkerContainer.webidl deleted file mode 100644 index 540079583b9..00000000000 --- a/components/script/dom/webidls/ServiceWorkerContainer.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/ServiceWorker/#serviceworkercontainer-interface -[Pref="dom_serviceworker_enabled", Exposed=(Window,Worker)] -interface ServiceWorkerContainer : EventTarget { - readonly attribute ServiceWorker? controller; - //readonly attribute Promise<ServiceWorkerRegistration> ready; - - [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, - optional RegistrationOptions options = {}); - - //[NewObject] Promise<any> getRegistration(optional USVString clientURL = ""); - //[NewObject] Promise<FrozenArray<ServiceWorkerRegistration>> getRegistrations(); - - //void startMessages(); - - // events - //attribute EventHandler oncontrollerchange; - //attribute EventHandler onerror; - //attribute EventHandler onmessage; // event.source of message events is ServiceWorker object - //attribute EventHandler onmessageerror; -}; - -dictionary RegistrationOptions { - USVString scope; - WorkerType type = "classic"; - ServiceWorkerUpdateViaCache updateViaCache = "imports"; -}; diff --git a/components/script/dom/webidls/ServiceWorkerGlobalScope.webidl b/components/script/dom/webidls/ServiceWorkerGlobalScope.webidl deleted file mode 100644 index f7535867deb..00000000000 --- a/components/script/dom/webidls/ServiceWorkerGlobalScope.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope - -[Global=(Worker,ServiceWorker), Exposed=ServiceWorker, - Pref="dom_serviceworker_enabled"] -interface ServiceWorkerGlobalScope : WorkerGlobalScope { - // A container for a list of Client objects that correspond to - // browsing contexts (or shared workers) that are on the origin of this SW - //[SameObject] readonly attribute Clients clients; - //[SameObject] readonly attribute ServiceWorkerRegistration registration; - - //[NewObject] Promise<void> skipWaiting(); - - //attribute EventHandler oninstall; - //attribute EventHandler onactivate; - //attribute EventHandler onfetch; - - // event - attribute EventHandler onmessage; // event.source of the message events is Client object - attribute EventHandler onmessageerror; -}; diff --git a/components/script/dom/webidls/ServiceWorkerRegistration.webidl b/components/script/dom/webidls/ServiceWorkerRegistration.webidl deleted file mode 100644 index 29982ee8ec3..00000000000 --- a/components/script/dom/webidls/ServiceWorkerRegistration.webidl +++ /dev/null @@ -1,27 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/ServiceWorker/#serviceworkerregistration-interface -[Pref="dom_serviceworker_enabled", SecureContext, Exposed=(Window,Worker)] -interface ServiceWorkerRegistration : EventTarget { - readonly attribute ServiceWorker? installing; - readonly attribute ServiceWorker? waiting; - readonly attribute ServiceWorker? active; - [SameObject] readonly attribute NavigationPreloadManager navigationPreload; - - readonly attribute USVString scope; - readonly attribute ServiceWorkerUpdateViaCache updateViaCache; - - // [NewObject] Promise<void> update(); - // [NewObject] Promise<boolean> unregister(); - - // event - // attribute EventHandler onupdatefound; -}; - -enum ServiceWorkerUpdateViaCache { - "imports", - "all", - "none" -}; diff --git a/components/script/dom/webidls/ServoParser.webidl b/components/script/dom/webidls/ServoParser.webidl deleted file mode 100644 index 0e30e557905..00000000000 --- a/components/script/dom/webidls/ServoParser.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[Exposed=(Window,Worker), - LegacyNoInterfaceObject] -interface ServoParser {}; diff --git a/components/script/dom/webidls/ShadowRoot.webidl b/components/script/dom/webidls/ShadowRoot.webidl deleted file mode 100644 index 444dd53d22c..00000000000 --- a/components/script/dom/webidls/ShadowRoot.webidl +++ /dev/null @@ -1,33 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://dom.spec.whatwg.org/#interface-shadowroot - */ - -[Exposed=Window] -interface ShadowRoot : DocumentFragment { - readonly attribute ShadowRootMode mode; - // readonly attribute boolean delegatesFocus; - readonly attribute SlotAssignmentMode slotAssignment; - readonly attribute boolean clonable; - // readonly attribute boolean serializable; - readonly attribute Element host; - // attribute EventHandler onslotchange; -}; - - -enum ShadowRootMode { "open", "closed"}; -enum SlotAssignmentMode { "manual", "named" }; - -ShadowRoot includes DocumentOrShadowRoot; - -// https://html.spec.whatwg.org/multipage/#dom-parsing-and-serialization -partial interface ShadowRoot { - // [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html); - // DOMString getHTML(optional GetHTMLOptions options = {}); - - // [CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML; - [CEReactions] attribute [LegacyNullToEmptyString] DOMString innerHTML; -}; diff --git a/components/script/dom/webidls/StaticRange.webidl b/components/script/dom/webidls/StaticRange.webidl deleted file mode 100644 index a582afe3d7a..00000000000 --- a/components/script/dom/webidls/StaticRange.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#interface-staticrange - */ - -dictionary StaticRangeInit { - required Node startContainer; - required unsigned long startOffset; - required Node endContainer; - required unsigned long endOffset; -}; - -[Exposed=Window] -interface StaticRange : AbstractRange { - [Throws] constructor(StaticRangeInit init); -}; diff --git a/components/script/dom/webidls/StereoPannerNode.webidl b/components/script/dom/webidls/StereoPannerNode.webidl deleted file mode 100644 index e59f7cb9d19..00000000000 --- a/components/script/dom/webidls/StereoPannerNode.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#StereoPannerNode - */ - -dictionary StereoPannerOptions: AudioNodeOptions { - float pan = 0; -}; - -[Exposed=Window] -interface StereoPannerNode : AudioScheduledSourceNode { - [Throws] constructor(BaseAudioContext context, optional StereoPannerOptions options = {}); - readonly attribute AudioParam pan; -}; diff --git a/components/script/dom/webidls/Storage.webidl b/components/script/dom/webidls/Storage.webidl deleted file mode 100644 index a4912e35f5f..00000000000 --- a/components/script/dom/webidls/Storage.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://html.spec.whatwg.org/multipage/#the-storage-interface - * - */ - -[Exposed=Window] -interface Storage { - - readonly attribute unsigned long length; - - DOMString? key(unsigned long index); - - getter DOMString? getItem(DOMString name); - - [Throws] - setter undefined setItem(DOMString name, DOMString value); - - deleter undefined removeItem(DOMString name); - - undefined clear(); -}; diff --git a/components/script/dom/webidls/StorageEvent.webidl b/components/script/dom/webidls/StorageEvent.webidl deleted file mode 100644 index 42ce914e49f..00000000000 --- a/components/script/dom/webidls/StorageEvent.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * Interface for a client side storage. See - * https://html.spec.whatwg.org/multipage/#the-storageevent-interface - * for more information. - * - * Event sent to a window when a storage area changes. - */ - -[Exposed=Window] -interface StorageEvent : Event { - [Throws] constructor(DOMString type, optional StorageEventInit eventInitDict = {}); - readonly attribute DOMString? key; - readonly attribute DOMString? oldValue; - readonly attribute DOMString? newValue; - readonly attribute DOMString url; - readonly attribute Storage? storageArea; - - - undefined initStorageEvent(DOMString type, optional boolean bubbles = false, - optional boolean cancelable = false, optional DOMString? key = null, optional - DOMString? oldValue = null, optional DOMString? newValue = null, optional - USVString url = "", optional Storage? storageArea = null); -}; - -dictionary StorageEventInit : EventInit { - DOMString? key = null; - DOMString? oldValue = null; - DOMString? newValue = null; - DOMString url = ""; - Storage? storageArea = null; -}; diff --git a/components/script/dom/webidls/StylePropertyMapReadOnly.webidl b/components/script/dom/webidls/StylePropertyMapReadOnly.webidl deleted file mode 100644 index b427ebd7ba0..00000000000 --- a/components/script/dom/webidls/StylePropertyMapReadOnly.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.css-houdini.org/css-typed-om-1/#stylepropertymapreadonly -// NOTE: should this be exposed to Window? -[Pref="dom_worklet_enabled", Exposed=(Worklet)] -interface StylePropertyMapReadOnly { - CSSStyleValue? get(DOMString property); - // sequence<CSSStyleValue> getAll(DOMString property); - boolean has(DOMString property); - // iterable<DOMString, (CSSStyleValue or sequence<CSSStyleValue>)>; - sequence<DOMString> getProperties(); - // https://github.com/w3c/css-houdini-drafts/issues/268 - // stringifier; -}; diff --git a/components/script/dom/webidls/StyleSheet.webidl b/components/script/dom/webidls/StyleSheet.webidl deleted file mode 100644 index cb8290cc30b..00000000000 --- a/components/script/dom/webidls/StyleSheet.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#the-stylesheet-interface -[Exposed=Window] -interface StyleSheet { - readonly attribute DOMString type_; - readonly attribute DOMString? href; - - readonly attribute Element? ownerNode; - // readonly attribute StyleSheet? parentStyleSheet; - readonly attribute DOMString? title; - - [SameObject, PutForwards=mediaText] readonly attribute MediaList media; - attribute boolean disabled; -}; - -// https://drafts.csswg.org/cssom/#the-linkstyle-interface -interface mixin LinkStyle { - readonly attribute StyleSheet? sheet; -}; diff --git a/components/script/dom/webidls/StyleSheetList.webidl b/components/script/dom/webidls/StyleSheetList.webidl deleted file mode 100644 index 2179c284495..00000000000 --- a/components/script/dom/webidls/StyleSheetList.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.csswg.org/cssom/#the-stylesheetlist-interface -// [ArrayClass] -[Exposed=Window] -interface StyleSheetList { - getter StyleSheet? item(unsigned long index); - readonly attribute unsigned long length; -}; diff --git a/components/script/dom/webidls/SubmitEvent.webidl b/components/script/dom/webidls/SubmitEvent.webidl deleted file mode 100644 index f5b2c49257d..00000000000 --- a/components/script/dom/webidls/SubmitEvent.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#submitevent -[Exposed=Window] -interface SubmitEvent : Event { - constructor(DOMString typeArg, optional SubmitEventInit eventInitDict = {}); - - readonly attribute HTMLElement? submitter; -}; - -dictionary SubmitEventInit : EventInit { - HTMLElement? submitter = null; -}; diff --git a/components/script/dom/webidls/SubtleCrypto.webidl b/components/script/dom/webidls/SubtleCrypto.webidl deleted file mode 100644 index e0bc1bc04a5..00000000000 --- a/components/script/dom/webidls/SubtleCrypto.webidl +++ /dev/null @@ -1,166 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webcrypto/#subtlecrypto-interface - -typedef (object or DOMString) AlgorithmIdentifier; - -typedef AlgorithmIdentifier HashAlgorithmIdentifier; - -dictionary Algorithm { - required DOMString name; -}; - -dictionary KeyAlgorithm { - required DOMString name; -}; - -enum KeyFormat { "raw", "spki", "pkcs8", "jwk" }; - -[SecureContext,Exposed=(Window,Worker),Pref="dom_crypto_subtle_enabled"] -interface SubtleCrypto { - Promise<any> encrypt(AlgorithmIdentifier algorithm, - CryptoKey key, - BufferSource data); - Promise<any> decrypt(AlgorithmIdentifier algorithm, - CryptoKey key, - BufferSource data); - Promise<any> sign(AlgorithmIdentifier algorithm, - CryptoKey key, - BufferSource data); - Promise<any> verify(AlgorithmIdentifier algorithm, - CryptoKey key, - BufferSource signature, - BufferSource data); - Promise<any> digest(AlgorithmIdentifier algorithm, - BufferSource data); - - Promise<any> generateKey(AlgorithmIdentifier algorithm, - boolean extractable, - sequence<KeyUsage> keyUsages ); - Promise<any> deriveKey(AlgorithmIdentifier algorithm, - CryptoKey baseKey, - AlgorithmIdentifier derivedKeyType, - boolean extractable, - sequence<KeyUsage> keyUsages ); - Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm, - CryptoKey baseKey, - optional unsigned long? length = null); - - Promise<CryptoKey> importKey(KeyFormat format, - (BufferSource or JsonWebKey) keyData, - AlgorithmIdentifier algorithm, - boolean extractable, - sequence<KeyUsage> keyUsages ); - Promise<any> exportKey(KeyFormat format, CryptoKey key); - - Promise<any> wrapKey(KeyFormat format, - CryptoKey key, - CryptoKey wrappingKey, - AlgorithmIdentifier wrapAlgorithm); - Promise<CryptoKey> unwrapKey(KeyFormat format, - BufferSource wrappedKey, - CryptoKey unwrappingKey, - AlgorithmIdentifier unwrapAlgorithm, - AlgorithmIdentifier unwrappedKeyAlgorithm, - boolean extractable, - sequence<KeyUsage> keyUsages ); -}; - -// AES shared -dictionary AesKeyAlgorithm : KeyAlgorithm { - required unsigned short length; -}; - -dictionary AesKeyGenParams : Algorithm { - required [EnforceRange] unsigned short length; -}; - -dictionary AesDerivedKeyParams : Algorithm { - required [EnforceRange] unsigned short length; -}; - -// AES_CBC -dictionary AesCbcParams : Algorithm { - required BufferSource iv; -}; - -// AES_CTR -dictionary AesCtrParams : Algorithm { - required BufferSource counter; - required [EnforceRange] octet length; -}; - -// https://w3c.github.io/webcrypto/#aes-gcm-params -dictionary AesGcmParams : Algorithm { - required BufferSource iv; - BufferSource additionalData; - [EnforceRange] octet tagLength; -}; - -// https://w3c.github.io/webcrypto/#dfn-HmacImportParams -dictionary HmacImportParams : Algorithm { - required HashAlgorithmIdentifier hash; - [EnforceRange] unsigned long length; -}; - -// https://w3c.github.io/webcrypto/#dfn-HmacKeyAlgorithm -dictionary HmacKeyAlgorithm : KeyAlgorithm { - required KeyAlgorithm hash; - required unsigned long length; -}; - -// https://w3c.github.io/webcrypto/#dfn-HmacKeyGenParams -dictionary HmacKeyGenParams : Algorithm { - required HashAlgorithmIdentifier hash; - [EnforceRange] unsigned long length; -}; - -// https://w3c.github.io/webcrypto/#hkdf-params -dictionary HkdfParams : Algorithm { - required HashAlgorithmIdentifier hash; - required BufferSource salt; - required BufferSource info; -}; - -// https://w3c.github.io/webcrypto/#pbkdf2-params -dictionary Pbkdf2Params : Algorithm { - required BufferSource salt; - required [EnforceRange] unsigned long iterations; - required HashAlgorithmIdentifier hash; -}; - -// JWK -dictionary RsaOtherPrimesInfo { - // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms - DOMString r; - DOMString d; - DOMString t; -}; - -dictionary JsonWebKey { - // The following fields are defined in Section 3.1 of JSON Web Key - DOMString kty; - DOMString use; - sequence<DOMString> key_ops; - DOMString alg; - - // The following fields are defined in JSON Web Key Parameters Registration - boolean ext; - - // The following fields are defined in Section 6 of JSON Web Algorithms - DOMString crv; - DOMString x; - DOMString y; - DOMString d; - DOMString n; - DOMString e; - DOMString p; - DOMString q; - DOMString dp; - DOMString dq; - DOMString qi; - sequence<RsaOtherPrimesInfo> oth; - DOMString k; -}; diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl deleted file mode 100644 index ee13ed57d55..00000000000 --- a/components/script/dom/webidls/TestBinding.webidl +++ /dev/null @@ -1,620 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -enum TestEnum { "", "foo", "bar" }; -typedef (DOMString or URL or Blob) TestTypedef; -typedef (DOMString or URL or Blob)? TestTypedefNullableUnion; -typedef DOMString TestTypedefString; -typedef Blob TestTypedefInterface; - -dictionary TestDictionary { - required boolean requiredValue; - boolean booleanValue; - byte byteValue; - octet octetValue; - short shortValue; - unsigned short unsignedShortValue; - long longValue; - unsigned long unsignedLongValue; - long long longLongValue; - unsigned long long unsignedLongLongValue; - unrestricted float unrestrictedFloatValue; - float floatValue; - unrestricted double unrestrictedDoubleValue; - double doubleValue; - DOMString stringValue; - USVString usvstringValue; - TestEnum enumValue; - Blob interfaceValue; - any anyValue; - object objectValue; - TestDictionaryDefaults dict = {}; - sequence<TestDictionaryDefaults> seqDict; - // Testing codegen to import Element correctly, ensure no other code references Element directly - sequence<Element> elementSequence; - // Reserved rust keyword - DOMString type; - // These are used to test bidirectional conversion - // and differentiation of non-required and nullable types - // in dictionaries. - DOMString? nonRequiredNullable; - DOMString? nonRequiredNullable2; - SimpleCallback noCallbackImport; - callbackWithOnlyOneOptionalArg noCallbackImport2; -}; - -dictionary TestDictionaryParent { - DOMString parentStringMember; -}; - -dictionary TestDictionaryWithParent : TestDictionaryParent { - DOMString stringMember; -}; - -dictionary TestDictionaryDefaults { - boolean booleanValue = false; - byte byteValue = 7; - octet octetValue = 7; - short shortValue = 7; - unsigned short unsignedShortValue = 7; - long longValue = 7; - unsigned long unsignedLongValue = 7; - long long longLongValue = 7; - unsigned long long unsignedLongLongValue = 7; - unrestricted float unrestrictedFloatValue = 7.0; - float floatValue = 7.0; - unrestricted double UnrestrictedDoubleValue = 7.0; - double doubleValue = 7.0; - ByteString bytestringValue = "foo"; - DOMString stringValue = "foo"; - USVString usvstringValue = "foo"; - TestEnum enumValue = "bar"; - any anyValue = null; - sequence<object> arrayValue = []; - - boolean? nullableBooleanValue = false; - byte? nullableByteValue = 7; - octet? nullableOctetValue = 7; - short? nullableShortValue = 7; - unsigned short? nullableUnsignedShortValue = 7; - long? nullableLongValue = 7; - unsigned long? nullableUnsignedLongValue = 7; - long long? nullableLongLongValue = 7; - unsigned long long? nullableUnsignedLongLongValue = 7; - unrestricted float? nullableUnrestrictedFloatValue = 7.0; - float? nullableFloatValue = 7.0; - unrestricted double? nullableUnrestrictedDoubleValue = 7.0; - double? nullableDoubleValue = 7.0; - ByteString? nullableBytestringValue = "foo"; - DOMString? nullableStringValue = "foo"; - USVString? nullableUsvstringValue = "foo"; - // TestEnum? nullableEnumValue = "bar"; - object? nullableObjectValue = null; -}; - -dictionary TestURLLike { - required DOMString href; -}; - -[Pref="dom_testbinding_enabled", - Exposed=(Window,Worker) -] -interface TestBinding { - [Throws] constructor(); - [Throws] constructor(sequence<unrestricted double> numberSequence); - [Throws] constructor(unrestricted double num); - attribute boolean booleanAttribute; - attribute byte byteAttribute; - attribute octet octetAttribute; - attribute short shortAttribute; - attribute unsigned short unsignedShortAttribute; - attribute long longAttribute; - attribute unsigned long unsignedLongAttribute; - attribute long long longLongAttribute; - attribute unsigned long long unsignedLongLongAttribute; - attribute unrestricted float unrestrictedFloatAttribute; - attribute float floatAttribute; - attribute unrestricted double unrestrictedDoubleAttribute; - attribute double doubleAttribute; - attribute DOMString stringAttribute; - attribute USVString usvstringAttribute; - attribute ByteString byteStringAttribute; - attribute TestEnum enumAttribute; - attribute Blob interfaceAttribute; - attribute (HTMLElement or long) unionAttribute; - attribute (Event or DOMString) union2Attribute; - attribute (Event or USVString) union3Attribute; - attribute (DOMString or unsigned long) union4Attribute; - attribute (DOMString or boolean) union5Attribute; - attribute (unsigned long or boolean) union6Attribute; - attribute (Blob or boolean) union7Attribute; - attribute (Blob or unsigned long) union8Attribute; - attribute (ByteString or long) union9Attribute; - readonly attribute Uint8ClampedArray arrayAttribute; - attribute any anyAttribute; - attribute object objectAttribute; - - attribute boolean? booleanAttributeNullable; - attribute byte? byteAttributeNullable; - attribute octet? octetAttributeNullable; - attribute short? shortAttributeNullable; - attribute unsigned short? unsignedShortAttributeNullable; - attribute long? longAttributeNullable; - attribute unsigned long? unsignedLongAttributeNullable; - attribute long long? longLongAttributeNullable; - attribute unsigned long long? unsignedLongLongAttributeNullable; - attribute unrestricted float? unrestrictedFloatAttributeNullable; - attribute float? floatAttributeNullable; - attribute unrestricted double? unrestrictedDoubleAttributeNullable; - attribute double? doubleAttributeNullable; - attribute DOMString? stringAttributeNullable; - attribute USVString? usvstringAttributeNullable; - attribute ByteString? byteStringAttributeNullable; - readonly attribute TestEnum? enumAttributeNullable; - attribute Blob? interfaceAttributeNullable; - attribute URL? interfaceAttributeWeak; - attribute object? objectAttributeNullable; - attribute (HTMLElement or long)? unionAttributeNullable; - attribute (Event or DOMString)? union2AttributeNullable; - attribute (Blob or boolean)? union3AttributeNullable; - attribute (unsigned long or boolean)? union4AttributeNullable; - attribute (DOMString or boolean)? union5AttributeNullable; - attribute (ByteString or long)? union6AttributeNullable; - [BinaryName="BinaryRenamedAttribute"] attribute DOMString attrToBinaryRename; - [BinaryName="BinaryRenamedAttribute2"] attribute DOMString attr-to-binary-rename; - attribute DOMString attr-to-automatically-rename; - - const long long constantInt64 = -1; - const unsigned long long constantUint64 = 1; - const float constantFloat32 = 1.0; - const double constantFloat64 = 1.0; - const unrestricted float constantUnrestrictedFloat32 = 1.0; - const unrestricted double constantUnrestrictedFloat64 = 1.0; - - [PutForwards=booleanAttribute] - readonly attribute TestBinding forwardedAttribute; - - [BinaryName="BinaryRenamedMethod"] undefined methToBinaryRename(); - undefined receiveVoid(); - boolean receiveBoolean(); - byte receiveByte(); - octet receiveOctet(); - short receiveShort(); - unsigned short receiveUnsignedShort(); - long receiveLong(); - unsigned long receiveUnsignedLong(); - long long receiveLongLong(); - unsigned long long receiveUnsignedLongLong(); - unrestricted float receiveUnrestrictedFloat(); - float receiveFloat(); - unrestricted double receiveUnrestrictedDouble(); - double receiveDouble(); - DOMString receiveString(); - USVString receiveUsvstring(); - ByteString receiveByteString(); - TestEnum receiveEnum(); - Blob receiveInterface(); - any receiveAny(); - object receiveObject(); - (HTMLElement or long) receiveUnion(); - (Event or DOMString) receiveUnion2(); - (DOMString or sequence<long>) receiveUnion3(); - (DOMString or sequence<DOMString>) receiveUnion4(); - (Blob or sequence<Blob>) receiveUnion5(); - (DOMString or unsigned long) receiveUnion6(); - (DOMString or boolean) receiveUnion7(); - (unsigned long or boolean) receiveUnion8(); - (HTMLElement or unsigned long or DOMString or boolean) receiveUnion9(); - (ByteString or long) receiveUnion10(); - (sequence<ByteString> or long or DOMString) receiveUnion11(); - sequence<long> receiveSequence(); - sequence<Blob> receiveInterfaceSequence(); - - byte? receiveNullableByte(); - boolean? receiveNullableBoolean(); - octet? receiveNullableOctet(); - short? receiveNullableShort(); - unsigned short? receiveNullableUnsignedShort(); - long? receiveNullableLong(); - unsigned long? receiveNullableUnsignedLong(); - long long? receiveNullableLongLong(); - unsigned long long? receiveNullableUnsignedLongLong(); - unrestricted float? receiveNullableUnrestrictedFloat(); - float? receiveNullableFloat(); - unrestricted double? receiveNullableUnrestrictedDouble(); - double? receiveNullableDouble(); - DOMString? receiveNullableString(); - USVString? receiveNullableUsvstring(); - ByteString? receiveNullableByteString(); - TestEnum? receiveNullableEnum(); - Blob? receiveNullableInterface(); - object? receiveNullableObject(); - (HTMLElement or long)? receiveNullableUnion(); - (Event or DOMString)? receiveNullableUnion2(); - (DOMString or sequence<long>)? receiveNullableUnion3(); - (sequence<long> or boolean)? receiveNullableUnion4(); - (unsigned long or boolean)? receiveNullableUnion5(); - (ByteString or long)? receiveNullableUnion6(); - sequence<long>? receiveNullableSequence(); - TestDictionary receiveTestDictionaryWithSuccessOnKeyword(); - boolean dictMatchesPassedValues(TestDictionary arg); - - (DOMString or object) receiveUnionIdentity((DOMString or object) arg); - - undefined passBoolean(boolean arg); - undefined passByte(byte arg); - undefined passOctet(octet arg); - undefined passShort(short arg); - undefined passUnsignedShort(unsigned short arg); - undefined passLong(long arg); - undefined passUnsignedLong(unsigned long arg); - undefined passLongLong(long long arg); - undefined passUnsignedLongLong(unsigned long long arg); - undefined passUnrestrictedFloat(unrestricted float arg); - undefined passFloat(float arg); - undefined passUnrestrictedDouble(unrestricted double arg); - undefined passDouble(double arg); - undefined passString(DOMString arg); - undefined passUsvstring(USVString arg); - undefined passByteString(ByteString arg); - undefined passEnum(TestEnum arg); - undefined passInterface(Blob arg); - undefined passTypedArray(Int8Array arg); - undefined passTypedArray2(ArrayBuffer arg); - undefined passTypedArray3(ArrayBufferView arg); - undefined passUnion((HTMLElement or long) arg); - undefined passUnion2((Event or DOMString) data); - undefined passUnion3((Blob or DOMString) data); - undefined passUnion4((DOMString or sequence<DOMString>) seq); - undefined passUnion5((DOMString or boolean) data); - undefined passUnion6((unsigned long or boolean) bool); - undefined passUnion7((sequence<DOMString> or unsigned long) arg); - undefined passUnion8((sequence<ByteString> or long) arg); - undefined passUnion9((TestDictionary or long) arg); - undefined passUnion10((DOMString or object) arg); - undefined passUnion11((ArrayBuffer or ArrayBufferView) arg); - undefined passUnionWithTypedef((Document or TestTypedef) arg); - undefined passUnionWithTypedef2((sequence<long> or TestTypedef) arg); - undefined passAny(any arg); - undefined passObject(object arg); - undefined passCallbackFunction(Function fun); - undefined passCallbackInterface(EventListener listener); - undefined passSequence(sequence<long> seq); - undefined passAnySequence(sequence<any> seq); - sequence<any> anySequencePassthrough(sequence<any> seq); - undefined passObjectSequence(sequence<object> seq); - undefined passStringSequence(sequence<DOMString> seq); - undefined passInterfaceSequence(sequence<Blob> seq); - - undefined passOverloaded(ArrayBuffer arg); - undefined passOverloaded(DOMString arg); - - // https://github.com/servo/servo/pull/26154 - DOMString passOverloadedDict(Node arg); - DOMString passOverloadedDict(TestURLLike arg); - - undefined passNullableBoolean(boolean? arg); - undefined passNullableByte(byte? arg); - undefined passNullableOctet(octet? arg); - undefined passNullableShort(short? arg); - undefined passNullableUnsignedShort(unsigned short? arg); - undefined passNullableLong(long? arg); - undefined passNullableUnsignedLong(unsigned long? arg); - undefined passNullableLongLong(long long? arg); - undefined passNullableUnsignedLongLong(unsigned long long? arg); - undefined passNullableUnrestrictedFloat(unrestricted float? arg); - undefined passNullableFloat(float? arg); - undefined passNullableUnrestrictedDouble(unrestricted double? arg); - undefined passNullableDouble(double? arg); - undefined passNullableString(DOMString? arg); - undefined passNullableUsvstring(USVString? arg); - undefined passNullableByteString(ByteString? arg); - // void passNullableEnum(TestEnum? arg); - undefined passNullableInterface(Blob? arg); - undefined passNullableObject(object? arg); - undefined passNullableTypedArray(Int8Array? arg); - undefined passNullableUnion((HTMLElement or long)? arg); - undefined passNullableUnion2((Event or DOMString)? data); - undefined passNullableUnion3((DOMString or sequence<long>)? data); - undefined passNullableUnion4((sequence<long> or boolean)? bool); - undefined passNullableUnion5((unsigned long or boolean)? arg); - undefined passNullableUnion6((ByteString or long)? arg); - undefined passNullableCallbackFunction(Function? fun); - undefined passNullableCallbackInterface(EventListener? listener); - undefined passNullableSequence(sequence<long>? seq); - - undefined passOptionalBoolean(optional boolean arg); - undefined passOptionalByte(optional byte arg); - undefined passOptionalOctet(optional octet arg); - undefined passOptionalShort(optional short arg); - undefined passOptionalUnsignedShort(optional unsigned short arg); - undefined passOptionalLong(optional long arg); - undefined passOptionalUnsignedLong(optional unsigned long arg); - undefined passOptionalLongLong(optional long long arg); - undefined passOptionalUnsignedLongLong(optional unsigned long long arg); - undefined passOptionalUnrestrictedFloat(optional unrestricted float arg); - undefined passOptionalFloat(optional float arg); - undefined passOptionalUnrestrictedDouble(optional unrestricted double arg); - undefined passOptionalDouble(optional double arg); - undefined passOptionalString(optional DOMString arg); - undefined passOptionalUsvstring(optional USVString arg); - undefined passOptionalByteString(optional ByteString arg); - undefined passOptionalEnum(optional TestEnum arg); - undefined passOptionalInterface(optional Blob arg); - undefined passOptionalUnion(optional (HTMLElement or long) arg); - undefined passOptionalUnion2(optional (Event or DOMString) data); - undefined passOptionalUnion3(optional (DOMString or sequence<long>) arg); - undefined passOptionalUnion4(optional (sequence<long> or boolean) data); - undefined passOptionalUnion5(optional (unsigned long or boolean) bool); - undefined passOptionalUnion6(optional (ByteString or long) arg); - undefined passOptionalAny(optional any arg); - undefined passOptionalObject(optional object arg); - undefined passOptionalCallbackFunction(optional Function fun); - undefined passOptionalCallbackInterface(optional EventListener listener); - undefined passOptionalSequence(optional sequence<long> seq); - - undefined passOptionalNullableBoolean(optional boolean? arg); - undefined passOptionalNullableByte(optional byte? arg); - undefined passOptionalNullableOctet(optional octet? arg); - undefined passOptionalNullableShort(optional short? arg); - undefined passOptionalNullableUnsignedShort(optional unsigned short? arg); - undefined passOptionalNullableLong(optional long? arg); - undefined passOptionalNullableUnsignedLong(optional unsigned long? arg); - undefined passOptionalNullableLongLong(optional long long? arg); - undefined passOptionalNullableUnsignedLongLong(optional unsigned long long? arg); - undefined passOptionalNullableUnrestrictedFloat(optional unrestricted float? arg); - undefined passOptionalNullableFloat(optional float? arg); - undefined passOptionalNullableUnrestrictedDouble(optional unrestricted double? arg); - undefined passOptionalNullableDouble(optional double? arg); - undefined passOptionalNullableString(optional DOMString? arg); - undefined passOptionalNullableUsvstring(optional USVString? arg); - undefined passOptionalNullableByteString(optional ByteString? arg); - // void passOptionalNullableEnum(optional TestEnum? arg); - undefined passOptionalNullableInterface(optional Blob? arg); - undefined passOptionalNullableObject(optional object? arg); - undefined passOptionalNullableUnion(optional (HTMLElement or long)? arg); - undefined passOptionalNullableUnion2(optional (Event or DOMString)? data); - undefined passOptionalNullableUnion3(optional (DOMString or sequence<long>)? arg); - undefined passOptionalNullableUnion4(optional (sequence<long> or boolean)? data); - undefined passOptionalNullableUnion5(optional (unsigned long or boolean)? bool); - undefined passOptionalNullableUnion6(optional (ByteString or long)? arg); - undefined passOptionalNullableCallbackFunction(optional Function? fun); - undefined passOptionalNullableCallbackInterface(optional EventListener? listener); - undefined passOptionalNullableSequence(optional sequence<long>? seq); - - undefined passOptionalBooleanWithDefault(optional boolean arg = false); - undefined passOptionalByteWithDefault(optional byte arg = 0); - undefined passOptionalOctetWithDefault(optional octet arg = 19); - undefined passOptionalShortWithDefault(optional short arg = 5); - undefined passOptionalUnsignedShortWithDefault(optional unsigned short arg = 2); - undefined passOptionalLongWithDefault(optional long arg = 7); - undefined passOptionalUnsignedLongWithDefault(optional unsigned long arg = 6); - undefined passOptionalLongLongWithDefault(optional long long arg = -12); - undefined passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17); - undefined passOptionalBytestringWithDefault(optional ByteString arg = "x"); - undefined passOptionalStringWithDefault(optional DOMString arg = "x"); - undefined passOptionalUsvstringWithDefault(optional USVString arg = "x"); - undefined passOptionalEnumWithDefault(optional TestEnum arg = "foo"); - undefined passOptionalSequenceWithDefault(optional sequence<long> seq = []); - // void passOptionalUnionWithDefault(optional (HTMLElement or long) arg = 9); - // void passOptionalUnion2WithDefault(optional(Event or DOMString)? data = "foo"); - - undefined passOptionalNullableBooleanWithDefault(optional boolean? arg = null); - undefined passOptionalNullableByteWithDefault(optional byte? arg = null); - undefined passOptionalNullableOctetWithDefault(optional octet? arg = null); - undefined passOptionalNullableShortWithDefault(optional short? arg = null); - undefined passOptionalNullableUnsignedShortWithDefault(optional unsigned short? arg = null); - undefined passOptionalNullableLongWithDefault(optional long? arg = null); - undefined passOptionalNullableUnsignedLongWithDefault(optional unsigned long? arg = null); - undefined passOptionalNullableLongLongWithDefault(optional long long? arg = null); - undefined passOptionalNullableUnsignedLongLongWithDefault(optional unsigned long long? arg = null); - undefined passOptionalNullableStringWithDefault(optional DOMString? arg = null); - undefined passOptionalNullableUsvstringWithDefault(optional USVString? arg = null); - undefined passOptionalNullableByteStringWithDefault(optional ByteString? arg = null); - // void passOptionalNullableEnumWithDefault(optional TestEnum? arg = null); - undefined passOptionalNullableInterfaceWithDefault(optional Blob? arg = null); - undefined passOptionalNullableObjectWithDefault(optional object? arg = null); - undefined passOptionalNullableUnionWithDefault(optional (HTMLElement or long)? arg = null); - undefined passOptionalNullableUnion2WithDefault(optional (Event or DOMString)? data = null); - // void passOptionalNullableCallbackFunctionWithDefault(optional Function? fun = null); - undefined passOptionalNullableCallbackInterfaceWithDefault(optional EventListener? listener = null); - undefined passOptionalAnyWithDefault(optional any arg = null); - - undefined passOptionalNullableBooleanWithNonNullDefault(optional boolean? arg = false); - undefined passOptionalNullableByteWithNonNullDefault(optional byte? arg = 7); - undefined passOptionalNullableOctetWithNonNullDefault(optional octet? arg = 7); - undefined passOptionalNullableShortWithNonNullDefault(optional short? arg = 7); - undefined passOptionalNullableUnsignedShortWithNonNullDefault(optional unsigned short? arg = 7); - undefined passOptionalNullableLongWithNonNullDefault(optional long? arg = 7); - undefined passOptionalNullableUnsignedLongWithNonNullDefault(optional unsigned long? arg = 7); - undefined passOptionalNullableLongLongWithNonNullDefault(optional long long? arg = 7); - undefined passOptionalNullableUnsignedLongLongWithNonNullDefault(optional unsigned long long? arg = 7); - // void passOptionalNullableUnrestrictedFloatWithNonNullDefault(optional unrestricted float? arg = 0.0); - // void passOptionalNullableFloatWithNonNullDefault(optional float? arg = 0.0); - // void passOptionalNullableUnrestrictedDoubleWithNonNullDefault(optional unrestricted double? arg = 0.0); - // void passOptionalNullableDoubleWithNonNullDefault(optional double? arg = 0.0); - undefined passOptionalNullableStringWithNonNullDefault(optional DOMString? arg = "x"); - undefined passOptionalNullableUsvstringWithNonNullDefault(optional USVString? arg = "x"); - // void passOptionalNullableEnumWithNonNullDefault(optional TestEnum? arg = "foo"); - // void passOptionalNullableUnionWithNonNullDefault(optional (HTMLElement or long)? arg = 7); - // void passOptionalNullableUnion2WithNonNullDefault(optional (Event or DOMString)? data = "foo"); - TestBinding passOptionalOverloaded(TestBinding arg0, optional unsigned long arg1 = 0, - optional unsigned long arg2 = 0); - undefined passOptionalOverloaded(Blob arg0, optional unsigned long arg1 = 0); - - undefined passVariadicBoolean(boolean... args); - undefined passVariadicBooleanAndDefault(optional boolean arg = true, boolean... args); - undefined passVariadicByte(byte... args); - undefined passVariadicOctet(octet... args); - undefined passVariadicShort(short... args); - undefined passVariadicUnsignedShort(unsigned short... args); - undefined passVariadicLong(long... args); - undefined passVariadicUnsignedLong(unsigned long... args); - undefined passVariadicLongLong(long long... args); - undefined passVariadicUnsignedLongLong(unsigned long long... args); - undefined passVariadicUnrestrictedFloat(unrestricted float... args); - undefined passVariadicFloat(float... args); - undefined passVariadicUnrestrictedDouble(unrestricted double... args); - undefined passVariadicDouble(double... args); - undefined passVariadicString(DOMString... args); - undefined passVariadicUsvstring(USVString... args); - undefined passVariadicByteString(ByteString... args); - undefined passVariadicEnum(TestEnum... args); - undefined passVariadicInterface(Blob... args); - undefined passVariadicUnion((HTMLElement or long)... args); - undefined passVariadicUnion2((Event or DOMString)... args); - undefined passVariadicUnion3((Blob or DOMString)... args); - undefined passVariadicUnion4((Blob or boolean)... args); - undefined passVariadicUnion5((DOMString or unsigned long)... args); - undefined passVariadicUnion6((unsigned long or boolean)... args); - undefined passVariadicUnion7((ByteString or long)... args); - undefined passVariadicAny(any... args); - undefined passVariadicObject(object... args); - - undefined passSequenceSequence(sequence<sequence<long>> seq); - sequence<sequence<long>> returnSequenceSequence(); - undefined passUnionSequenceSequence((long or sequence<sequence<long>>) seq); - - undefined passRecord(record<DOMString, long> arg); - undefined passRecordWithUSVStringKey(record<USVString, long> arg); - undefined passRecordWithByteStringKey(record<ByteString, long> arg); - undefined passNullableRecord(record<DOMString, long>? arg); - undefined passRecordOfNullableInts(record<DOMString, long?> arg); - undefined passOptionalRecordOfNullableInts(optional record<DOMString, long?> arg); - undefined passOptionalNullableRecordOfNullableInts(optional record<DOMString, long?>? arg); - undefined passCastableObjectRecord(record<DOMString, TestBinding> arg); - undefined passNullableCastableObjectRecord(record<DOMString, TestBinding?> arg); - undefined passCastableObjectNullableRecord(record<DOMString, TestBinding>? arg); - undefined passNullableCastableObjectNullableRecord(record<DOMString, TestBinding?>? arg); - undefined passOptionalRecord(optional record<DOMString, long> arg); - undefined passOptionalNullableRecord(optional record<DOMString, long>? arg); - undefined passOptionalNullableRecordWithDefaultValue(optional record<DOMString, long>? arg = null); - undefined passOptionalObjectRecord(optional record<DOMString, TestBinding> arg); - undefined passStringRecord(record<DOMString, DOMString> arg); - undefined passByteStringRecord(record<DOMString, ByteString> arg); - undefined passRecordOfRecords(record<DOMString, record<DOMString, long>> arg); - - undefined passRecordUnion((long or record<DOMString, ByteString>) init); - undefined passRecordUnion2((TestBinding or record<DOMString, ByteString>) init); - undefined passRecordUnion3((TestBinding or sequence<sequence<ByteString>> or record<DOMString, ByteString>) init); - - record<DOMString, long> receiveRecord(); - record<USVString, long> receiveRecordWithUSVStringKey(); - record<ByteString, long> receiveRecordWithByteStringKey(); - record<DOMString, long>? receiveNullableRecord(); - record<DOMString, long?> receiveRecordOfNullableInts(); - record<DOMString, long?>? receiveNullableRecordOfNullableInts(); - record<DOMString, record<DOMString, long>> receiveRecordOfRecords(); - record<DOMString, any> receiveAnyRecord(); - - static attribute boolean booleanAttributeStatic; - static undefined receiveVoidStatic(); - boolean BooleanMozPreference(DOMString pref_name); - DOMString StringMozPreference(DOMString pref_name); - - [Pref="dom_testbinding_prefcontrolled_enabled"] - readonly attribute boolean prefControlledAttributeDisabled; - [Pref="dom_testbinding_prefcontrolled_enabled"] - static readonly attribute boolean prefControlledStaticAttributeDisabled; - [Pref="dom_testbinding_prefcontrolled_enabled"] - undefined prefControlledMethodDisabled(); - [Pref="dom_testbinding_prefcontrolled_enabled"] - static undefined prefControlledStaticMethodDisabled(); - [Pref="dom_testbinding_prefcontrolled_enabled"] - const unsigned short prefControlledConstDisabled = 0; - [Pref="layout_animations_test_enabled"] - undefined advanceClock(long millis); - - [Pref="dom_testbinding_prefcontrolled2_enabled"] - readonly attribute boolean prefControlledAttributeEnabled; - [Pref="dom_testbinding_prefcontrolled2_enabled"] - static readonly attribute boolean prefControlledStaticAttributeEnabled; - [Pref="dom_testbinding_prefcontrolled2_enabled"] - undefined prefControlledMethodEnabled(); - [Pref="dom_testbinding_prefcontrolled2_enabled"] - static undefined prefControlledStaticMethodEnabled(); - [Pref="dom_testbinding_prefcontrolled2_enabled"] - const unsigned short prefControlledConstEnabled = 0; - - [Func="TestBinding::condition_unsatisfied"] - readonly attribute boolean funcControlledAttributeDisabled; - [Func="TestBinding::condition_unsatisfied"] - static readonly attribute boolean funcControlledStaticAttributeDisabled; - [Func="TestBinding::condition_unsatisfied"] - undefined funcControlledMethodDisabled(); - [Func="TestBinding::condition_unsatisfied"] - static undefined funcControlledStaticMethodDisabled(); - [Func="TestBinding::condition_unsatisfied"] - const unsigned short funcControlledConstDisabled = 0; - - [Func="TestBinding::condition_satisfied"] - readonly attribute boolean funcControlledAttributeEnabled; - [Func="TestBinding::condition_satisfied"] - static readonly attribute boolean funcControlledStaticAttributeEnabled; - [Func="TestBinding::condition_satisfied"] - undefined funcControlledMethodEnabled(); - [Func="TestBinding::condition_satisfied"] - static undefined funcControlledStaticMethodEnabled(); - [Func="TestBinding::condition_satisfied"] - const unsigned short funcControlledConstEnabled = 0; - - [Throws] - Promise<any> returnResolvedPromise(any value); - [Throws] - Promise<any> returnRejectedPromise(any value); - readonly attribute Promise<boolean> promiseAttribute; - undefined acceptPromise(Promise<DOMString> string); - Promise<any> promiseNativeHandler(SimpleCallback? resolve, SimpleCallback? reject); - undefined promiseResolveNative(Promise<any> p, any value); - undefined promiseRejectNative(Promise<any> p, any value); - undefined promiseRejectWithTypeError(Promise<any> p, USVString message); - undefined resolvePromiseDelayed(Promise<any> p, DOMString value, unsigned long long ms); - - [Throws] - static Promise<any> staticThrowToRejectPromise(); - [Throws] - Promise<any> methodThrowToRejectPromise(); - [Throws] - readonly attribute Promise<any> getterThrowToRejectPromise; - - static Promise<any> staticInternalThrowToRejectPromise([EnforceRange] unsigned long long arg); - Promise<any> methodInternalThrowToRejectPromise([EnforceRange] unsigned long long arg); - - undefined panic(); - - GlobalScope entryGlobal(); - GlobalScope incumbentGlobal(); - - [Exposed=(Window)] - readonly attribute boolean semiExposedBoolFromInterface; - - TestDictionaryWithParent getDictionaryWithParent(DOMString parent, DOMString child); -}; - -[Exposed=(Window)] -partial interface TestBinding { - readonly attribute boolean boolFromSemiExposedPartialInterface; -}; - -partial interface TestBinding { - [Exposed=(Window)] - readonly attribute boolean semiExposedBoolFromPartialInterface; -}; - -callback SimpleCallback = undefined(any value); -callback callbackWithOnlyOneOptionalArg = Promise<undefined> (optional any reason); - -partial interface TestBinding { - [Pref="dom_testable_crash_enabled"] - undefined crashHard(); -}; - -[Exposed=(Window,Worker), Pref="dom_testbinding_enabled"] -namespace TestNS { - const unsigned long ONE = 1; - const unsigned long TWO = 0x2; -}; diff --git a/components/script/dom/webidls/TestBindingIterable.webidl b/components/script/dom/webidls/TestBindingIterable.webidl deleted file mode 100644 index cc7628af707..00000000000 --- a/components/script/dom/webidls/TestBindingIterable.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[Pref="dom_testbinding_enabled", Exposed=(Window,Worker)] -interface TestBindingIterable { - [Throws] constructor(); - undefined add(DOMString arg); - readonly attribute unsigned long length; - getter DOMString getItem(unsigned long index); - iterable<DOMString>; -}; diff --git a/components/script/dom/webidls/TestBindingMaplike.webidl b/components/script/dom/webidls/TestBindingMaplike.webidl deleted file mode 100644 index 8debb804a3e..00000000000 --- a/components/script/dom/webidls/TestBindingMaplike.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[Pref="dom_testbinding_enabled", Exposed=(Window,Worker)] -interface TestBindingMaplike { - [Throws] - constructor(); - - maplike<DOMString, long>; - undefined setInternal(DOMString aKey, long aValue); - undefined clearInternal(); - boolean deleteInternal(DOMString aKey); - boolean hasInternal(DOMString aKey); - [Throws] - long getInternal(DOMString aKey); -}; diff --git a/components/script/dom/webidls/TestBindingPairIterable.webidl b/components/script/dom/webidls/TestBindingPairIterable.webidl deleted file mode 100644 index e3106949e3e..00000000000 --- a/components/script/dom/webidls/TestBindingPairIterable.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[Pref="dom_testbinding_enabled", Exposed=(Window,Worker)] -interface TestBindingPairIterable { - [Throws] constructor(); - undefined add(DOMString key, unsigned long value); - iterable<DOMString, unsigned long>; -}; diff --git a/components/script/dom/webidls/TestBindingProxy.webidl b/components/script/dom/webidls/TestBindingProxy.webidl deleted file mode 100644 index 957db0f0302..00000000000 --- a/components/script/dom/webidls/TestBindingProxy.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * This IDL file was created to test the special operations (see - * https://heycam.github.io/webidl/#idl-special-operations) without converting - * TestBinding.webidl into a proxy. - * - */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[Pref="dom_testbinding_enabled", Exposed=(Window,Worker)] -interface TestBindingProxy : TestBinding { - readonly attribute unsigned long length; - - getter DOMString getNamedItem(DOMString item_name); - - setter undefined setNamedItem(DOMString item_name, DOMString value); - - getter DOMString getItem(unsigned long index); - - setter undefined setItem(unsigned long index, DOMString value); - - deleter undefined removeItem(DOMString name); - - stringifier; -}; diff --git a/components/script/dom/webidls/TestBindingSetlike.webidl b/components/script/dom/webidls/TestBindingSetlike.webidl deleted file mode 100644 index 16b264bb9f6..00000000000 --- a/components/script/dom/webidls/TestBindingSetlike.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[Pref="dom_testbinding_enabled", Exposed=(Window,Worker)] -interface TestBindingSetlike { - [Throws] - constructor(); - - setlike<DOMString>; -}; diff --git a/components/script/dom/webidls/TestRunner.webidl b/components/script/dom/webidls/TestRunner.webidl deleted file mode 100644 index 4be17153247..00000000000 --- a/components/script/dom/webidls/TestRunner.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://webbluetoothcg.github.io/web-bluetooth/tests#test-runner - -// callback BluetoothManualChooserEventsCallback = void(sequence<DOMString> events); - -[Pref="dom_bluetooth_testing_enabled", Exposed=Window] -interface TestRunner { - [Throws] - undefined setBluetoothMockDataSet(DOMString dataSetName); - // void setBluetoothManualChooser(); - // void getBluetoothManualChooserEvents(BluetoothManualChooserEventsCallback callback); - // void sendBluetoothManualChooserEvent(DOMString event, DOMString argument); -}; diff --git a/components/script/dom/webidls/TestWorklet.webidl b/components/script/dom/webidls/TestWorklet.webidl deleted file mode 100644 index 8e5898736b0..00000000000 --- a/components/script/dom/webidls/TestWorklet.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[Pref="dom_worklet_testing_enabled", Exposed=(Window)] -interface TestWorklet { - [Throws] constructor(); - [NewObject] Promise<undefined> addModule(USVString moduleURL, optional WorkletOptions options = {}); - DOMString? lookup(DOMString key); -}; diff --git a/components/script/dom/webidls/TestWorkletGlobalScope.webidl b/components/script/dom/webidls/TestWorkletGlobalScope.webidl deleted file mode 100644 index 86599a2c257..00000000000 --- a/components/script/dom/webidls/TestWorkletGlobalScope.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[Global=(Worklet,TestWorklet), Pref="dom_worklet_enabled", Exposed=TestWorklet] -interface TestWorkletGlobalScope : WorkletGlobalScope { - undefined registerKeyValue(DOMString key, DOMString value); -}; diff --git a/components/script/dom/webidls/Text.webidl b/components/script/dom/webidls/Text.webidl deleted file mode 100644 index 0b0a980d0a9..00000000000 --- a/components/script/dom/webidls/Text.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/ - * - * To the extent possible under law, the editors have waived all copyright - * and related or neighboring rights to this work. - */ - -// https://dom.spec.whatwg.org/#text -[Exposed=Window] -interface Text : CharacterData { - [Throws] constructor(optional DOMString data = ""); - [NewObject, Throws] - Text splitText(unsigned long offset); - [Pure] - readonly attribute DOMString wholeText; -}; diff --git a/components/script/dom/webidls/TextDecoder.webidl b/components/script/dom/webidls/TextDecoder.webidl deleted file mode 100644 index cc9cf5506db..00000000000 --- a/components/script/dom/webidls/TextDecoder.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://encoding.spec.whatwg.org/#interface-textdecoder -dictionary TextDecoderOptions { - boolean fatal = false; - boolean ignoreBOM = false; -}; - -dictionary TextDecodeOptions { - boolean stream = false; -}; - -[Exposed=(Window,Worker)] -interface TextDecoder { - [Throws] constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options = {}); - readonly attribute DOMString encoding; - readonly attribute boolean fatal; - readonly attribute boolean ignoreBOM; - [Throws] - USVString decode(optional BufferSource input, optional TextDecodeOptions options = {}); -}; diff --git a/components/script/dom/webidls/TextEncoder.webidl b/components/script/dom/webidls/TextEncoder.webidl deleted file mode 100644 index 7028bb19172..00000000000 --- a/components/script/dom/webidls/TextEncoder.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -/* https://encoding.spec.whatwg.org/#interface-textencoder */ - -dictionary TextEncoderEncodeIntoResult { - unsigned long long read; - unsigned long long written; -}; - -[Exposed=(Window,Worker)] -interface TextEncoder { - [Throws] constructor(); - readonly attribute DOMString encoding; - [NewObject] - Uint8Array encode(optional USVString input = ""); - TextEncoderEncodeIntoResult encodeInto(USVString source, [AllowShared] Uint8Array destination); -}; diff --git a/components/script/dom/webidls/TextMetrics.webidl b/components/script/dom/webidls/TextMetrics.webidl deleted file mode 100644 index ebf0bd8a3dc..00000000000 --- a/components/script/dom/webidls/TextMetrics.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#textmetrics -[Exposed=(PaintWorklet, Window, Worker), Pref="dom_canvas_text_enabled"] -interface TextMetrics { - // x-direction - readonly attribute double width; // advance width - readonly attribute double actualBoundingBoxLeft; - readonly attribute double actualBoundingBoxRight; - - // y-direction - readonly attribute double fontBoundingBoxAscent; - readonly attribute double fontBoundingBoxDescent; - readonly attribute double actualBoundingBoxAscent; - readonly attribute double actualBoundingBoxDescent; - readonly attribute double emHeightAscent; - readonly attribute double emHeightDescent; - readonly attribute double hangingBaseline; - readonly attribute double alphabeticBaseline; - readonly attribute double ideographicBaseline; -}; diff --git a/components/script/dom/webidls/TextTrack.webidl b/components/script/dom/webidls/TextTrack.webidl deleted file mode 100644 index c0016ca6ed9..00000000000 --- a/components/script/dom/webidls/TextTrack.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#texttrack - -enum TextTrackMode { "disabled", "hidden", "showing" }; -enum TextTrackKind { "subtitles", "captions", "descriptions", "chapters", "metadata" }; - -[Exposed=Window] -interface TextTrack : EventTarget { - readonly attribute TextTrackKind kind; - readonly attribute DOMString label; - readonly attribute DOMString language; - - readonly attribute DOMString id; - // readonly attribute DOMString inBandMetadataTrackDispatchType; - - attribute TextTrackMode mode; - - readonly attribute TextTrackCueList? cues; - readonly attribute TextTrackCueList? activeCues; - - [Throws] - undefined addCue(TextTrackCue cue); - [Throws] - undefined removeCue(TextTrackCue cue); - - attribute EventHandler oncuechange; -}; diff --git a/components/script/dom/webidls/TextTrackCue.webidl b/components/script/dom/webidls/TextTrackCue.webidl deleted file mode 100644 index 20f1bf3f06d..00000000000 --- a/components/script/dom/webidls/TextTrackCue.webidl +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#texttrackcue - -[Exposed=Window] -interface TextTrackCue : EventTarget { - readonly attribute TextTrack? track; - - attribute DOMString id; - attribute double startTime; - attribute double endTime; - attribute boolean pauseOnExit; - - attribute EventHandler onenter; - attribute EventHandler onexit; -}; diff --git a/components/script/dom/webidls/TextTrackCueList.webidl b/components/script/dom/webidls/TextTrackCueList.webidl deleted file mode 100644 index 357d8751bc2..00000000000 --- a/components/script/dom/webidls/TextTrackCueList.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#texttrackcuelist - -[Exposed=Window] -interface TextTrackCueList { - readonly attribute unsigned long length; - getter TextTrackCue (unsigned long index); - TextTrackCue? getCueById(DOMString id); -}; diff --git a/components/script/dom/webidls/TextTrackList.webidl b/components/script/dom/webidls/TextTrackList.webidl deleted file mode 100644 index 33e1bef0ff4..00000000000 --- a/components/script/dom/webidls/TextTrackList.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#texttracklist - -[Exposed=Window] -interface TextTrackList : EventTarget { - readonly attribute unsigned long length; - getter TextTrack (unsigned long index); - TextTrack? getTrackById(DOMString id); - - attribute EventHandler onchange; - attribute EventHandler onaddtrack; - attribute EventHandler onremovetrack; -}; diff --git a/components/script/dom/webidls/TimeRanges.webidl b/components/script/dom/webidls/TimeRanges.webidl deleted file mode 100644 index 0163a590a91..00000000000 --- a/components/script/dom/webidls/TimeRanges.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage#time-ranges - -[Exposed=Window] -interface TimeRanges { - readonly attribute unsigned long length; - [Throws] double start(unsigned long index); - [Throws] double end(unsigned long index); -}; diff --git a/components/script/dom/webidls/Touch.webidl b/components/script/dom/webidls/Touch.webidl deleted file mode 100644 index c887a0fc2a3..00000000000 --- a/components/script/dom/webidls/Touch.webidl +++ /dev/null @@ -1,20 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// http://w3c.github.io/touch-events/#idl-def-Touch -[Exposed=Window] -interface Touch { - readonly attribute long identifier; - readonly attribute EventTarget target; - readonly attribute double screenX; - readonly attribute double screenY; - readonly attribute double clientX; - readonly attribute double clientY; - readonly attribute double pageX; - readonly attribute double pageY; - // readonly attribute float radiusX; - // readonly attribute float radiusY; - // readonly attribute float rotationAngle; - // readonly attribute float force; -}; diff --git a/components/script/dom/webidls/TouchEvent.webidl b/components/script/dom/webidls/TouchEvent.webidl deleted file mode 100644 index 3779349b781..00000000000 --- a/components/script/dom/webidls/TouchEvent.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// http://w3c.github.io/touch-events/#idl-def-TouchEvent -[Exposed=Window] -interface TouchEvent : UIEvent { - readonly attribute TouchList touches; - readonly attribute TouchList targetTouches; - readonly attribute TouchList changedTouches; - readonly attribute boolean altKey; - readonly attribute boolean metaKey; - readonly attribute boolean ctrlKey; - readonly attribute boolean shiftKey; -}; diff --git a/components/script/dom/webidls/TouchList.webidl b/components/script/dom/webidls/TouchList.webidl deleted file mode 100644 index bc6f7cb1304..00000000000 --- a/components/script/dom/webidls/TouchList.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// http://w3c.github.io/touch-events/#idl-def-TouchList -[Exposed=Window] -interface TouchList { - readonly attribute unsigned long length; - getter Touch? item (unsigned long index); -}; diff --git a/components/script/dom/webidls/TrackEvent.webidl b/components/script/dom/webidls/TrackEvent.webidl deleted file mode 100644 index 124e5cf4345..00000000000 --- a/components/script/dom/webidls/TrackEvent.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-trackevent-interface - -[Exposed=Window] -interface TrackEvent : Event { - [Throws] constructor(DOMString type, optional TrackEventInit eventInitDict = {}); - readonly attribute (VideoTrack or AudioTrack or TextTrack)? track; -}; - -dictionary TrackEventInit : EventInit { - (VideoTrack or AudioTrack or TextTrack)? track = null; -}; diff --git a/components/script/dom/webidls/TransitionEvent.webidl b/components/script/dom/webidls/TransitionEvent.webidl deleted file mode 100644 index eaa9f3917db..00000000000 --- a/components/script/dom/webidls/TransitionEvent.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * For more information on this interface please see - * https://dom.spec.whatwg.org/#event - */ - -[Exposed=Window] -interface TransitionEvent : Event { - [Throws] constructor(DOMString type, optional TransitionEventInit transitionEventInitDict = {}); - readonly attribute DOMString propertyName; - readonly attribute float elapsedTime; - readonly attribute DOMString pseudoElement; -}; - -dictionary TransitionEventInit : EventInit { - DOMString propertyName = ""; - float elapsedTime = 0.0; - DOMString pseudoElement = ""; -}; diff --git a/components/script/dom/webidls/TreeWalker.webidl b/components/script/dom/webidls/TreeWalker.webidl deleted file mode 100644 index 4162855dd09..00000000000 --- a/components/script/dom/webidls/TreeWalker.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://dom.spec.whatwg.org/#interface-treewalker - */ - -[Exposed=Window] -interface TreeWalker { - [SameObject] - readonly attribute Node root; - [Constant] - readonly attribute unsigned long whatToShow; - [Constant] - readonly attribute NodeFilter? filter; - [Pure] - attribute Node currentNode; - - [Throws] - Node? parentNode(); - [Throws] - Node? firstChild(); - [Throws] - Node? lastChild(); - [Throws] - Node? previousSibling(); - [Throws] - Node? nextSibling(); - [Throws] - Node? previousNode(); - [Throws] - Node? nextNode(); -}; diff --git a/components/script/dom/webidls/UIEvent.webidl b/components/script/dom/webidls/UIEvent.webidl deleted file mode 100644 index 04eb12c2083..00000000000 --- a/components/script/dom/webidls/UIEvent.webidl +++ /dev/null @@ -1,31 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/uievents/#interface-uievent -[Exposed=Window] -interface UIEvent : Event { - [Throws] constructor(DOMString type, optional UIEventInit eventInitDict = {}); - // readonly attribute WindowProxy? view; - readonly attribute Window? view; - readonly attribute long detail; -}; - -// https://w3c.github.io/uievents/#dictdef-uieventinit-uieventinit -dictionary UIEventInit : EventInit { - // WindowProxy? view = null; - Window? view = null; - long detail = 0; -}; - -// https://w3c.github.io/uievents/#idl-interface-UIEvent-initializers -partial interface UIEvent { - // Deprecated in DOM Level 3 - undefined initUIEvent ( - DOMString typeArg, - boolean bubblesArg, - boolean cancelableArg, - Window? viewArg, - long detailArg - ); -}; diff --git a/components/script/dom/webidls/URL.webidl b/components/script/dom/webidls/URL.webidl deleted file mode 100644 index 3ab51bb7d5d..00000000000 --- a/components/script/dom/webidls/URL.webidl +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://url.spec.whatwg.org/#url -[Exposed=(Window,Worker), - LegacyWindowAlias=webkitURL] -interface URL { - [Throws] constructor(USVString url, optional USVString base); - - static URL? parse(USVString url, optional USVString base); - static boolean canParse(USVString url, optional USVString base); - - [SetterThrows] - stringifier attribute USVString href; - readonly attribute USVString origin; - attribute USVString protocol; - attribute USVString username; - attribute USVString password; - attribute USVString host; - attribute USVString hostname; - attribute USVString port; - attribute USVString pathname; - attribute USVString search; - readonly attribute URLSearchParams searchParams; - attribute USVString hash; - - // https://w3c.github.io/FileAPI/#creating-revoking - static DOMString createObjectURL(Blob blob); - // static DOMString createFor(Blob blob); - static undefined revokeObjectURL(DOMString url); - - USVString toJSON(); -}; diff --git a/components/script/dom/webidls/URLSearchParams.webidl b/components/script/dom/webidls/URLSearchParams.webidl deleted file mode 100644 index 065af4bbd04..00000000000 --- a/components/script/dom/webidls/URLSearchParams.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://url.spec.whatwg.org/#interface-urlsearchparams - */ - -[Exposed=(Window,Worker)] -interface URLSearchParams { - [Throws] constructor(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = ""); - readonly attribute unsigned long size; - undefined append(USVString name, USVString value); - undefined delete(USVString name, optional USVString value); - USVString? get(USVString name); - sequence<USVString> getAll(USVString name); - boolean has(USVString name, optional USVString value); - undefined set(USVString name, USVString value); - - undefined sort(); - - // Be careful with implementing iterable interface. - // Search params might be mutated by URL::SetSearch while iterating (discussed in PR #10351). - iterable<USVString, USVString>; - stringifier; -}; diff --git a/components/script/dom/webidls/UnderlyingSource.webidl b/components/script/dom/webidls/UnderlyingSource.webidl deleted file mode 100644 index 5295129ee38..00000000000 --- a/components/script/dom/webidls/UnderlyingSource.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://streams.spec.whatwg.org/#underlying-source-api - -[GenerateInit] -dictionary UnderlyingSource { - UnderlyingSourceStartCallback start; - UnderlyingSourcePullCallback pull; - UnderlyingSourceCancelCallback cancel; - ReadableStreamType type; - [EnforceRange] unsigned long long autoAllocateChunkSize; -}; - -typedef (ReadableStreamDefaultController or ReadableByteStreamController) ReadableStreamController; - -callback UnderlyingSourceStartCallback = any (ReadableStreamController controller); -callback UnderlyingSourcePullCallback = Promise<undefined> (ReadableStreamController controller); -callback UnderlyingSourceCancelCallback = Promise<undefined> (optional any reason); - diff --git a/components/script/dom/webidls/UnderlyingSourceContainer.webidl b/components/script/dom/webidls/UnderlyingSourceContainer.webidl deleted file mode 100644 index b0bcfcaf242..00000000000 --- a/components/script/dom/webidls/UnderlyingSourceContainer.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// This interface is entirely internal to Servo, and should not be accessible to -// web pages. - -[LegacyNoInterfaceObject, Exposed=(Window,Worker)] -// Need to escape "ReadableStream" so it's treated as an identifier. -interface _UnderlyingSourceContainer { -}; diff --git a/components/script/dom/webidls/VTTCue.webidl b/components/script/dom/webidls/VTTCue.webidl deleted file mode 100644 index ccbd342a788..00000000000 --- a/components/script/dom/webidls/VTTCue.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webvtt/#the-vttcue-interface - -enum AutoKeyword { "auto"}; -typedef (double or AutoKeyword) LineAndPositionSetting; -enum DirectionSetting { "" /* horizontal */, "rl", "lr" }; -enum LineAlignSetting { "start", "center", "end" }; -enum PositionAlignSetting { "line-left", "center", "line-right", "auto" }; -enum AlignSetting { "start", "center", "end", "left", "right" }; - -[Pref="dom_webvtt_enabled", Exposed=Window] -interface VTTCue : TextTrackCue { - constructor(double startTime, double endTime, DOMString text); - attribute VTTRegion? region; - attribute DirectionSetting vertical; - attribute boolean snapToLines; - attribute LineAndPositionSetting line; - attribute LineAlignSetting lineAlign; - [SetterThrows] - attribute LineAndPositionSetting position; - attribute PositionAlignSetting positionAlign; - [SetterThrows] - attribute double size; - attribute AlignSetting align; - attribute DOMString text; - DocumentFragment getCueAsHTML(); -}; diff --git a/components/script/dom/webidls/VTTRegion.webidl b/components/script/dom/webidls/VTTRegion.webidl deleted file mode 100644 index f4a616ef323..00000000000 --- a/components/script/dom/webidls/VTTRegion.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/webvtt/#the-vttregion-interface - -enum ScrollSetting { "" /* none */, "up"}; - -[Pref="dom_webvtt_enabled", Exposed=Window] -interface VTTRegion { - [Throws] constructor(); - attribute DOMString id; - [SetterThrows] - attribute double width; - [SetterThrows] - attribute unsigned long lines; - [SetterThrows] - attribute double regionAnchorX; - [SetterThrows] - attribute double regionAnchorY; - [SetterThrows] - attribute double viewportAnchorX; - [SetterThrows] - attribute double viewportAnchorY; - attribute ScrollSetting scroll; -}; diff --git a/components/script/dom/webidls/ValidityState.webidl b/components/script/dom/webidls/ValidityState.webidl deleted file mode 100644 index a1a553e91ff..00000000000 --- a/components/script/dom/webidls/ValidityState.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#validitystate -[Exposed=Window] -interface ValidityState { - readonly attribute boolean valueMissing; - readonly attribute boolean typeMismatch; - readonly attribute boolean patternMismatch; - readonly attribute boolean tooLong; - readonly attribute boolean tooShort; - readonly attribute boolean rangeUnderflow; - readonly attribute boolean rangeOverflow; - readonly attribute boolean stepMismatch; - readonly attribute boolean badInput; - readonly attribute boolean customError; - readonly attribute boolean valid; -}; diff --git a/components/script/dom/webidls/VideoTrack.webidl b/components/script/dom/webidls/VideoTrack.webidl deleted file mode 100644 index 90d6c487eaa..00000000000 --- a/components/script/dom/webidls/VideoTrack.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#videotrack - -[Exposed=Window] -interface VideoTrack { - readonly attribute DOMString id; - readonly attribute DOMString kind; - readonly attribute DOMString label; - readonly attribute DOMString language; - attribute boolean selected; -}; diff --git a/components/script/dom/webidls/VideoTrackList.webidl b/components/script/dom/webidls/VideoTrackList.webidl deleted file mode 100644 index 9c880f0d2b7..00000000000 --- a/components/script/dom/webidls/VideoTrackList.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#videotracklist - -[Exposed=Window] -interface VideoTrackList : EventTarget { - readonly attribute unsigned long length; - getter VideoTrack (unsigned long index); - VideoTrack? getTrackById(DOMString id); - readonly attribute long selectedIndex; - - attribute EventHandler onchange; - attribute EventHandler onaddtrack; - attribute EventHandler onremovetrack; -}; diff --git a/components/script/dom/webidls/VisibilityStateEntry.webidl b/components/script/dom/webidls/VisibilityStateEntry.webidl deleted file mode 100644 index 12e85541be5..00000000000 --- a/components/script/dom/webidls/VisibilityStateEntry.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#visibilitystateentry - -[Exposed=(Window)] -interface VisibilityStateEntry : PerformanceEntry { - readonly attribute DOMString name; // shadows inherited name - readonly attribute DOMString entryType; // shadows inherited entryType - readonly attribute DOMHighResTimeStamp startTime; // shadows inherited startTime - readonly attribute unsigned long duration; // shadows inherited duration -}; diff --git a/components/script/dom/webidls/VoidFunction.webidl b/components/script/dom/webidls/VoidFunction.webidl deleted file mode 100644 index 551a69d87e0..00000000000 --- a/components/script/dom/webidls/VoidFunction.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://heycam.github.io/webidl/#VoidFunction - * - * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and - * Opera Software ASA. You are granted a license to use, reproduce - * and create derivative works of this document. - */ - -callback VoidFunction = undefined (); diff --git a/components/script/dom/webidls/WEBGLColorBufferFloat.webidl b/components/script/dom/webidls/WEBGLColorBufferFloat.webidl deleted file mode 100644 index 72004df6167..00000000000 --- a/components/script/dom/webidls/WEBGLColorBufferFloat.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/WEBGL_color_buffer_float/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface WEBGLColorBufferFloat { - const GLenum RGBA32F_EXT = 0x8814; - const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211; - const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17; -}; // interface WEBGL_color_buffer_float diff --git a/components/script/dom/webidls/WEBGLCompressedTextureETC1.webidl b/components/script/dom/webidls/WEBGLCompressedTextureETC1.webidl deleted file mode 100644 index 479139fdbe9..00000000000 --- a/components/script/dom/webidls/WEBGLCompressedTextureETC1.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc1/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface WEBGLCompressedTextureETC1 { - /* Compressed Texture Format */ - const GLenum COMPRESSED_RGB_ETC1_WEBGL = 0x8D64; -}; // interface WEBGLCompressedTextureETC1 diff --git a/components/script/dom/webidls/WEBGLCompressedTextureS3TC.webidl b/components/script/dom/webidls/WEBGLCompressedTextureS3TC.webidl deleted file mode 100644 index c04957f6bd4..00000000000 --- a/components/script/dom/webidls/WEBGLCompressedTextureS3TC.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface WEBGLCompressedTextureS3TC { - /* Compressed Texture Formats */ - const GLenum COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; - const GLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; - const GLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; - const GLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; -}; // interface WEBGLCompressedTextureS3TC diff --git a/components/script/dom/webidls/WebGL2RenderingContext.webidl b/components/script/dom/webidls/WebGL2RenderingContext.webidl deleted file mode 100644 index 72cedc30da6..00000000000 --- a/components/script/dom/webidls/WebGL2RenderingContext.webidl +++ /dev/null @@ -1,588 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/ -// -// This IDL depends on the typed array specification defined at: -// https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl - -typedef long long GLint64; -typedef unsigned long long GLuint64; - -typedef (/*[AllowShared]*/ Uint32Array or sequence<GLuint>) Uint32List; - -interface mixin WebGL2RenderingContextBase -{ - const GLenum READ_BUFFER = 0x0C02; - const GLenum UNPACK_ROW_LENGTH = 0x0CF2; - const GLenum UNPACK_SKIP_ROWS = 0x0CF3; - const GLenum UNPACK_SKIP_PIXELS = 0x0CF4; - const GLenum PACK_ROW_LENGTH = 0x0D02; - const GLenum PACK_SKIP_ROWS = 0x0D03; - const GLenum PACK_SKIP_PIXELS = 0x0D04; - const GLenum COLOR = 0x1800; - const GLenum DEPTH = 0x1801; - const GLenum STENCIL = 0x1802; - const GLenum RED = 0x1903; - const GLenum RGB8 = 0x8051; - const GLenum RGBA8 = 0x8058; - const GLenum RGB10_A2 = 0x8059; - const GLenum TEXTURE_BINDING_3D = 0x806A; - const GLenum UNPACK_SKIP_IMAGES = 0x806D; - const GLenum UNPACK_IMAGE_HEIGHT = 0x806E; - const GLenum TEXTURE_3D = 0x806F; - const GLenum TEXTURE_WRAP_R = 0x8072; - const GLenum MAX_3D_TEXTURE_SIZE = 0x8073; - const GLenum UNSIGNED_INT_2_10_10_10_REV = 0x8368; - const GLenum MAX_ELEMENTS_VERTICES = 0x80E8; - const GLenum MAX_ELEMENTS_INDICES = 0x80E9; - const GLenum TEXTURE_MIN_LOD = 0x813A; - const GLenum TEXTURE_MAX_LOD = 0x813B; - const GLenum TEXTURE_BASE_LEVEL = 0x813C; - const GLenum TEXTURE_MAX_LEVEL = 0x813D; - const GLenum MIN = 0x8007; - const GLenum MAX = 0x8008; - const GLenum DEPTH_COMPONENT24 = 0x81A6; - const GLenum MAX_TEXTURE_LOD_BIAS = 0x84FD; - const GLenum TEXTURE_COMPARE_MODE = 0x884C; - const GLenum TEXTURE_COMPARE_FUNC = 0x884D; - const GLenum CURRENT_QUERY = 0x8865; - const GLenum QUERY_RESULT = 0x8866; - const GLenum QUERY_RESULT_AVAILABLE = 0x8867; - const GLenum STREAM_READ = 0x88E1; - const GLenum STREAM_COPY = 0x88E2; - const GLenum STATIC_READ = 0x88E5; - const GLenum STATIC_COPY = 0x88E6; - const GLenum DYNAMIC_READ = 0x88E9; - const GLenum DYNAMIC_COPY = 0x88EA; - const GLenum MAX_DRAW_BUFFERS = 0x8824; - const GLenum DRAW_BUFFER0 = 0x8825; - const GLenum DRAW_BUFFER1 = 0x8826; - const GLenum DRAW_BUFFER2 = 0x8827; - const GLenum DRAW_BUFFER3 = 0x8828; - const GLenum DRAW_BUFFER4 = 0x8829; - const GLenum DRAW_BUFFER5 = 0x882A; - const GLenum DRAW_BUFFER6 = 0x882B; - const GLenum DRAW_BUFFER7 = 0x882C; - const GLenum DRAW_BUFFER8 = 0x882D; - const GLenum DRAW_BUFFER9 = 0x882E; - const GLenum DRAW_BUFFER10 = 0x882F; - const GLenum DRAW_BUFFER11 = 0x8830; - const GLenum DRAW_BUFFER12 = 0x8831; - const GLenum DRAW_BUFFER13 = 0x8832; - const GLenum DRAW_BUFFER14 = 0x8833; - const GLenum DRAW_BUFFER15 = 0x8834; - const GLenum MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; - const GLenum MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; - const GLenum SAMPLER_3D = 0x8B5F; - const GLenum SAMPLER_2D_SHADOW = 0x8B62; - const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; - const GLenum PIXEL_PACK_BUFFER = 0x88EB; - const GLenum PIXEL_UNPACK_BUFFER = 0x88EC; - const GLenum PIXEL_PACK_BUFFER_BINDING = 0x88ED; - const GLenum PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; - const GLenum FLOAT_MAT2x3 = 0x8B65; - const GLenum FLOAT_MAT2x4 = 0x8B66; - const GLenum FLOAT_MAT3x2 = 0x8B67; - const GLenum FLOAT_MAT3x4 = 0x8B68; - const GLenum FLOAT_MAT4x2 = 0x8B69; - const GLenum FLOAT_MAT4x3 = 0x8B6A; - const GLenum SRGB = 0x8C40; - const GLenum SRGB8 = 0x8C41; - const GLenum SRGB8_ALPHA8 = 0x8C43; - const GLenum COMPARE_REF_TO_TEXTURE = 0x884E; - const GLenum RGBA32F = 0x8814; - const GLenum RGB32F = 0x8815; - const GLenum RGBA16F = 0x881A; - const GLenum RGB16F = 0x881B; - const GLenum VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; - const GLenum MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; - const GLenum MIN_PROGRAM_TEXEL_OFFSET = 0x8904; - const GLenum MAX_PROGRAM_TEXEL_OFFSET = 0x8905; - const GLenum MAX_VARYING_COMPONENTS = 0x8B4B; - const GLenum TEXTURE_2D_ARRAY = 0x8C1A; - const GLenum TEXTURE_BINDING_2D_ARRAY = 0x8C1D; - const GLenum R11F_G11F_B10F = 0x8C3A; - const GLenum UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; - const GLenum RGB9_E5 = 0x8C3D; - const GLenum UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; - const GLenum TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; - const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; - const GLenum TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; - const GLenum TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; - const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; - const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; - const GLenum RASTERIZER_DISCARD = 0x8C89; - const GLenum MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; - const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; - const GLenum INTERLEAVED_ATTRIBS = 0x8C8C; - const GLenum SEPARATE_ATTRIBS = 0x8C8D; - const GLenum TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; - const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; - const GLenum RGBA32UI = 0x8D70; - const GLenum RGB32UI = 0x8D71; - const GLenum RGBA16UI = 0x8D76; - const GLenum RGB16UI = 0x8D77; - const GLenum RGBA8UI = 0x8D7C; - const GLenum RGB8UI = 0x8D7D; - const GLenum RGBA32I = 0x8D82; - const GLenum RGB32I = 0x8D83; - const GLenum RGBA16I = 0x8D88; - const GLenum RGB16I = 0x8D89; - const GLenum RGBA8I = 0x8D8E; - const GLenum RGB8I = 0x8D8F; - const GLenum RED_INTEGER = 0x8D94; - const GLenum RGB_INTEGER = 0x8D98; - const GLenum RGBA_INTEGER = 0x8D99; - const GLenum SAMPLER_2D_ARRAY = 0x8DC1; - const GLenum SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; - const GLenum SAMPLER_CUBE_SHADOW = 0x8DC5; - const GLenum UNSIGNED_INT_VEC2 = 0x8DC6; - const GLenum UNSIGNED_INT_VEC3 = 0x8DC7; - const GLenum UNSIGNED_INT_VEC4 = 0x8DC8; - const GLenum INT_SAMPLER_2D = 0x8DCA; - const GLenum INT_SAMPLER_3D = 0x8DCB; - const GLenum INT_SAMPLER_CUBE = 0x8DCC; - const GLenum INT_SAMPLER_2D_ARRAY = 0x8DCF; - const GLenum UNSIGNED_INT_SAMPLER_2D = 0x8DD2; - const GLenum UNSIGNED_INT_SAMPLER_3D = 0x8DD3; - const GLenum UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; - const GLenum UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; - const GLenum DEPTH_COMPONENT32F = 0x8CAC; - const GLenum DEPTH32F_STENCIL8 = 0x8CAD; - const GLenum FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; - const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; - const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; - const GLenum FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; - const GLenum FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; - const GLenum FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; - const GLenum FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; - const GLenum FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; - const GLenum FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; - const GLenum FRAMEBUFFER_DEFAULT = 0x8218; - // BUG: https://github.com/KhronosGroup/WebGL/issues/2216 - // const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A; - // const GLenum DEPTH_STENCIL = 0x84F9; - const GLenum UNSIGNED_INT_24_8 = 0x84FA; - const GLenum DEPTH24_STENCIL8 = 0x88F0; - const GLenum UNSIGNED_NORMALIZED = 0x8C17; - const GLenum DRAW_FRAMEBUFFER_BINDING = 0x8CA6; /* Same as FRAMEBUFFER_BINDING */ - const GLenum READ_FRAMEBUFFER = 0x8CA8; - const GLenum DRAW_FRAMEBUFFER = 0x8CA9; - const GLenum READ_FRAMEBUFFER_BINDING = 0x8CAA; - const GLenum RENDERBUFFER_SAMPLES = 0x8CAB; - const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; - const GLenum MAX_COLOR_ATTACHMENTS = 0x8CDF; - const GLenum COLOR_ATTACHMENT1 = 0x8CE1; - const GLenum COLOR_ATTACHMENT2 = 0x8CE2; - const GLenum COLOR_ATTACHMENT3 = 0x8CE3; - const GLenum COLOR_ATTACHMENT4 = 0x8CE4; - const GLenum COLOR_ATTACHMENT5 = 0x8CE5; - const GLenum COLOR_ATTACHMENT6 = 0x8CE6; - const GLenum COLOR_ATTACHMENT7 = 0x8CE7; - const GLenum COLOR_ATTACHMENT8 = 0x8CE8; - const GLenum COLOR_ATTACHMENT9 = 0x8CE9; - const GLenum COLOR_ATTACHMENT10 = 0x8CEA; - const GLenum COLOR_ATTACHMENT11 = 0x8CEB; - const GLenum COLOR_ATTACHMENT12 = 0x8CEC; - const GLenum COLOR_ATTACHMENT13 = 0x8CED; - const GLenum COLOR_ATTACHMENT14 = 0x8CEE; - const GLenum COLOR_ATTACHMENT15 = 0x8CEF; - const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; - const GLenum MAX_SAMPLES = 0x8D57; - const GLenum HALF_FLOAT = 0x140B; - const GLenum RG = 0x8227; - const GLenum RG_INTEGER = 0x8228; - const GLenum R8 = 0x8229; - const GLenum RG8 = 0x822B; - const GLenum R16F = 0x822D; - const GLenum R32F = 0x822E; - const GLenum RG16F = 0x822F; - const GLenum RG32F = 0x8230; - const GLenum R8I = 0x8231; - const GLenum R8UI = 0x8232; - const GLenum R16I = 0x8233; - const GLenum R16UI = 0x8234; - const GLenum R32I = 0x8235; - const GLenum R32UI = 0x8236; - const GLenum RG8I = 0x8237; - const GLenum RG8UI = 0x8238; - const GLenum RG16I = 0x8239; - const GLenum RG16UI = 0x823A; - const GLenum RG32I = 0x823B; - const GLenum RG32UI = 0x823C; - const GLenum VERTEX_ARRAY_BINDING = 0x85B5; - const GLenum R8_SNORM = 0x8F94; - const GLenum RG8_SNORM = 0x8F95; - const GLenum RGB8_SNORM = 0x8F96; - const GLenum RGBA8_SNORM = 0x8F97; - const GLenum SIGNED_NORMALIZED = 0x8F9C; - const GLenum COPY_READ_BUFFER = 0x8F36; - const GLenum COPY_WRITE_BUFFER = 0x8F37; - const GLenum COPY_READ_BUFFER_BINDING = 0x8F36; /* Same as COPY_READ_BUFFER */ - const GLenum COPY_WRITE_BUFFER_BINDING = 0x8F37; /* Same as COPY_WRITE_BUFFER */ - const GLenum UNIFORM_BUFFER = 0x8A11; - const GLenum UNIFORM_BUFFER_BINDING = 0x8A28; - const GLenum UNIFORM_BUFFER_START = 0x8A29; - const GLenum UNIFORM_BUFFER_SIZE = 0x8A2A; - const GLenum MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B; - const GLenum MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D; - const GLenum MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E; - const GLenum MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F; - const GLenum MAX_UNIFORM_BLOCK_SIZE = 0x8A30; - const GLenum MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31; - const GLenum MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33; - const GLenum UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34; - const GLenum ACTIVE_UNIFORM_BLOCKS = 0x8A36; - const GLenum UNIFORM_TYPE = 0x8A37; - const GLenum UNIFORM_SIZE = 0x8A38; - const GLenum UNIFORM_BLOCK_INDEX = 0x8A3A; - const GLenum UNIFORM_OFFSET = 0x8A3B; - const GLenum UNIFORM_ARRAY_STRIDE = 0x8A3C; - const GLenum UNIFORM_MATRIX_STRIDE = 0x8A3D; - const GLenum UNIFORM_IS_ROW_MAJOR = 0x8A3E; - const GLenum UNIFORM_BLOCK_BINDING = 0x8A3F; - const GLenum UNIFORM_BLOCK_DATA_SIZE = 0x8A40; - const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42; - const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43; - const GLenum UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44; - const GLenum UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46; - const GLenum INVALID_INDEX = 0xFFFFFFFF; - const GLenum MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; - const GLenum MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; - const GLenum MAX_SERVER_WAIT_TIMEOUT = 0x9111; - const GLenum OBJECT_TYPE = 0x9112; - const GLenum SYNC_CONDITION = 0x9113; - const GLenum SYNC_STATUS = 0x9114; - const GLenum SYNC_FLAGS = 0x9115; - const GLenum SYNC_FENCE = 0x9116; - const GLenum SYNC_GPU_COMMANDS_COMPLETE = 0x9117; - const GLenum UNSIGNALED = 0x9118; - const GLenum SIGNALED = 0x9119; - const GLenum ALREADY_SIGNALED = 0x911A; - const GLenum TIMEOUT_EXPIRED = 0x911B; - const GLenum CONDITION_SATISFIED = 0x911C; - const GLenum WAIT_FAILED = 0x911D; - const GLenum SYNC_FLUSH_COMMANDS_BIT = 0x00000001; - const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; - const GLenum ANY_SAMPLES_PASSED = 0x8C2F; - const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; - const GLenum SAMPLER_BINDING = 0x8919; - const GLenum RGB10_A2UI = 0x906F; - const GLenum INT_2_10_10_10_REV = 0x8D9F; - const GLenum TRANSFORM_FEEDBACK = 0x8E22; - const GLenum TRANSFORM_FEEDBACK_PAUSED = 0x8E23; - const GLenum TRANSFORM_FEEDBACK_ACTIVE = 0x8E24; - const GLenum TRANSFORM_FEEDBACK_BINDING = 0x8E25; - const GLenum TEXTURE_IMMUTABLE_FORMAT = 0x912F; - const GLenum MAX_ELEMENT_INDEX = 0x8D6B; - const GLenum TEXTURE_IMMUTABLE_LEVELS = 0x82DF; - - const GLint64 TIMEOUT_IGNORED = -1; - - /* WebGL-specific enums */ - const GLenum MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247; - - /* Buffer objects */ - undefined copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, - GLintptr writeOffset, GLsizeiptr size); - // MapBufferRange, in particular its read-only and write-only modes, - // can not be exposed safely to JavaScript. GetBufferSubData - // replaces it for the purpose of fetching data back from the GPU. - undefined getBufferSubData(GLenum target, GLintptr srcByteOffset, /*[AllowShared]*/ ArrayBufferView dstBuffer, - optional GLuint dstOffset = 0, optional GLuint length = 0); - - /* Framebuffer objects */ - undefined blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, - GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); - undefined framebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, - GLint layer); - undefined invalidateFramebuffer(GLenum target, sequence<GLenum> attachments); - undefined invalidateSubFramebuffer(GLenum target, sequence<GLenum> attachments, - GLint x, GLint y, GLsizei width, GLsizei height); - undefined readBuffer(GLenum src); - - /* Renderbuffer objects */ - any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname); - undefined renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, - GLsizei width, GLsizei height); - - /* Texture objects */ - undefined texStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, - GLsizei height); - undefined texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, - GLsizei height, GLsizei depth); - - //[Throws] - //void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - // GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset); - //[Throws] - //void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - // GLsizei depth, GLint border, GLenum format, GLenum type, - // TexImageSource source); // May throw DOMException - //[Throws] - //void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - // GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView? srcData); - //[Throws] - //void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - // GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, - // GLuint srcOffset); - - //[Throws] - //void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, - // GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, - // GLintptr pboOffset); - //[Throws] - //void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, - // GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, - // TexImageSource source); // May throw DOMException - //[Throws] - //void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, - // GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, - // [AllowShared] ArrayBufferView? srcData, optional GLuint srcOffset = 0); - - //void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, - // GLint x, GLint y, GLsizei width, GLsizei height); - - //void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, - // GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset); - //void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, - // GLsizei height, GLsizei depth, GLint border, [AllowShared] ArrayBufferView srcData, - // optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); - - //void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - // GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, - // GLenum format, GLsizei imageSize, GLintptr offset); - //void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - // GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, - // GLenum format, [AllowShared] ArrayBufferView srcData, - // optional GLuint srcOffset = 0, - // optional GLuint srcLengthOverride = 0); - - /* Programs and shaders */ - [WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name); - - /* Uniforms */ - undefined uniform1ui(WebGLUniformLocation? location, GLuint v0); - undefined uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1); - undefined uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2); - undefined uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); - - undefined uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - undefined uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - undefined uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - undefined uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - - undefined uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, - optional GLuint srcOffset = 0, optional GLuint srcLength = 0); - undefined uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, - optional GLuint srcOffset = 0, optional GLuint srcLength = 0); - - undefined uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, - optional GLuint srcOffset = 0, optional GLuint srcLength = 0); - undefined uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, - optional GLuint srcOffset = 0, optional GLuint srcLength = 0); - - undefined uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, - optional GLuint srcOffset = 0, optional GLuint srcLength = 0); - undefined uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, - optional GLuint srcOffset = 0, optional GLuint srcLength = 0); - - /* Vertex attribs */ - undefined vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w); - undefined vertexAttribI4iv(GLuint index, Int32List values); - undefined vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); - undefined vertexAttribI4uiv(GLuint index, Uint32List values); - undefined vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); - - /* Writing to the drawing buffer */ - undefined vertexAttribDivisor(GLuint index, GLuint divisor); - undefined drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); - undefined drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount); - undefined drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset); - - /* Multiple Render Targets */ - undefined drawBuffers(sequence<GLenum> buffers); - - undefined clearBufferfv(GLenum buffer, GLint drawbuffer, Float32List values, - optional GLuint srcOffset = 0); - undefined clearBufferiv(GLenum buffer, GLint drawbuffer, Int32List values, - optional GLuint srcOffset = 0); - undefined clearBufferuiv(GLenum buffer, GLint drawbuffer, Uint32List values, - optional GLuint srcOffset = 0); - - undefined clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); - - /* Query Objects */ - WebGLQuery? createQuery(); - undefined deleteQuery(WebGLQuery? query); - /*[WebGLHandlesContextLoss]*/ GLboolean isQuery(WebGLQuery? query); - undefined beginQuery(GLenum target, WebGLQuery query); - undefined endQuery(GLenum target); - WebGLQuery? getQuery(GLenum target, GLenum pname); - any getQueryParameter(WebGLQuery query, GLenum pname); - - /* Sampler Objects */ - WebGLSampler? createSampler(); - undefined deleteSampler(WebGLSampler? sampler); - [WebGLHandlesContextLoss] GLboolean isSampler(WebGLSampler? sampler); - undefined bindSampler(GLuint unit, WebGLSampler? sampler); - undefined samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param); - undefined samplerParameterf(WebGLSampler sampler, GLenum pname, GLfloat param); - any getSamplerParameter(WebGLSampler sampler, GLenum pname); - - /* Sync objects */ - WebGLSync? fenceSync(GLenum condition, GLbitfield flags); - [WebGLHandlesContextLoss] GLboolean isSync(WebGLSync? sync); - undefined deleteSync(WebGLSync? sync); - GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout); - undefined waitSync(WebGLSync sync, GLbitfield flags, GLint64 timeout); - any getSyncParameter(WebGLSync sync, GLenum pname); - - /* Transform Feedback */ - WebGLTransformFeedback? createTransformFeedback(); - undefined deleteTransformFeedback(WebGLTransformFeedback? tf); - [WebGLHandlesContextLoss] GLboolean isTransformFeedback(WebGLTransformFeedback? tf); - undefined bindTransformFeedback (GLenum target, WebGLTransformFeedback? tf); - undefined beginTransformFeedback(GLenum primitiveMode); - undefined endTransformFeedback(); - undefined transformFeedbackVaryings(WebGLProgram program, sequence<DOMString> varyings, GLenum bufferMode); - WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram program, GLuint index); - undefined pauseTransformFeedback(); - undefined resumeTransformFeedback(); - - /* Uniform Buffer Objects and Transform Feedback Buffers */ - undefined bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer); - undefined bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size); - any getIndexedParameter(GLenum target, GLuint index); - sequence<GLuint>? getUniformIndices(WebGLProgram program, sequence<DOMString> uniformNames); - any getActiveUniforms(WebGLProgram program, sequence<GLuint> uniformIndices, GLenum pname); - GLuint getUniformBlockIndex(WebGLProgram program, DOMString uniformBlockName); - any getActiveUniformBlockParameter(WebGLProgram program, GLuint uniformBlockIndex, GLenum pname); - DOMString? getActiveUniformBlockName(WebGLProgram program, GLuint uniformBlockIndex); - undefined uniformBlockBinding(WebGLProgram program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); - - /* Vertex Array Objects */ - WebGLVertexArrayObject? createVertexArray(); - undefined deleteVertexArray(WebGLVertexArrayObject? vertexArray); - [WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray); - undefined bindVertexArray(WebGLVertexArrayObject? array); -}; - -interface mixin WebGL2RenderingContextOverloads -{ - // WebGL1: - undefined bufferData(GLenum target, GLsizeiptr size, GLenum usage); - undefined bufferData(GLenum target, /*[AllowShared]*/ BufferSource? srcData, GLenum usage); - undefined bufferSubData(GLenum target, GLintptr dstByteOffset, /*[AllowShared]*/ BufferSource srcData); - // WebGL2: - undefined bufferData(GLenum target, /*[AllowShared]*/ ArrayBufferView srcData, GLenum usage, GLuint srcOffset, - optional GLuint length = 0); - undefined bufferSubData(GLenum target, GLintptr dstByteOffset, /*[AllowShared]*/ ArrayBufferView srcData, - GLuint srcOffset, optional GLuint length = 0); - - // WebGL1 legacy entrypoints: - [Throws] - undefined texImage2D(GLenum target, GLint level, GLint internalformat, - GLsizei width, GLsizei height, GLint border, GLenum format, - GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels); - [Throws] - undefined texImage2D(GLenum target, GLint level, GLint internalformat, - GLenum format, GLenum type, TexImageSource source); // May throw DOMException - - [Throws] - undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels); - [Throws] - undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLenum format, GLenum type, TexImageSource source); // May throw DOMException - - // WebGL2 entrypoints: - [Throws] - undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - GLint border, GLenum format, GLenum type, GLintptr pboOffset); - [Throws] - undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - GLint border, GLenum format, GLenum type, - TexImageSource source); // May throw DOMException - [Throws] - undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, - GLint border, GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView srcData, - GLuint srcOffset); - - //[Throws] - //void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - // GLsizei height, GLenum format, GLenum type, GLintptr pboOffset); - //[Throws] - //void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - // GLsizei height, GLenum format, GLenum type, - // TexImageSource source); // May throw DOMException - //[Throws] - //void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - // GLsizei height, GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView srcData, - // GLuint srcOffset); - - //void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, - // GLsizei height, GLint border, GLsizei imageSize, GLintptr offset); - undefined compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, - GLsizei height, GLint border, /*[AllowShared]*/ ArrayBufferView srcData, - optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); - - //void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - // GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset); - undefined compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, GLenum format, - /*[AllowShared]*/ ArrayBufferView srcData, - optional GLuint srcOffset = 0, - optional GLuint srcLengthOverride = 0); - - undefined uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - undefined uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - undefined uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - undefined uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - - undefined uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - undefined uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - undefined uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - undefined uniform4iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, - optional GLuint srcLength = 0); - - undefined uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, - optional GLuint srcOffset = 0, optional GLuint srcLength = 0); - undefined uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, - optional GLuint srcOffset = 0, optional GLuint srcLength = 0); - undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, - optional GLuint srcOffset = 0, optional GLuint srcLength = 0); - - /* Reading back pixels */ - // WebGL1: - undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - /*[AllowShared]*/ ArrayBufferView? dstData); - // WebGL2: - undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - GLintptr offset); - undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - /*[AllowShared]*/ ArrayBufferView dstData, GLuint dstOffset); -}; - -[Exposed=Window, Func="WebGL2RenderingContext::is_webgl2_enabled"] -interface WebGL2RenderingContext -{ -}; -WebGL2RenderingContext includes WebGLRenderingContextBase; -WebGL2RenderingContext includes WebGL2RenderingContextBase; -WebGL2RenderingContext includes WebGL2RenderingContextOverloads; diff --git a/components/script/dom/webidls/WebGLActiveInfo.webidl b/components/script/dom/webidls/WebGLActiveInfo.webidl deleted file mode 100644 index eedfd8c35b3..00000000000 --- a/components/script/dom/webidls/WebGLActiveInfo.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7 -// - -[Exposed=(Window,Worker)] -interface WebGLActiveInfo { - readonly attribute GLint size; - readonly attribute GLenum type; - readonly attribute DOMString name; -}; diff --git a/components/script/dom/webidls/WebGLBuffer.webidl b/components/script/dom/webidls/WebGLBuffer.webidl deleted file mode 100644 index a8ad5a103d2..00000000000 --- a/components/script/dom/webidls/WebGLBuffer.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.4 -// - -[Exposed=(Window,Worker)] -interface WebGLBuffer : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLContextEvent.webidl b/components/script/dom/webidls/WebGLContextEvent.webidl deleted file mode 100644 index 5c6a1c4f1d7..00000000000 --- a/components/script/dom/webidls/WebGLContextEvent.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15 -[Exposed=Window] -interface WebGLContextEvent : Event { - [Throws] constructor(DOMString type, optional WebGLContextEventInit eventInit = {}); - readonly attribute DOMString statusMessage; -}; - -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15 -dictionary WebGLContextEventInit : EventInit { - DOMString statusMessage; -}; diff --git a/components/script/dom/webidls/WebGLFramebuffer.webidl b/components/script/dom/webidls/WebGLFramebuffer.webidl deleted file mode 100644 index e557542bfb0..00000000000 --- a/components/script/dom/webidls/WebGLFramebuffer.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7 -// - -[Exposed=(Window,Worker)] -interface WebGLFramebuffer : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLObject.webidl b/components/script/dom/webidls/WebGLObject.webidl deleted file mode 100644 index 6bfcf4d647b..00000000000 --- a/components/script/dom/webidls/WebGLObject.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.3 -// - -[Abstract, Exposed=(Window,Worker)] -interface WebGLObject { - attribute USVString label; -}; diff --git a/components/script/dom/webidls/WebGLProgram.webidl b/components/script/dom/webidls/WebGLProgram.webidl deleted file mode 100644 index 1246b222acd..00000000000 --- a/components/script/dom/webidls/WebGLProgram.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.6 -// - -[Exposed=(Window,Worker)] -interface WebGLProgram : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLQuery.webidl b/components/script/dom/webidls/WebGLQuery.webidl deleted file mode 100644 index feea145c611..00000000000 --- a/components/script/dom/webidls/WebGLQuery.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.8 -// - -[Exposed=Window, Pref="dom_webgl2_enabled"] -interface WebGLQuery : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLRenderbuffer.webidl b/components/script/dom/webidls/WebGLRenderbuffer.webidl deleted file mode 100644 index 91a437039fb..00000000000 --- a/components/script/dom/webidls/WebGLRenderbuffer.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.5 -// - -[Exposed=(Window,Worker)] -interface WebGLRenderbuffer : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl deleted file mode 100644 index 6938e547cce..00000000000 --- a/components/script/dom/webidls/WebGLRenderingContext.webidl +++ /dev/null @@ -1,688 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/ -// -// This IDL depends on the typed array specification defined at: -// https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl - -typedef unsigned long GLenum; -typedef boolean GLboolean; -typedef unsigned long GLbitfield; -typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */ -typedef short GLshort; -typedef long GLint; -typedef long GLsizei; -typedef long long GLintptr; -typedef long long GLsizeiptr; -// Ideally the typedef below would use 'unsigned byte', but that doesn't currently exist in Web IDL. -typedef octet GLubyte; /* 'octet' should be an unsigned 8 bit type. */ -typedef unsigned short GLushort; -typedef unsigned long GLuint; -typedef unrestricted float GLfloat; -typedef unrestricted float GLclampf; - -typedef (ImageData or - HTMLImageElement or - HTMLCanvasElement or - HTMLVideoElement) TexImageSource; - -typedef (/*[AllowShared]*/ Float32Array or sequence<GLfloat>) Float32List; -typedef (/*[AllowShared]*/ Int32Array or sequence<GLint>) Int32List; - -dictionary WebGLContextAttributes { - GLboolean alpha = true; - GLboolean depth = true; - GLboolean stencil = false; - GLboolean antialias = true; - GLboolean premultipliedAlpha = true; - GLboolean preserveDrawingBuffer = false; - GLboolean preferLowPowerToHighPerformance = false; - GLboolean failIfMajorPerformanceCaveat = false; -}; - -[Exposed=(Window,Worker)] -interface mixin WebGLRenderingContextBase -{ - - /* ClearBufferMask */ - const GLenum DEPTH_BUFFER_BIT = 0x00000100; - const GLenum STENCIL_BUFFER_BIT = 0x00000400; - const GLenum COLOR_BUFFER_BIT = 0x00004000; - - /* BeginMode */ - const GLenum POINTS = 0x0000; - const GLenum LINES = 0x0001; - const GLenum LINE_LOOP = 0x0002; - const GLenum LINE_STRIP = 0x0003; - const GLenum TRIANGLES = 0x0004; - const GLenum TRIANGLE_STRIP = 0x0005; - const GLenum TRIANGLE_FAN = 0x0006; - - /* AlphaFunction (not supported in ES20) */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* BlendingFactorDest */ - const GLenum ZERO = 0; - const GLenum ONE = 1; - const GLenum SRC_COLOR = 0x0300; - const GLenum ONE_MINUS_SRC_COLOR = 0x0301; - const GLenum SRC_ALPHA = 0x0302; - const GLenum ONE_MINUS_SRC_ALPHA = 0x0303; - const GLenum DST_ALPHA = 0x0304; - const GLenum ONE_MINUS_DST_ALPHA = 0x0305; - - /* BlendingFactorSrc */ - /* ZERO */ - /* ONE */ - const GLenum DST_COLOR = 0x0306; - const GLenum ONE_MINUS_DST_COLOR = 0x0307; - const GLenum SRC_ALPHA_SATURATE = 0x0308; - /* SRC_ALPHA */ - /* ONE_MINUS_SRC_ALPHA */ - /* DST_ALPHA */ - /* ONE_MINUS_DST_ALPHA */ - - /* BlendEquationSeparate */ - const GLenum FUNC_ADD = 0x8006; - const GLenum BLEND_EQUATION = 0x8009; - const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ - const GLenum BLEND_EQUATION_ALPHA = 0x883D; - - /* BlendSubtract */ - const GLenum FUNC_SUBTRACT = 0x800A; - const GLenum FUNC_REVERSE_SUBTRACT = 0x800B; - - /* Separate Blend Functions */ - const GLenum BLEND_DST_RGB = 0x80C8; - const GLenum BLEND_SRC_RGB = 0x80C9; - const GLenum BLEND_DST_ALPHA = 0x80CA; - const GLenum BLEND_SRC_ALPHA = 0x80CB; - const GLenum CONSTANT_COLOR = 0x8001; - const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002; - const GLenum CONSTANT_ALPHA = 0x8003; - const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004; - const GLenum BLEND_COLOR = 0x8005; - - /* Buffer Objects */ - const GLenum ARRAY_BUFFER = 0x8892; - const GLenum ELEMENT_ARRAY_BUFFER = 0x8893; - const GLenum ARRAY_BUFFER_BINDING = 0x8894; - const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; - - const GLenum STREAM_DRAW = 0x88E0; - const GLenum STATIC_DRAW = 0x88E4; - const GLenum DYNAMIC_DRAW = 0x88E8; - - const GLenum BUFFER_SIZE = 0x8764; - const GLenum BUFFER_USAGE = 0x8765; - - const GLenum CURRENT_VERTEX_ATTRIB = 0x8626; - - /* CullFaceMode */ - const GLenum FRONT = 0x0404; - const GLenum BACK = 0x0405; - const GLenum FRONT_AND_BACK = 0x0408; - - /* DepthFunction */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* EnableCap */ - /* TEXTURE_2D */ - const GLenum CULL_FACE = 0x0B44; - const GLenum BLEND = 0x0BE2; - const GLenum DITHER = 0x0BD0; - const GLenum STENCIL_TEST = 0x0B90; - const GLenum DEPTH_TEST = 0x0B71; - const GLenum SCISSOR_TEST = 0x0C11; - const GLenum POLYGON_OFFSET_FILL = 0x8037; - const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E; - const GLenum SAMPLE_COVERAGE = 0x80A0; - - /* ErrorCode */ - const GLenum NO_ERROR = 0; - const GLenum INVALID_ENUM = 0x0500; - const GLenum INVALID_VALUE = 0x0501; - const GLenum INVALID_OPERATION = 0x0502; - const GLenum OUT_OF_MEMORY = 0x0505; - - /* FrontFaceDirection */ - const GLenum CW = 0x0900; - const GLenum CCW = 0x0901; - - /* GetPName */ - const GLenum LINE_WIDTH = 0x0B21; - const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D; - const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E; - const GLenum CULL_FACE_MODE = 0x0B45; - const GLenum FRONT_FACE = 0x0B46; - const GLenum DEPTH_RANGE = 0x0B70; - const GLenum DEPTH_WRITEMASK = 0x0B72; - const GLenum DEPTH_CLEAR_VALUE = 0x0B73; - const GLenum DEPTH_FUNC = 0x0B74; - const GLenum STENCIL_CLEAR_VALUE = 0x0B91; - const GLenum STENCIL_FUNC = 0x0B92; - const GLenum STENCIL_FAIL = 0x0B94; - const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95; - const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96; - const GLenum STENCIL_REF = 0x0B97; - const GLenum STENCIL_VALUE_MASK = 0x0B93; - const GLenum STENCIL_WRITEMASK = 0x0B98; - const GLenum STENCIL_BACK_FUNC = 0x8800; - const GLenum STENCIL_BACK_FAIL = 0x8801; - const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; - const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; - const GLenum STENCIL_BACK_REF = 0x8CA3; - const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4; - const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5; - const GLenum VIEWPORT = 0x0BA2; - const GLenum SCISSOR_BOX = 0x0C10; - /* SCISSOR_TEST */ - const GLenum COLOR_CLEAR_VALUE = 0x0C22; - const GLenum COLOR_WRITEMASK = 0x0C23; - const GLenum UNPACK_ALIGNMENT = 0x0CF5; - const GLenum PACK_ALIGNMENT = 0x0D05; - const GLenum MAX_TEXTURE_SIZE = 0x0D33; - const GLenum MAX_VIEWPORT_DIMS = 0x0D3A; - const GLenum SUBPIXEL_BITS = 0x0D50; - const GLenum RED_BITS = 0x0D52; - const GLenum GREEN_BITS = 0x0D53; - const GLenum BLUE_BITS = 0x0D54; - const GLenum ALPHA_BITS = 0x0D55; - const GLenum DEPTH_BITS = 0x0D56; - const GLenum STENCIL_BITS = 0x0D57; - const GLenum POLYGON_OFFSET_UNITS = 0x2A00; - /* POLYGON_OFFSET_FILL */ - const GLenum POLYGON_OFFSET_FACTOR = 0x8038; - const GLenum TEXTURE_BINDING_2D = 0x8069; - const GLenum SAMPLE_BUFFERS = 0x80A8; - const GLenum SAMPLES = 0x80A9; - const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA; - const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB; - - /* GetTextureParameter */ - /* TEXTURE_MAG_FILTER */ - /* TEXTURE_MIN_FILTER */ - /* TEXTURE_WRAP_S */ - /* TEXTURE_WRAP_T */ - - const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3; - - /* HintMode */ - const GLenum DONT_CARE = 0x1100; - const GLenum FASTEST = 0x1101; - const GLenum NICEST = 0x1102; - - /* HintTarget */ - const GLenum GENERATE_MIPMAP_HINT = 0x8192; - - /* DataType */ - const GLenum BYTE = 0x1400; - const GLenum UNSIGNED_BYTE = 0x1401; - const GLenum SHORT = 0x1402; - const GLenum UNSIGNED_SHORT = 0x1403; - const GLenum INT = 0x1404; - const GLenum UNSIGNED_INT = 0x1405; - const GLenum FLOAT = 0x1406; - - /* PixelFormat */ - const GLenum DEPTH_COMPONENT = 0x1902; - const GLenum ALPHA = 0x1906; - const GLenum RGB = 0x1907; - const GLenum RGBA = 0x1908; - const GLenum LUMINANCE = 0x1909; - const GLenum LUMINANCE_ALPHA = 0x190A; - - /* PixelType */ - /* UNSIGNED_BYTE */ - const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033; - const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034; - const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363; - - /* Shaders */ - const GLenum FRAGMENT_SHADER = 0x8B30; - const GLenum VERTEX_SHADER = 0x8B31; - const GLenum MAX_VERTEX_ATTRIBS = 0x8869; - const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; - const GLenum MAX_VARYING_VECTORS = 0x8DFC; - const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; - const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; - const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872; - const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; - const GLenum SHADER_TYPE = 0x8B4F; - const GLenum DELETE_STATUS = 0x8B80; - const GLenum LINK_STATUS = 0x8B82; - const GLenum VALIDATE_STATUS = 0x8B83; - const GLenum ATTACHED_SHADERS = 0x8B85; - const GLenum ACTIVE_UNIFORMS = 0x8B86; - const GLenum ACTIVE_ATTRIBUTES = 0x8B89; - const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C; - const GLenum CURRENT_PROGRAM = 0x8B8D; - - /* StencilFunction */ - const GLenum NEVER = 0x0200; - const GLenum LESS = 0x0201; - const GLenum EQUAL = 0x0202; - const GLenum LEQUAL = 0x0203; - const GLenum GREATER = 0x0204; - const GLenum NOTEQUAL = 0x0205; - const GLenum GEQUAL = 0x0206; - const GLenum ALWAYS = 0x0207; - - /* StencilOp */ - /* ZERO */ - const GLenum KEEP = 0x1E00; - const GLenum REPLACE = 0x1E01; - const GLenum INCR = 0x1E02; - const GLenum DECR = 0x1E03; - const GLenum INVERT = 0x150A; - const GLenum INCR_WRAP = 0x8507; - const GLenum DECR_WRAP = 0x8508; - - /* StringName */ - const GLenum VENDOR = 0x1F00; - const GLenum RENDERER = 0x1F01; - const GLenum VERSION = 0x1F02; - - /* TextureMagFilter */ - const GLenum NEAREST = 0x2600; - const GLenum LINEAR = 0x2601; - - /* TextureMinFilter */ - /* NEAREST */ - /* LINEAR */ - const GLenum NEAREST_MIPMAP_NEAREST = 0x2700; - const GLenum LINEAR_MIPMAP_NEAREST = 0x2701; - const GLenum NEAREST_MIPMAP_LINEAR = 0x2702; - const GLenum LINEAR_MIPMAP_LINEAR = 0x2703; - - /* TextureParameterName */ - const GLenum TEXTURE_MAG_FILTER = 0x2800; - const GLenum TEXTURE_MIN_FILTER = 0x2801; - const GLenum TEXTURE_WRAP_S = 0x2802; - const GLenum TEXTURE_WRAP_T = 0x2803; - - /* TextureTarget */ - const GLenum TEXTURE_2D = 0x0DE1; - const GLenum TEXTURE = 0x1702; - - const GLenum TEXTURE_CUBE_MAP = 0x8513; - const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514; - const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; - const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; - const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; - const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; - const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; - const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; - const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; - - /* TextureUnit */ - const GLenum TEXTURE0 = 0x84C0; - const GLenum TEXTURE1 = 0x84C1; - const GLenum TEXTURE2 = 0x84C2; - const GLenum TEXTURE3 = 0x84C3; - const GLenum TEXTURE4 = 0x84C4; - const GLenum TEXTURE5 = 0x84C5; - const GLenum TEXTURE6 = 0x84C6; - const GLenum TEXTURE7 = 0x84C7; - const GLenum TEXTURE8 = 0x84C8; - const GLenum TEXTURE9 = 0x84C9; - const GLenum TEXTURE10 = 0x84CA; - const GLenum TEXTURE11 = 0x84CB; - const GLenum TEXTURE12 = 0x84CC; - const GLenum TEXTURE13 = 0x84CD; - const GLenum TEXTURE14 = 0x84CE; - const GLenum TEXTURE15 = 0x84CF; - const GLenum TEXTURE16 = 0x84D0; - const GLenum TEXTURE17 = 0x84D1; - const GLenum TEXTURE18 = 0x84D2; - const GLenum TEXTURE19 = 0x84D3; - const GLenum TEXTURE20 = 0x84D4; - const GLenum TEXTURE21 = 0x84D5; - const GLenum TEXTURE22 = 0x84D6; - const GLenum TEXTURE23 = 0x84D7; - const GLenum TEXTURE24 = 0x84D8; - const GLenum TEXTURE25 = 0x84D9; - const GLenum TEXTURE26 = 0x84DA; - const GLenum TEXTURE27 = 0x84DB; - const GLenum TEXTURE28 = 0x84DC; - const GLenum TEXTURE29 = 0x84DD; - const GLenum TEXTURE30 = 0x84DE; - const GLenum TEXTURE31 = 0x84DF; - const GLenum ACTIVE_TEXTURE = 0x84E0; - - /* TextureWrapMode */ - const GLenum REPEAT = 0x2901; - const GLenum CLAMP_TO_EDGE = 0x812F; - const GLenum MIRRORED_REPEAT = 0x8370; - - /* Uniform Types */ - const GLenum FLOAT_VEC2 = 0x8B50; - const GLenum FLOAT_VEC3 = 0x8B51; - const GLenum FLOAT_VEC4 = 0x8B52; - const GLenum INT_VEC2 = 0x8B53; - const GLenum INT_VEC3 = 0x8B54; - const GLenum INT_VEC4 = 0x8B55; - const GLenum BOOL = 0x8B56; - const GLenum BOOL_VEC2 = 0x8B57; - const GLenum BOOL_VEC3 = 0x8B58; - const GLenum BOOL_VEC4 = 0x8B59; - const GLenum FLOAT_MAT2 = 0x8B5A; - const GLenum FLOAT_MAT3 = 0x8B5B; - const GLenum FLOAT_MAT4 = 0x8B5C; - const GLenum SAMPLER_2D = 0x8B5E; - const GLenum SAMPLER_CUBE = 0x8B60; - - /* Vertex Arrays */ - const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; - const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; - const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; - const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; - const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; - const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; - const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; - - /* Read Format */ - const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; - const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; - - /* Shader Source */ - const GLenum COMPILE_STATUS = 0x8B81; - - /* Shader Precision-Specified Types */ - const GLenum LOW_FLOAT = 0x8DF0; - const GLenum MEDIUM_FLOAT = 0x8DF1; - const GLenum HIGH_FLOAT = 0x8DF2; - const GLenum LOW_INT = 0x8DF3; - const GLenum MEDIUM_INT = 0x8DF4; - const GLenum HIGH_INT = 0x8DF5; - - /* Framebuffer Object. */ - const GLenum FRAMEBUFFER = 0x8D40; - const GLenum RENDERBUFFER = 0x8D41; - - const GLenum RGBA4 = 0x8056; - const GLenum RGB5_A1 = 0x8057; - const GLenum RGB565 = 0x8D62; - const GLenum DEPTH_COMPONENT16 = 0x81A5; - const GLenum STENCIL_INDEX8 = 0x8D48; - const GLenum DEPTH_STENCIL = 0x84F9; - - const GLenum RENDERBUFFER_WIDTH = 0x8D42; - const GLenum RENDERBUFFER_HEIGHT = 0x8D43; - const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; - const GLenum RENDERBUFFER_RED_SIZE = 0x8D50; - const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51; - const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52; - const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53; - const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54; - const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55; - - const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; - const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; - const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; - const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; - - const GLenum COLOR_ATTACHMENT0 = 0x8CE0; - const GLenum DEPTH_ATTACHMENT = 0x8D00; - const GLenum STENCIL_ATTACHMENT = 0x8D20; - const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A; - - const GLenum NONE = 0; - - const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5; - const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; - const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; - const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; - const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD; - - const GLenum FRAMEBUFFER_BINDING = 0x8CA6; - const GLenum RENDERBUFFER_BINDING = 0x8CA7; - const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8; - - const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506; - - /* WebGL-specific enums */ - const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240; - const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; - const GLenum CONTEXT_LOST_WEBGL = 0x9242; - const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243; - const GLenum BROWSER_DEFAULT_WEBGL = 0x9244; - - readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; - readonly attribute GLsizei drawingBufferWidth; - readonly attribute GLsizei drawingBufferHeight; - - [WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes(); - [WebGLHandlesContextLoss] boolean isContextLost(); - - sequence<DOMString>? getSupportedExtensions(); - object? getExtension(DOMString name); - - undefined activeTexture(GLenum texture); - undefined attachShader(WebGLProgram program, WebGLShader shader); - undefined bindAttribLocation(WebGLProgram program, GLuint index, DOMString name); - undefined bindBuffer(GLenum target, WebGLBuffer? buffer); - undefined bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer); - undefined bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer); - undefined bindTexture(GLenum target, WebGLTexture? texture); - undefined blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - undefined blendEquation(GLenum mode); - undefined blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); - undefined blendFunc(GLenum sfactor, GLenum dfactor); - undefined blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, - GLenum srcAlpha, GLenum dstAlpha); - - [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target); - undefined clear(GLbitfield mask); - undefined clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - undefined clearDepth(GLclampf depth); - undefined clearStencil(GLint s); - undefined colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - undefined compileShader(WebGLShader shader); - - undefined copyTexImage2D(GLenum target, GLint level, GLenum internalformat, - GLint x, GLint y, GLsizei width, GLsizei height, - GLint border); - undefined copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLint x, GLint y, GLsizei width, GLsizei height); - - WebGLBuffer? createBuffer(); - WebGLFramebuffer? createFramebuffer(); - WebGLProgram? createProgram(); - WebGLRenderbuffer? createRenderbuffer(); - WebGLShader? createShader(GLenum type); - WebGLTexture? createTexture(); - - undefined cullFace(GLenum mode); - - undefined deleteBuffer(WebGLBuffer? buffer); - undefined deleteFramebuffer(WebGLFramebuffer? framebuffer); - undefined deleteProgram(WebGLProgram? program); - undefined deleteRenderbuffer(WebGLRenderbuffer? renderbuffer); - undefined deleteShader(WebGLShader? shader); - undefined deleteTexture(WebGLTexture? texture); - - undefined depthFunc(GLenum func); - undefined depthMask(GLboolean flag); - undefined depthRange(GLclampf zNear, GLclampf zFar); - undefined detachShader(WebGLProgram program, WebGLShader shader); - undefined disable(GLenum cap); - undefined disableVertexAttribArray(GLuint index); - undefined drawArrays(GLenum mode, GLint first, GLsizei count); - undefined drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset); - - undefined enable(GLenum cap); - undefined enableVertexAttribArray(GLuint index); - undefined finish(); - undefined flush(); - undefined framebufferRenderbuffer(GLenum target, GLenum attachment, - GLenum renderbuffertarget, - WebGLRenderbuffer? renderbuffer); - undefined framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, - WebGLTexture? texture, GLint level); - undefined frontFace(GLenum mode); - - undefined generateMipmap(GLenum target); - - WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index); - WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index); - sequence<WebGLShader>? getAttachedShaders(WebGLProgram program); - - [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram program, DOMString name); - - any getBufferParameter(GLenum target, GLenum pname); - any getParameter(GLenum pname); - - [WebGLHandlesContextLoss] GLenum getError(); - - any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, - GLenum pname); - any getProgramParameter(WebGLProgram program, GLenum pname); - DOMString? getProgramInfoLog(WebGLProgram program); - any getRenderbufferParameter(GLenum target, GLenum pname); - any getShaderParameter(WebGLShader shader, GLenum pname); - WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype); - DOMString? getShaderInfoLog(WebGLShader shader); - - DOMString? getShaderSource(WebGLShader shader); - - any getTexParameter(GLenum target, GLenum pname); - - any getUniform(WebGLProgram program, WebGLUniformLocation location); - - WebGLUniformLocation? getUniformLocation(WebGLProgram program, DOMString name); - - any getVertexAttrib(GLuint index, GLenum pname); - - [WebGLHandlesContextLoss] GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname); - - undefined hint(GLenum target, GLenum mode); - [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer); - [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap); - [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer); - [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program); - [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer); - [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader); - [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture); - undefined lineWidth(GLfloat width); - undefined linkProgram(WebGLProgram program); - undefined pixelStorei(GLenum pname, GLint param); - undefined polygonOffset(GLfloat factor, GLfloat units); - - undefined renderbufferStorage(GLenum target, GLenum internalformat, - GLsizei width, GLsizei height); - undefined sampleCoverage(GLclampf value, GLboolean invert); - undefined scissor(GLint x, GLint y, GLsizei width, GLsizei height); - - undefined shaderSource(WebGLShader shader, DOMString source); - - undefined stencilFunc(GLenum func, GLint ref, GLuint mask); - undefined stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); - undefined stencilMask(GLuint mask); - undefined stencilMaskSeparate(GLenum face, GLuint mask); - undefined stencilOp(GLenum fail, GLenum zfail, GLenum zpass); - undefined stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); - - undefined texParameterf(GLenum target, GLenum pname, GLfloat param); - undefined texParameteri(GLenum target, GLenum pname, GLint param); - - undefined uniform1f(WebGLUniformLocation? location, GLfloat x); - undefined uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); - undefined uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z); - undefined uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - - undefined uniform1i(WebGLUniformLocation? location, GLint x); - undefined uniform2i(WebGLUniformLocation? location, GLint x, GLint y); - undefined uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z); - undefined uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); - - undefined useProgram(WebGLProgram? program); - undefined validateProgram(WebGLProgram program); - - undefined vertexAttrib1f(GLuint indx, GLfloat x); - undefined vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); - undefined vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); - undefined vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - - undefined vertexAttrib1fv(GLuint indx, Float32List values); - undefined vertexAttrib2fv(GLuint indx, Float32List values); - undefined vertexAttrib3fv(GLuint indx, Float32List values); - undefined vertexAttrib4fv(GLuint indx, Float32List values); - - undefined vertexAttribPointer(GLuint indx, GLint size, GLenum type, - GLboolean normalized, GLsizei stride, GLintptr offset); - - undefined viewport(GLint x, GLint y, GLsizei width, GLsizei height); -}; - -interface mixin WebGLRenderingContextOverloads -{ - undefined bufferData(GLenum target, GLsizeiptr size, GLenum usage); - undefined bufferData(GLenum target, /*[AllowShared]*/ BufferSource? data, GLenum usage); - undefined bufferSubData(GLenum target, GLintptr offset, /*[AllowShared]*/ BufferSource data); - - undefined compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, - GLsizei width, GLsizei height, GLint border, - /*[AllowShared]*/ ArrayBufferView data); - undefined compressedTexSubImage2D(GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, GLenum format, - /*[AllowShared]*/ ArrayBufferView data); - - undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels); - - [Throws] - undefined texImage2D(GLenum target, GLint level, GLint internalformat, - GLsizei width, GLsizei height, GLint border, GLenum format, - GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels); - [Throws] - undefined texImage2D(GLenum target, GLint level, GLint internalformat, - GLenum format, GLenum type, TexImageSource source); // May throw DOMException - - [Throws] - undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels); - [Throws] - undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLenum format, GLenum type, TexImageSource source); // May throw DOMException - - undefined uniform1fv(WebGLUniformLocation? location, Float32List v); - undefined uniform2fv(WebGLUniformLocation? location, Float32List v); - undefined uniform3fv(WebGLUniformLocation? location, Float32List v); - undefined uniform4fv(WebGLUniformLocation? location, Float32List v); - - undefined uniform1iv(WebGLUniformLocation? location, Int32List v); - undefined uniform2iv(WebGLUniformLocation? location, Int32List v); - undefined uniform3iv(WebGLUniformLocation? location, Int32List v); - undefined uniform4iv(WebGLUniformLocation? location, Int32List v); - - undefined uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); - undefined uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); - undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); -}; - -[Exposed=(Window,Worker)] -interface WebGLRenderingContext -{ -}; -WebGLRenderingContext includes WebGLRenderingContextBase; -WebGLRenderingContext includes WebGLRenderingContextOverloads; diff --git a/components/script/dom/webidls/WebGLSampler.webidl b/components/script/dom/webidls/WebGLSampler.webidl deleted file mode 100644 index 4669aebeabd..00000000000 --- a/components/script/dom/webidls/WebGLSampler.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.8 -// - -[Exposed=Window, Pref="dom_webgl2_enabled"] -interface WebGLSampler : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLShader.webidl b/components/script/dom/webidls/WebGLShader.webidl deleted file mode 100644 index 4a0fe299a52..00000000000 --- a/components/script/dom/webidls/WebGLShader.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.8 -// - -[Exposed=(Window,Worker)] -interface WebGLShader : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLShaderPrecisionFormat.webidl b/components/script/dom/webidls/WebGLShaderPrecisionFormat.webidl deleted file mode 100644 index e2ed4821d11..00000000000 --- a/components/script/dom/webidls/WebGLShaderPrecisionFormat.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7 -// - -[Exposed=(Window,Worker)] -interface WebGLShaderPrecisionFormat { - readonly attribute GLint rangeMin; - readonly attribute GLint rangeMax; - readonly attribute GLint precision; -}; diff --git a/components/script/dom/webidls/WebGLSync.webidl b/components/script/dom/webidls/WebGLSync.webidl deleted file mode 100644 index 66640a888f0..00000000000 --- a/components/script/dom/webidls/WebGLSync.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.14 -// - -[Exposed=Window, Pref="dom_webgl2_enabled"] -interface WebGLSync : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLTexture.webidl b/components/script/dom/webidls/WebGLTexture.webidl deleted file mode 100644 index 4afad31fde7..00000000000 --- a/components/script/dom/webidls/WebGLTexture.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/#5.9 -// - -[Exposed=(Window,Worker)] -interface WebGLTexture : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLTransformFeedback.webidl b/components/script/dom/webidls/WebGLTransformFeedback.webidl deleted file mode 100644 index ee666366dd4..00000000000 --- a/components/script/dom/webidls/WebGLTransformFeedback.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.15 -// - -[Exposed=(Window), Pref="dom_webgl2_enabled"] -interface WebGLTransformFeedback : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLUniformLocation.webidl b/components/script/dom/webidls/WebGLUniformLocation.webidl deleted file mode 100644 index 3db0333177c..00000000000 --- a/components/script/dom/webidls/WebGLUniformLocation.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.10 -// - -[Exposed=(Window,Worker)] -interface WebGLUniformLocation { -}; diff --git a/components/script/dom/webidls/WebGLVertexArrayObject.webidl b/components/script/dom/webidls/WebGLVertexArrayObject.webidl deleted file mode 100644 index c6649e17ef8..00000000000 --- a/components/script/dom/webidls/WebGLVertexArrayObject.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -// -// WebGL IDL definitions scraped from the Khronos specification: -// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.17 -// - -[Exposed=(Window), Pref="dom_webgl2_enabled"] -interface WebGLVertexArrayObject : WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGLVertexArrayObjectOES.webidl b/components/script/dom/webidls/WebGLVertexArrayObjectOES.webidl deleted file mode 100644 index e33e058f2b4..00000000000 --- a/components/script/dom/webidls/WebGLVertexArrayObjectOES.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * WebGL IDL definitions scraped from the Khronos specification: - * https://www.khronos.org/registry/webgl/extensions/OES_vertex_array_object/ - */ - -[LegacyNoInterfaceObject, Exposed=Window] -interface WebGLVertexArrayObjectOES: WebGLObject { -}; diff --git a/components/script/dom/webidls/WebGPU.webidl b/components/script/dom/webidls/WebGPU.webidl deleted file mode 100644 index 177a12d3563..00000000000 --- a/components/script/dom/webidls/WebGPU.webidl +++ /dev/null @@ -1,1283 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBGPU - -// Source: WebGPU (https://gpuweb.github.io/gpuweb/) -// Direct source: https://github.com/w3c/webref/blob/curated/ed/idl/webgpu.idl - -[Exposed=(Window)] -interface mixin GPUObjectBase { - attribute USVString label; -}; - -dictionary GPUObjectDescriptorBase { - USVString label = ""; -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUSupportedLimits { - readonly attribute unsigned long maxTextureDimension1D; - readonly attribute unsigned long maxTextureDimension2D; - readonly attribute unsigned long maxTextureDimension3D; - readonly attribute unsigned long maxTextureArrayLayers; - readonly attribute unsigned long maxBindGroups; - readonly attribute unsigned long maxBindGroupsPlusVertexBuffers; - readonly attribute unsigned long maxBindingsPerBindGroup; - readonly attribute unsigned long maxDynamicUniformBuffersPerPipelineLayout; - readonly attribute unsigned long maxDynamicStorageBuffersPerPipelineLayout; - readonly attribute unsigned long maxSampledTexturesPerShaderStage; - readonly attribute unsigned long maxSamplersPerShaderStage; - readonly attribute unsigned long maxStorageBuffersPerShaderStage; - readonly attribute unsigned long maxStorageTexturesPerShaderStage; - readonly attribute unsigned long maxUniformBuffersPerShaderStage; - readonly attribute unsigned long long maxUniformBufferBindingSize; - readonly attribute unsigned long long maxStorageBufferBindingSize; - readonly attribute unsigned long minUniformBufferOffsetAlignment; - readonly attribute unsigned long minStorageBufferOffsetAlignment; - readonly attribute unsigned long maxVertexBuffers; - readonly attribute unsigned long long maxBufferSize; - readonly attribute unsigned long maxVertexAttributes; - readonly attribute unsigned long maxVertexBufferArrayStride; - readonly attribute unsigned long maxInterStageShaderComponents; - readonly attribute unsigned long maxInterStageShaderVariables; - readonly attribute unsigned long maxColorAttachments; - readonly attribute unsigned long maxColorAttachmentBytesPerSample; - readonly attribute unsigned long maxComputeWorkgroupStorageSize; - readonly attribute unsigned long maxComputeInvocationsPerWorkgroup; - readonly attribute unsigned long maxComputeWorkgroupSizeX; - readonly attribute unsigned long maxComputeWorkgroupSizeY; - readonly attribute unsigned long maxComputeWorkgroupSizeZ; - readonly attribute unsigned long maxComputeWorkgroupsPerDimension; -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUSupportedFeatures { - readonly setlike<DOMString>; -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface WGSLLanguageFeatures { - readonly setlike<DOMString>; -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUAdapterInfo { - readonly attribute DOMString vendor; - readonly attribute DOMString architecture; - readonly attribute DOMString device; - readonly attribute DOMString description; -}; - -interface mixin NavigatorGPU { - [SameObject, Pref="dom_webgpu_enabled", Exposed=(Window /* ,DedicatedWorker */)] readonly attribute GPU gpu; -}; - -Navigator includes NavigatorGPU; -WorkerNavigator includes NavigatorGPU; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPU { - [NewObject] - Promise<GPUAdapter?> requestAdapter(optional GPURequestAdapterOptions options = {}); - GPUTextureFormat getPreferredCanvasFormat(); - [SameObject] readonly attribute WGSLLanguageFeatures wgslLanguageFeatures; -}; - -dictionary GPURequestAdapterOptions { - GPUPowerPreference powerPreference; - boolean forceFallbackAdapter = false; -}; - -enum GPUPowerPreference { - "low-power", - "high-performance" -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUAdapter { - [SameObject] readonly attribute GPUSupportedFeatures features; - [SameObject] readonly attribute GPUSupportedLimits limits; - readonly attribute boolean isFallbackAdapter; - - [NewObject] - Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {}); - [NewObject] - Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []); -}; - -dictionary GPUDeviceDescriptor: GPUObjectDescriptorBase { - sequence<GPUFeatureName> requiredFeatures = []; - record<DOMString, GPUSize64> requiredLimits;// = {}; -}; - -enum GPUFeatureName { - "depth-clip-control", - "depth32float-stencil8", - "texture-compression-bc", - "texture-compression-bc-sliced-3d", - "texture-compression-etc2", - "texture-compression-astc", - "timestamp-query", - "indirect-first-instance", - "shader-f16", - "rg11b10ufloat-renderable", - "bgra8unorm-storage", - "float32-filterable", - "clip-distances", - "dual-source-blending", -}; - -[Exposed=(Window, DedicatedWorker), /*Serializable,*/ Pref="dom_webgpu_enabled"] -interface GPUDevice: EventTarget { - [SameObject] readonly attribute GPUSupportedFeatures features; - [SameObject] readonly attribute GPUSupportedLimits limits; - - // Overriding the name to avoid collision with `class Queue` in gcc - [SameObject, BinaryName="getQueue"] readonly attribute GPUQueue queue; - - undefined destroy(); - - [NewObject, Throws] - GPUBuffer createBuffer(GPUBufferDescriptor descriptor); - [NewObject, Throws] - GPUTexture createTexture(GPUTextureDescriptor descriptor); - [NewObject] - GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {}); - - [Throws] - GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor); - GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor); - GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor); - - GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor); - GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor); - [Throws] - GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor); - - [NewObject] - Promise<GPUComputePipeline> createComputePipelineAsync(GPUComputePipelineDescriptor descriptor); - [Throws, NewObject] - Promise<GPURenderPipeline> createRenderPipelineAsync(GPURenderPipelineDescriptor descriptor); - - [NewObject] - GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {}); - [Throws, NewObject] - GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor); - //[NewObject] - //GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor); -}; -GPUDevice includes GPUObjectBase; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUBuffer { - readonly attribute GPUSize64Out size; - readonly attribute GPUFlagsConstant usage; - - readonly attribute GPUBufferMapState mapState; - - [NewObject] - Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); - [NewObject, Throws] - ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size); - undefined unmap(); - - undefined destroy(); -}; -GPUBuffer includes GPUObjectBase; - - -enum GPUBufferMapState { - "unmapped", - "pending", - "mapped", -}; - -dictionary GPUBufferDescriptor : GPUObjectDescriptorBase { - required GPUSize64 size; - required GPUBufferUsageFlags usage; - boolean mappedAtCreation = false; -}; - -typedef [EnforceRange] unsigned long GPUBufferUsageFlags; -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -namespace GPUBufferUsage { - const GPUFlagsConstant MAP_READ = 0x0001; - const GPUFlagsConstant MAP_WRITE = 0x0002; - const GPUFlagsConstant COPY_SRC = 0x0004; - const GPUFlagsConstant COPY_DST = 0x0008; - const GPUFlagsConstant INDEX = 0x0010; - const GPUFlagsConstant VERTEX = 0x0020; - const GPUFlagsConstant UNIFORM = 0x0040; - const GPUFlagsConstant STORAGE = 0x0080; - const GPUFlagsConstant INDIRECT = 0x0100; - const GPUFlagsConstant QUERY_RESOLVE = 0x0200; -}; - -typedef [EnforceRange] unsigned long GPUMapModeFlags; -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -namespace GPUMapMode { - const GPUFlagsConstant READ = 0x0001; - const GPUFlagsConstant WRITE = 0x0002; -}; - -[Exposed=(Window, DedicatedWorker), Serializable , Pref="dom_webgpu_enabled"] -interface GPUTexture { - [Throws, NewObject] - GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); - - undefined destroy(); - - readonly attribute GPUIntegerCoordinateOut width; - readonly attribute GPUIntegerCoordinateOut height; - readonly attribute GPUIntegerCoordinateOut depthOrArrayLayers; - readonly attribute GPUIntegerCoordinateOut mipLevelCount; - readonly attribute GPUSize32Out sampleCount; - readonly attribute GPUTextureDimension dimension; - readonly attribute GPUTextureFormat format; - readonly attribute GPUFlagsConstant usage; -}; -GPUTexture includes GPUObjectBase; - -dictionary GPUTextureDescriptor : GPUObjectDescriptorBase { - required GPUExtent3D size; - GPUIntegerCoordinate mipLevelCount = 1; - GPUSize32 sampleCount = 1; - GPUTextureDimension dimension = "2d"; - required GPUTextureFormat format; - required GPUTextureUsageFlags usage; - sequence<GPUTextureFormat> viewFormats = []; -}; - -enum GPUTextureDimension { - "1d", - "2d", - "3d", -}; - -typedef [EnforceRange] unsigned long GPUTextureUsageFlags; -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUTextureUsage { - const GPUTextureUsageFlags COPY_SRC = 0x01; - const GPUTextureUsageFlags COPY_DST = 0x02; - const GPUTextureUsageFlags TEXTURE_BINDING = 0x04; - const GPUTextureUsageFlags STORAGE_BINDING = 0x08; - const GPUTextureUsageFlags RENDER_ATTACHMENT = 0x10; -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUTextureView { -}; -GPUTextureView includes GPUObjectBase; - -dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase { - GPUTextureFormat format; - GPUTextureViewDimension dimension; - GPUTextureUsageFlags usage = 0; - GPUTextureAspect aspect = "all"; - GPUIntegerCoordinate baseMipLevel = 0; - GPUIntegerCoordinate mipLevelCount; - GPUIntegerCoordinate baseArrayLayer = 0; - GPUIntegerCoordinate arrayLayerCount; -}; - -enum GPUTextureViewDimension { - "1d", - "2d", - "2d-array", - "cube", - "cube-array", - "3d" -}; - -enum GPUTextureAspect { - "all", - "stencil-only", - "depth-only" -}; - -enum GPUTextureFormat { - // 8-bit formats - "r8unorm", - "r8snorm", - "r8uint", - "r8sint", - - // 16-bit formats - "r16uint", - "r16sint", - "r16float", - "rg8unorm", - "rg8snorm", - "rg8uint", - "rg8sint", - - // 32-bit formats - "r32uint", - "r32sint", - "r32float", - "rg16uint", - "rg16sint", - "rg16float", - "rgba8unorm", - "rgba8unorm-srgb", - "rgba8snorm", - "rgba8uint", - "rgba8sint", - "bgra8unorm", - "bgra8unorm-srgb", - // Packed 32-bit formats - "rgb9e5ufloat", - "rgb10a2uint", - "rgb10a2unorm", - "rg11b10ufloat", - - // 64-bit formats - "rg32uint", - "rg32sint", - "rg32float", - "rgba16uint", - "rgba16sint", - "rgba16float", - - // 128-bit formats - "rgba32uint", - "rgba32sint", - "rgba32float", - - // Depth/stencil formats - "stencil8", - "depth16unorm", - "depth24plus", - "depth24plus-stencil8", - "depth32float", - - // "depth32float-stencil8" feature - "depth32float-stencil8", - - // BC compressed formats usable if "texture-compression-bc" is both - // supported by the device/user agent and enabled in requestDevice. - "bc1-rgba-unorm", - "bc1-rgba-unorm-srgb", - "bc2-rgba-unorm", - "bc2-rgba-unorm-srgb", - "bc3-rgba-unorm", - "bc3-rgba-unorm-srgb", - "bc4-r-unorm", - "bc4-r-snorm", - "bc5-rg-unorm", - "bc5-rg-snorm", - "bc6h-rgb-ufloat", - "bc6h-rgb-float", - "bc7-rgba-unorm", - "bc7-rgba-unorm-srgb", - - // ETC2 compressed formats usable if "texture-compression-etc2" is both - // supported by the device/user agent and enabled in requestDevice. - "etc2-rgb8unorm", - "etc2-rgb8unorm-srgb", - "etc2-rgb8a1unorm", - "etc2-rgb8a1unorm-srgb", - "etc2-rgba8unorm", - "etc2-rgba8unorm-srgb", - "eac-r11unorm", - "eac-r11snorm", - "eac-rg11unorm", - "eac-rg11snorm", - - // ASTC compressed formats usable if "texture-compression-astc" is both - // supported by the device/user agent and enabled in requestDevice. - "astc-4x4-unorm", - "astc-4x4-unorm-srgb", - "astc-5x4-unorm", - "astc-5x4-unorm-srgb", - "astc-5x5-unorm", - "astc-5x5-unorm-srgb", - "astc-6x5-unorm", - "astc-6x5-unorm-srgb", - "astc-6x6-unorm", - "astc-6x6-unorm-srgb", - "astc-8x5-unorm", - "astc-8x5-unorm-srgb", - "astc-8x6-unorm", - "astc-8x6-unorm-srgb", - "astc-8x8-unorm", - "astc-8x8-unorm-srgb", - "astc-10x5-unorm", - "astc-10x5-unorm-srgb", - "astc-10x6-unorm", - "astc-10x6-unorm-srgb", - "astc-10x8-unorm", - "astc-10x8-unorm-srgb", - "astc-10x10-unorm", - "astc-10x10-unorm-srgb", - "astc-12x10-unorm", - "astc-12x10-unorm-srgb", - "astc-12x12-unorm", - "astc-12x12-unorm-srgb", -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUSampler { -}; -GPUSampler includes GPUObjectBase; - -dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase { - GPUAddressMode addressModeU = "clamp-to-edge"; - GPUAddressMode addressModeV = "clamp-to-edge"; - GPUAddressMode addressModeW = "clamp-to-edge"; - GPUFilterMode magFilter = "nearest"; - GPUFilterMode minFilter = "nearest"; - GPUFilterMode mipmapFilter = "nearest"; - float lodMinClamp = 0; - float lodMaxClamp = 1000.0; // TODO: What should this be? - GPUCompareFunction compare; - [Clamp] unsigned short maxAnisotropy = 1; -}; - -enum GPUAddressMode { - "clamp-to-edge", - "repeat", - "mirror-repeat" -}; - -enum GPUFilterMode { - "nearest", - "linear", -}; - -enum GPUCompareFunction { - "never", - "less", - "equal", - "less-equal", - "greater", - "not-equal", - "greater-equal", - "always" -}; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUBindGroupLayout { -}; -GPUBindGroupLayout includes GPUObjectBase; - -dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase { - required sequence<GPUBindGroupLayoutEntry> entries; -}; - -dictionary GPUBindGroupLayoutEntry { - required GPUIndex32 binding; - required GPUShaderStageFlags visibility; - - GPUBufferBindingLayout buffer; - GPUSamplerBindingLayout sampler; - GPUTextureBindingLayout texture; - GPUStorageTextureBindingLayout storageTexture; - GPUExternalTextureBindingLayout externalTexture; -}; - -typedef [EnforceRange] unsigned long GPUShaderStageFlags; -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUShaderStage { - const GPUShaderStageFlags VERTEX = 1; - const GPUShaderStageFlags FRAGMENT = 2; - const GPUShaderStageFlags COMPUTE = 4; -}; - -enum GPUBufferBindingType { - "uniform", - "storage", - "read-only-storage", -}; - -dictionary GPUBufferBindingLayout { - GPUBufferBindingType type = "uniform"; - boolean hasDynamicOffset = false; - GPUSize64 minBindingSize = 0; -}; - -enum GPUSamplerBindingType { - "filtering", - "non-filtering", - "comparison", -}; - -dictionary GPUSamplerBindingLayout { - GPUSamplerBindingType type = "filtering"; -}; - -enum GPUTextureSampleType { - "float", - "unfilterable-float", - "depth", - "sint", - "uint", -}; - -dictionary GPUTextureBindingLayout { - GPUTextureSampleType sampleType = "float"; - GPUTextureViewDimension viewDimension = "2d"; - boolean multisampled = false; -}; - -enum GPUStorageTextureAccess { - "write-only", - "read-only", - "read-write", -}; - -dictionary GPUStorageTextureBindingLayout { - GPUStorageTextureAccess access = "write-only"; - required GPUTextureFormat format; - GPUTextureViewDimension viewDimension = "2d"; -}; - -dictionary GPUExternalTextureBindingLayout { -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUBindGroup { -}; -GPUBindGroup includes GPUObjectBase; - -dictionary GPUBindGroupDescriptor : GPUObjectDescriptorBase { - required GPUBindGroupLayout layout; - required sequence<GPUBindGroupEntry> entries; -}; - -typedef (GPUSampler or GPUTextureView or GPUBufferBinding) GPUBindingResource; - -dictionary GPUBindGroupEntry { - required GPUIndex32 binding; - required GPUBindingResource resource; -}; - -dictionary GPUBufferBinding { - required GPUBuffer buffer; - GPUSize64 offset = 0; - GPUSize64 size; -}; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUPipelineLayout { -}; -GPUPipelineLayout includes GPUObjectBase; - -dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase { - required sequence<GPUBindGroupLayout> bindGroupLayouts; -}; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUShaderModule { - Promise<GPUCompilationInfo> getCompilationInfo(); -}; -GPUShaderModule includes GPUObjectBase; - -dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { - // UTF8String is not observably different from USVString - required USVString code; - object sourceMap; -}; - -enum GPUCompilationMessageType { - "error", - "warning", - "info" -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUCompilationMessage { - readonly attribute DOMString message; - readonly attribute GPUCompilationMessageType type; - readonly attribute unsigned long long lineNum; - readonly attribute unsigned long long linePos; - readonly attribute unsigned long long offset; - readonly attribute unsigned long long length; -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUCompilationInfo { - //readonly attribute FrozenArray<GPUCompilationMessage> messages; - readonly attribute any messages; -}; - -[Exposed=(Window, Worker), Pref="dom_webgpu_enabled"] -interface GPUPipelineError : DOMException { - constructor(optional DOMString message = "", GPUPipelineErrorInit options); - readonly attribute GPUPipelineErrorReason reason; -}; - -dictionary GPUPipelineErrorInit { - required GPUPipelineErrorReason reason; -}; - -enum GPUPipelineErrorReason { - "validation", - "internal", -}; - -enum GPUAutoLayoutMode { - "auto" -}; - -dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase { - required (GPUPipelineLayout or GPUAutoLayoutMode) layout; -}; - -interface mixin GPUPipelineBase { - [Throws] GPUBindGroupLayout getBindGroupLayout(unsigned long index); -}; - -dictionary GPUProgrammableStage { - required GPUShaderModule module; - USVString entryPoint; - record<USVString, GPUPipelineConstantValue> constants; -}; - -typedef double GPUPipelineConstantValue; // May represent WGSL's bool, f32, i32, u32, and f16 if enabled. - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUComputePipeline { -}; -GPUComputePipeline includes GPUObjectBase; -GPUComputePipeline includes GPUPipelineBase; - -dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase { - required GPUProgrammableStage compute; -}; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPURenderPipeline { -}; -GPURenderPipeline includes GPUObjectBase; -GPURenderPipeline includes GPUPipelineBase; - -dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase { - required GPUVertexState vertex; - GPUPrimitiveState primitive = {}; - GPUDepthStencilState depthStencil; - GPUMultisampleState multisample = {}; - GPUFragmentState fragment; -}; - -dictionary GPUPrimitiveState { - GPUPrimitiveTopology topology = "triangle-list"; - GPUIndexFormat stripIndexFormat; - GPUFrontFace frontFace = "ccw"; - GPUCullMode cullMode = "none"; - // Enable depth clamping (requires "depth-clamping" feature) - boolean clampDepth = false; -}; - -enum GPUPrimitiveTopology { - "point-list", - "line-list", - "line-strip", - "triangle-list", - "triangle-strip" -}; - -enum GPUFrontFace { - "ccw", - "cw" -}; - -enum GPUCullMode { - "none", - "front", - "back" -}; - -dictionary GPUMultisampleState { - GPUSize32 count = 1; - GPUSampleMask mask = 0xFFFFFFFF; - boolean alphaToCoverageEnabled = false; -}; - -dictionary GPUFragmentState: GPUProgrammableStage { - required sequence<GPUColorTargetState> targets; -}; - -dictionary GPUColorTargetState { - required GPUTextureFormat format; - GPUBlendState blend; - GPUColorWriteFlags writeMask = 0xF; // GPUColorWrite.ALL -}; - -dictionary GPUBlendState { - required GPUBlendComponent color; - required GPUBlendComponent alpha; -}; - -typedef [EnforceRange] unsigned long GPUColorWriteFlags; -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPUColorWrite { - const GPUColorWriteFlags RED = 0x1; - const GPUColorWriteFlags GREEN = 0x2; - const GPUColorWriteFlags BLUE = 0x4; - const GPUColorWriteFlags ALPHA = 0x8; - const GPUColorWriteFlags ALL = 0xF; -}; - -dictionary GPUBlendComponent { - GPUBlendFactor srcFactor = "one"; - GPUBlendFactor dstFactor = "zero"; - GPUBlendOperation operation = "add"; -}; - -enum GPUBlendFactor { - "zero", - "one", - "src", - "one-minus-src", - "src-alpha", - "one-minus-src-alpha", - "dst", - "one-minus-dst", - "dst-alpha", - "one-minus-dst-alpha", - "src-alpha-saturated", - "constant", - "one-minus-constant", -}; - -enum GPUBlendOperation { - "add", - "subtract", - "reverse-subtract", - "min", - "max" -}; - -dictionary GPUDepthStencilState { - required GPUTextureFormat format; - - boolean depthWriteEnabled = false; - GPUCompareFunction depthCompare = "always"; - - GPUStencilFaceState stencilFront = {}; - GPUStencilFaceState stencilBack = {}; - - GPUStencilValue stencilReadMask = 0xFFFFFFFF; - GPUStencilValue stencilWriteMask = 0xFFFFFFFF; - - GPUDepthBias depthBias = 0; - float depthBiasSlopeScale = 0; - float depthBiasClamp = 0; -}; - -dictionary GPUStencilFaceState { - GPUCompareFunction compare = "always"; - GPUStencilOperation failOp = "keep"; - GPUStencilOperation depthFailOp = "keep"; - GPUStencilOperation passOp = "keep"; -}; - -enum GPUStencilOperation { - "keep", - "zero", - "replace", - "invert", - "increment-clamp", - "decrement-clamp", - "increment-wrap", - "decrement-wrap" -}; - -enum GPUIndexFormat { - "uint16", - "uint32", -}; - -enum GPUVertexFormat { - "uint8x2", - "uint8x4", - "sint8x2", - "sint8x4", - "unorm8x2", - "unorm8x4", - "snorm8x2", - "snorm8x4", - "uint16x2", - "uint16x4", - "sint16x2", - "sint16x4", - "unorm16x2", - "unorm16x4", - "snorm16x2", - "snorm16x4", - "float16x2", - "float16x4", - "float32", - "float32x2", - "float32x3", - "float32x4", - "uint32", - "uint32x2", - "uint32x3", - "uint32x4", - "sint32", - "sint32x2", - "sint32x3", - "sint32x4", -}; - -enum GPUVertexStepMode { - "vertex", - "instance", -}; - -dictionary GPUVertexState: GPUProgrammableStage { - sequence<GPUVertexBufferLayout?> buffers = []; -}; - -dictionary GPUVertexBufferLayout { - required GPUSize64 arrayStride; - GPUVertexStepMode stepMode = "vertex"; - required sequence<GPUVertexAttribute> attributes; -}; - -dictionary GPUVertexAttribute { - required GPUVertexFormat format; - required GPUSize64 offset; - required GPUIndex32 shaderLocation; -}; - -dictionary GPUImageDataLayout { - GPUSize64 offset = 0; - GPUSize32 bytesPerRow; - GPUSize32 rowsPerImage; -}; - -dictionary GPUImageCopyBuffer : GPUImageDataLayout { - required GPUBuffer buffer; -}; - -dictionary GPUImageCopyTexture { - required GPUTexture texture; - GPUIntegerCoordinate mipLevel = 0; - GPUOrigin3D origin; - GPUTextureAspect aspect = "all"; -}; - -dictionary GPUImageCopyTextureTagged : GPUImageCopyTexture { - //GPUPredefinedColorSpace colorSpace = "srgb"; //TODO - boolean premultipliedAlpha = false; -}; - -dictionary GPUImageCopyExternalImage { - required (ImageBitmap or HTMLCanvasElement or OffscreenCanvas) source; - GPUOrigin2D origin = {}; - boolean flipY = false; -}; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUCommandBuffer { -}; -GPUCommandBuffer includes GPUObjectBase; - -dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase { -}; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUCommandEncoder { - [NewObject] - GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {}); - [NewObject, Throws] - GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); - - undefined copyBufferToBuffer( - GPUBuffer source, - GPUSize64 sourceOffset, - GPUBuffer destination, - GPUSize64 destinationOffset, - GPUSize64 size); - - [Throws] - undefined copyBufferToTexture( - GPUImageCopyBuffer source, - GPUImageCopyTexture destination, - GPUExtent3D copySize); - - [Throws] - undefined copyTextureToBuffer( - GPUImageCopyTexture source, - GPUImageCopyBuffer destination, - GPUExtent3D copySize); - - [Throws] - undefined copyTextureToTexture( - GPUImageCopyTexture source, - GPUImageCopyTexture destination, - GPUExtent3D copySize); - - /* - undefined copyImageBitmapToTexture( - GPUImageBitmapCopyView source, - GPUImageCopyTexture destination, - GPUExtent3D copySize); - */ - - //undefined pushDebugGroup(USVString groupLabel); - //undefined popDebugGroup(); - //undefined insertDebugMarker(USVString markerLabel); - - [NewObject] - GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {}); -}; -GPUCommandEncoder includes GPUObjectBase; - -dictionary GPUImageBitmapCopyView { - //required ImageBitmap imageBitmap; //TODO - GPUOrigin2D origin; -}; - -//TODO -dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { - boolean measureExecutionTime = false; -}; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUComputePassEncoder { - undefined setPipeline(GPUComputePipeline pipeline); - undefined dispatchWorkgroups(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1); - //[Pref="dom_webgpu_indirect-dispatch.enabled"] - undefined dispatchWorkgroupsIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); - - undefined end(); -}; -GPUComputePassEncoder includes GPUObjectBase; -GPUComputePassEncoder includes GPUProgrammablePassEncoder; - -dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase { -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPURenderPassEncoder { - undefined setViewport(float x, float y, - float width, float height, - float minDepth, float maxDepth); - - undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y, - GPUIntegerCoordinate width, GPUIntegerCoordinate height); - - [Throws] - undefined setBlendConstant(GPUColor color); - undefined setStencilReference(GPUStencilValue reference); - - //undefined beginOcclusionQuery(GPUSize32 queryIndex); - //undefined endOcclusionQuery(); - - //undefined beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex); - //undefined endPipelineStatisticsQuery(); - - //undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex); - - undefined executeBundles(sequence<GPURenderBundle> bundles); - - undefined end(); -}; -GPURenderPassEncoder includes GPUObjectBase; -GPURenderPassEncoder includes GPUProgrammablePassEncoder; -GPURenderPassEncoder includes GPURenderEncoderBase; - -[Exposed=(Window, DedicatedWorker)] -interface mixin GPUProgrammablePassEncoder { - undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, - optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []); - - //undefined pushDebugGroup(USVString groupLabel); - //undefined popDebugGroup(); - //undefined insertDebugMarker(USVString markerLabel); -}; - -dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase { - required sequence<GPURenderPassColorAttachment> colorAttachments; - GPURenderPassDepthStencilAttachment depthStencilAttachment; - GPUQuerySet occlusionQuerySet; -}; - -dictionary GPURenderPassColorAttachment { - required GPUTextureView view; - GPUTextureView resolveTarget; - - GPUColor clearValue; - required GPULoadOp loadOp; - required GPUStoreOp storeOp; -}; - -dictionary GPURenderPassDepthStencilAttachment { - required GPUTextureView view; - - float depthClearValue; - GPULoadOp depthLoadOp; - GPUStoreOp depthStoreOp; - boolean depthReadOnly = false; - - GPUStencilValue stencilClearValue = 0; - GPULoadOp stencilLoadOp; - GPUStoreOp stencilStoreOp; - boolean stencilReadOnly = false; -}; - -enum GPULoadOp { - "load", - "clear" -}; - -enum GPUStoreOp { - "store", - "discard" -}; - -dictionary GPURenderPassLayout: GPUObjectDescriptorBase { - // TODO: We don't support nullable enumerated arguments yet - required sequence<GPUTextureFormat> colorFormats; - GPUTextureFormat depthStencilFormat; - GPUSize32 sampleCount = 1; -}; - -// https://gpuweb.github.io/gpuweb/#gpurendercommandsmixin -[Exposed=(Window, DedicatedWorker)] -interface mixin GPURenderEncoderBase { - undefined setPipeline(GPURenderPipeline pipeline); - - undefined setIndexBuffer(GPUBuffer buffer, - GPUIndexFormat indexFormat, - optional GPUSize64 offset = 0, - optional GPUSize64 size = 0); - undefined setVertexBuffer(GPUIndex32 slot, - GPUBuffer buffer, - optional GPUSize64 offset = 0, - optional GPUSize64 size = 0); - - undefined draw(GPUSize32 vertexCount, - optional GPUSize32 instanceCount = 1, - optional GPUSize32 firstVertex = 0, - optional GPUSize32 firstInstance = 0); - undefined drawIndexed(GPUSize32 indexCount, - optional GPUSize32 instanceCount = 1, - optional GPUSize32 firstIndex = 0, - optional GPUSignedOffset32 baseVertex = 0, - optional GPUSize32 firstInstance = 0); - - //[Pref="dom_webgpu_indirect-dispatch.enabled"] - undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); - //[Pref="dom_webgpu_indirect-dispatch.enabled"] - undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPURenderBundle { -}; -GPURenderBundle includes GPUObjectBase; - -dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase { -}; - -[Exposed=(Window, DedicatedWorker), Pref="dom_webgpu_enabled"] -interface GPURenderBundleEncoder { - GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); -}; -GPURenderBundleEncoder includes GPUObjectBase; -GPURenderBundleEncoder includes GPUProgrammablePassEncoder; -GPURenderBundleEncoder includes GPURenderEncoderBase; - -dictionary GPURenderBundleEncoderDescriptor : GPURenderPassLayout { - boolean depthReadOnly = false; - boolean stencilReadOnly = false; -}; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUQueue { - undefined submit(sequence<GPUCommandBuffer> buffers); - - Promise<undefined> onSubmittedWorkDone(); - - [Throws] - undefined writeBuffer( - GPUBuffer buffer, - GPUSize64 bufferOffset, - BufferSource data, - optional GPUSize64 dataOffset = 0, - optional GPUSize64 size); - - [Throws] - undefined writeTexture( - GPUImageCopyTexture destination, - BufferSource data, - GPUImageDataLayout dataLayout, - GPUExtent3D size); - - //[Throws] - //undefined copyExternalImageToTexture( - // GPUImageCopyExternalImage source, - // GPUImageCopyTextureTagged destination, - // GPUExtent3D copySize); -}; -GPUQueue includes GPUObjectBase; - -[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom_webgpu_enabled"] -interface GPUQuerySet { - undefined destroy(); -}; -GPUQuerySet includes GPUObjectBase; - -dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase { - required GPUQueryType type; - required GPUSize32 count; - sequence<GPUPipelineStatisticName> pipelineStatistics = []; -}; - -enum GPUPipelineStatisticName { - "vertex-shader-invocations", - "clipper-invocations", - "clipper-primitives-out", - "fragment-shader-invocations", - "compute-shader-invocations" -}; - -enum GPUQueryType { - "occlusion", - "pipeline-statistics", - "timestamp" -}; - - -partial interface GPUCanvasContext { - [Throws, Pref="dom_webgpu_enabled"] - undefined configure(GPUCanvasConfiguration descriptor); - [Pref="dom_webgpu_enabled"] undefined unconfigure(); - [Throws, Pref="dom_webgpu_enabled"] - GPUTexture getCurrentTexture(); -}; - -enum GPUCanvasAlphaMode { - "opaque", - "premultiplied", -}; - -dictionary GPUCanvasConfiguration { - required GPUDevice device; - required GPUTextureFormat format; - GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT - sequence<GPUTextureFormat> viewFormats = []; - // PredefinedColorSpace colorSpace = "srgb"; // TODO - GPUCanvasAlphaMode alphaMode = "opaque"; -}; - -enum GPUDeviceLostReason { - "unknown", - "destroyed", -}; - -[Exposed=(Window, Worker), Pref="dom_webgpu_enabled"] -interface GPUDeviceLostInfo { - readonly attribute GPUDeviceLostReason reason; - readonly attribute DOMString message; -}; - -partial interface GPUDevice { - readonly attribute Promise<GPUDeviceLostInfo> lost; -}; - -[Exposed=(Window, Worker), Pref="dom_webgpu_enabled"] -interface GPUError { - readonly attribute DOMString message; -}; - -[Exposed=(Window, Worker), Pref="dom_webgpu_enabled"] -interface GPUValidationError - : GPUError { - constructor(DOMString message); -}; - -[Exposed=(Window, Worker), Pref="dom_webgpu_enabled"] -interface GPUOutOfMemoryError - : GPUError { - constructor(DOMString message); -}; - -[Exposed=(Window, Worker), Pref="dom_webgpu_enabled"] -interface GPUInternalError - : GPUError { - constructor(DOMString message); -}; - -enum GPUErrorFilter { - "validation", - "out-of-memory", - "internal", -}; - -partial interface GPUDevice { - undefined pushErrorScope(GPUErrorFilter filter); - [NewObject] - Promise<GPUError?> popErrorScope(); -}; - -[Exposed=(Window, Worker), Pref="dom_webgpu_enabled"] -interface GPUUncapturedErrorEvent : Event { - constructor( - DOMString type, - GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict - ); - /*[SameObject]*/ readonly attribute GPUError error; -}; - -dictionary GPUUncapturedErrorEventInit : EventInit { - required GPUError error; -}; - -partial interface GPUDevice { - [Exposed=(Window, DedicatedWorker)] - attribute EventHandler onuncapturederror; -}; - -typedef [EnforceRange] unsigned long GPUBufferDynamicOffset; -typedef [EnforceRange] unsigned long GPUStencilValue; -typedef [EnforceRange] unsigned long GPUSampleMask; -typedef [EnforceRange] long GPUDepthBias; - -typedef [EnforceRange] unsigned long long GPUSize64; -typedef [EnforceRange] unsigned long GPUIntegerCoordinate; -typedef [EnforceRange] unsigned long GPUIndex32; -typedef [EnforceRange] unsigned long GPUSize32; -typedef [EnforceRange] long GPUSignedOffset32; - -typedef unsigned long long GPUSize64Out; -typedef unsigned long GPUIntegerCoordinateOut; -typedef unsigned long GPUSize32Out; - -typedef unsigned long GPUFlagsConstant; - -dictionary GPUColorDict { - required double r; - required double g; - required double b; - required double a; -}; -typedef (sequence<double> or GPUColorDict) GPUColor; - -dictionary GPUOrigin2DDict { - GPUIntegerCoordinate x = 0; - GPUIntegerCoordinate y = 0; -}; -typedef (sequence<GPUIntegerCoordinate> or GPUOrigin2DDict) GPUOrigin2D; - -dictionary GPUOrigin3DDict { - GPUIntegerCoordinate x = 0; - GPUIntegerCoordinate y = 0; - GPUIntegerCoordinate z = 0; -}; -typedef (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict) GPUOrigin3D; - -dictionary GPUExtent3DDict { - required GPUIntegerCoordinate width; - GPUIntegerCoordinate height = 1; - GPUIntegerCoordinate depthOrArrayLayers = 1; -}; - -typedef (sequence<GPUIntegerCoordinate> or GPUExtent3DDict) GPUExtent3D; diff --git a/components/script/dom/webidls/WebSocket.webidl b/components/script/dom/webidls/WebSocket.webidl deleted file mode 100644 index 9fff327fc6f..00000000000 --- a/components/script/dom/webidls/WebSocket.webidl +++ /dev/null @@ -1,36 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-websocket-interface - -enum BinaryType { "blob", "arraybuffer" }; - -[Exposed=(Window,Worker)] -interface WebSocket : EventTarget { - [Throws] constructor(DOMString url, optional (DOMString or sequence<DOMString>) protocols); - readonly attribute DOMString url; - //ready state - const unsigned short CONNECTING = 0; - const unsigned short OPEN = 1; - const unsigned short CLOSING = 2; - const unsigned short CLOSED = 3; - readonly attribute unsigned short readyState; - readonly attribute unsigned long long bufferedAmount; - - //networking - attribute EventHandler onopen; - attribute EventHandler onerror; - attribute EventHandler onclose; - //readonly attribute DOMString extensions; - readonly attribute DOMString protocol; - [Throws] undefined close(optional [Clamp] unsigned short code, optional USVString reason); - - //messaging - attribute EventHandler onmessage; - attribute BinaryType binaryType; - [Throws] undefined send(USVString data); - [Throws] undefined send(Blob data); - [Throws] undefined send(ArrayBuffer data); - [Throws] undefined send(ArrayBufferView data); -}; diff --git a/components/script/dom/webidls/WheelEvent.webidl b/components/script/dom/webidls/WheelEvent.webidl deleted file mode 100644 index 7667aa81560..00000000000 --- a/components/script/dom/webidls/WheelEvent.webidl +++ /dev/null @@ -1,33 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://w3c.github.io/uievents/#interface-wheelevent -[Exposed=Window] -interface WheelEvent : MouseEvent { - [Throws] constructor(DOMString typeArg, optional WheelEventInit wheelEventInitDict = {}); - const unsigned long DOM_DELTA_PIXEL = 0x00; - const unsigned long DOM_DELTA_LINE = 0x01; - const unsigned long DOM_DELTA_PAGE = 0x02; - readonly attribute double deltaX; - readonly attribute double deltaY; - readonly attribute double deltaZ; - readonly attribute unsigned long deltaMode; -}; - -// https://w3c.github.io/uievents/#idl-wheeleventinit -dictionary WheelEventInit : MouseEventInit { - double deltaX = 0.0; - double deltaY = 0.0; - double deltaZ = 0.0; - unsigned long deltaMode = 0; -}; - -// https://w3c.github.io/uievents/#idl-interface-WheelEvent-initializers -partial interface WheelEvent { - // Deprecated in DOM Level 3 - undefined initWheelEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, - Window? viewArg, long detailArg, - double deltaX, double deltaY, - double deltaZ, unsigned long deltaMode); -}; diff --git a/components/script/dom/webidls/Window.webidl b/components/script/dom/webidls/Window.webidl deleted file mode 100644 index 64d7563b38e..00000000000 --- a/components/script/dom/webidls/Window.webidl +++ /dev/null @@ -1,193 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#window -[Global=Window, Exposed=Window /*, LegacyUnenumerableNamedProperties */] -/*sealed*/ interface Window : GlobalScope { - // the current browsing context - [LegacyUnforgeable, CrossOriginReadable] readonly attribute WindowProxy window; - [BinaryName="Self_", Replaceable, CrossOriginReadable] readonly attribute WindowProxy self; - [LegacyUnforgeable] readonly attribute Document document; - - attribute DOMString name; - - [PutForwards=href, LegacyUnforgeable, CrossOriginReadable, CrossOriginWritable] - readonly attribute Location location; - readonly attribute History history; - [Pref="dom_customelements_enabled"] - readonly attribute CustomElementRegistry customElements; - //[Replaceable] readonly attribute BarProp locationbar; - //[Replaceable] readonly attribute BarProp menubar; - //[Replaceable] readonly attribute BarProp personalbar; - //[Replaceable] readonly attribute BarProp scrollbars; - //[Replaceable] readonly attribute BarProp statusbar; - //[Replaceable] readonly attribute BarProp toolbar; - attribute DOMString status; - [CrossOriginCallable] undefined close(); - [CrossOriginReadable] readonly attribute boolean closed; - undefined stop(); - //[CrossOriginCallable] void focus(); - //[CrossOriginCallable] void blur(); - - // other browsing contexts - [Replaceable, CrossOriginReadable] readonly attribute WindowProxy frames; - [Replaceable, CrossOriginReadable] readonly attribute unsigned long length; - // Note that this can return null in the case that the browsing context has been discarded. - // https://github.com/whatwg/html/issues/2115 - [LegacyUnforgeable, CrossOriginReadable] readonly attribute WindowProxy? top; - [Throws, CrossOriginReadable] attribute any opener; - // Note that this can return null in the case that the browsing context has been discarded. - // https://github.com/whatwg/html/issues/2115 - [Replaceable, CrossOriginReadable] readonly attribute WindowProxy? parent; - readonly attribute Element? frameElement; - [Throws] WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", - optional DOMString features = ""); - //getter WindowProxy (unsigned long index); - - getter object (DOMString name); - - // the user agent - readonly attribute Navigator navigator; - //[Replaceable] readonly attribute External external; - //readonly attribute ApplicationCache applicationCache; - - // user prompts - undefined alert(DOMString message); - undefined alert(); - boolean confirm(optional DOMString message = ""); - DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); - //void print(); - //any showModalDialog(DOMString url, optional any argument); - - unsigned long requestAnimationFrame(FrameRequestCallback callback); - undefined cancelAnimationFrame(unsigned long handle); - - [Throws, CrossOriginCallable] - undefined postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []); - [Throws, CrossOriginCallable] - undefined postMessage(any message, optional WindowPostMessageOptions options = {}); - - // also has obsolete members -}; -Window includes GlobalEventHandlers; -Window includes WindowEventHandlers; - -// https://html.spec.whatwg.org/multipage/#Window-partial -partial interface Window { - undefined captureEvents(); - undefined releaseEvents(); -}; - -// https://drafts.csswg.org/cssom/#extensions-to-the-window-interface -partial interface Window { - [NewObject] - CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString pseudoElt); -}; - -// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface -enum ScrollBehavior { "auto", "instant", "smooth" }; - -// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface -dictionary ScrollOptions { - ScrollBehavior behavior = "auto"; -}; - -// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface -dictionary ScrollToOptions : ScrollOptions { - unrestricted double left; - unrestricted double top; -}; - -// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface -partial interface Window { - [Exposed=(Window), NewObject] MediaQueryList matchMedia(DOMString query); - [SameObject, Replaceable] readonly attribute Screen screen; - - // browsing context - undefined moveTo(long x, long y); - undefined moveBy(long x, long y); - undefined resizeTo(long x, long y); - undefined resizeBy(long x, long y); - - // viewport - [Replaceable] readonly attribute long innerWidth; - [Replaceable] readonly attribute long innerHeight; - - // viewport scrolling - [Replaceable] readonly attribute long scrollX; - [Replaceable] readonly attribute long pageXOffset; - [Replaceable] readonly attribute long scrollY; - [Replaceable] readonly attribute long pageYOffset; - undefined scroll(optional ScrollToOptions options = {}); - undefined scroll(unrestricted double x, unrestricted double y); - undefined scrollTo(optional ScrollToOptions options = {}); - undefined scrollTo(unrestricted double x, unrestricted double y); - undefined scrollBy(optional ScrollToOptions options = {}); - undefined scrollBy(unrestricted double x, unrestricted double y); - - // client - [Replaceable] readonly attribute long screenX; - [Replaceable] readonly attribute long screenY; - [Replaceable] readonly attribute long outerWidth; - [Replaceable] readonly attribute long outerHeight; - [Replaceable] readonly attribute double devicePixelRatio; -}; - -// Proprietary extensions. -partial interface Window { - [Pref="dom_servo_helpers_enabled"] - undefined debug(DOMString arg); - [Pref="dom_servo_helpers_enabled"] - undefined gc(); - [Pref="dom_servo_helpers_enabled"] - undefined js_backtrace(); -}; - -// WebDriver extensions -partial interface Window { - // Shouldn't be public, but just to make things work for now - undefined webdriverCallback(optional any result); - undefined webdriverTimeout(); -}; - -// https://html.spec.whatwg.org/multipage/#dom-sessionstorage -interface mixin WindowSessionStorage { - readonly attribute Storage sessionStorage; -}; -Window includes WindowSessionStorage; - -// https://html.spec.whatwg.org/multipage/#dom-localstorage -interface mixin WindowLocalStorage { - readonly attribute Storage localStorage; -}; -Window includes WindowLocalStorage; - -// http://w3c.github.io/animation-timing/#framerequestcallback -callback FrameRequestCallback = undefined (DOMHighResTimeStamp time); - -// https://webbluetoothcg.github.io/web-bluetooth/tests#test-interfaces -partial interface Window { - [Pref="dom_bluetooth_testing_enabled", Exposed=Window] - readonly attribute TestRunner testRunner; - //readonly attribute EventSender eventSender; -}; - -partial interface Window { - [Pref="css_animations_testing_enabled"] - readonly attribute unsigned long runningAnimationCount; -}; - -// https://w3c.github.io/selection-api/#dom-document -partial interface Window { - Selection? getSelection(); -}; - -// https://dom.spec.whatwg.org/#interface-window-extensions -partial interface Window { - [Replaceable] readonly attribute any event; // historical -}; - -dictionary WindowPostMessageOptions : StructuredSerializeOptions { - USVString targetOrigin = "/"; -}; diff --git a/components/script/dom/webidls/WindowOrWorkerGlobalScope.webidl b/components/script/dom/webidls/WindowOrWorkerGlobalScope.webidl deleted file mode 100644 index d9204c11774..00000000000 --- a/components/script/dom/webidls/WindowOrWorkerGlobalScope.webidl +++ /dev/null @@ -1,49 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#windoworworkerglobalscope - -typedef (DOMString or Function) TimerHandler; - -[Exposed=(Window,Worker)] -interface mixin WindowOrWorkerGlobalScope { - [Replaceable] readonly attribute USVString origin; - - // base64 utility methods - [Throws] DOMString btoa(DOMString data); - [Throws] DOMString atob(DOMString data); - - // timers - long setTimeout(TimerHandler handler, optional long timeout = 0, any... arguments); - undefined clearTimeout(optional long handle = 0); - long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments); - undefined clearInterval(optional long handle = 0); - - // microtask queuing - undefined queueMicrotask(VoidFunction callback); - - // ImageBitmap - [Pref="dom_imagebitmap_enabled"] - Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options = {}); - // Promise<ImageBitmap> createImageBitmap( - // ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options); - - // structured cloning - [Throws] - any structuredClone(any value, optional StructuredSerializeOptions options = {}); -}; - -// https://w3c.github.io/hr-time/#the-performance-attribute -partial interface mixin WindowOrWorkerGlobalScope { - [Replaceable] - readonly attribute Performance performance; -}; - -// https://w3c.github.io/webappsec-secure-contexts/#monkey-patching-global-object -partial interface mixin WindowOrWorkerGlobalScope { - readonly attribute boolean isSecureContext; -}; - -Window includes WindowOrWorkerGlobalScope; -WorkerGlobalScope includes WindowOrWorkerGlobalScope; diff --git a/components/script/dom/webidls/WindowProxy.webidl b/components/script/dom/webidls/WindowProxy.webidl deleted file mode 100644 index 8f102540bba..00000000000 --- a/components/script/dom/webidls/WindowProxy.webidl +++ /dev/null @@ -1,7 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#the-windowproxy-exotic-object -[Exposed=(Window,DissimilarOriginWindow), LegacyNoInterfaceObject] -interface WindowProxy {}; diff --git a/components/script/dom/webidls/Worker.webidl b/components/script/dom/webidls/Worker.webidl deleted file mode 100644 index ef535126606..00000000000 --- a/components/script/dom/webidls/Worker.webidl +++ /dev/null @@ -1,31 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#abstractworker -[Exposed=(Window,Worker)] -interface mixin AbstractWorker { - attribute EventHandler onerror; -}; - -// https://html.spec.whatwg.org/multipage/#worker -[Exposed=(Window,Worker)] -interface Worker : EventTarget { - [Throws] constructor(USVString scriptURL, optional WorkerOptions options = {}); - undefined terminate(); - - [Throws] undefined postMessage(any message, sequence<object> transfer); - [Throws] undefined postMessage(any message, optional StructuredSerializeOptions options = {}); - attribute EventHandler onmessage; - attribute EventHandler onmessageerror; -}; - -dictionary WorkerOptions { - WorkerType type = "classic"; - RequestCredentials credentials = "same-origin"; // credentials is only used if type is "module" - DOMString name = ""; -}; - -enum WorkerType { "classic", "module" }; - -Worker includes AbstractWorker; diff --git a/components/script/dom/webidls/WorkerGlobalScope.webidl b/components/script/dom/webidls/WorkerGlobalScope.webidl deleted file mode 100644 index 05301fb28e6..00000000000 --- a/components/script/dom/webidls/WorkerGlobalScope.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#workerglobalscope -[Abstract, Exposed=Worker] -interface WorkerGlobalScope : GlobalScope { - [BinaryName="Self_"] readonly attribute WorkerGlobalScope self; - readonly attribute WorkerLocation location; - - //void close(); - attribute OnErrorEventHandler onerror; - // attribute EventHandler onlanguagechange; - // attribute EventHandler onoffline; - // attribute EventHandler ononline; -}; - -// https://html.spec.whatwg.org/multipage/#WorkerGlobalScope-partial -[Exposed=Worker] -partial interface WorkerGlobalScope { // not obsolete - [Throws] - undefined importScripts(DOMString... urls); - readonly attribute WorkerNavigator navigator; -}; diff --git a/components/script/dom/webidls/WorkerLocation.webidl b/components/script/dom/webidls/WorkerLocation.webidl deleted file mode 100644 index 8985da7e6e9..00000000000 --- a/components/script/dom/webidls/WorkerLocation.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#worker-locations -[Exposed=Worker] -interface WorkerLocation { - stringifier readonly attribute USVString href; - readonly attribute USVString origin; - readonly attribute USVString protocol; - readonly attribute USVString host; - readonly attribute USVString hostname; - readonly attribute USVString port; - readonly attribute USVString pathname; - readonly attribute USVString search; - readonly attribute USVString hash; -}; diff --git a/components/script/dom/webidls/WorkerNavigator.webidl b/components/script/dom/webidls/WorkerNavigator.webidl deleted file mode 100644 index 33ddfade93d..00000000000 --- a/components/script/dom/webidls/WorkerNavigator.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://html.spec.whatwg.org/multipage/#workernavigator -[Exposed=Worker] -interface WorkerNavigator {}; -WorkerNavigator includes NavigatorID; -WorkerNavigator includes NavigatorLanguage; -//WorkerNavigator includes NavigatorOnLine; -WorkerNavigator includes NavigatorConcurrentHardware; - -// https://w3c.github.io/permissions/#navigator-and-workernavigator-extension - -[Exposed=(Worker)] -partial interface WorkerNavigator { - [Pref="dom_permissions_enabled"] readonly attribute Permissions permissions; -}; - diff --git a/components/script/dom/webidls/Worklet.webidl b/components/script/dom/webidls/Worklet.webidl deleted file mode 100644 index a656c1e3865..00000000000 --- a/components/script/dom/webidls/Worklet.webidl +++ /dev/null @@ -1,13 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.css-houdini.org/worklets/#worklet -[Pref="dom_worklet_enabled", Exposed=(Window)] -interface Worklet { - [NewObject] Promise<undefined> addModule(USVString moduleURL, optional WorkletOptions options = {}); -}; - -dictionary WorkletOptions { - RequestCredentials credentials = "omit"; -}; diff --git a/components/script/dom/webidls/WorkletGlobalScope.webidl b/components/script/dom/webidls/WorkletGlobalScope.webidl deleted file mode 100644 index 33283c84161..00000000000 --- a/components/script/dom/webidls/WorkletGlobalScope.webidl +++ /dev/null @@ -1,10 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://drafts.css-houdini.org/worklets/#workletglobalscope -// TODO: The spec IDL doesn't make this a subclass of EventTarget -// https://github.com/whatwg/html/issues/2611 -[Pref="dom_worklet_enabled", Exposed=Worklet] -interface WorkletGlobalScope: GlobalScope { -}; diff --git a/components/script/dom/webidls/XMLDocument.webidl b/components/script/dom/webidls/XMLDocument.webidl deleted file mode 100644 index 64d11d29cd7..00000000000 --- a/components/script/dom/webidls/XMLDocument.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is: - * https://dom.spec.whatwg.org/#interface-document - * https://html.spec.whatwg.org/multipage/#the-document-object - */ - -// https://dom.spec.whatwg.org/#interface-document -[Exposed=Window] -interface XMLDocument : Document {}; diff --git a/components/script/dom/webidls/XMLHttpRequest.webidl b/components/script/dom/webidls/XMLHttpRequest.webidl deleted file mode 100644 index c7225cff112..00000000000 --- a/components/script/dom/webidls/XMLHttpRequest.webidl +++ /dev/null @@ -1,77 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://xhr.spec.whatwg.org/#interface-xmlhttprequest - * - * To the extent possible under law, the editor has waived all copyright - * and related or neighboring rights to this work. In addition, as of 1 May 2014, - * the editor has made this specification available under the Open Web Foundation - * Agreement Version 1.0, which is available at - * http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. - */ - -// https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit -typedef (Blob or BufferSource or FormData or DOMString or URLSearchParams) XMLHttpRequestBodyInit; - -// https://fetch.spec.whatwg.org/#bodyinit -typedef (ReadableStream or XMLHttpRequestBodyInit) BodyInit; - -enum XMLHttpRequestResponseType { - "", - "arraybuffer", - "blob", - "document", - "json", - "text", -}; - -[Exposed=(Window,Worker)] -interface XMLHttpRequest : XMLHttpRequestEventTarget { - [Throws] constructor(); - // event handler - attribute EventHandler onreadystatechange; - - // states - const unsigned short UNSENT = 0; - const unsigned short OPENED = 1; - const unsigned short HEADERS_RECEIVED = 2; - const unsigned short LOADING = 3; - const unsigned short DONE = 4; - readonly attribute unsigned short readyState; - - // request - [Throws] - undefined open(ByteString method, USVString url); - [Throws] - undefined open(ByteString method, USVString url, boolean async, - optional USVString? username = null, - optional USVString? password = null); - - [Throws] - undefined setRequestHeader(ByteString name, ByteString value); - [SetterThrows] - attribute unsigned long timeout; - [SetterThrows] - attribute boolean withCredentials; - readonly attribute XMLHttpRequestUpload upload; - [Throws] - undefined send(optional (Document or XMLHttpRequestBodyInit)? data = null); - undefined abort(); - - // response - readonly attribute USVString responseURL; - readonly attribute unsigned short status; - readonly attribute ByteString statusText; - ByteString? getResponseHeader(ByteString name); - ByteString getAllResponseHeaders(); - [Throws] - undefined overrideMimeType(DOMString mime); - [SetterThrows] - attribute XMLHttpRequestResponseType responseType; - readonly attribute any response; - [Throws] - readonly attribute USVString responseText; - [Throws, Exposed=Window] readonly attribute Document? responseXML; -}; diff --git a/components/script/dom/webidls/XMLHttpRequestEventTarget.webidl b/components/script/dom/webidls/XMLHttpRequestEventTarget.webidl deleted file mode 100644 index bde137a2b48..00000000000 --- a/components/script/dom/webidls/XMLHttpRequestEventTarget.webidl +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://xhr.spec.whatwg.org/#interface-xmlhttprequest - * - * To the extent possible under law, the editor has waived all copyright - * and related or neighboring rights to this work. In addition, as of 1 May 2014, - * the editor has made this specification available under the Open Web Foundation - * Agreement Version 1.0, which is available at - * http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. - */ - -[Abstract, Exposed=(Window,Worker)] -interface XMLHttpRequestEventTarget : EventTarget { - // event handlers - attribute EventHandler onloadstart; - attribute EventHandler onprogress; - attribute EventHandler onabort; - attribute EventHandler onerror; - attribute EventHandler onload; - attribute EventHandler ontimeout; - attribute EventHandler onloadend; -}; diff --git a/components/script/dom/webidls/XMLHttpRequestUpload.webidl b/components/script/dom/webidls/XMLHttpRequestUpload.webidl deleted file mode 100644 index 3dfee1210c5..00000000000 --- a/components/script/dom/webidls/XMLHttpRequestUpload.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://xhr.spec.whatwg.org/#interface-xmlhttprequest - * - * To the extent possible under law, the editor has waived all copyright - * and related or neighboring rights to this work. In addition, as of 1 May 2014, - * the editor has made this specification available under the Open Web Foundation - * Agreement Version 1.0, which is available at - * http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. - */ - -[Exposed=(Window,Worker)] -interface XMLHttpRequestUpload : XMLHttpRequestEventTarget { -}; diff --git a/components/script/dom/webidls/XMLSerializer.webidl b/components/script/dom/webidls/XMLSerializer.webidl deleted file mode 100644 index c0111220e42..00000000000 --- a/components/script/dom/webidls/XMLSerializer.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -/* - * The origin of this IDL file is - * https://w3c.github.io/DOM-Parsing/#the-domparser-interface - */ - -[Exposed=Window] -interface XMLSerializer { - [Throws] constructor(); - [Throws] - DOMString serializeToString(Node root); -}; diff --git a/components/script/dom/webidls/XPathEvaluator.webidl b/components/script/dom/webidls/XPathEvaluator.webidl deleted file mode 100644 index ebb505c104c..00000000000 --- a/components/script/dom/webidls/XPathEvaluator.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#mixin-xpathevaluatorbase -interface mixin XPathEvaluatorBase { - [NewObject, Throws, Pref="dom_xpath_enabled"] XPathExpression createExpression( - DOMString expression, - optional XPathNSResolver? resolver = null - ); - Node createNSResolver(Node nodeResolver); // legacy - // XPathResult.ANY_TYPE = 0 - [Throws, Pref="dom_xpath_enabled"] XPathResult evaluate( - DOMString expression, - Node contextNode, - optional XPathNSResolver? resolver = null, - optional unsigned short type = 0, - optional XPathResult? result = null - ); -}; - -Document includes XPathEvaluatorBase; - -// https://dom.spec.whatwg.org/#interface-xpathevaluator -[Exposed=Window, Pref="dom_xpath_enabled"] -interface XPathEvaluator { - constructor(); -}; - -XPathEvaluator includes XPathEvaluatorBase; diff --git a/components/script/dom/webidls/XPathExpression.webidl b/components/script/dom/webidls/XPathExpression.webidl deleted file mode 100644 index 29cbd23e757..00000000000 --- a/components/script/dom/webidls/XPathExpression.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#interface-xpathexpression -[Exposed=Window, Pref="dom_xpath_enabled"] -interface XPathExpression { - // XPathResult.ANY_TYPE = 0 - [Throws] XPathResult evaluate( - Node contextNode, - optional unsigned short type = 0, - optional XPathResult? result = null - ); -}; diff --git a/components/script/dom/webidls/XPathNSResolver.webidl b/components/script/dom/webidls/XPathNSResolver.webidl deleted file mode 100644 index 099f6afd105..00000000000 --- a/components/script/dom/webidls/XPathNSResolver.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#mixin-xpathevaluatorbase -[Exposed=Window] -callback interface XPathNSResolver { - DOMString? lookupNamespaceURI(DOMString? prefix); -}; diff --git a/components/script/dom/webidls/XPathResult.webidl b/components/script/dom/webidls/XPathResult.webidl deleted file mode 100644 index ed0e9804ca4..00000000000 --- a/components/script/dom/webidls/XPathResult.webidl +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// https://dom.spec.whatwg.org/#interface-xpathresult -[Exposed=Window, Pref="dom_xpath_enabled"] -interface XPathResult { - const unsigned short ANY_TYPE = 0; - const unsigned short NUMBER_TYPE = 1; - const unsigned short STRING_TYPE = 2; - const unsigned short BOOLEAN_TYPE = 3; - const unsigned short UNORDERED_NODE_ITERATOR_TYPE = 4; - const unsigned short ORDERED_NODE_ITERATOR_TYPE = 5; - const unsigned short UNORDERED_NODE_SNAPSHOT_TYPE = 6; - const unsigned short ORDERED_NODE_SNAPSHOT_TYPE = 7; - const unsigned short ANY_UNORDERED_NODE_TYPE = 8; - const unsigned short FIRST_ORDERED_NODE_TYPE = 9; - - readonly attribute unsigned short resultType; - [Throws] readonly attribute unrestricted double numberValue; - [Throws] readonly attribute DOMString stringValue; - [Throws] readonly attribute boolean booleanValue; - [Throws] readonly attribute Node? singleNodeValue; - [Throws] readonly attribute boolean invalidIteratorState; - [Throws] readonly attribute unsigned long snapshotLength; - - [Throws] Node? iterateNext(); - [Throws] Node? snapshotItem(unsigned long index); -}; diff --git a/components/script/dom/webidls/XRBoundedReferenceSpace.webidl b/components/script/dom/webidls/XRBoundedReferenceSpace.webidl deleted file mode 100644 index 9bf63f7f685..00000000000 --- a/components/script/dom/webidls/XRBoundedReferenceSpace.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrboundedreferencespace-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRBoundedReferenceSpace : XRReferenceSpace { - readonly attribute /*FrozenArray<DOMPointReadOnly>*/ any boundsGeometry; -}; diff --git a/components/script/dom/webidls/XRCompositionLayer.webidl b/components/script/dom/webidls/XRCompositionLayer.webidl deleted file mode 100644 index bdfe3435965..00000000000 --- a/components/script/dom/webidls/XRCompositionLayer.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// TODO: Implement the layer types -// https://github.com/servo/servo/issues/27493 - -// https://immersive-web.github.io/layers/#xrcompositionlayer -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRCompositionLayer : XRLayer { -// readonly attribute XRLayerLayout layout; -// -// attribute boolean blendTextureSourceAlpha; -// attribute boolean? chromaticAberrationCorrection; -// attribute float? fixedFoveation; -// -// readonly attribute boolean needsRedraw; -// -// void destroy(); -}; diff --git a/components/script/dom/webidls/XRCubeLayer.webidl b/components/script/dom/webidls/XRCubeLayer.webidl deleted file mode 100644 index 30744201a87..00000000000 --- a/components/script/dom/webidls/XRCubeLayer.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// TODO: Implement the layer types -// https://github.com/servo/servo/issues/27493 - -// https://immersive-web.github.io/layers/#xrcubelayer - -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRCubeLayer : XRCompositionLayer { -// attribute XRSpace space; -// attribute DOMPointReadOnly orientation; -// -// // Events -// attribute EventHandler onredraw; -}; diff --git a/components/script/dom/webidls/XRCylinderLayer.webidl b/components/script/dom/webidls/XRCylinderLayer.webidl deleted file mode 100644 index c20801f81a0..00000000000 --- a/components/script/dom/webidls/XRCylinderLayer.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// TODO: Implement the layer types -// https://github.com/servo/servo/issues/27493 - -// https://immersive-web.github.io/layers/#xrcylinderlayer -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRCylinderLayer : XRCompositionLayer { -// attribute XRSpace space; -// attribute XRRigidTransform transform; -// -// attribute float radius; -// attribute float centralAngle; -// attribute float aspectRatio; -// -// // Events -// attribute EventHandler onredraw; -}; diff --git a/components/script/dom/webidls/XREquirectLayer.webidl b/components/script/dom/webidls/XREquirectLayer.webidl deleted file mode 100644 index 7b1d1584d62..00000000000 --- a/components/script/dom/webidls/XREquirectLayer.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// TODO: Implement the layer types -// https://github.com/servo/servo/issues/27493 - -// https://immersive-web.github.io/layers/#xrequirectlayer -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XREquirectLayer : XRCompositionLayer { -// attribute XRSpace space; -// attribute XRRigidTransform transform; -// -// attribute float radius; -// attribute float centralHorizontalAngle; -// attribute float upperVerticalAngle; -// attribute float lowerVerticalAngle; -// -// // Events -// attribute EventHandler onredraw; -}; diff --git a/components/script/dom/webidls/XRFrame.webidl b/components/script/dom/webidls/XRFrame.webidl deleted file mode 100644 index d5ec4b6ef21..00000000000 --- a/components/script/dom/webidls/XRFrame.webidl +++ /dev/null @@ -1,28 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrframe-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRFrame { - [SameObject] readonly attribute XRSession session; - readonly attribute DOMHighResTimeStamp predictedDisplayTime; - - [Throws] XRViewerPose? getViewerPose(XRReferenceSpace referenceSpace); - [Throws] XRPose? getPose(XRSpace space, XRSpace baseSpace); - - // WebXR Hand Input - [Pref="dom_webxr_hands_enabled", Throws] - XRJointPose? getJointPose(XRJointSpace joint, XRSpace baseSpace); - [Pref="dom_webxr_hands_enabled", Throws] - boolean fillJointRadii(sequence<XRJointSpace> jointSpaces, Float32Array radii); - - [Pref="dom_webxr_hands_enabled", Throws] - boolean fillPoses(sequence<XRSpace> spaces, XRSpace baseSpace, Float32Array transforms); - - // WebXR Hit Test - sequence<XRHitTestResult> getHitTestResults(XRHitTestSource hitTestSource); -}; diff --git a/components/script/dom/webidls/XRHand.webidl b/components/script/dom/webidls/XRHand.webidl deleted file mode 100644 index 6749eab8dd5..00000000000 --- a/components/script/dom/webidls/XRHand.webidl +++ /dev/null @@ -1,48 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md - -enum XRHandJoint { - "wrist", - - "thumb-metacarpal", - "thumb-phalanx-proximal", - "thumb-phalanx-distal", - "thumb-tip", - - "index-finger-metacarpal", - "index-finger-phalanx-proximal", - "index-finger-phalanx-intermediate", - "index-finger-phalanx-distal", - "index-finger-tip", - - "middle-finger-metacarpal", - "middle-finger-phalanx-proximal", - "middle-finger-phalanx-intermediate", - "middle-finger-phalanx-distal", - "middle-finger-tip", - - "ring-finger-metacarpal", - "ring-finger-phalanx-proximal", - "ring-finger-phalanx-intermediate", - "ring-finger-phalanx-distal", - "ring-finger-tip", - - "pinky-finger-metacarpal", - "pinky-finger-phalanx-proximal", - "pinky-finger-phalanx-intermediate", - "pinky-finger-phalanx-distal", - "pinky-finger-tip" -}; - -[SecureContext, Exposed=Window, Pref="dom_webxr_hands_enabled"] -interface XRHand { - iterable<XRHandJoint, XRJointSpace>; - - readonly attribute unsigned long size; - XRJointSpace get(XRHandJoint key); -}; diff --git a/components/script/dom/webidls/XRHitTestResult.webidl b/components/script/dom/webidls/XRHitTestResult.webidl deleted file mode 100644 index cdbac19d504..00000000000 --- a/components/script/dom/webidls/XRHitTestResult.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/hit-test/#xrhittestresult-interface - -[SecureContext, Exposed=Window] -interface XRHitTestResult { - XRPose? getPose(XRSpace baseSpace); -}; diff --git a/components/script/dom/webidls/XRHitTestSource.webidl b/components/script/dom/webidls/XRHitTestSource.webidl deleted file mode 100644 index 4db03b437a1..00000000000 --- a/components/script/dom/webidls/XRHitTestSource.webidl +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/hit-test/#xrhittestsource-interface - -enum XRHitTestTrackableType { - "point", - "plane", - "mesh" -}; - -dictionary XRHitTestOptionsInit { - required XRSpace space; - sequence<XRHitTestTrackableType> entityTypes; - XRRay offsetRay; -}; - -[SecureContext, Exposed=Window] -interface XRHitTestSource { - undefined cancel(); -}; diff --git a/components/script/dom/webidls/XRInputSource.webidl b/components/script/dom/webidls/XRInputSource.webidl deleted file mode 100644 index 7b82b050777..00000000000 --- a/components/script/dom/webidls/XRInputSource.webidl +++ /dev/null @@ -1,37 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrinputsource-interface - -enum XRHandedness { - "none", - "left", - "right" -}; - -enum XRTargetRayMode { - "gaze", - "tracked-pointer", - "screen", - "transient-pointer" -}; - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRInputSource { - readonly attribute XRHandedness handedness; - readonly attribute XRTargetRayMode targetRayMode; - [SameObject] readonly attribute XRSpace targetRaySpace; - [SameObject] readonly attribute XRSpace? gripSpace; - /* [SameObject] */ readonly attribute /* FrozenArray<DOMString> */ any profiles; - readonly attribute boolean skipRendering; - - // WebXR Gamepads Module - [SameObject] readonly attribute Gamepad? gamepad; - - // Hand Input - [Pref="dom_webxr_hands_enabled"] - readonly attribute XRHand? hand; -}; diff --git a/components/script/dom/webidls/XRInputSourceArray.webidl b/components/script/dom/webidls/XRInputSourceArray.webidl deleted file mode 100644 index 093eab67ed9..00000000000 --- a/components/script/dom/webidls/XRInputSourceArray.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrinputsourcearray-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRInputSourceArray { - iterable<XRInputSource>; - readonly attribute unsigned long length; - getter XRInputSource(unsigned long index); -}; diff --git a/components/script/dom/webidls/XRInputSourceEvent.webidl b/components/script/dom/webidls/XRInputSourceEvent.webidl deleted file mode 100644 index 11055b3f247..00000000000 --- a/components/script/dom/webidls/XRInputSourceEvent.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrinputsourceevent-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRInputSourceEvent : Event { - [Throws] constructor(DOMString type, XRInputSourceEventInit eventInitDict); - [SameObject] readonly attribute XRFrame frame; - [SameObject] readonly attribute XRInputSource inputSource; -}; - -dictionary XRInputSourceEventInit : EventInit { - required XRFrame frame; - required XRInputSource inputSource; -}; diff --git a/components/script/dom/webidls/XRInputSourcesChangeEvent.webidl b/components/script/dom/webidls/XRInputSourcesChangeEvent.webidl deleted file mode 100644 index f6b65d12a09..00000000000 --- a/components/script/dom/webidls/XRInputSourcesChangeEvent.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrinputsourceschangedevent-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_test"] -interface XRInputSourcesChangeEvent : Event { - constructor(DOMString type, XRInputSourcesChangeEventInit eventInitDict); - [SameObject] readonly attribute XRSession session; - /* [SameObject] */ readonly attribute /* FrozenArray<XRInputSource> */ any added; - /* [SameObject] */ readonly attribute /* FrozenArray<XRInputSource> */ any removed; -}; - -dictionary XRInputSourcesChangeEventInit : EventInit { - required XRSession session; - required sequence<XRInputSource> added; - required sequence<XRInputSource> removed; -}; diff --git a/components/script/dom/webidls/XRJointPose.webidl b/components/script/dom/webidls/XRJointPose.webidl deleted file mode 100644 index 73bde0ca6e6..00000000000 --- a/components/script/dom/webidls/XRJointPose.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md - -[SecureContext, Exposed=Window, Pref="dom_webxr_hands_enabled"] -interface XRJointPose: XRPose { - readonly attribute float? radius; -}; diff --git a/components/script/dom/webidls/XRJointSpace.webidl b/components/script/dom/webidls/XRJointSpace.webidl deleted file mode 100644 index 2eeca7edc15..00000000000 --- a/components/script/dom/webidls/XRJointSpace.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://github.com/immersive-web/webxr-hands-input/blob/master/explainer.md - -[SecureContext, Exposed=Window, Pref="dom_webxr_hands_enabled"] -interface XRJointSpace: XRSpace { - readonly attribute XRHandJoint jointName; -}; diff --git a/components/script/dom/webidls/XRLayer.webidl b/components/script/dom/webidls/XRLayer.webidl deleted file mode 100644 index fdc9b2bee3a..00000000000 --- a/components/script/dom/webidls/XRLayer.webidl +++ /dev/null @@ -1,9 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrlayer -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRLayer : EventTarget {}; diff --git a/components/script/dom/webidls/XRLayerEvent.webidl b/components/script/dom/webidls/XRLayerEvent.webidl deleted file mode 100644 index 553a70fcaec..00000000000 --- a/components/script/dom/webidls/XRLayerEvent.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/layers/#xrlayerevent-interface -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRLayerEvent : Event { - constructor(DOMString type, XRLayerEventInit eventInitDict); - [SameObject] readonly attribute XRLayer layer; -}; - -dictionary XRLayerEventInit : EventInit { - required XRLayer layer; -}; diff --git a/components/script/dom/webidls/XRMediaBinding.webidl b/components/script/dom/webidls/XRMediaBinding.webidl deleted file mode 100644 index 558aa0596c3..00000000000 --- a/components/script/dom/webidls/XRMediaBinding.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/layers/#xrmediabindingtype -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRMediaBinding { - [Throws] constructor(XRSession session); - - [Throws] XRQuadLayer createQuadLayer(HTMLVideoElement video, XRMediaLayerInit init); - [Throws] XRCylinderLayer createCylinderLayer(HTMLVideoElement video, XRMediaLayerInit init); - [Throws] XREquirectLayer createEquirectLayer(HTMLVideoElement video, XRMediaLayerInit init); -}; - -dictionary XRMediaLayerInit { - required XRSpace space; - XRLayerLayout layout = "mono"; - boolean invertStereo = false; -}; diff --git a/components/script/dom/webidls/XRPose.webidl b/components/script/dom/webidls/XRPose.webidl deleted file mode 100644 index 2ac5f372cdd..00000000000 --- a/components/script/dom/webidls/XRPose.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrpose-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRPose { - [SameObject] readonly attribute XRRigidTransform transform; - [SameObject] readonly attribute DOMPointReadOnly? linearVelocity; - [SameObject] readonly attribute DOMPointReadOnly? angularVelocity; - - readonly attribute boolean emulatedPosition; -}; diff --git a/components/script/dom/webidls/XRProjectionLayer.webidl b/components/script/dom/webidls/XRProjectionLayer.webidl deleted file mode 100644 index bdb9de13dd2..00000000000 --- a/components/script/dom/webidls/XRProjectionLayer.webidl +++ /dev/null @@ -1,14 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// TODO: Implement the layer types -// https://github.com/servo/servo/issues/27493 - -// https://immersive-web.github.io/layers/#xrprojectionlayer -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRProjectionLayer : XRCompositionLayer { -// readonly attribute boolean ignoreDepthValues; -}; diff --git a/components/script/dom/webidls/XRQuadLayer.webidl b/components/script/dom/webidls/XRQuadLayer.webidl deleted file mode 100644 index 0b4afcac9be..00000000000 --- a/components/script/dom/webidls/XRQuadLayer.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// TODO: Implement the layer types -// https://github.com/servo/servo/issues/27493 - -// https://immersive-web.github.io/layers/#xrquadlayer -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRQuadLayer : XRCompositionLayer { -// attribute XRSpace space; -// attribute XRRigidTransform transform; -// -// attribute float width; -// attribute float height; -// -// // Events -// attribute EventHandler onredraw; -}; diff --git a/components/script/dom/webidls/XRRay.webidl b/components/script/dom/webidls/XRRay.webidl deleted file mode 100644 index b5fd7ed3494..00000000000 --- a/components/script/dom/webidls/XRRay.webidl +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/hit-test/#xrray-interface - -dictionary XRRayDirectionInit { - double x = 0; - double y = 0; - double z = -1; - double w = 0; -}; - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRRay { - [Throws] constructor(optional DOMPointInit origin = {}, optional XRRayDirectionInit direction = {}); - [Throws] constructor(XRRigidTransform transform); - [SameObject] readonly attribute DOMPointReadOnly origin; - [SameObject] readonly attribute DOMPointReadOnly direction; - [SameObject] readonly attribute Float32Array matrix; -}; diff --git a/components/script/dom/webidls/XRReferenceSpace.webidl b/components/script/dom/webidls/XRReferenceSpace.webidl deleted file mode 100644 index aad31702f01..00000000000 --- a/components/script/dom/webidls/XRReferenceSpace.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrreferencespace-interface - -enum XRReferenceSpaceType { - "viewer", - "local", - "local-floor", - "bounded-floor", - "unbounded" -}; - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRReferenceSpace : XRSpace { - [NewObject] XRReferenceSpace getOffsetReferenceSpace(XRRigidTransform originOffset); - - attribute EventHandler onreset; -}; diff --git a/components/script/dom/webidls/XRReferenceSpaceEvent.webidl b/components/script/dom/webidls/XRReferenceSpaceEvent.webidl deleted file mode 100644 index b9075294d1e..00000000000 --- a/components/script/dom/webidls/XRReferenceSpaceEvent.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrreferencespaceevent-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRReferenceSpaceEvent : Event { - [Throws] constructor(DOMString type, XRReferenceSpaceEventInit eventInitDict); - [SameObject] readonly attribute XRReferenceSpace referenceSpace; - [SameObject] readonly attribute XRRigidTransform? transform; -}; - -dictionary XRReferenceSpaceEventInit : EventInit { - required XRReferenceSpace referenceSpace; - XRRigidTransform? transform = null; -}; diff --git a/components/script/dom/webidls/XRRenderState.webidl b/components/script/dom/webidls/XRRenderState.webidl deleted file mode 100644 index ff91e0d2fea..00000000000 --- a/components/script/dom/webidls/XRRenderState.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrrenderstate-interface - -dictionary XRRenderStateInit { - double depthNear; - double depthFar; - double inlineVerticalFieldOfView; - XRWebGLLayer? baseLayer; - sequence<XRLayer>? layers; -}; - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] interface XRRenderState { - readonly attribute double depthNear; - readonly attribute double depthFar; - readonly attribute double? inlineVerticalFieldOfView; - readonly attribute XRWebGLLayer? baseLayer; - - // https://immersive-web.github.io/layers/#xrrenderstatechanges - // workaround until we have FrozenArray - readonly attribute /* FrozenArray<XRLayer> */ any layers; -}; diff --git a/components/script/dom/webidls/XRRigidTransform.webidl b/components/script/dom/webidls/XRRigidTransform.webidl deleted file mode 100644 index 11fbf9615b7..00000000000 --- a/components/script/dom/webidls/XRRigidTransform.webidl +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrrigidtransform-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRRigidTransform { - [Throws] constructor(optional DOMPointInit position = {}, optional DOMPointInit orientation = {}); - readonly attribute DOMPointReadOnly position; - readonly attribute DOMPointReadOnly orientation; - readonly attribute Float32Array matrix; - readonly attribute XRRigidTransform inverse; -}; diff --git a/components/script/dom/webidls/XRSession.webidl b/components/script/dom/webidls/XRSession.webidl deleted file mode 100644 index ccd72b187c6..00000000000 --- a/components/script/dom/webidls/XRSession.webidl +++ /dev/null @@ -1,69 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrsession-interface - -enum XREnvironmentBlendMode { - "opaque", - "additive", - "alpha-blend", -}; - -enum XRVisibilityState { - "visible", - "visible-blurred", - "hidden", -}; - -enum XRInteractionMode { - "screen-space", - "world-space", -}; - -callback XRFrameRequestCallback = undefined (DOMHighResTimeStamp time, XRFrame frame); - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRSession : EventTarget { - // Attributes - readonly attribute XRVisibilityState visibilityState; - readonly attribute float? frameRate; - readonly attribute Float32Array? supportedFrameRates; - [SameObject] readonly attribute XRRenderState renderState; - [SameObject] readonly attribute XRInputSourceArray inputSources; - readonly attribute /*FrozenArray<DOMString>*/ any enabledFeatures; - readonly attribute boolean isSystemKeyboardSupported; - - // Methods - [Throws] undefined updateRenderState(optional XRRenderStateInit state = {}); - Promise<undefined> updateTargetFrameRate(float rate); - Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type); - - long requestAnimationFrame(XRFrameRequestCallback callback); - undefined cancelAnimationFrame(long handle); - - Promise<undefined> end(); - - // Events - attribute EventHandler onend; - attribute EventHandler onselect; - attribute EventHandler onsqueeze; - attribute EventHandler oninputsourceschange; - attribute EventHandler onselectstart; - attribute EventHandler onselectend; - attribute EventHandler onsqueezestart; - attribute EventHandler onsqueezeend; - attribute EventHandler onvisibilitychange; - attribute EventHandler onframeratechange; - - // AR Module - // Attributes - readonly attribute XREnvironmentBlendMode environmentBlendMode; - readonly attribute XRInteractionMode interactionMode; - - // Hit Test Module - // Methods - Promise<XRHitTestSource> requestHitTestSource(XRHitTestOptionsInit options); -}; diff --git a/components/script/dom/webidls/XRSessionEvent.webidl b/components/script/dom/webidls/XRSessionEvent.webidl deleted file mode 100644 index 4e48f0c6c5c..00000000000 --- a/components/script/dom/webidls/XRSessionEvent.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrsessionevent-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRSessionEvent : Event { - [Throws] constructor(DOMString type, XRSessionEventInit eventInitDict); - [SameObject] readonly attribute XRSession session; -}; - -dictionary XRSessionEventInit : EventInit { - required XRSession session; -}; diff --git a/components/script/dom/webidls/XRSpace.webidl b/components/script/dom/webidls/XRSpace.webidl deleted file mode 100644 index 236c9164402..00000000000 --- a/components/script/dom/webidls/XRSpace.webidl +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrspace-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRSpace : EventTarget { - // XRRigidTransform? getTransformTo(XRSpace other); -}; diff --git a/components/script/dom/webidls/XRSubImage.webidl b/components/script/dom/webidls/XRSubImage.webidl deleted file mode 100644 index 3e8efdb24d7..00000000000 --- a/components/script/dom/webidls/XRSubImage.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/layers/#xrsubimagetype -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRSubImage { - [SameObject] readonly attribute XRViewport viewport; -}; diff --git a/components/script/dom/webidls/XRSystem.webidl b/components/script/dom/webidls/XRSystem.webidl deleted file mode 100644 index ef5537ebdac..00000000000 --- a/components/script/dom/webidls/XRSystem.webidl +++ /dev/null @@ -1,37 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrsystem-interface -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRSystem: EventTarget { - // Methods - Promise<boolean> isSessionSupported(XRSessionMode mode); - Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit parameters = {}); - - // Events - // attribute EventHandler ondevicechange; -}; - -[SecureContext] -partial interface Navigator { - [SameObject, Pref="dom_webxr_enabled"] readonly attribute XRSystem xr; -}; - -enum XRSessionMode { - "inline", - "immersive-vr", - "immersive-ar" -}; - -dictionary XRSessionInit { - sequence<any> requiredFeatures; - sequence<any> optionalFeatures; -}; - -partial interface XRSystem { - // https://github.com/immersive-web/webxr-test-api/ - [SameObject, Pref="dom_webxr_test"] readonly attribute XRTest test; -}; diff --git a/components/script/dom/webidls/XRTest.webidl b/components/script/dom/webidls/XRTest.webidl deleted file mode 100644 index 710d3520249..00000000000 --- a/components/script/dom/webidls/XRTest.webidl +++ /dev/null @@ -1,44 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://github.com/immersive-web/webxr-test-api/ - -[Exposed=Window, Pref="dom_webxr_test"] -interface XRTest { - // Simulates connecting a device to the system. - // Used to instantiate a fake device for use in tests. - Promise<FakeXRDevice> simulateDeviceConnection(FakeXRDeviceInit init); - - // // Simulates a user activation (aka user gesture) for the current scope. - // // The activation is only guaranteed to be valid in the provided function and only applies to WebXR - // // Device API methods. - undefined simulateUserActivation(Function f); - - // // Disconnect all fake devices - Promise<undefined> disconnectAllDevices(); -}; - -dictionary FakeXRDeviceInit { - boolean supportsImmersive = false; - sequence<XRSessionMode> supportedModes; - - required sequence<FakeXRViewInit> views; - - // this is actually sequence<any>, but we don't support - // non-string features anyway - sequence<DOMString> supportedFeatures; - // Whether the space supports tracking in inline sessions - boolean supportsTrackingInInline = true; - // The bounds coordinates. If null, bounded reference spaces are not supported. - sequence<FakeXRBoundsPoint> boundsCoodinates; - // Eye level used for calculating floor-level spaces - FakeXRRigidTransformInit floorOrigin; - FakeXRRigidTransformInit viewerOrigin; - - // Hit test extensions: - FakeXRWorldInit world; -}; - diff --git a/components/script/dom/webidls/XRView.webidl b/components/script/dom/webidls/XRView.webidl deleted file mode 100644 index 235eb5a6b2b..00000000000 --- a/components/script/dom/webidls/XRView.webidl +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrview-interface - -enum XREye { - "left", - "right", - "none", -}; - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRView { - readonly attribute XREye eye; - readonly attribute Float32Array projectionMatrix; - [SameObject] readonly attribute XRRigidTransform transform; - readonly attribute double? recommendedViewportScale; - - undefined requestViewportScale(double? scale); - - // AR Module - readonly attribute boolean isFirstPersonObserver; -}; diff --git a/components/script/dom/webidls/XRViewerPose.webidl b/components/script/dom/webidls/XRViewerPose.webidl deleted file mode 100644 index 82f57571f8f..00000000000 --- a/components/script/dom/webidls/XRViewerPose.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrviewerpose-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRViewerPose : XRPose { - // readonly attribute FrozenArray<XRView> views; - // workaround until we have FrozenArray - // see https://github.com/servo/servo/issues/10427#issuecomment-449593626 - readonly attribute any views; -}; diff --git a/components/script/dom/webidls/XRViewport.webidl b/components/script/dom/webidls/XRViewport.webidl deleted file mode 100644 index 4fc6c7afd86..00000000000 --- a/components/script/dom/webidls/XRViewport.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrviewport-interface - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRViewport { - readonly attribute long x; - readonly attribute long y; - readonly attribute long width; - readonly attribute long height; -}; diff --git a/components/script/dom/webidls/XRWebGLBinding.webidl b/components/script/dom/webidls/XRWebGLBinding.webidl deleted file mode 100644 index 121c2c1db86..00000000000 --- a/components/script/dom/webidls/XRWebGLBinding.webidl +++ /dev/null @@ -1,85 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/layers/#XRWebGLBindingtype -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRWebGLBinding { - [Throws] constructor(XRSession session, XRWebGLRenderingContext context); - -// readonly attribute double nativeProjectionScaleFactor; - - [Throws] XRProjectionLayer createProjectionLayer(XRTextureType textureType, - optional XRProjectionLayerInit init = {}); - [Throws] XRQuadLayer createQuadLayer(XRTextureType textureType, - optional XRQuadLayerInit init); - [Throws] XRCylinderLayer createCylinderLayer(XRTextureType textureType, - optional XRCylinderLayerInit init); - [Throws] XREquirectLayer createEquirectLayer(XRTextureType textureType, - optional XREquirectLayerInit init); - [Throws] XRCubeLayer createCubeLayer(optional XRCubeLayerInit init); - - [Throws] XRWebGLSubImage getSubImage(XRCompositionLayer layer, XRFrame frame, optional XREye eye = "none"); - [Throws] XRWebGLSubImage getViewSubImage(XRProjectionLayer layer, XRView view); -}; - -dictionary XRProjectionLayerInit { - boolean depth = true; - boolean stencil = false; - boolean alpha = true; - double scaleFactor = 1.0; -}; - -dictionary XRQuadLayerInit : XRLayerInit { - XRRigidTransform? transform; - float width = 1.0; - float height = 1.0; - boolean isStatic = false; -}; - -dictionary XRCylinderLayerInit : XRLayerInit { - XRRigidTransform? transform; - float radius = 2.0; - float centralAngle = 0.78539; - float aspectRatio = 2.0; - boolean isStatic = false; -}; - -dictionary XREquirectLayerInit : XRLayerInit { - XRRigidTransform? transform; - float radius = 0; - float centralHorizontalAngle = 6.28318; - float upperVerticalAngle = 1.570795; - float lowerVerticalAngle = -1.570795; - boolean isStatic = false; -}; - -dictionary XRCubeLayerInit : XRLayerInit { - DOMPointReadOnly? orientation; - boolean isStatic = false; -}; - -dictionary XRLayerInit { - required XRSpace space; - required unsigned long viewPixelWidth; - required unsigned long viewPixelHeight; - XRLayerLayout layout = "mono"; - boolean depth = false; - boolean stencil = false; - boolean alpha = true; -}; - -enum XRTextureType { - "texture", - "texture-array" -}; - -enum XRLayerLayout { - "default", - "mono", - "stereo", - "stereo-left-right", - "stereo-top-bottom" -}; diff --git a/components/script/dom/webidls/XRWebGLLayer.webidl b/components/script/dom/webidls/XRWebGLLayer.webidl deleted file mode 100644 index e69033fcd2a..00000000000 --- a/components/script/dom/webidls/XRWebGLLayer.webidl +++ /dev/null @@ -1,44 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/webxr/#xrwebgllayer-interface - -typedef (WebGLRenderingContext or - WebGL2RenderingContext) XRWebGLRenderingContext; - -dictionary XRWebGLLayerInit { - boolean antialias = true; - boolean depth = true; - boolean stencil = false; - boolean alpha = true; - boolean ignoreDepthValues = false; - double framebufferScaleFactor = 1.0; -}; - -[SecureContext, Exposed=Window, Pref="dom_webxr_enabled"] -interface XRWebGLLayer: XRLayer { - [Throws] constructor(XRSession session, - XRWebGLRenderingContext context, - optional XRWebGLLayerInit layerInit = {}); - // Attributes - readonly attribute boolean antialias; - readonly attribute boolean ignoreDepthValues; - attribute float? fixedFoveation; - - [SameObject] readonly attribute WebGLFramebuffer? framebuffer; - readonly attribute unsigned long framebufferWidth; - readonly attribute unsigned long framebufferHeight; - - // Methods - XRViewport? getViewport(XRView view); - - // Static Methods - static double getNativeFramebufferScaleFactor(XRSession session); -}; - -partial interface mixin WebGLRenderingContextBase { - [Pref="dom_webxr_enabled"] Promise<undefined> makeXRCompatible(); -}; diff --git a/components/script/dom/webidls/XRWebGLSubImage.webidl b/components/script/dom/webidls/XRWebGLSubImage.webidl deleted file mode 100644 index 83ccdd91166..00000000000 --- a/components/script/dom/webidls/XRWebGLSubImage.webidl +++ /dev/null @@ -1,15 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -// skip-unless CARGO_FEATURE_WEBXR - -// https://immersive-web.github.io/layers/#xrwebglsubimagetype -[SecureContext, Exposed=Window, Pref="dom_webxr_layers_enabled"] -interface XRWebGLSubImage : XRSubImage { - [SameObject] readonly attribute WebGLTexture colorTexture; - [SameObject] readonly attribute WebGLTexture? depthStencilTexture; - readonly attribute unsigned long? imageIndex; - readonly attribute unsigned long textureWidth; - readonly attribute unsigned long textureHeight; -}; |