diff --git a/.eslintrc b/.eslintrc index ee87fe67..8fe8ddc5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -18,7 +18,8 @@ ], "quotes": [ "error", - "single" + "single", + { "allowTemplateLiterals": true } ], "semi": [ "error", diff --git a/.travis.yml b/.travis.yml index 1dc12c8a..884b772b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,6 +60,16 @@ matrix: ./build.sh) || exit 1; done + # The `web-sys` crate's tests pass on nightly. + - rust: nightly + env: JOB=test-web-sys + before_install: *INSTALL_NODE_VIA_NVM + install: + - npm install + script: cargo test --manifest-path crates/web-sys/Cargo.toml + addons: + firefox: latest + # Tests pass on nightly using yarn - rust: nightly env: JOB=test-yarn-smoke diff --git a/Cargo.toml b/Cargo.toml index 3c937aee..aef8c661 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,7 @@ members = [ "crates/cli", "crates/typescript", "crates/webidl", + "crates/web-sys", "examples/hello_world", "examples/smorgasboard", "examples/console_log", diff --git a/crates/backend/src/defined.rs b/crates/backend/src/defined.rs new file mode 100644 index 00000000..7ca80376 --- /dev/null +++ b/crates/backend/src/defined.rs @@ -0,0 +1,256 @@ +use ast; +use proc_macro2::Ident; +use syn; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ImportedTypeKind { + /// The definition of an imported type. + Definition, + /// A reference to an imported type. + Reference, +} + +/// Iterate over definitions of and references to imported types in the AST. +pub trait ImportedTypes { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind); +} + +/// Iterate over definitions of imported types in the AST. +pub trait ImportedTypeDefinitions { + fn imported_type_definitions(&self, f: &mut F) + where + F: FnMut(&Ident); +} + +impl ImportedTypeDefinitions for T +where + T: ImportedTypes, +{ + fn imported_type_definitions(&self, f: &mut F) + where + F: FnMut(&Ident), + { + self.imported_types(&mut |id, kind| { + if let ImportedTypeKind::Definition = kind { + f(id); + } + }); + } +} + +/// Iterate over references to imported types in the AST. +pub trait ImportedTypeReferences { + fn imported_type_references(&self, f: &mut F) + where + F: FnMut(&Ident); +} + +impl ImportedTypeReferences for T +where + T: ImportedTypes, +{ + fn imported_type_references(&self, f: &mut F) + where + F: FnMut(&Ident), + { + self.imported_types(&mut |id, kind| { + if let ImportedTypeKind::Reference = kind { + f(id); + } + }); + } +} + +impl ImportedTypes for ast::Program { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + self.imports.imported_types(f); + self.type_aliases.imported_types(f); + } +} + +impl ImportedTypes for Vec +where + T: ImportedTypes, +{ + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + for x in self { + x.imported_types(f); + } + } +} + +impl ImportedTypes for ast::Import { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + self.kind.imported_types(f) + } +} + +impl ImportedTypes for ast::ImportKind { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + match self { + ast::ImportKind::Static(s) => s.imported_types(f), + ast::ImportKind::Function(fun) => fun.imported_types(f), + ast::ImportKind::Type(ty) => ty.imported_types(f), + } + } +} + +impl ImportedTypes for ast::ImportStatic { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + self.ty.imported_types(f); + } +} + +impl ImportedTypes for syn::Type { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + match self { + syn::Type::Reference(ref r) => r.imported_types(f), + syn::Type::Path(ref p) => p.imported_types(f), + _ => {} + } + } +} + +impl ImportedTypes for syn::TypeReference { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + self.elem.imported_types(f); + } +} + +impl ImportedTypes for syn::TypePath { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + if self.qself.is_some() + || self.path.leading_colon.is_some() + || self.path.segments.len() != 1 + { + return; + } + f( + &self.path.segments.last().unwrap().value().ident, + ImportedTypeKind::Reference, + ); + } +} + +impl ImportedTypes for ast::ImportFunction { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + self.function.imported_types(f); + self.kind.imported_types(f); + } +} + +impl ImportedTypes for ast::ImportFunctionKind { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + match self { + ast::ImportFunctionKind::Method { ty, .. } => ty.imported_types(f), + ast::ImportFunctionKind::Normal => {} + } + } +} + +impl ImportedTypes for ast::Function { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + self.arguments.imported_types(f); + if let Some(ref r) = self.ret { + r.imported_types(f); + } + } +} + +impl ImportedTypes for syn::ArgCaptured { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + self.ty.imported_types(f); + } +} + +impl ImportedTypes for ast::ImportType { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + f(&self.name, ImportedTypeKind::Definition); + } +} + +impl ImportedTypes for ast::TypeAlias { + fn imported_types(&self, f: &mut F) + where + F: FnMut(&Ident, ImportedTypeKind), + { + f(&self.dest, ImportedTypeKind::Reference); + } +} + +/// Remove any methods, statics, &c, that reference types that are *not* +/// defined. +pub trait RemoveUndefinedImports { + fn remove_undefined_imports(&mut self, is_defined: &F) + where + F: Fn(&Ident) -> bool; +} + +impl RemoveUndefinedImports for ast::Program { + fn remove_undefined_imports(&mut self, is_defined: &F) + where + F: Fn(&Ident) -> bool, + { + self.imports.remove_undefined_imports(is_defined); + self.type_aliases.remove_undefined_imports(is_defined); + } +} + +impl RemoveUndefinedImports for Vec +where + T: ImportedTypeReferences, +{ + fn remove_undefined_imports(&mut self, is_defined: &F) + where + F: Fn(&Ident) -> bool, + { + self.retain(|x| { + let mut all_defined = true; + x.imported_type_references(&mut |id| { + all_defined = all_defined && is_defined(id); + }); + all_defined + }); + } +} diff --git a/crates/backend/src/lib.rs b/crates/backend/src/lib.rs index 40181999..5eca3c23 100755 --- a/crates/backend/src/lib.rs +++ b/crates/backend/src/lib.rs @@ -11,4 +11,5 @@ extern crate wasm_bindgen_shared as shared; pub mod ast; mod codegen; +pub mod defined; pub mod util; diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index 176908f1..3a95720c 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -284,6 +284,40 @@ impl<'a> Context<'a> { )) })?; + self.bind("__wbindgen_is_object", &|me| { + me.expose_get_object(); + Ok(String::from( + " + function(i) { + const val = getObject(i); + return typeof(val) === 'object' && val !== null ? 1 : 0; + } + ", + )) + })?; + + self.bind("__wbindgen_is_function", &|me| { + me.expose_get_object(); + Ok(String::from( + " + function(i) { + return typeof(getObject(i)) === 'function' ? 1 : 0; + } + ", + )) + })?; + + self.bind("__wbindgen_is_string", &|me| { + me.expose_get_object(); + Ok(String::from( + " + function(i) { + return typeof(getObject(i)) === 'string' ? 1 : 0; + } + ", + )) + })?; + self.bind("__wbindgen_string_get", &|me| { me.expose_pass_string_to_wasm()?; me.expose_get_object(); @@ -1501,7 +1535,7 @@ impl<'a> Context<'a> { if (desc) return desc; obj = Object.getPrototypeOf(obj); } - throw new Error('descriptor not found'); + throw new Error(`descriptor for id='${id}' not found`); } ", ); @@ -1866,11 +1900,24 @@ impl<'a, 'b> SubContext<'a, 'b> { } }; + let fallback = if import.structural { + "".to_string() + } else { + format!( + " || function() {{ + throw new Error(`wasm-bindgen: {} does not exist`); + }}", + target + ) + }; + self.cx.global(&format!( " - const {}_target = {}; + const {}_target = {} {} ; ", - import.shim, target + import.shim, + target, + fallback )); format!( "{}_target{}", diff --git a/crates/test-project-builder/src/lib.rs b/crates/test-project-builder/src/lib.rs index dd296ae2..2ce5d97e 100644 --- a/crates/test-project-builder/src/lib.rs +++ b/crates/test-project-builder/src/lib.rs @@ -16,6 +16,7 @@ use std::time::{Duration, Instant}; static CNT: AtomicUsize = ATOMIC_USIZE_INIT; thread_local!(static IDX: usize = CNT.fetch_add(1, Ordering::SeqCst)); +#[derive(Clone)] pub struct Project { files: Vec<(String, String)>, debug: bool, @@ -423,18 +424,17 @@ impl Project { buildrs.push_str(&format!( r#" fs::create_dir_all("{}").unwrap(); + let bindings = compile_file(Path::new("{}")).expect("should compile OK"); + println!("generated WebIDL bindings = '''\n{{}}\n'''", bindings); + File::create(&Path::new(&dest).join("{}")) .unwrap() - .write_all( - compile_file(Path::new("{}")) - .unwrap() - .as_bytes() - ) + .write_all(bindings.as_bytes()) .unwrap(); "#, path.parent().unwrap().to_str().unwrap(), - path.to_str().unwrap(), origpath.to_str().unwrap(), + path.to_str().unwrap(), )); self.files.push(( @@ -477,8 +477,8 @@ impl Project { } runjs.push_str(" - function run(test, wasm) { - test.test(); + async function run(test, wasm) { + await test.test(); if (wasm.assertStackEmpty) wasm.assertStackEmpty(); @@ -544,11 +544,13 @@ impl Project { assert!(modules.is_empty()); runjs.push_str(" const test = require('./test'); - try { - run(test, {}); - } catch (e) { - onerror(e); - } + (async function () { + try { + await run(test, {}); + } catch (e) { + onerror(e); + } + }()); "); } self.files.push(("run.js".to_string(), runjs)); @@ -560,6 +562,7 @@ impl Project { let (root, target_dir) = self.build(); let mut cmd = Command::new("cargo"); cmd.arg("build") + .arg("-vv") .arg("--target") .arg("wasm32-unknown-unknown") .current_dir(&root) @@ -638,12 +641,15 @@ impl Project { // move files from the root into each test, it looks like this may be // needed for webpack to work well when invoked concurrently. - fs::hard_link("package.json", root.join("package.json")).unwrap(); - if !Path::new("node_modules").exists() { + let mut cwd = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + cwd.pop(); // chop off test-project-builder + cwd.pop(); // chop off crates + fs::copy(cwd.join("package.json"), root.join("package.json")).unwrap(); + let modules = cwd.join("node_modules"); + if !modules.exists() { panic!("\n\nfailed to find `node_modules`, have you run `npm install` yet?\n\n"); } - let cwd = env::current_dir().unwrap(); - symlink_dir(&cwd.join("node_modules"), &root.join("node_modules")).unwrap(); + symlink_dir(&modules, &root.join("node_modules")).unwrap(); if self.headless { return self.test_headless(&root) @@ -677,7 +683,12 @@ impl Project { lazy_static! { static ref MUTEX: Mutex<()> = Mutex::new(()); } - let _lock = MUTEX.lock(); + let _lock = { + let _x = wrap_step("waiting on headless test lock"); + // Don't panic on a poisoned mutex, since we only use it to + // serialize servers. + MUTEX.lock().unwrap_or_else(|poisoned| poisoned.into_inner()) + }; let mut cmd = self.npm(); cmd.arg("run") @@ -686,20 +697,29 @@ impl Project { .arg("--quiet") .arg("--watch-stdin") .current_dir(&root); - let _server = run_in_background(&mut cmd, "webpack-dev-server".into()); + let mut server = run_in_background(&mut cmd, "webpack-dev-server".into()); // wait for webpack-dev-server to come online and bind its port - loop { - if TcpStream::connect("127.0.0.1:8080").is_ok() { - break; + { + let _x = wrap_step("waiting for webpack-dev-server"); + + loop { + if TcpStream::connect("127.0.0.1:8080").is_ok() { + break; + } + if server.exited() { + panic!("webpack-dev-server exited during headless test initialization") + } + thread::sleep(Duration::from_millis(100)); } - thread::sleep(Duration::from_millis(100)); } let path = env::var_os("PATH").unwrap_or_default(); let mut path = env::split_paths(&path).collect::>(); path.push(root.join("node_modules/geckodriver")); + let _x = wrap_step("running headless test"); + let mut cmd = Command::new("node"); cmd.args(&self.node_args) .arg(root.join("run-headless.js")) @@ -775,6 +795,12 @@ struct BackgroundChild { stderr: Option>>, } +impl BackgroundChild { + pub fn exited(&mut self) -> bool { + self.child.try_wait().expect("should try_wait OK").is_some() + } +} + impl Drop for BackgroundChild { fn drop(&mut self) { drop(self.stdin.take()); diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml new file mode 100644 index 00000000..1605ddea --- /dev/null +++ b/crates/web-sys/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "web-sys" +version = "0.1.0" +authors = ["Nick Fitzgerald "] +readme = "./README.md" + +[build-dependencies] +env_logger = "0.5.10" +failure = "0.1" +wasm-bindgen-webidl = { path = "../webidl", version = "=0.2.11" } + +[dependencies] +wasm-bindgen = { path = "../..", version = "=0.2.11" } + +[dev-dependencies] +wasm-bindgen-test-project-builder = { path = "../test-project-builder", version = '=0.2.11' } diff --git a/crates/web-sys/README.md b/crates/web-sys/README.md new file mode 100644 index 00000000..8e363928 --- /dev/null +++ b/crates/web-sys/README.md @@ -0,0 +1,3 @@ +# `web-sys` + +Raw bindings to Web APIs for projects using `wasm-bindgen`. diff --git a/crates/web-sys/build.rs b/crates/web-sys/build.rs new file mode 100644 index 00000000..df2b2742 --- /dev/null +++ b/crates/web-sys/build.rs @@ -0,0 +1,50 @@ +extern crate env_logger; +extern crate failure; +extern crate wasm_bindgen_webidl; + +use failure::ResultExt; +use std::env; +use std::fs; +use std::io::Write; +use std::path; +use std::process; + +fn main() { + if let Err(e) = try_main() { + eprintln!("Error: {}", e); + for c in e.causes().skip(1) { + eprintln!(" caused by {}", c); + } + process::exit(1); + } +} + +fn try_main() -> Result<(), failure::Error> { + println!("cargo:rerun-if-changed=build.rs"); + env_logger::init(); + + println!("cargo:rerun-if-changed=webidls/enabled"); + let entries = fs::read_dir("webidls/enabled").context("reading webidls/enabled directory")?; + + let mut contents = String::new(); + for entry in entries { + let entry = entry.context("getting webidls/enabled/* entry")?; + println!("cargo:rerun-if-changed={}", entry.path().display()); + + let this_contents = + fs::read_to_string(entry.path()).context("reading WebIDL file contents")?; + contents.push_str(&this_contents); + } + + let bindings = wasm_bindgen_webidl::compile(&contents) + .context("compiling WebIDL into wasm-bindgen bindings")?; + + let out_dir = env::var("OUT_DIR").context("reading OUT_DIR environment variable")?; + let mut out_file = fs::File::create(path::Path::new(&out_dir).join("bindings.rs")) + .context("creating output bindings file")?; + out_file + .write_all(bindings.as_bytes()) + .context("writing bindings to output file")?; + + Ok(()) +} diff --git a/crates/web-sys/src/lib.rs b/crates/web-sys/src/lib.rs new file mode 100755 index 00000000..33883a66 --- /dev/null +++ b/crates/web-sys/src/lib.rs @@ -0,0 +1,5 @@ +#![feature(wasm_custom_section, wasm_import_module)] + +extern crate wasm_bindgen; + +include!(concat!(env!("OUT_DIR"), "/bindings.rs")); diff --git a/crates/web-sys/tests/all/event.rs b/crates/web-sys/tests/all/event.rs new file mode 100644 index 00000000..7025fdf5 --- /dev/null +++ b/crates/web-sys/tests/all/event.rs @@ -0,0 +1,54 @@ +use super::project; + +#[test] +fn event() { + project() + .add_local_dependency("web-sys", env!("CARGO_MANIFEST_DIR")) + .headless(true) + .file( + "src/lib.rs", + r#" + #![feature(proc_macro, wasm_custom_section)] + extern crate wasm_bindgen; + use wasm_bindgen::prelude::*; + extern crate web_sys; + + #[wasm_bindgen] + pub fn test_event(event: &web_sys::Event) { + // These should match `new Event`. + assert!(event.bubbles()); + assert!(event.cancelable()); + assert!(event.composed()); + + // The default behavior not initially prevented, but after + // we call `prevent_default` it better be. + assert!(!event.default_prevented()); + event.prevent_default(); + assert!(event.default_prevented()); + } + "#, + ) + .file( + "test.js", + r#" + import * as assert from "assert"; + import * as wasm from "./out"; + + export async function test() { + await new Promise(resolve => { + window.addEventListener("test-event", e => { + wasm.test_event(e); + resolve(); + }); + + window.dispatchEvent(new Event("test-event", { + bubbles: true, + cancelable: true, + composed: true, + })); + }); + } + "#, + ) + .test(); +} diff --git a/crates/web-sys/tests/all/main.rs b/crates/web-sys/tests/all/main.rs new file mode 100644 index 00000000..577a7f30 --- /dev/null +++ b/crates/web-sys/tests/all/main.rs @@ -0,0 +1,4 @@ +extern crate wasm_bindgen_test_project_builder as project_builder; +use project_builder::project; + +mod event; diff --git a/crates/web-sys/webidls/available/AbortController.webidl b/crates/web-sys/webidls/available/AbortController.webidl new file mode 100644 index 00000000..19a8f8a6 --- /dev/null +++ b/crates/web-sys/webidls/available/AbortController.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#abortcontroller + */ + +[Constructor(), Exposed=(Window,Worker,System)] +interface AbortController { + readonly attribute AbortSignal signal; + + void abort(); +}; diff --git a/crates/web-sys/webidls/available/AbortSignal.webidl b/crates/web-sys/webidls/available/AbortSignal.webidl new file mode 100644 index 00000000..6b66f76c --- /dev/null +++ b/crates/web-sys/webidls/available/AbortSignal.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#abortsignal + */ + +[Exposed=(Window,Worker,System)] +interface AbortSignal : EventTarget { + readonly attribute boolean aborted; + + attribute EventHandler onabort; +}; diff --git a/crates/web-sys/webidls/available/AbstractWorker.webidl b/crates/web-sys/webidls/available/AbstractWorker.webidl new file mode 100644 index 00000000..7ea6e367 --- /dev/null +++ b/crates/web-sys/webidls/available/AbstractWorker.webidl @@ -0,0 +1,10 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[NoInterfaceObject, Exposed=(Window,Worker,System)] +interface AbstractWorker { + attribute EventHandler onerror; +}; diff --git a/crates/web-sys/webidls/available/AnalyserNode.webidl b/crates/web-sys/webidls/available/AnalyserNode.webidl new file mode 100644 index 00000000..73c697f0 --- /dev/null +++ b/crates/web-sys/webidls/available/AnalyserNode.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary AnalyserOptions : AudioNodeOptions { + unsigned long fftSize = 2048; + double maxDecibels = -30; + double minDecibels = -100; + double smoothingTimeConstant = 0.8; +}; + +[Pref="dom.webaudio.enabled", + Constructor(BaseAudioContext context, optional AnalyserOptions options)] +interface AnalyserNode : AudioNode { + + // Real-time frequency-domain data + void getFloatFrequencyData(Float32Array array); + void getByteFrequencyData(Uint8Array array); + + // Real-time waveform data + void getFloatTimeDomainData(Float32Array array); + void getByteTimeDomainData(Uint8Array array); + + [SetterThrows, Pure] + attribute unsigned long fftSize; + [Pure] + readonly attribute unsigned long frequencyBinCount; + + [SetterThrows, Pure] + attribute double minDecibels; + [SetterThrows, Pure] + attribute double maxDecibels; + + [SetterThrows, Pure] + attribute double smoothingTimeConstant; + +}; + +// Mozilla extension +AnalyserNode implements AudioNodePassThrough; diff --git a/crates/web-sys/webidls/available/Animation.webidl b/crates/web-sys/webidls/available/Animation.webidl new file mode 100644 index 00000000..6ef41bad --- /dev/null +++ b/crates/web-sys/webidls/available/Animation.webidl @@ -0,0 +1,55 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#animation + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum AnimationPlayState { "idle", "running", "paused", "finished" }; + +[Func="nsDocument::IsElementAnimateEnabled", + Constructor (optional AnimationEffect? effect = null, + optional AnimationTimeline? timeline)] +interface Animation : EventTarget { + attribute DOMString id; + [Func="nsDocument::IsWebAnimationsEnabled", Pure] + attribute AnimationEffect? effect; + [Func="nsDocument::IsWebAnimationsEnabled"] + attribute AnimationTimeline? timeline; + [BinaryName="startTimeAsDouble"] + attribute double? startTime; + [SetterThrows, BinaryName="currentTimeAsDouble"] + attribute double? currentTime; + + attribute double playbackRate; + [BinaryName="playStateFromJS"] + readonly attribute AnimationPlayState playState; + [BinaryName="pendingFromJS"] + readonly attribute boolean pending; + [Func="nsDocument::IsWebAnimationsEnabled", Throws] + readonly attribute Promise ready; + [Func="nsDocument::IsWebAnimationsEnabled", Throws] + readonly attribute Promise finished; + attribute EventHandler onfinish; + attribute EventHandler oncancel; + void cancel (); + [Throws] + void finish (); + [Throws, BinaryName="playFromJS"] + void play (); + [Throws, BinaryName="pauseFromJS"] + void pause (); + void updatePlaybackRate (double playbackRate); + [Throws] + void reverse (); +}; + +// Non-standard extensions +partial interface Animation { + [ChromeOnly] readonly attribute boolean isRunningOnCompositor; +}; diff --git a/crates/web-sys/webidls/available/AnimationEffect.webidl b/crates/web-sys/webidls/available/AnimationEffect.webidl new file mode 100644 index 00000000..81a04b21 --- /dev/null +++ b/crates/web-sys/webidls/available/AnimationEffect.webidl @@ -0,0 +1,65 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#animationeffectreadonly + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum FillMode { + "none", + "forwards", + "backwards", + "both", + "auto" +}; + +enum PlaybackDirection { + "normal", + "reverse", + "alternate", + "alternate-reverse" +}; + +dictionary EffectTiming { + double delay = 0.0; + double endDelay = 0.0; + FillMode fill = "auto"; + double iterationStart = 0.0; + unrestricted double iterations = 1.0; + (unrestricted double or DOMString) duration = "auto"; + PlaybackDirection direction = "normal"; + DOMString easing = "linear"; +}; + +dictionary OptionalEffectTiming { + double delay; + double endDelay; + FillMode fill; + double iterationStart; + unrestricted double iterations; + (unrestricted double or DOMString) duration; + PlaybackDirection direction; + DOMString easing; +}; + +dictionary ComputedEffectTiming : EffectTiming { + unrestricted double endTime = 0.0; + unrestricted double activeDuration = 0.0; + double? localTime = null; + double? progress = null; + unrestricted double? currentIteration = null; +}; + +[Func="nsDocument::IsWebAnimationsEnabled"] +interface AnimationEffect { + EffectTiming getTiming(); + [BinaryName="getComputedTimingAsDict"] + ComputedEffectTiming getComputedTiming(); + [Throws] + void updateTiming(optional OptionalEffectTiming timing); +}; diff --git a/crates/web-sys/webidls/available/AnimationEvent.webidl b/crates/web-sys/webidls/available/AnimationEvent.webidl new file mode 100644 index 00000000..e48ed571 --- /dev/null +++ b/crates/web-sys/webidls/available/AnimationEvent.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * 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. + */ + +[Constructor(DOMString type, optional AnimationEventInit eventInitDict)] +interface AnimationEvent : Event { + 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/crates/web-sys/webidls/available/AnimationPlaybackEvent.webidl b/crates/web-sys/webidls/available/AnimationPlaybackEvent.webidl new file mode 100644 index 00000000..db8136ea --- /dev/null +++ b/crates/web-sys/webidls/available/AnimationPlaybackEvent.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#animationplaybackevent + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Func="nsDocument::IsWebAnimationsEnabled", + Constructor(DOMString type, + optional AnimationPlaybackEventInit eventInitDict)] +interface AnimationPlaybackEvent : Event { + readonly attribute double? currentTime; + readonly attribute double? timelineTime; +}; + +dictionary AnimationPlaybackEventInit : EventInit { + double? currentTime = null; + double? timelineTime = null; +}; diff --git a/crates/web-sys/webidls/available/AnimationTimeline.webidl b/crates/web-sys/webidls/available/AnimationTimeline.webidl new file mode 100644 index 00000000..70126603 --- /dev/null +++ b/crates/web-sys/webidls/available/AnimationTimeline.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#animationtimeline + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Func="nsDocument::IsWebAnimationsEnabled"] +interface AnimationTimeline { + [BinaryName="currentTimeAsDouble"] + readonly attribute double? currentTime; +}; diff --git a/crates/web-sys/webidls/available/Attr.webidl b/crates/web-sys/webidls/available/Attr.webidl new file mode 100644 index 00000000..921e2df8 --- /dev/null +++ b/crates/web-sys/webidls/available/Attr.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface Attr : Node { + readonly attribute DOMString localName; + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString value; + + [Constant] + readonly attribute DOMString name; + [Constant] + readonly attribute DOMString? namespaceURI; + [Constant] + readonly attribute DOMString? prefix; + + readonly attribute boolean specified; +}; + +// Mozilla extensions + +partial interface Attr { + [GetterThrows] + readonly attribute Element? ownerElement; +}; diff --git a/crates/web-sys/webidls/available/AudioBuffer.webidl b/crates/web-sys/webidls/available/AudioBuffer.webidl new file mode 100644 index 00000000..7006b86e --- /dev/null +++ b/crates/web-sys/webidls/available/AudioBuffer.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary AudioBufferOptions { + unsigned long numberOfChannels = 1; + required unsigned long length; + required float sampleRate; +}; + +[Pref="dom.webaudio.enabled", + Constructor(AudioBufferOptions options)] +interface AudioBuffer { + + readonly attribute float sampleRate; + readonly attribute unsigned long length; + + // in seconds + readonly attribute double duration; + + readonly attribute unsigned long numberOfChannels; + + [Throws] + Float32Array getChannelData(unsigned long channel); + + [Throws] + void copyFromChannel(Float32Array destination, long channelNumber, optional unsigned long startInChannel = 0); + [Throws] + void copyToChannel(Float32Array source, long channelNumber, optional unsigned long startInChannel = 0); +}; diff --git a/crates/web-sys/webidls/available/AudioBufferSourceNode.webidl b/crates/web-sys/webidls/available/AudioBufferSourceNode.webidl new file mode 100644 index 00000000..1c30db3d --- /dev/null +++ b/crates/web-sys/webidls/available/AudioBufferSourceNode.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary AudioBufferSourceOptions { + AudioBuffer? buffer; + float detune = 0; + boolean loop = false; + double loopEnd = 0; + double loopStart = 0; + float playbackRate = 1; +}; + +[Pref="dom.webaudio.enabled", + Constructor(BaseAudioContext context, optional AudioBufferSourceOptions options)] +interface AudioBufferSourceNode : AudioScheduledSourceNode { + + attribute AudioBuffer? buffer; + + readonly attribute AudioParam playbackRate; + readonly attribute AudioParam detune; + + attribute boolean loop; + attribute double loopStart; + attribute double loopEnd; + + [Throws] + void start(optional double when = 0, optional double grainOffset = 0, + optional double grainDuration); +}; + +// Mozilla extensions +AudioBufferSourceNode implements AudioNodePassThrough; diff --git a/crates/web-sys/webidls/available/AudioContext.webidl b/crates/web-sys/webidls/available/AudioContext.webidl new file mode 100644 index 00000000..d115b968 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioContext.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary AudioContextOptions { + float sampleRate = 0; +}; + +[Pref="dom.webaudio.enabled", + Constructor(optional AudioContextOptions contextOptions)] +interface AudioContext : BaseAudioContext { + + // Bug 1324545: readonly attribute double outputLatency; + // Bug 1324545: AudioTimestamp getOutputTimestamp (); + + [Throws] + Promise suspend(); + [Throws] + Promise close(); + + [NewObject, Throws] + MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); + + [NewObject, Throws] + MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); + + // Bug 1324548: MediaStreamTrackAudioSourceNode createMediaStreamTrackSource (AudioMediaStreamTrack mediaStreamTrack); + + [NewObject, Throws] + MediaStreamAudioDestinationNode createMediaStreamDestination(); +}; diff --git a/crates/web-sys/webidls/available/AudioDestinationNode.webidl b/crates/web-sys/webidls/available/AudioDestinationNode.webidl new file mode 100644 index 00000000..e5c6db86 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioDestinationNode.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled"] +interface AudioDestinationNode : AudioNode { + + readonly attribute unsigned long maxChannelCount; + +}; + diff --git a/crates/web-sys/webidls/available/AudioListener.webidl b/crates/web-sys/webidls/available/AudioListener.webidl new file mode 100644 index 00000000..8970e6b9 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioListener.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled"] +interface AudioListener { + + // same as OpenAL (default 1) + [Deprecated="PannerNodeDoppler"] + attribute double dopplerFactor; + + // in meters / second (default 343.3) + [Deprecated="PannerNodeDoppler"] + attribute double speedOfSound; + + // Uses a 3D cartesian coordinate system + void setPosition(double x, double y, double z); + void setOrientation(double x, double y, double z, double xUp, double yUp, double zUp); + [Deprecated="PannerNodeDoppler"] + void setVelocity(double x, double y, double z); + +}; + diff --git a/crates/web-sys/webidls/available/AudioNode.webidl b/crates/web-sys/webidls/available/AudioNode.webidl new file mode 100644 index 00000000..80b33e50 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioNode.webidl @@ -0,0 +1,76 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum ChannelCountMode { + "max", + "clamped-max", + "explicit" +}; + +enum ChannelInterpretation { + "speakers", + "discrete" +}; + +dictionary AudioNodeOptions { + unsigned long channelCount; + ChannelCountMode channelCountMode; + ChannelInterpretation channelInterpretation; +}; + +[Pref="dom.webaudio.enabled"] +interface AudioNode : EventTarget { + + [Throws] + AudioNode connect(AudioNode destination, optional unsigned long output = 0, optional unsigned long input = 0); + [Throws] + void connect(AudioParam destination, optional unsigned long output = 0); + [Throws] + void disconnect(); + [Throws] + void disconnect(unsigned long output); + [Throws] + void disconnect(AudioNode destination); + [Throws] + void disconnect(AudioNode destination, unsigned long output); + [Throws] + void disconnect(AudioNode destination, unsigned long output, unsigned long input); + [Throws] + void disconnect(AudioParam destination); + [Throws] + void disconnect(AudioParam destination, unsigned long output); + + readonly attribute BaseAudioContext context; + readonly attribute unsigned long numberOfInputs; + readonly attribute unsigned long numberOfOutputs; + + // Channel up-mixing and down-mixing rules for all inputs. + [SetterThrows] + attribute unsigned long channelCount; + [SetterThrows] + attribute ChannelCountMode channelCountMode; + [SetterThrows] + attribute ChannelInterpretation channelInterpretation; + +}; + +// Mozilla extension +partial interface AudioNode { + [ChromeOnly] + readonly attribute unsigned long id; +}; +[NoInterfaceObject] +interface AudioNodePassThrough { + [ChromeOnly] + attribute boolean passThrough; +}; + diff --git a/crates/web-sys/webidls/available/AudioParam.webidl b/crates/web-sys/webidls/available/AudioParam.webidl new file mode 100644 index 00000000..7e151b41 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioParam.webidl @@ -0,0 +1,52 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled"] +interface AudioParam { + + attribute float value; + readonly attribute float defaultValue; + readonly attribute float minValue; + readonly attribute float maxValue; + + // Parameter automation. + [Throws] + AudioParam setValueAtTime(float value, double startTime); + [Throws] + AudioParam linearRampToValueAtTime(float value, double endTime); + [Throws] + AudioParam exponentialRampToValueAtTime(float value, double endTime); + + // Exponentially approach the target value with a rate having the given time constant. + [Throws] + AudioParam setTargetAtTime(float target, double startTime, double timeConstant); + + // Sets an array of arbitrary parameter values starting at time for the given duration. + // The number of values will be scaled to fit into the desired duration. + [Throws] + AudioParam setValueCurveAtTime(Float32Array values, double startTime, double duration); + + // Cancels all scheduled parameter changes with times greater than or equal to startTime. + [Throws] + AudioParam cancelScheduledValues(double startTime); + +}; + +// Mozilla extension +partial interface AudioParam { + // The ID of the AudioNode this AudioParam belongs to. + [ChromeOnly] + readonly attribute unsigned long parentNodeId; + // The name of the AudioParam + [ChromeOnly] + readonly attribute DOMString name; +}; diff --git a/crates/web-sys/webidls/available/AudioParamMap.webidl b/crates/web-sys/webidls/available/AudioParamMap.webidl new file mode 100644 index 00000000..9aabd93d --- /dev/null +++ b/crates/web-sys/webidls/available/AudioParamMap.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#audioparammap + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.audioworklet.enabled"] +interface AudioParamMap { + readonly maplike; +}; diff --git a/crates/web-sys/webidls/available/AudioProcessingEvent.webidl b/crates/web-sys/webidls/available/AudioProcessingEvent.webidl new file mode 100644 index 00000000..8cf3d9cc --- /dev/null +++ b/crates/web-sys/webidls/available/AudioProcessingEvent.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled"] +interface AudioProcessingEvent : Event { + + readonly attribute double playbackTime; + + [Throws] + readonly attribute AudioBuffer inputBuffer; + [Throws] + readonly attribute AudioBuffer outputBuffer; + +}; + diff --git a/crates/web-sys/webidls/available/AudioScheduledSourceNode.webidl b/crates/web-sys/webidls/available/AudioScheduledSourceNode.webidl new file mode 100644 index 00000000..2acf6373 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioScheduledSourceNode.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#idl-def-AudioScheduledSourceNode + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface AudioScheduledSourceNode : AudioNode { + attribute EventHandler onended; + [Throws] + void start (optional double when = 0); + + [Throws] + void stop (optional double when = 0); +}; diff --git a/crates/web-sys/webidls/available/AudioStreamTrack.webidl b/crates/web-sys/webidls/available/AudioStreamTrack.webidl new file mode 100644 index 00000000..9fff71ce --- /dev/null +++ b/crates/web-sys/webidls/available/AudioStreamTrack.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/getusermedia.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +// [Constructor(optional MediaTrackConstraints audioConstraints)] +interface AudioStreamTrack : MediaStreamTrack { +// static sequence getSourceIds (); +}; diff --git a/crates/web-sys/webidls/available/AudioTrack.webidl b/crates/web-sys/webidls/available/AudioTrack.webidl new file mode 100644 index 00000000..e70456a3 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioTrack.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#audiotrack + */ + +[Pref="media.track.enabled"] +interface AudioTrack { + readonly attribute DOMString id; + readonly attribute DOMString kind; + readonly attribute DOMString label; + readonly attribute DOMString language; + attribute boolean enabled; +}; diff --git a/crates/web-sys/webidls/available/AudioTrackList.webidl b/crates/web-sys/webidls/available/AudioTrackList.webidl new file mode 100644 index 00000000..2c229a67 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioTrackList.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#audiotracklist + */ + +[Pref="media.track.enabled"] +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/crates/web-sys/webidls/available/AudioWorklet.webidl b/crates/web-sys/webidls/available/AudioWorklet.webidl new file mode 100644 index 00000000..720cd03c --- /dev/null +++ b/crates/web-sys/webidls/available/AudioWorklet.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window, SecureContext, Pref="dom.audioworklet.enabled"] +interface AudioWorklet : Worklet { +}; \ No newline at end of file diff --git a/crates/web-sys/webidls/available/AudioWorkletGlobalScope.webidl b/crates/web-sys/webidls/available/AudioWorkletGlobalScope.webidl new file mode 100644 index 00000000..a2b860e3 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioWorkletGlobalScope.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#audioworkletglobalscope + */ + +[Global=(Worklet,AudioWorklet),Exposed=AudioWorklet] +interface AudioWorkletGlobalScope : WorkletGlobalScope { + void registerProcessor (DOMString name, VoidFunction processorCtor); + readonly attribute unsigned long long currentFrame; + readonly attribute double currentTime; + readonly attribute float sampleRate; +}; diff --git a/crates/web-sys/webidls/available/AudioWorkletNode.webidl b/crates/web-sys/webidls/available/AudioWorkletNode.webidl new file mode 100644 index 00000000..fedb9449 --- /dev/null +++ b/crates/web-sys/webidls/available/AudioWorkletNode.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary AudioWorkletNodeOptions : AudioNodeOptions { + unsigned long numberOfInputs = 1; + unsigned long numberOfOutputs = 1; + sequence outputChannelCount; + record parameterData; + object? processorOptions = null; +}; + +[SecureContext, Pref="dom.audioworklet.enabled", + Constructor (BaseAudioContext context, DOMString name, optional AudioWorkletNodeOptions options)] +interface AudioWorkletNode : AudioNode { + [Throws] + readonly attribute AudioParamMap parameters; + [Throws] + readonly attribute MessagePort port; + attribute EventHandler onprocessorerror; +}; diff --git a/crates/web-sys/webidls/available/AudioWorkletProcessor.webidl b/crates/web-sys/webidls/available/AudioWorkletProcessor.webidl new file mode 100644 index 00000000..01ef6cbc --- /dev/null +++ b/crates/web-sys/webidls/available/AudioWorkletProcessor.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#audioworkletprocessor + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=AudioWorklet, + Constructor (optional AudioWorkletNodeOptions options)] +interface AudioWorkletProcessor { + [Throws] + readonly attribute MessagePort port; +}; diff --git a/crates/web-sys/webidls/available/AutocompleteInfo.webidl b/crates/web-sys/webidls/available/AutocompleteInfo.webidl new file mode 100644 index 00000000..ad32ff6d --- /dev/null +++ b/crates/web-sys/webidls/available/AutocompleteInfo.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * This dictionary is used for the input, textarea and select element's + * getAutocompleteInfo method. + */ + +dictionary AutocompleteInfo { + DOMString section = ""; + DOMString addressType = ""; + DOMString contactType = ""; + DOMString fieldName = ""; +}; diff --git a/crates/web-sys/webidls/available/BarProp.webidl b/crates/web-sys/webidls/available/BarProp.webidl new file mode 100644 index 00000000..871f0793 --- /dev/null +++ b/crates/web-sys/webidls/available/BarProp.webidl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface BarProp +{ + [Throws, NeedsCallerType] + attribute boolean visible; +}; diff --git a/crates/web-sys/webidls/available/BaseAudioContext.webidl b/crates/web-sys/webidls/available/BaseAudioContext.webidl new file mode 100644 index 00000000..e8796bb9 --- /dev/null +++ b/crates/web-sys/webidls/available/BaseAudioContext.webidl @@ -0,0 +1,102 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#idl-def-BaseAudioContext + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +callback DecodeSuccessCallback = void (AudioBuffer decodedData); +callback DecodeErrorCallback = void (DOMException error); + +enum AudioContextState { + "suspended", + "running", + "closed" +}; + +interface BaseAudioContext : EventTarget { + readonly attribute AudioDestinationNode destination; + readonly attribute float sampleRate; + readonly attribute double currentTime; + readonly attribute AudioListener listener; + readonly attribute AudioContextState state; + [Throws, SameObject, SecureContext, Pref="dom.audioworklet.enabled"] + readonly attribute AudioWorklet audioWorklet; + // Bug 1324552: readonly attribute double baseLatency; + + [Throws] + Promise resume(); + + attribute EventHandler onstatechange; + + [NewObject, Throws] + AudioBuffer createBuffer (unsigned long numberOfChannels, + unsigned long length, + float sampleRate); + + [Throws] + Promise decodeAudioData(ArrayBuffer audioData, + optional DecodeSuccessCallback successCallback, + optional DecodeErrorCallback errorCallback); + + // AudioNode creation + [NewObject, Throws] + AudioBufferSourceNode createBufferSource(); + + [NewObject, Throws] + ConstantSourceNode createConstantSource(); + + [NewObject, Throws] + ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, + optional unsigned long numberOfInputChannels = 2, + optional unsigned long numberOfOutputChannels = 2); + + [NewObject, Throws] + AnalyserNode createAnalyser(); + + [NewObject, Throws] + GainNode createGain(); + + [NewObject, Throws] + DelayNode createDelay(optional double maxDelayTime = 1); // TODO: no = 1 + + [NewObject, Throws] + BiquadFilterNode createBiquadFilter(); + + [NewObject, Throws] + IIRFilterNode createIIRFilter(sequence feedforward, sequence feedback); + + [NewObject, Throws] + WaveShaperNode createWaveShaper(); + + [NewObject, Throws] + PannerNode createPanner(); + + [NewObject, Throws] + StereoPannerNode createStereoPanner(); + + [NewObject, Throws] + ConvolverNode createConvolver(); + + [NewObject, Throws] + ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); + + [NewObject, Throws] + ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); + + [NewObject, Throws] + DynamicsCompressorNode createDynamicsCompressor(); + + [NewObject, Throws] + OscillatorNode createOscillator(); + + [NewObject, Throws] + PeriodicWave createPeriodicWave(Float32Array real, + Float32Array imag, + optional PeriodicWaveConstraints constraints); +}; diff --git a/crates/web-sys/webidls/available/BaseKeyframeTypes.webidl b/crates/web-sys/webidls/available/BaseKeyframeTypes.webidl new file mode 100644 index 00000000..2cbfc4ba --- /dev/null +++ b/crates/web-sys/webidls/available/BaseKeyframeTypes.webidl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#the-compositeoperation-enumeration + * https://drafts.csswg.org/web-animations/#dictdef-basepropertyindexedkeyframe + * https://drafts.csswg.org/web-animations/#dictdef-basekeyframe + * https://drafts.csswg.org/web-animations/#dictdef-basecomputedkeyframe + * + * Copyright © 2016 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum CompositeOperation { "replace", "add", "accumulate" }; + +// The following dictionary types are not referred to by other .webidl files, +// but we use it for manual JS->IDL and IDL->JS conversions in KeyframeEffect's +// implementation. + +dictionary BasePropertyIndexedKeyframe { + (double? or sequence) offset = []; + (DOMString or sequence) easing = []; + (CompositeOperation? or sequence) composite = []; +}; + +dictionary BaseKeyframe { + double? offset = null; + DOMString easing = "linear"; + CompositeOperation? composite = null; + + // Non-standard extensions + + // Member to allow testing when StyleAnimationValue::ComputeValues fails. + // + // Note that we currently only apply this to shorthand properties since + // it's easier to annotate shorthand property values and because we have + // only ever observed ComputeValues failing on shorthand values. + // + // Bug 1216844 should remove this member since after that bug is fixed we will + // have a well-defined behavior to use when animation endpoints are not + // available. + [ChromeOnly] boolean simulateComputeValuesFailure = false; +}; + +dictionary BaseComputedKeyframe : BaseKeyframe { + double computedOffset; +}; diff --git a/crates/web-sys/webidls/available/BasicCardPayment.webidl b/crates/web-sys/webidls/available/BasicCardPayment.webidl new file mode 100644 index 00000000..3cd62a43 --- /dev/null +++ b/crates/web-sys/webidls/available/BasicCardPayment.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this WebIDL file is + * https://www.w3.org/TR/payment-request/#paymentrequest-interface + */ +enum BasicCardType { + "credit", + "debit", + "prepaid" +}; + +dictionary BasicCardRequest { + sequence supportedNetworks; + sequence supportedTypes; +}; + +dictionary BasicCardResponse { + DOMString cardholderName; + required DOMString cardNumber; + DOMString expiryMonth; + DOMString expiryYear; + DOMString cardSecurityCode; + PaymentAddress? billingAddress; +}; diff --git a/crates/web-sys/webidls/available/BatteryManager.webidl b/crates/web-sys/webidls/available/BatteryManager.webidl new file mode 100644 index 00000000..a964f3b0 --- /dev/null +++ b/crates/web-sys/webidls/available/BatteryManager.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/battery-status/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface BatteryManager : EventTarget { + readonly attribute boolean charging; + readonly attribute unrestricted double chargingTime; + readonly attribute unrestricted double dischargingTime; + readonly attribute double level; + + attribute EventHandler onchargingchange; + attribute EventHandler onchargingtimechange; + attribute EventHandler ondischargingtimechange; + attribute EventHandler onlevelchange; +}; diff --git a/crates/web-sys/webidls/available/BeforeUnloadEvent.webidl b/crates/web-sys/webidls/available/BeforeUnloadEvent.webidl new file mode 100644 index 00000000..e64e1b2c --- /dev/null +++ b/crates/web-sys/webidls/available/BeforeUnloadEvent.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * http://www.whatwg.org/specs/web-apps/current-work/#beforeunloadevent + */ + +interface BeforeUnloadEvent : Event { + attribute DOMString returnValue; +}; diff --git a/crates/web-sys/webidls/available/BiquadFilterNode.webidl b/crates/web-sys/webidls/available/BiquadFilterNode.webidl new file mode 100644 index 00000000..c9ac0f0b --- /dev/null +++ b/crates/web-sys/webidls/available/BiquadFilterNode.webidl @@ -0,0 +1,50 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +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; +}; + +[Pref="dom.webaudio.enabled", + Constructor(BaseAudioContext context, optional BiquadFilterOptions options)] +interface BiquadFilterNode : AudioNode { + + attribute BiquadFilterType type; + readonly attribute AudioParam frequency; // in Hertz + readonly attribute AudioParam detune; // in Cents + readonly attribute AudioParam Q; // Quality factor + readonly attribute AudioParam gain; // in Decibels + + void getFrequencyResponse(Float32Array frequencyHz, + Float32Array magResponse, + Float32Array phaseResponse); + +}; + +// Mozilla extension +BiquadFilterNode implements AudioNodePassThrough; + diff --git a/crates/web-sys/webidls/available/Blob.webidl b/crates/web-sys/webidls/available/Blob.webidl new file mode 100644 index 00000000..94812cd8 --- /dev/null +++ b/crates/web-sys/webidls/available/Blob.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/FileAPI/#blob + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +typedef (BufferSource or Blob or USVString) BlobPart; + +[Constructor(optional sequence blobParts, + optional BlobPropertyBag options), + Exposed=(Window,Worker)] +interface Blob { + + [GetterThrows] + readonly attribute unsigned long long size; + + readonly attribute DOMString type; + + //slice Blob into byte-ranged chunks + + [Throws] + Blob slice([Clamp] optional long long start, + [Clamp] optional long long end, + optional DOMString contentType); +}; + +enum EndingTypes { "transparent", "native" }; + +dictionary BlobPropertyBag { + DOMString type = ""; + EndingTypes endings = "transparent"; +}; diff --git a/crates/web-sys/webidls/available/BlobEvent.webidl b/crates/web-sys/webidls/available/BlobEvent.webidl new file mode 100644 index 00000000..8d041870 --- /dev/null +++ b/crates/web-sys/webidls/available/BlobEvent.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Constructor(DOMString type, optional BlobEventInit eventInitDict)] +interface BlobEvent : Event +{ + readonly attribute Blob? data; +}; + +dictionary BlobEventInit : EventInit +{ + Blob? data = null; +}; diff --git a/crates/web-sys/webidls/available/BoxObject.webidl b/crates/web-sys/webidls/available/BoxObject.webidl new file mode 100644 index 00000000..8bebd6c9 --- /dev/null +++ b/crates/web-sys/webidls/available/BoxObject.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Func="IsChromeOrXBL"] +interface BoxObject { + readonly attribute Element? element; + + readonly attribute long x; + readonly attribute long y; + [Throws] + readonly attribute long screenX; + [Throws] + readonly attribute long screenY; + readonly attribute long width; + readonly attribute long height; + + nsISupports? getPropertyAsSupports(DOMString propertyName); + void setPropertyAsSupports(DOMString propertyName, nsISupports value); + [Throws] + DOMString? getProperty(DOMString propertyName); + void setProperty(DOMString propertyName, DOMString propertyValue); + void removeProperty(DOMString propertyName); + + // for stepping through content in the expanded dom with box-ordinal-group order + readonly attribute Element? parentBox; + readonly attribute Element? firstChild; + readonly attribute Element? lastChild; + readonly attribute Element? nextSibling; + readonly attribute Element? previousSibling; +}; diff --git a/crates/web-sys/webidls/available/BroadcastChannel.webidl b/crates/web-sys/webidls/available/BroadcastChannel.webidl new file mode 100644 index 00000000..fb0b639f --- /dev/null +++ b/crates/web-sys/webidls/available/BroadcastChannel.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://html.spec.whatwg.org/#broadcastchannel + */ + +[Constructor(DOMString channel), + Exposed=(Window,Worker)] +interface BroadcastChannel : EventTarget { + readonly attribute DOMString name; + + [Throws] + void postMessage(any message); + + void close(); + + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; diff --git a/crates/web-sys/webidls/available/BrowserElement.webidl b/crates/web-sys/webidls/available/BrowserElement.webidl new file mode 100644 index 00000000..8a683d94 --- /dev/null +++ b/crates/web-sys/webidls/available/BrowserElement.webidl @@ -0,0 +1,153 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +callback BrowserElementNextPaintEventCallback = void (); + +enum BrowserFindCaseSensitivity { "case-sensitive", "case-insensitive" }; +enum BrowserFindDirection { "forward", "backward" }; + +dictionary BrowserElementDownloadOptions { + DOMString? filename; + DOMString? referrer; +}; + +dictionary BrowserElementExecuteScriptOptions { + DOMString? url; + DOMString? origin; +}; + +[NoInterfaceObject] +interface BrowserElement { +}; + +BrowserElement implements BrowserElementCommon; +BrowserElement implements BrowserElementPrivileged; + +[NoInterfaceObject] +interface BrowserElementCommon { + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void addNextPaintListener(BrowserElementNextPaintEventCallback listener); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void removeNextPaintListener(BrowserElementNextPaintEventCallback listener); +}; + +[NoInterfaceObject] +interface BrowserElementPrivileged { + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void sendMouseEvent(DOMString type, + unsigned long x, + unsigned long y, + unsigned long button, + unsigned long clickCount, + unsigned long modifiers); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + Func="TouchEvent::PrefEnabled", + ChromeOnly] + void sendTouchEvent(DOMString type, + sequence identifiers, + sequence x, + sequence y, + sequence rx, + sequence ry, + sequence rotationAngles, + sequence forces, + unsigned long count, + unsigned long modifiers); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void goBack(); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void goForward(); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void reload(optional boolean hardReload = false); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void stop(); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + DOMRequest download(DOMString url, + optional BrowserElementDownloadOptions options); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + DOMRequest purgeHistory(); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + DOMRequest getScreenshot([EnforceRange] unsigned long width, + [EnforceRange] unsigned long height, + optional DOMString mimeType=""); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void zoom(float zoom); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + DOMRequest getCanGoBack(); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + DOMRequest getCanGoForward(); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + DOMRequest getContentDimensions(); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void findAll(DOMString searchString, BrowserFindCaseSensitivity caseSensitivity); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void findNext(BrowserFindDirection direction); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + void clearMatch(); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + DOMRequest executeScript(DOMString script, + optional BrowserElementExecuteScriptOptions options); + + [Throws, + Pref="dom.mozBrowserFramesEnabled", + ChromeOnly] + DOMRequest getWebManifest(); + +}; diff --git a/crates/web-sys/webidls/available/BrowserElementDictionaries.webidl b/crates/web-sys/webidls/available/BrowserElementDictionaries.webidl new file mode 100644 index 00000000..400e4025 --- /dev/null +++ b/crates/web-sys/webidls/available/BrowserElementDictionaries.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary OpenWindowEventDetail { + DOMString url = ""; + DOMString name = ""; + DOMString features = ""; + Node? frameElement = null; +}; + +dictionary DOMWindowResizeEventDetail { + long width = 0; + long height = 0; +}; diff --git a/crates/web-sys/webidls/available/BrowserFeedWriter.webidl b/crates/web-sys/webidls/available/BrowserFeedWriter.webidl new file mode 100644 index 00000000..d756a883 --- /dev/null +++ b/crates/web-sys/webidls/available/BrowserFeedWriter.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[JSImplementation="@mozilla.org/browser/feeds/result-writer;1", + Func="mozilla::FeedWriterEnabled::IsEnabled", + Constructor] +interface BrowserFeedWriter { + /** + * Writes the feed content, assumes that the feed writer is initialized. + */ + void writeContent(); + + /** + * Uninitialize the feed writer. + */ + void close(); +}; diff --git a/crates/web-sys/webidls/available/CDATASection.webidl b/crates/web-sys/webidls/available/CDATASection.webidl new file mode 100644 index 00000000..895dae08 --- /dev/null +++ b/crates/web-sys/webidls/available/CDATASection.webidl @@ -0,0 +1,8 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface CDATASection : Text { +}; diff --git a/crates/web-sys/webidls/available/CSPDictionaries.webidl b/crates/web-sys/webidls/available/CSPDictionaries.webidl new file mode 100644 index 00000000..f8de1c9a --- /dev/null +++ b/crates/web-sys/webidls/available/CSPDictionaries.webidl @@ -0,0 +1,38 @@ +/* This Source Code Form is subject to the terms of 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/. */ + +/** + * Dictionary used to display CSP info. + */ + +dictionary CSP { + boolean report-only = false; + + sequence default-src; + sequence script-src; + sequence object-src; + sequence style-src; + sequence img-src; + sequence media-src; + sequence frame-src; + sequence font-src; + sequence connect-src; + sequence report-uri; + sequence frame-ancestors; + // sequence reflected-xss; // not supported in Firefox + sequence base-uri; + sequence form-action; + sequence referrer; + sequence manifest-src; + sequence upgrade-insecure-requests; + sequence child-src; + sequence block-all-mixed-content; + sequence require-sri-for; + sequence sandbox; + sequence worker-src; +}; + +dictionary CSPPolicies { + sequence csp-policies; +}; diff --git a/crates/web-sys/webidls/available/CSPReport.webidl b/crates/web-sys/webidls/available/CSPReport.webidl new file mode 100644 index 00000000..301ca288 --- /dev/null +++ b/crates/web-sys/webidls/available/CSPReport.webidl @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of 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/. */ + +/** + * This dictionary holds the parameters used to send + * CSP reports in JSON format. + */ + +dictionary CSPReportProperties { + DOMString document-uri = ""; + DOMString referrer = ""; + DOMString blocked-uri = ""; + DOMString violated-directive = ""; + DOMString original-policy= ""; + DOMString source-file; + DOMString script-sample; + long line-number; + long column-number; +}; + +dictionary CSPReport { + CSPReportProperties csp-report; +}; diff --git a/crates/web-sys/webidls/available/CSS.webidl b/crates/web-sys/webidls/available/CSS.webidl new file mode 100644 index 00000000..ad3f9a42 --- /dev/null +++ b/crates/web-sys/webidls/available/CSS.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css3-conditional/ + * http://dev.w3.org/csswg/cssom/#the-css.escape%28%29-method + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +namespace CSS { + [Throws] + boolean supports(DOMString property, DOMString value); + + [Throws] + boolean supports(DOMString conditionText); +}; + +// http://dev.w3.org/csswg/cssom/#the-css.escape%28%29-method +partial namespace CSS { + DOMString escape(DOMString ident); +}; diff --git a/crates/web-sys/webidls/available/CSSAnimation.webidl b/crates/web-sys/webidls/available/CSSAnimation.webidl new file mode 100644 index 00000000..8799bfad --- /dev/null +++ b/crates/web-sys/webidls/available/CSSAnimation.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-animations-2/#the-CSSAnimation-interface + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Func="nsDocument::IsWebAnimationsEnabled", + HeaderFile="nsAnimationManager.h"] +interface CSSAnimation : Animation { + [Constant] readonly attribute DOMString animationName; +}; diff --git a/crates/web-sys/webidls/available/CSSConditionRule.webidl b/crates/web-sys/webidls/available/CSSConditionRule.webidl new file mode 100644 index 00000000..24fae234 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSConditionRule.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface + */ + +// https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface +interface CSSConditionRule : CSSGroupingRule { + [SetterThrows] + attribute DOMString conditionText; +}; diff --git a/crates/web-sys/webidls/available/CSSCounterStyleRule.webidl b/crates/web-sys/webidls/available/CSSCounterStyleRule.webidl new file mode 100644 index 00000000..bb6f7e0e --- /dev/null +++ b/crates/web-sys/webidls/available/CSSCounterStyleRule.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-counter-styles-3/#the-csscounterstylerule-interface + */ + +// https://drafts.csswg.org/css-counter-styles-3/#the-csscounterstylerule-interface +interface CSSCounterStyleRule : CSSRule { + attribute DOMString name; + attribute DOMString system; + attribute DOMString symbols; + attribute DOMString additiveSymbols; + attribute DOMString negative; + attribute DOMString prefix; + attribute DOMString suffix; + attribute DOMString range; + attribute DOMString pad; + attribute DOMString speakAs; + attribute DOMString fallback; +}; diff --git a/crates/web-sys/webidls/available/CSSFontFaceRule.webidl b/crates/web-sys/webidls/available/CSSFontFaceRule.webidl new file mode 100644 index 00000000..221dd26a --- /dev/null +++ b/crates/web-sys/webidls/available/CSSFontFaceRule.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-fonts/#om-fontface + */ + +// https://drafts.csswg.org/css-fonts/#om-fontface +// But we implement a very old draft, apparently.... +// See bug 1058408 for implementing the current spec. +interface CSSFontFaceRule : CSSRule { + [SameObject] readonly attribute CSSStyleDeclaration style; +}; diff --git a/crates/web-sys/webidls/available/CSSFontFeatureValuesRule.webidl b/crates/web-sys/webidls/available/CSSFontFeatureValuesRule.webidl new file mode 100644 index 00000000..75329381 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSFontFeatureValuesRule.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-fonts/#om-fontfeaturevalues + */ + +// https://drafts.csswg.org/css-fonts/#om-fontfeaturevalues +// but we don't implement anything remotely resembling the spec. +interface CSSFontFeatureValuesRule : CSSRule { + [SetterThrows] + attribute DOMString fontFamily; + + // Not yet implemented + // readonly attribute CSSFontFeatureValuesMap annotation; + // readonly attribute CSSFontFeatureValuesMap ornaments; + // readonly attribute CSSFontFeatureValuesMap stylistic; + // readonly attribute CSSFontFeatureValuesMap swash; + // readonly attribute CSSFontFeatureValuesMap characterVariant; + // readonly attribute CSSFontFeatureValuesMap styleset; +}; + +partial interface CSSFontFeatureValuesRule { + // Gecko addition? + [SetterThrows] + attribute DOMString valueText; +}; diff --git a/crates/web-sys/webidls/available/CSSGroupingRule.webidl b/crates/web-sys/webidls/available/CSSGroupingRule.webidl new file mode 100644 index 00000000..93a221fb --- /dev/null +++ b/crates/web-sys/webidls/available/CSSGroupingRule.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#cssgroupingrule + */ + +// https://drafts.csswg.org/cssom/#cssgroupingrule +interface CSSGroupingRule : CSSRule { + [SameObject] readonly attribute CSSRuleList cssRules; + [Throws] + unsigned long insertRule(DOMString rule, optional unsigned long index = 0); + [Throws] + void deleteRule(unsigned long index); +}; diff --git a/crates/web-sys/webidls/available/CSSImportRule.webidl b/crates/web-sys/webidls/available/CSSImportRule.webidl new file mode 100644 index 00000000..fccb9714 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSImportRule.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#cssimportrule + */ + +// https://drafts.csswg.org/cssom/#cssimportrule +interface CSSImportRule : CSSRule { + readonly attribute DOMString href; + // Per spec, the .media is never null, but in our implementation it can + // be since stylesheet can be null, and in Stylo, media is derived from + // the stylesheet. See . + [SameObject, PutForwards=mediaText] readonly attribute MediaList? media; + // Per spec, the .styleSheet is never null, but in our implementation it can + // be. See . + [SameObject] readonly attribute CSSStyleSheet? styleSheet; +}; diff --git a/crates/web-sys/webidls/available/CSSKeyframeRule.webidl b/crates/web-sys/webidls/available/CSSKeyframeRule.webidl new file mode 100644 index 00000000..25d8965f --- /dev/null +++ b/crates/web-sys/webidls/available/CSSKeyframeRule.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-animations/#interface-csskeyframerule + */ + +// https://drafts.csswg.org/css-animations/#interface-csskeyframerule +interface CSSKeyframeRule : CSSRule { + attribute DOMString keyText; + readonly attribute CSSStyleDeclaration style; +}; diff --git a/crates/web-sys/webidls/available/CSSKeyframesRule.webidl b/crates/web-sys/webidls/available/CSSKeyframesRule.webidl new file mode 100644 index 00000000..d0ea978d --- /dev/null +++ b/crates/web-sys/webidls/available/CSSKeyframesRule.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-animations/#interface-csskeyframesrule + */ + +// https://drafts.csswg.org/css-animations/#interface-csskeyframesrule +interface CSSKeyframesRule : CSSRule { + attribute DOMString name; + readonly attribute CSSRuleList cssRules; + + void appendRule(DOMString rule); + void deleteRule(DOMString select); + CSSKeyframeRule? findRule(DOMString select); +}; diff --git a/crates/web-sys/webidls/available/CSSMediaRule.webidl b/crates/web-sys/webidls/available/CSSMediaRule.webidl new file mode 100644 index 00000000..841a1b6f --- /dev/null +++ b/crates/web-sys/webidls/available/CSSMediaRule.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#the-cssmediarule-interface + * https://drafts.csswg.org/css-conditional/#the-cssmediarule-interface + */ + +// https://drafts.csswg.org/cssom/#the-cssmediarule-interface and +// https://drafts.csswg.org/css-conditional/#the-cssmediarule-interface +// except they disagree with each other. We're taking the inheritance from +// css-conditional and the PutForwards behavior from cssom. +interface CSSMediaRule : CSSConditionRule { + [SameObject, PutForwards=mediaText] readonly attribute MediaList media; +}; diff --git a/crates/web-sys/webidls/available/CSSMozDocumentRule.webidl b/crates/web-sys/webidls/available/CSSMozDocumentRule.webidl new file mode 100644 index 00000000..27a22d52 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSMozDocumentRule.webidl @@ -0,0 +1,10 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// This is a non-standard interface for @-moz-document rules +interface CSSMozDocumentRule : CSSConditionRule { + // XXX Add access to the URL list. +}; diff --git a/crates/web-sys/webidls/available/CSSNamespaceRule.webidl b/crates/web-sys/webidls/available/CSSNamespaceRule.webidl new file mode 100644 index 00000000..63f93017 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSNamespaceRule.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#cssnamespacerule + */ + +// https://drafts.csswg.org/cssom/#cssnamespacerule +interface CSSNamespaceRule : CSSRule { + readonly attribute DOMString namespaceURI; + readonly attribute DOMString prefix; +}; diff --git a/crates/web-sys/webidls/available/CSSPageRule.webidl b/crates/web-sys/webidls/available/CSSPageRule.webidl new file mode 100644 index 00000000..93e47ef0 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSPageRule.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#the-csspagerule-interface + */ + +// https://drafts.csswg.org/cssom/#the-csspagerule-interface +// Per spec, this should inherit from CSSGroupingRule, but we don't +// implement this yet. +interface CSSPageRule : CSSRule { + // selectorText not implemented yet + // attribute DOMString selectorText; + [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; +}; diff --git a/crates/web-sys/webidls/available/CSSPseudoElement.webidl b/crates/web-sys/webidls/available/CSSPseudoElement.webidl new file mode 100644 index 00000000..6d33baf0 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSPseudoElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-pseudo/#CSSPseudoElement-interface + * https://drafts.csswg.org/cssom/#pseudoelement + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +// Both CSSOM and CSS Pseudo-Elements 4 provide contradictory definitions for +// this interface. +// What we implement here is a minimal subset of the two definitions which we +// ship behind a pref until the specification issues have been resolved. +[Func="nsDocument::IsWebAnimationsEnabled"] +interface CSSPseudoElement { + readonly attribute DOMString type; + readonly attribute Element parentElement; +}; + +// https://drafts.csswg.org/web-animations/#extensions-to-the-pseudoelement-interface +CSSPseudoElement implements Animatable; diff --git a/crates/web-sys/webidls/available/CSSRule.webidl b/crates/web-sys/webidls/available/CSSRule.webidl new file mode 100644 index 00000000..a8259303 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSRule.webidl @@ -0,0 +1,58 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#the-cssrule-interface + * https://drafts.csswg.org/css-animations/#interface-cssrule + * https://drafts.csswg.org/css-counter-styles-3/#extentions-to-cssrule-interface + * https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface + * https://drafts.csswg.org/css-fonts-3/#om-fontfeaturevalues + */ + +// https://drafts.csswg.org/cssom/#the-cssrule-interface +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; + // FIXME: We don't support MARGIN_RULE yet. + // XXXbz Should we expose the constant anyway? + // 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 +partial interface CSSRule { + const unsigned short KEYFRAMES_RULE = 7; + const unsigned short KEYFRAME_RULE = 8; +}; + +// https://drafts.csswg.org/css-counter-styles-3/#extentions-to-cssrule-interface +partial interface CSSRule { + const unsigned short COUNTER_STYLE_RULE = 11; +}; + +// https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface +partial interface CSSRule { + const unsigned short SUPPORTS_RULE = 12; +}; + +// Non-standard extension for @-moz-document rules. +partial interface CSSRule { + [ChromeOnly] + const unsigned short DOCUMENT_RULE = 13; +}; + +// https://drafts.csswg.org/css-fonts-3/#om-fontfeaturevalues +partial interface CSSRule { + const unsigned short FONT_FEATURE_VALUES_RULE = 14; +}; diff --git a/crates/web-sys/webidls/available/CSSRuleList.webidl b/crates/web-sys/webidls/available/CSSRuleList.webidl new file mode 100644 index 00000000..c4faec14 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSRuleList.webidl @@ -0,0 +1,10 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface CSSRuleList { + readonly attribute unsigned long length; + getter CSSRule? item(unsigned long index); +}; diff --git a/crates/web-sys/webidls/available/CSSStyleDeclaration.webidl b/crates/web-sys/webidls/available/CSSStyleDeclaration.webidl new file mode 100644 index 00000000..050edbd9 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSStyleDeclaration.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/cssom/ + */ + + // Because of getComputedStyle, many CSSStyleDeclaration objects can be + // short-living. +[ProbablyShortLivingWrapper] +interface CSSStyleDeclaration { + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString cssText; + + readonly attribute unsigned long length; + getter DOMString item(unsigned long index); + + [Throws, ChromeOnly] + sequence getCSSImageURLs(DOMString property); + + [Throws] + DOMString getPropertyValue(DOMString property); + DOMString getPropertyPriority(DOMString property); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = ""); + [CEReactions, Throws] + DOMString removeProperty(DOMString property); + + readonly attribute CSSRule? parentRule; +}; diff --git a/crates/web-sys/webidls/available/CSSStyleRule.webidl b/crates/web-sys/webidls/available/CSSStyleRule.webidl new file mode 100644 index 00000000..571bd6a5 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSStyleRule.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#the-cssstylerule-interface + */ + +// https://drafts.csswg.org/cssom/#the-cssstylerule-interface +interface CSSStyleRule : CSSRule { + attribute DOMString selectorText; + [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; +}; diff --git a/crates/web-sys/webidls/available/CSSStyleSheet.webidl b/crates/web-sys/webidls/available/CSSStyleSheet.webidl new file mode 100644 index 00000000..4c5f1977 --- /dev/null +++ b/crates/web-sys/webidls/available/CSSStyleSheet.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/cssom/ + */ + +enum CSSStyleSheetParsingMode { + "author", + "user", + "agent" +}; + +interface CSSStyleSheet : StyleSheet { + [Pure] + readonly attribute CSSRule? ownerRule; + [Throws, NeedsSubjectPrincipal] + readonly attribute CSSRuleList cssRules; + [ChromeOnly, BinaryName="parsingModeDOM"] + readonly attribute CSSStyleSheetParsingMode parsingMode; + [Throws, NeedsSubjectPrincipal] + unsigned long insertRule(DOMString rule, optional unsigned long index = 0); + [Throws, NeedsSubjectPrincipal] + void deleteRule(unsigned long index); +}; diff --git a/crates/web-sys/webidls/available/CSSSupportsRule.webidl b/crates/web-sys/webidls/available/CSSSupportsRule.webidl new file mode 100644 index 00000000..0576e90e --- /dev/null +++ b/crates/web-sys/webidls/available/CSSSupportsRule.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-conditional/#the-csssupportsrule-interface + */ + +// https://drafts.csswg.org/css-conditional/#the-csssupportsrule-interface +interface CSSSupportsRule : CSSConditionRule { +}; diff --git a/crates/web-sys/webidls/available/CSSTransition.webidl b/crates/web-sys/webidls/available/CSSTransition.webidl new file mode 100644 index 00000000..44ffb79f --- /dev/null +++ b/crates/web-sys/webidls/available/CSSTransition.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-transitions-2/#the-CSSTransition-interface + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Func="nsDocument::IsWebAnimationsEnabled", + HeaderFile="nsTransitionManager.h"] +interface CSSTransition : Animation { + [Constant] readonly attribute DOMString transitionProperty; +}; diff --git a/crates/web-sys/webidls/available/Cache.webidl b/crates/web-sys/webidls/available/Cache.webidl new file mode 100644 index 00000000..3df0ba31 --- /dev/null +++ b/crates/web-sys/webidls/available/Cache.webidl @@ -0,0 +1,44 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * + */ + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache + +[Exposed=(Window,Worker), + Func="mozilla::dom::DOMPrefs::DOMCachesEnabled"] +interface Cache { + [NewObject] + Promise match(RequestInfo request, optional CacheQueryOptions options); + [NewObject] + Promise> matchAll(optional RequestInfo request, optional CacheQueryOptions options); + [NewObject, NeedsCallerType] + Promise add(RequestInfo request); + [NewObject, NeedsCallerType] + Promise addAll(sequence requests); + [NewObject] + Promise put(RequestInfo request, Response response); + [NewObject] + Promise delete(RequestInfo request, optional CacheQueryOptions options); + [NewObject] + Promise> keys(optional RequestInfo request, optional CacheQueryOptions options); +}; + +dictionary CacheQueryOptions { + boolean ignoreSearch = false; + boolean ignoreMethod = false; + boolean ignoreVary = false; + DOMString cacheName; +}; + +dictionary CacheBatchOperation { + DOMString type; + Request request; + Response response; + CacheQueryOptions options; +}; diff --git a/crates/web-sys/webidls/available/CacheStorage.webidl b/crates/web-sys/webidls/available/CacheStorage.webidl new file mode 100644 index 00000000..135006c2 --- /dev/null +++ b/crates/web-sys/webidls/available/CacheStorage.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * + */ + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache-storage + +interface Principal; + +[Exposed=(Window,Worker), + ChromeConstructor(CacheStorageNamespace namespace, Principal principal), + Func="mozilla::dom::DOMPrefs::DOMCachesEnabled"] +interface CacheStorage { + [NewObject] + Promise match(RequestInfo request, optional CacheQueryOptions options); + [NewObject] + Promise has(DOMString cacheName); + [NewObject] + Promise open(DOMString cacheName); + [NewObject] + Promise delete(DOMString cacheName); + [NewObject] + Promise> keys(); +}; + +// chrome-only, gecko specific extension +enum CacheStorageNamespace { + "content", "chrome" +}; diff --git a/crates/web-sys/webidls/available/CanvasCaptureMediaStream.webidl b/crates/web-sys/webidls/available/CanvasCaptureMediaStream.webidl new file mode 100644 index 00000000..98b1adbf --- /dev/null +++ b/crates/web-sys/webidls/available/CanvasCaptureMediaStream.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/mediacapture-fromelement/index.html + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Pref="canvas.capturestream.enabled"] +interface CanvasCaptureMediaStream : MediaStream { + readonly attribute HTMLCanvasElement canvas; + void requestFrame(); +}; diff --git a/crates/web-sys/webidls/available/CanvasRenderingContext2D.webidl b/crates/web-sys/webidls/available/CanvasRenderingContext2D.webidl new file mode 100644 index 00000000..13f61d4f --- /dev/null +++ b/crates/web-sys/webidls/available/CanvasRenderingContext2D.webidl @@ -0,0 +1,400 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/ + * + * © 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. + */ + +enum CanvasWindingRule { "nonzero", "evenodd" }; + +dictionary ContextAttributes2D { + // whether or not we're planning to do a lot of readback operations + boolean willReadFrequently = false; + // signal if the canvas contains an alpha channel + boolean alpha = true; +}; + +dictionary HitRegionOptions { + Path2D? path = null; + DOMString id = ""; + Element? control = null; +}; + +typedef (HTMLImageElement or + SVGImageElement) HTMLOrSVGImageElement; + +typedef (HTMLOrSVGImageElement or + HTMLCanvasElement or + HTMLVideoElement or + ImageBitmap) CanvasImageSource; + +interface CanvasRenderingContext2D { + + // back-reference to the canvas. Might be null if we're not + // associated with a canvas. + readonly attribute HTMLCanvasElement? canvas; + + // Mozilla-specific stuff + // FIXME Bug 768048 mozCurrentTransform/mozCurrentTransformInverse should return a WebIDL array. + [Throws] + attribute object mozCurrentTransform; // [ m11, m12, m21, m22, dx, dy ], i.e. row major + [Throws] + attribute object mozCurrentTransformInverse; + + [SetterThrows] + attribute DOMString mozTextStyle; + + // image smoothing mode -- if disabled, images won't be smoothed + // if scaled. + [Deprecated="PrefixedImageSmoothingEnabled"] + attribute boolean mozImageSmoothingEnabled; + + // Show the caret if appropriate when drawing + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_DRAW_CARET = 0x01; + // Don't flush pending layout notifications that could otherwise + // be batched up + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_DO_NOT_FLUSH = 0x02; + // Draw scrollbars and scroll the viewport if they are present + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_DRAW_VIEW = 0x04; + // Use the widget layer manager if available. This means hardware + // acceleration may be used, but it might actually be slower or + // lower quality than normal. It will however more accurately reflect + // the pixels rendered to the screen. + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_USE_WIDGET_LAYERS = 0x08; + // Don't synchronously decode images - draw what we have + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_ASYNC_DECODE_IMAGES = 0x10; + + /** + * Renders a region of a window into the canvas. The contents of + * the window's viewport are rendered, ignoring viewport clipping + * and scrolling. + * + * @param x + * @param y + * @param w + * @param h specify the area of the window to render, in CSS + * pixels. + * + * @param backgroundColor the canvas is filled with this color + * before we render the window into it. This color may be + * transparent/translucent. It is given as a CSS color string + * (e.g., rgb() or rgba()). + * + * @param flags Used to better control the drawWindow call. + * Flags can be ORed together. + * + * Of course, the rendering obeys the current scale, transform and + * globalAlpha values. + * + * Hints: + * -- If 'rgba(0,0,0,0)' is used for the background color, the + * drawing will be transparent wherever the window is transparent. + * -- Top-level browsed documents are usually not transparent + * because the user's background-color preference is applied, + * but IFRAMEs are transparent if the page doesn't set a background. + * -- If an opaque color is used for the background color, rendering + * will be faster because we won't have to compute the window's + * transparency. + * + * This API cannot currently be used by Web content. It is chrome + * and Web Extensions (with a permission) only. + */ + [Throws, Func="CanvasUtils::HasDrawWindowPrivilege"] + void drawWindow(Window window, double x, double y, double w, double h, + DOMString bgColor, optional unsigned long flags = 0); + + /** + * This causes a context that is currently using a hardware-accelerated + * backend to fallback to a software one. All state should be preserved. + */ + [ChromeOnly] + void demote(); +}; + +CanvasRenderingContext2D implements CanvasState; +CanvasRenderingContext2D implements CanvasTransform; +CanvasRenderingContext2D implements CanvasCompositing; +CanvasRenderingContext2D implements CanvasImageSmoothing; +CanvasRenderingContext2D implements CanvasFillStrokeStyles; +CanvasRenderingContext2D implements CanvasShadowStyles; +CanvasRenderingContext2D implements CanvasFilters; +CanvasRenderingContext2D implements CanvasRect; +CanvasRenderingContext2D implements CanvasDrawPath; +CanvasRenderingContext2D implements CanvasUserInterface; +CanvasRenderingContext2D implements CanvasText; +CanvasRenderingContext2D implements CanvasDrawImage; +CanvasRenderingContext2D implements CanvasImageData; +CanvasRenderingContext2D implements CanvasPathDrawingStyles; +CanvasRenderingContext2D implements CanvasTextDrawingStyles; +CanvasRenderingContext2D implements CanvasPathMethods; +CanvasRenderingContext2D implements CanvasHitRegions; + + +[NoInterfaceObject] +interface CanvasState { + // state + void save(); // push state on state stack + void restore(); // pop state stack and restore state +}; + +[NoInterfaceObject] +interface CanvasTransform { + // transformations (default transform is the identity matrix) +// NOT IMPLEMENTED attribute SVGMatrix currentTransform; + [Throws, LenientFloat] + void scale(double x, double y); + [Throws, LenientFloat] + void rotate(double angle); + [Throws, LenientFloat] + void translate(double x, double y); + [Throws, LenientFloat] + void transform(double a, double b, double c, double d, double e, double f); + [Throws, LenientFloat] + void setTransform(double a, double b, double c, double d, double e, double f); + [Throws] + void resetTransform(); +}; + +[NoInterfaceObject] +interface CanvasCompositing { + attribute unrestricted double globalAlpha; // (default 1.0) + [Throws] + attribute DOMString globalCompositeOperation; // (default source-over) +}; + +[NoInterfaceObject] +interface CanvasImageSmoothing { + // drawing images + attribute boolean imageSmoothingEnabled; +}; + +[NoInterfaceObject] +interface CanvasFillStrokeStyles { + // colors and styles (see also the CanvasPathDrawingStyles interface) + attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black) + attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black) + [NewObject] + CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1); + [NewObject, Throws] + CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1); + [NewObject, Throws] + CanvasPattern? createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition); +}; + +[NoInterfaceObject] +interface CanvasShadowStyles { + [LenientFloat] + attribute double shadowOffsetX; // (default 0) + [LenientFloat] + attribute double shadowOffsetY; // (default 0) + [LenientFloat] + attribute double shadowBlur; // (default 0) + attribute DOMString shadowColor; // (default transparent black) +}; + +[NoInterfaceObject] +interface CanvasFilters { + [Pref="canvas.filters.enabled", SetterThrows] + attribute DOMString filter; // (default empty string = no filter) +}; + +[NoInterfaceObject] +interface CanvasRect { + [LenientFloat] + void clearRect(double x, double y, double w, double h); + [LenientFloat] + void fillRect(double x, double y, double w, double h); + [LenientFloat] + void strokeRect(double x, double y, double w, double h); +}; + +[NoInterfaceObject] +interface CanvasDrawPath { + // path API (see also CanvasPathMethods) + void beginPath(); + void fill(optional CanvasWindingRule winding = "nonzero"); + void fill(Path2D path, optional CanvasWindingRule winding = "nonzero"); + void stroke(); + void stroke(Path2D path); + void clip(optional CanvasWindingRule winding = "nonzero"); + void clip(Path2D path, optional CanvasWindingRule winding = "nonzero"); +// NOT IMPLEMENTED void resetClip(); + [NeedsSubjectPrincipal] + boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasWindingRule winding = "nonzero"); + [NeedsSubjectPrincipal] // Only required because overloads can't have different extended attributes. + boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y, optional CanvasWindingRule winding = "nonzero"); + [NeedsSubjectPrincipal] + boolean isPointInStroke(double x, double y); + [NeedsSubjectPrincipal] // Only required because overloads can't have different extended attributes. + boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y); +}; + +[NoInterfaceObject] +interface CanvasUserInterface { + [Pref="canvas.focusring.enabled", Throws] void drawFocusIfNeeded(Element element); +// NOT IMPLEMENTED void drawSystemFocusRing(Path path, HTMLElement element); + [Pref="canvas.customfocusring.enabled"] boolean drawCustomFocusRing(Element element); +// NOT IMPLEMENTED boolean drawCustomFocusRing(Path path, HTMLElement element); +// NOT IMPLEMENTED void scrollPathIntoView(); +// NOT IMPLEMENTED void scrollPathIntoView(Path path); +}; + +[NoInterfaceObject] +interface CanvasText { + // text (see also the CanvasPathDrawingStyles interface) + [Throws, LenientFloat] + void fillText(DOMString text, double x, double y, optional double maxWidth); + [Throws, LenientFloat] + void strokeText(DOMString text, double x, double y, optional double maxWidth); + [NewObject, Throws] + TextMetrics measureText(DOMString text); +}; + +[NoInterfaceObject] +interface CanvasDrawImage { + [Throws, LenientFloat] + void drawImage(CanvasImageSource image, double dx, double dy); + [Throws, LenientFloat] + void drawImage(CanvasImageSource image, double dx, double dy, double dw, double dh); + [Throws, LenientFloat] + void drawImage(CanvasImageSource image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh); +}; + +[NoInterfaceObject] +interface CanvasImageData { + // pixel manipulation + [NewObject, Throws] + ImageData createImageData(double sw, double sh); + [NewObject, Throws] + ImageData createImageData(ImageData imagedata); + [NewObject, Throws, NeedsSubjectPrincipal] + ImageData getImageData(double sx, double sy, double sw, double sh); + [Throws] + void putImageData(ImageData imagedata, double dx, double dy); + [Throws] + void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight); +}; + +[NoInterfaceObject] +interface CanvasPathDrawingStyles { + // line caps/joins + [LenientFloat] + attribute double lineWidth; // (default 1) + attribute DOMString lineCap; // "butt", "round", "square" (default "butt") + [GetterThrows] + attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") + [LenientFloat] + attribute double miterLimit; // (default 10) + + // dashed lines + [LenientFloat, Throws] void setLineDash(sequence segments); // default empty + sequence getLineDash(); + [LenientFloat] attribute double lineDashOffset; +}; + +[NoInterfaceObject] +interface CanvasTextDrawingStyles { + // text + [SetterThrows] + attribute DOMString font; // (default 10px sans-serif) + attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start") + attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic") +}; + +[NoInterfaceObject] +interface CanvasPathMethods { + // shared path API methods + void closePath(); + [LenientFloat] + void moveTo(double x, double y); + [LenientFloat] + void lineTo(double x, double y); + [LenientFloat] + void quadraticCurveTo(double cpx, double cpy, double x, double y); + + [LenientFloat] + void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); + + [Throws, LenientFloat] + void arcTo(double x1, double y1, double x2, double y2, double radius); +// NOT IMPLEMENTED [LenientFloat] void arcTo(double x1, double y1, double x2, double y2, double radiusX, double radiusY, double rotation); + + [LenientFloat] + void rect(double x, double y, double w, double h); + + [Throws, LenientFloat] + void arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise = false); + + [Throws, LenientFloat] + void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, optional boolean anticlockwise = false); +}; + +[NoInterfaceObject] +interface CanvasHitRegions { + // hit regions + [Pref="canvas.hitregions.enabled", Throws] void addHitRegion(optional HitRegionOptions options); + [Pref="canvas.hitregions.enabled"] void removeHitRegion(DOMString id); + [Pref="canvas.hitregions.enabled"] void clearHitRegions(); +}; + +interface CanvasGradient { + // opaque object + [Throws] + // addColorStop should take a double + void addColorStop(float offset, DOMString color); +}; + +interface CanvasPattern { + // opaque object + // [Throws, LenientFloat] - could not do this overload because of bug 1020975 + // void setTransform(double a, double b, double c, double d, double e, double f); + + // No throw necessary here - SVGMatrix is always good. + void setTransform(SVGMatrix matrix); +}; + +interface TextMetrics { + + // x-direction + readonly attribute double width; // advance width + + /* + * NOT IMPLEMENTED YET + + 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; + */ + +}; + +[Pref="canvas.path.enabled", + Constructor, + Constructor(Path2D other), + Constructor(DOMString pathString)] +interface Path2D +{ + void addPath(Path2D path, optional SVGMatrix transformation); +}; +Path2D implements CanvasPathMethods; diff --git a/crates/web-sys/webidls/available/CaretPosition.webidl b/crates/web-sys/webidls/available/CaretPosition.webidl new file mode 100644 index 00000000..5907b40d --- /dev/null +++ b/crates/web-sys/webidls/available/CaretPosition.webidl @@ -0,0 +1,20 @@ +/* This Source Code Form is subject to the terms of 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/. */ + +interface CaretPosition { + + /** + * The offsetNode could potentially be null due to anonymous content. + */ + readonly attribute Node? offsetNode; + readonly attribute unsigned long offset; + +}; + +/** + * Gecko specific methods and properties for CaretPosition. + */ +partial interface CaretPosition { + DOMRect? getClientRect(); +}; diff --git a/crates/web-sys/webidls/available/CaretStateChangedEvent.webidl b/crates/web-sys/webidls/available/CaretStateChangedEvent.webidl new file mode 100644 index 00000000..39edd4d8 --- /dev/null +++ b/crates/web-sys/webidls/available/CaretStateChangedEvent.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +enum CaretChangedReason { + "visibilitychange", + "updateposition", + "longpressonemptycontent", + "taponcaret", + "presscaret", + "releasecaret", + "scroll" +}; + +dictionary CaretStateChangedEventInit : EventInit { + boolean collapsed = true; + DOMRectReadOnly? boundingClientRect = null; + CaretChangedReason reason = "visibilitychange"; + boolean caretVisible = false; + boolean caretVisuallyVisible = false; + boolean selectionVisible = false; + boolean selectionEditable = false; + DOMString selectedTextContent = ""; +}; + +[Constructor(DOMString type, optional CaretStateChangedEventInit eventInit), + ChromeOnly] +interface CaretStateChangedEvent : Event { + readonly attribute boolean collapsed; + readonly attribute DOMRectReadOnly? boundingClientRect; + readonly attribute CaretChangedReason reason; + readonly attribute boolean caretVisible; + readonly attribute boolean caretVisuallyVisible; + readonly attribute boolean selectionVisible; + readonly attribute boolean selectionEditable; + readonly attribute DOMString selectedTextContent; +}; diff --git a/crates/web-sys/webidls/available/ChannelMergerNode.webidl b/crates/web-sys/webidls/available/ChannelMergerNode.webidl new file mode 100644 index 00000000..6818abae --- /dev/null +++ b/crates/web-sys/webidls/available/ChannelMergerNode.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary ChannelMergerOptions : AudioNodeOptions { + unsigned long numberOfInputs = 6; +}; + +[Pref="dom.webaudio.enabled", + Constructor(BaseAudioContext context, optional ChannelMergerOptions options)] +interface ChannelMergerNode : AudioNode { +}; diff --git a/crates/web-sys/webidls/available/ChannelSplitterNode.webidl b/crates/web-sys/webidls/available/ChannelSplitterNode.webidl new file mode 100644 index 00000000..25d254ca --- /dev/null +++ b/crates/web-sys/webidls/available/ChannelSplitterNode.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary ChannelSplitterOptions : AudioNodeOptions { + unsigned long numberOfOutputs = 6; +}; + +[Pref="dom.webaudio.enabled", + Constructor(BaseAudioContext context, optional ChannelSplitterOptions options)] +interface ChannelSplitterNode : AudioNode { + +}; + diff --git a/crates/web-sys/webidls/available/CharacterData.webidl b/crates/web-sys/webidls/available/CharacterData.webidl new file mode 100644 index 00000000..8d6a214e --- /dev/null +++ b/crates/web-sys/webidls/available/CharacterData.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#characterdata + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface CharacterData : Node { + [TreatNullAs=EmptyString, Pure, SetterThrows] + attribute DOMString data; + [Pure] + readonly attribute unsigned long length; + [Throws] + DOMString substringData(unsigned long offset, unsigned long count); + [Throws] + void appendData(DOMString data); + [Throws] + void insertData(unsigned long offset, DOMString data); + [Throws] + void deleteData(unsigned long offset, unsigned long count); + [Throws] + void replaceData(unsigned long offset, unsigned long count, DOMString data); +}; + +CharacterData implements ChildNode; +CharacterData implements NonDocumentTypeChildNode; diff --git a/crates/web-sys/webidls/available/CheckerboardReportService.webidl b/crates/web-sys/webidls/available/CheckerboardReportService.webidl new file mode 100644 index 00000000..d5a624e0 --- /dev/null +++ b/crates/web-sys/webidls/available/CheckerboardReportService.webidl @@ -0,0 +1,58 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + * This file declares data structures used to communicate checkerboard reports + * from C++ code to about:checkerboard (see bug 1238042). These dictionaries + * are NOT exposed to standard web content. + */ + +enum CheckerboardReason { + "severe", + "recent" +}; + +// Individual checkerboard report. Contains fields for the severity of the +// checkerboard event, the timestamp at which it was reported, the detailed +// log of the event, and the reason this report was saved (currently either +// "severe" or "recent"). +dictionary CheckerboardReport { + unsigned long severity; + DOMTimeStamp timestamp; // milliseconds since epoch + DOMString log; + CheckerboardReason reason; +}; + +// The guard function only allows creation of this interface on the +// about:checkerboard page, and only if it's in the parent process. +[Func="mozilla::dom::CheckerboardReportService::IsEnabled", + Constructor] +interface CheckerboardReportService { + /** + * Gets the available checkerboard reports. + */ + sequence getReports(); + + /** + * Gets the state of the apz.record_checkerboarding pref. + */ + boolean isRecordingEnabled(); + + /** + * Sets the state of the apz.record_checkerboarding pref. + */ + void setRecordingEnabled(boolean aEnabled); + + /** + * Flush any in-progress checkerboard reports. Since this happens + * asynchronously, the caller may register an observer with the observer + * service to be notified when this operation is complete. The observer should + * listen for the topic "APZ:FlushActiveCheckerboard:Done". Upon receiving + * this notification, the caller may call getReports() to obtain the flushed + * reports, along with any other reports that are available. + */ + void flushActiveReports(); +}; diff --git a/crates/web-sys/webidls/available/ChildNode.webidl b/crates/web-sys/webidls/available/ChildNode.webidl new file mode 100644 index 00000000..ae36cd93 --- /dev/null +++ b/crates/web-sys/webidls/available/ChildNode.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#interface-childnode + */ + +[NoInterfaceObject] +interface ChildNode { + [CEReactions, Throws, Unscopable] + void before((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + void after((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + void replaceWith((Node or DOMString)... nodes); + [CEReactions, Unscopable] + void remove(); +}; + +[NoInterfaceObject] +interface NonDocumentTypeChildNode { + [Pure] + readonly attribute Element? previousElementSibling; + [Pure] + readonly attribute Element? nextElementSibling; +}; diff --git a/crates/web-sys/webidls/available/ChildSHistory.webidl b/crates/web-sys/webidls/available/ChildSHistory.webidl new file mode 100644 index 00000000..17db8d66 --- /dev/null +++ b/crates/web-sys/webidls/available/ChildSHistory.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface nsISHistory; + +/** + * The ChildSHistory interface represents the child side of a browsing + * context's session history. + */ +[ChromeOnly] +interface ChildSHistory { + [Pure] + readonly attribute long count; + [Pure] + readonly attribute long index; + + boolean canGo(long aOffset); + [Throws] + void go(long aOffset); + + /** + * Reload the current entry. The flags which should be passed to this + * function are documented and defined in nsIWebNavigation.idl + */ + [Throws] + void reload(unsigned long aReloadFlags); + + /** + * Getter for the legacy nsISHistory implementation. + * + * This getter _will be going away_, but is needed while we finish + * implementing all of the APIs which we will need in the content + * process on ChildSHistory. + */ + readonly attribute nsISHistory legacySHistory; +}; diff --git a/crates/web-sys/webidls/available/ChromeNodeList.webidl b/crates/web-sys/webidls/available/ChromeNodeList.webidl new file mode 100644 index 00000000..3f062f2a --- /dev/null +++ b/crates/web-sys/webidls/available/ChromeNodeList.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Constructor, Func="IsChromeOrXBL"] +interface ChromeNodeList : NodeList { + [Throws] + void append(Node aNode); + [Throws] + void remove(Node aNode); +}; diff --git a/crates/web-sys/webidls/available/Client.webidl b/crates/web-sys/webidls/available/Client.webidl new file mode 100644 index 00000000..75d60b6d --- /dev/null +++ b/crates/web-sys/webidls/available/Client.webidl @@ -0,0 +1,51 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/ServiceWorker/#client-interface + * + */ + +[Exposed=ServiceWorker] +interface Client { + readonly attribute USVString url; + + // Remove frameType in bug 1290936 + [BinaryName="GetFrameType"] + readonly attribute FrameType frameType; + + readonly attribute ClientType type; + readonly attribute DOMString id; + + // Implement reserved in bug 1264177 + // readonly attribute boolean reserved; + + [Throws] + void postMessage(any message, optional sequence transfer = []); +}; + +[Exposed=ServiceWorker] +interface WindowClient : Client { + [BinaryName="GetVisibilityState"] + readonly attribute VisibilityState visibilityState; + readonly attribute boolean focused; + + // Implement ancestorOrigins in bug 1264180 + // [SameObject] readonly attribute FrozenArray ancestorOrigins; + + [Throws, NewObject] + Promise focus(); + + [Throws, NewObject] + Promise navigate(USVString url); +}; + +// Remove FrameType in bug 1290936 +enum FrameType { + "auxiliary", + "top-level", + "nested", + "none" +}; diff --git a/crates/web-sys/webidls/available/Clients.webidl b/crates/web-sys/webidls/available/Clients.webidl new file mode 100644 index 00000000..054ee0e5 --- /dev/null +++ b/crates/web-sys/webidls/available/Clients.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * + */ + +[Exposed=ServiceWorker] +interface Clients { + // The objects returned will be new instances every time + [NewObject] + Promise get(DOMString id); + [NewObject] + Promise> matchAll(optional ClientQueryOptions options); + [NewObject] + Promise openWindow(USVString url); + [NewObject] + Promise claim(); +}; + +dictionary ClientQueryOptions { + boolean includeUncontrolled = false; + ClientType type = "window"; +}; + +enum ClientType { + "window", + "worker", + "sharedworker", + // https://github.com/w3c/ServiceWorker/issues/1036 + "serviceworker", + "all" +}; + diff --git a/crates/web-sys/webidls/available/ClipboardEvent.webidl b/crates/web-sys/webidls/available/ClipboardEvent.webidl new file mode 100644 index 00000000..8fe8a493 --- /dev/null +++ b/crates/web-sys/webidls/available/ClipboardEvent.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface please see + * http://dev.w3.org/2006/webapi/clipops/#x5-clipboard-event-interfaces + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor(DOMString type, optional ClipboardEventInit eventInitDict)] +interface ClipboardEvent : Event +{ + readonly attribute DataTransfer? clipboardData; +}; + +dictionary ClipboardEventInit : EventInit +{ + DOMString data = ""; + DOMString dataType = ""; +}; diff --git a/crates/web-sys/webidls/available/CloseEvent.webidl b/crates/web-sys/webidls/available/CloseEvent.webidl new file mode 100644 index 00000000..4fddbd83 --- /dev/null +++ b/crates/web-sys/webidls/available/CloseEvent.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The nsIDOMCloseEvent interface is the interface to the event + * close on a WebSocket object. + * + * For more information on this interface, please see + * http://www.whatwg.org/specs/web-apps/current-work/multipage/network.html#closeevent + */ + +[Constructor(DOMString type, optional CloseEventInit eventInitDict),LegacyEventInit, + Exposed=(Window,Worker)] +interface CloseEvent : Event +{ + 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/crates/web-sys/webidls/available/CommandEvent.webidl b/crates/web-sys/webidls/available/CommandEvent.webidl new file mode 100644 index 00000000..0ce0a4e0 --- /dev/null +++ b/crates/web-sys/webidls/available/CommandEvent.webidl @@ -0,0 +1,10 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Func="IsChromeOrXBL"] +interface CommandEvent : Event { + readonly attribute DOMString? command; +}; diff --git a/crates/web-sys/webidls/available/Comment.webidl b/crates/web-sys/webidls/available/Comment.webidl new file mode 100644 index 00000000..023335f1 --- /dev/null +++ b/crates/web-sys/webidls/available/Comment.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#comment + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor(optional DOMString data = "")] +interface Comment : CharacterData { +}; diff --git a/crates/web-sys/webidls/available/CompositionEvent.webidl b/crates/web-sys/webidls/available/CompositionEvent.webidl new file mode 100644 index 00000000..16c5d6ea --- /dev/null +++ b/crates/web-sys/webidls/available/CompositionEvent.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://w3c.github.io/uievents/#interface-compositionevent + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor(DOMString type, optional CompositionEventInit eventInitDict)] +interface CompositionEvent : UIEvent +{ + readonly attribute DOMString? data; + // locale is currently non-standard + readonly attribute DOMString locale; + + /** + * ranges is trying to expose TextRangeArray in Gecko so a + * js-plugin couble be able to know the clauses information + */ + [ChromeOnly,Cached,Pure] + readonly attribute sequence ranges; +}; + +dictionary CompositionEventInit : UIEventInit { + DOMString data = ""; +}; + +partial interface CompositionEvent +{ + void initCompositionEvent(DOMString typeArg, + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional Window? viewArg = null, + optional DOMString? dataArg = null, + optional DOMString localeArg = ""); +}; diff --git a/crates/web-sys/webidls/available/Console.webidl b/crates/web-sys/webidls/available/Console.webidl new file mode 100644 index 00000000..6fbce7a4 --- /dev/null +++ b/crates/web-sys/webidls/available/Console.webidl @@ -0,0 +1,229 @@ +/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://console.spec.whatwg.org/#console-namespace + */ + +[Exposed=(Window,Worker,WorkerDebugger,Worklet,System), + ClassString="Console", + ProtoObjectHack] +namespace console { + + // NOTE: if you touch this namespace, remember to update the ConsoleInstance + // interface as well! + + // Logging + [UseCounter] + void assert(optional boolean condition = false, any... data); + [UseCounter] + void clear(); + [UseCounter] + void count(optional DOMString label = "default"); + [UseCounter] + void countReset(optional DOMString label = "default"); + [UseCounter] + void debug(any... data); + [UseCounter] + void error(any... data); + [UseCounter] + void info(any... data); + [UseCounter] + void log(any... data); + [UseCounter] + void table(any... data); // FIXME: The spec is still unclear about this. + [UseCounter] + void trace(any... data); + [UseCounter] + void warn(any... data); + [UseCounter] + void dir(any... data); // FIXME: This doesn't follow the spec yet. + [UseCounter] + void dirxml(any... data); + + // Grouping + [UseCounter] + void group(any... data); + [UseCounter] + void groupCollapsed(any... data); + [UseCounter] + void groupEnd(); + + // Timing + [UseCounter] + void time(optional DOMString label = "default"); + [UseCounter] + void timeLog(optional DOMString label = "default", any... data); + [UseCounter] + void timeEnd(optional DOMString label = "default"); + + // Mozilla only or Webcompat methods + + [UseCounter] + void _exception(any... data); + [UseCounter] + void timeStamp(optional any data); + + [UseCounter] + void profile(any... data); + [UseCounter] + void profileEnd(any... data); + + [ChromeOnly] + const boolean IS_NATIVE_CONSOLE = true; + + [ChromeOnly, NewObject] + ConsoleInstance createInstance(optional ConsoleInstanceOptions options); +}; + +// This is used to propagate console events to the observers. +dictionary ConsoleEvent { + (unsigned long long or DOMString) ID; + (unsigned long long or DOMString) innerID; + DOMString consoleID = ""; + DOMString addonId = ""; + DOMString level = ""; + DOMString filename = ""; + unsigned long lineNumber = 0; + unsigned long columnNumber = 0; + DOMString functionName = ""; + double timeStamp = 0; + sequence arguments; + sequence styles; + boolean private = false; + // stacktrace is handled via a getter in some cases so we can construct it + // lazily. Note that we're not making this whole thing an interface because + // consumers expect to see own properties on it, which would mean making the + // props unforgeable, which means lots of JSFunction allocations. Maybe we + // should fix those consumers, of course.... + // sequence stacktrace; + DOMString groupName = ""; + any timer = null; + any counter = null; + DOMString prefix = ""; +}; + +// Event for profile operations +dictionary ConsoleProfileEvent { + DOMString action = ""; + sequence arguments; +}; + +// This dictionary is used to manage stack trace data. +dictionary ConsoleStackEntry { + DOMString filename = ""; + unsigned long lineNumber = 0; + unsigned long columnNumber = 0; + DOMString functionName = ""; + DOMString? asyncCause; +}; + +dictionary ConsoleTimerStart { + DOMString name = ""; +}; + +dictionary ConsoleTimerLogOrEnd { + DOMString name = ""; + double duration = 0; +}; + +dictionary ConsoleTimerError { + DOMString error = ""; + DOMString name = ""; +}; + +dictionary ConsoleCounter { + DOMString label = ""; + unsigned long count = 0; +}; + +dictionary ConsoleCounterError { + DOMString label = ""; + DOMString error = ""; +}; + +[ChromeOnly, + Exposed=(Window,Worker,WorkerDebugger,Worklet,System)] +// This is basically a copy of the console namespace. +interface ConsoleInstance { + // Logging + void assert(optional boolean condition = false, any... data); + void clear(); + void count(optional DOMString label = "default"); + void countReset(optional DOMString label = "default"); + void debug(any... data); + void error(any... data); + void info(any... data); + void log(any... data); + void table(any... data); // FIXME: The spec is still unclear about this. + void trace(any... data); + void warn(any... data); + void dir(any... data); // FIXME: This doesn't follow the spec yet. + void dirxml(any... data); + + // Grouping + void group(any... data); + void groupCollapsed(any... data); + void groupEnd(); + + // Timing + void time(optional DOMString label = "default"); + void timeLog(optional DOMString label = "default", any... data); + void timeEnd(optional DOMString label = "default"); + + // Mozilla only or Webcompat methods + + void _exception(any... data); + void timeStamp(optional any data); + + void profile(any... data); + void profileEnd(any... data); +}; + +callback ConsoleInstanceDumpCallback = void (DOMString message); + +enum ConsoleLogLevel { + "All", "Debug", "Log", "Info", "Clear", "Trace", "TimeLog", "TimeEnd", "Time", + "Group", "GroupEnd", "Profile", "ProfileEnd", "Dir", "Dirxml", "Warn", "Error", + "Off" +}; + +dictionary ConsoleInstanceOptions { + // An optional function to intercept all strings written to stdout. + ConsoleInstanceDumpCallback dump; + + // An optional prefix string to be printed before the actual logged message. + DOMString prefix = ""; + + // An ID representing the source of the message. Normally the inner ID of a + // DOM window. + DOMString innerID = ""; + + // String identified for the console, this will be passed through the console + // notifications. + DOMString consoleID = ""; + + // Identifier that allows to filter which messages are logged based on their + // log level. + ConsoleLogLevel maxLogLevel; + + // String pref name which contains the level to use for maxLogLevel. If the + // pref doesn't exist, gets removed or it is used in workers, the maxLogLevel + // will default to the value passed to this constructor (or "all" if it wasn't + // specified). + DOMString maxLogLevelPref = ""; +}; + +enum ConsoleLevel { "log", "warning", "error" }; + +// this interface is just for testing +partial interface ConsoleInstance { + [ChromeOnly] + void reportForServiceWorkerScope(DOMString scope, DOMString message, + DOMString filename, unsigned long lineNumber, + unsigned long columnNumber, + ConsoleLevel level); +}; diff --git a/crates/web-sys/webidls/available/ConstantSourceNode.webidl b/crates/web-sys/webidls/available/ConstantSourceNode.webidl new file mode 100644 index 00000000..cd005897 --- /dev/null +++ b/crates/web-sys/webidls/available/ConstantSourceNode.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary ConstantSourceOptions { + float offset = 1; +}; + +[Pref="dom.webaudio.enabled", + Constructor(BaseAudioContext context, optional ConstantSourceOptions options)] +interface ConstantSourceNode : AudioScheduledSourceNode { + readonly attribute AudioParam offset; +}; diff --git a/crates/web-sys/webidls/available/ConvolverNode.webidl b/crates/web-sys/webidls/available/ConvolverNode.webidl new file mode 100644 index 00000000..0e0e1137 --- /dev/null +++ b/crates/web-sys/webidls/available/ConvolverNode.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary ConvolverOptions : AudioNodeOptions { + AudioBuffer? buffer; + boolean disableNormalization = false; +}; + +[Pref="dom.webaudio.enabled", + Constructor(BaseAudioContext context, optional ConvolverOptions options)] +interface ConvolverNode : AudioNode { + + [SetterThrows] + attribute AudioBuffer? buffer; + attribute boolean normalize; + +}; + +// Mozilla extension +ConvolverNode implements AudioNodePassThrough; + diff --git a/crates/web-sys/webidls/available/Coordinates.webidl b/crates/web-sys/webidls/available/Coordinates.webidl new file mode 100644 index 00000000..840782f7 --- /dev/null +++ b/crates/web-sys/webidls/available/Coordinates.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/geolocation-API + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[NoInterfaceObject] +interface Coordinates { + readonly attribute double latitude; + readonly attribute double longitude; + readonly attribute double? altitude; + readonly attribute double accuracy; + readonly attribute double? altitudeAccuracy; + readonly attribute double? heading; + readonly attribute double? speed; +}; diff --git a/crates/web-sys/webidls/available/CreateOfferRequest.webidl b/crates/web-sys/webidls/available/CreateOfferRequest.webidl new file mode 100644 index 00000000..134fe33f --- /dev/null +++ b/crates/web-sys/webidls/available/CreateOfferRequest.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This is an internal IDL file + */ + +[ChromeOnly, + JSImplementation="@mozilla.org/dom/createofferrequest;1"] +interface CreateOfferRequest { + readonly attribute unsigned long long windowID; + readonly attribute unsigned long long innerWindowID; + readonly attribute DOMString callID; + readonly attribute boolean isSecure; +}; diff --git a/crates/web-sys/webidls/available/CredentialManagement.webidl b/crates/web-sys/webidls/available/CredentialManagement.webidl new file mode 100644 index 00000000..fcb52507 --- /dev/null +++ b/crates/web-sys/webidls/available/CredentialManagement.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.w3.org/TR/credential-management-1/ + */ + +[Exposed=Window, SecureContext, Pref="security.webauth.webauthn"] +interface Credential { + readonly attribute USVString id; + readonly attribute DOMString type; +}; + +[Exposed=Window, SecureContext, Pref="security.webauth.webauthn"] +interface CredentialsContainer { + [Throws] + Promise get(optional CredentialRequestOptions options); + [Throws] + Promise create(optional CredentialCreationOptions options); + [Throws] + Promise store(Credential credential); + [Throws] + Promise preventSilentAccess(); +}; + +dictionary CredentialRequestOptions { + PublicKeyCredentialRequestOptions publicKey; + AbortSignal signal; +}; + +dictionary CredentialCreationOptions { + PublicKeyCredentialCreationOptions publicKey; + AbortSignal signal; +}; diff --git a/crates/web-sys/webidls/available/Crypto.webidl b/crates/web-sys/webidls/available/Crypto.webidl new file mode 100644 index 00000000..31574a21 --- /dev/null +++ b/crates/web-sys/webidls/available/Crypto.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#crypto-interface + */ + +[NoInterfaceObject, Exposed=(Window,Worker)] +interface GlobalCrypto { + [Throws] readonly attribute Crypto crypto; +}; + +[Exposed=(Window,Worker)] +interface Crypto { + readonly attribute SubtleCrypto subtle; + + [Throws] + ArrayBufferView getRandomValues(ArrayBufferView array); +}; diff --git a/crates/web-sys/webidls/available/CustomElementRegistry.webidl b/crates/web-sys/webidls/available/CustomElementRegistry.webidl new file mode 100644 index 00000000..b4b091b8 --- /dev/null +++ b/crates/web-sys/webidls/available/CustomElementRegistry.webidl @@ -0,0 +1,23 @@ +/* This Source Code Form is subject to the terms of 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/#dom-window-customelements +[Func="CustomElementRegistry::IsCustomElementEnabled"] +interface CustomElementRegistry { + [CEReactions, Throws] + void define(DOMString name, Function functionConstructor, + optional ElementDefinitionOptions options); + [ChromeOnly, Throws] + void setElementCreationCallback(DOMString name, CustomElementCreationCallback callback); + any get(DOMString name); + [Throws] + Promise whenDefined(DOMString name); + [CEReactions] void upgrade(Node root); +}; + +dictionary ElementDefinitionOptions { + DOMString extends; +}; + +callback CustomElementCreationCallback = void (DOMString name); diff --git a/crates/web-sys/webidls/available/CustomEvent.webidl b/crates/web-sys/webidls/available/CustomEvent.webidl new file mode 100644 index 00000000..8c7124dd --- /dev/null +++ b/crates/web-sys/webidls/available/CustomEvent.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor(DOMString type, optional CustomEventInit eventInitDict), + Exposed=(Window, Worker)] +interface CustomEvent : Event +{ + readonly attribute any detail; + + // initCustomEvent is a Gecko specific deprecated method. + void initCustomEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional any detail = null); +}; + +dictionary CustomEventInit : EventInit +{ + any detail = null; +}; diff --git a/crates/web-sys/webidls/available/DOMError.webidl b/crates/web-sys/webidls/available/DOMError.webidl new file mode 100644 index 00000000..5fb5d17e --- /dev/null +++ b/crates/web-sys/webidls/available/DOMError.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#domerror + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor(DOMString name, optional DOMString message = ""), + Exposed=(Window,Worker,System)] +interface DOMError { + [Constant, UseCounter] + readonly attribute DOMString name; + + [Constant, UseCounter] + readonly attribute DOMString message; +}; diff --git a/crates/web-sys/webidls/available/DOMException.webidl b/crates/web-sys/webidls/available/DOMException.webidl new file mode 100644 index 00000000..157e5cdc --- /dev/null +++ b/crates/web-sys/webidls/available/DOMException.webidl @@ -0,0 +1,107 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#exception-domexception + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + + +// This is the WebIDL version of nsIException. This is mostly legacy stuff. + +interface StackFrame; + +[NoInterfaceObject, + Exposed=(Window,Worker,System)] +interface ExceptionMembers +{ + // The nsresult associated with this exception. + readonly attribute unsigned long result; + + // Filename location. This is the location that caused the + // error, which may or may not be a source file location. + // For example, standard language errors would generally have + // the same location as their top stack entry. File + // parsers may put the location of the file they were parsing, + // etc. + + // null indicates "no data" + readonly attribute DOMString filename; + // Valid line numbers begin at '1'. '0' indicates unknown. + readonly attribute unsigned long lineNumber; + // Valid column numbers begin at 0. + // We don't have an unambiguous indicator for unknown. + readonly attribute unsigned long columnNumber; + + // A stack trace, if available. nsIStackFrame does not have classinfo so + // this was only ever usefully available to chrome JS. + [ChromeOnly, Exposed=Window] + readonly attribute StackFrame? location; + + // Arbitary data for the implementation. + [Exposed=Window] + readonly attribute nsISupports? data; + + // Formatted exception stack + [Replaceable] + readonly attribute DOMString stack; +}; + +[NoInterfaceObject, Exposed=(Window,Worker)] +interface Exception { + // The name of the error code (ie, a string repr of |result|). + readonly attribute DOMString name; + // A custom message set by the thrower. + readonly attribute DOMString message; + // A generic formatter - make it suitable to print, etc. + stringifier; +}; + +Exception implements ExceptionMembers; + +// XXXkhuey this is an 'exception', not an interface, but we don't have any +// parser or codegen mechanisms for dealing with exceptions. +[ExceptionClass, + Exposed=(Window, Worker,System), + Constructor(optional DOMString message = "", optional DOMString name)] +interface DOMException { + // The name of the error code (ie, a string repr of |result|). + readonly attribute DOMString name; + // A custom message set by the thrower. + readonly attribute DOMString message; + readonly attribute unsigned short code; + + 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; +}; + +// XXXkhuey copy all of Gecko's non-standard stuff onto DOMException, but leave +// the prototype chain sane. +DOMException implements ExceptionMembers; diff --git a/crates/web-sys/webidls/available/DOMImplementation.webidl b/crates/web-sys/webidls/available/DOMImplementation.webidl new file mode 100644 index 00000000..5fa3c859 --- /dev/null +++ b/crates/web-sys/webidls/available/DOMImplementation.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://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. + */ + +interface DOMImplementation { + boolean hasFeature(); + + [Throws] + DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, + DOMString systemId); + [Throws] + Document createDocument(DOMString? namespace, + [TreatNullAs=EmptyString] DOMString qualifiedName, + optional DocumentType? doctype = null); + [Throws] + Document createHTMLDocument(optional DOMString title); +}; diff --git a/crates/web-sys/webidls/available/DOMMatrix.webidl b/crates/web-sys/webidls/available/DOMMatrix.webidl new file mode 100644 index 00000000..06a0da44 --- /dev/null +++ b/crates/web-sys/webidls/available/DOMMatrix.webidl @@ -0,0 +1,150 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/fxtf/geometry/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="layout.css.DOMMatrix.enabled", + Constructor(optional (DOMString or sequence) init)] +interface DOMMatrixReadOnly { + // 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; + + // Immutable transform methods + DOMMatrix translate(unrestricted double tx, + unrestricted double ty, + optional unrestricted double tz = 0); + DOMMatrix scale(unrestricted double scale, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0); + DOMMatrix scale3d(unrestricted double scale, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0, + optional unrestricted double originZ = 0); + DOMMatrix scaleNonUniform(unrestricted double scaleX, + optional unrestricted double scaleY = 1, + optional unrestricted double scaleZ = 1, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0, + optional unrestricted double originZ = 0); + DOMMatrix rotate(unrestricted double angle, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0); + DOMMatrix rotateFromVector(unrestricted double x, + unrestricted double y); + DOMMatrix rotateAxisAngle(unrestricted double x, + unrestricted double y, + unrestricted double z, + unrestricted double angle); + DOMMatrix skewX(unrestricted double sx); + DOMMatrix skewY(unrestricted double sy); + DOMMatrix multiply(DOMMatrix other); + DOMMatrix flipX(); + DOMMatrix flipY(); + DOMMatrix inverse(); + + // Helper methods + readonly attribute boolean is2D; + readonly attribute boolean isIdentity; + DOMPoint transformPoint(optional DOMPointInit point); + [Throws] Float32Array toFloat32Array(); + [Throws] Float64Array toFloat64Array(); + stringifier; + [Default] object toJSON(); +}; + +[Pref="layout.css.DOMMatrix.enabled", + Constructor, + Constructor(DOMString transformList), + Constructor(DOMMatrixReadOnly other), + Constructor(Float32Array array32), + Constructor(Float64Array array64), + Constructor(sequence numberSequence)] +interface DOMMatrix : DOMMatrixReadOnly { + // 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 + DOMMatrix multiplySelf(DOMMatrix other); + DOMMatrix preMultiplySelf(DOMMatrix other); + DOMMatrix translateSelf(unrestricted double tx, + unrestricted double ty, + optional unrestricted double tz = 0); + DOMMatrix scaleSelf(unrestricted double scale, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0); + DOMMatrix scale3dSelf(unrestricted double scale, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0, + optional unrestricted double originZ = 0); + DOMMatrix scaleNonUniformSelf(unrestricted double scaleX, + optional unrestricted double scaleY = 1, + optional unrestricted double scaleZ = 1, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0, + optional unrestricted double originZ = 0); + DOMMatrix rotateSelf(unrestricted double angle, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0); + DOMMatrix rotateFromVectorSelf(unrestricted double x, + unrestricted double y); + DOMMatrix rotateAxisAngleSelf(unrestricted double x, + unrestricted double y, + unrestricted double z, + unrestricted double angle); + DOMMatrix skewXSelf(unrestricted double sx); + DOMMatrix skewYSelf(unrestricted double sy); + DOMMatrix invertSelf(); + [Throws] DOMMatrix setMatrixValue(DOMString transformList); +}; + diff --git a/crates/web-sys/webidls/available/DOMParser.webidl b/crates/web-sys/webidls/available/DOMParser.webidl new file mode 100644 index 00000000..8afff03d --- /dev/null +++ b/crates/web-sys/webidls/available/DOMParser.webidl @@ -0,0 +1,40 @@ +/* This Source Code Form is subject to the terms of 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://domparsing.spec.whatwg.org/#the-domparser-interface + */ + +interface Principal; +interface URI; +interface InputStream; + +enum SupportedType { + "text/html", + "text/xml", + "application/xml", + "application/xhtml+xml", + "image/svg+xml" +}; + +// the latter is Mozilla-specific +[Constructor] +interface DOMParser { + [NewObject, Throws] + Document parseFromString(DOMString str, SupportedType type); + + // Mozilla-specific stuff + [NewObject, Throws, ChromeOnly] + Document parseFromBuffer(sequence buf, SupportedType type); + [NewObject, Throws, ChromeOnly] + Document parseFromBuffer(Uint8Array buf, SupportedType type); + [NewObject, Throws, ChromeOnly] + Document parseFromStream(InputStream stream, DOMString? charset, + long contentLength, SupportedType type); + // Can be used to allow a DOMParser to parse XUL/XBL no matter what + // principal it's using for the document. + [ChromeOnly] + void forceEnableXULXBL(); +}; + diff --git a/crates/web-sys/webidls/available/DOMPoint.webidl b/crates/web-sys/webidls/available/DOMPoint.webidl new file mode 100644 index 00000000..2ebba958 --- /dev/null +++ b/crates/web-sys/webidls/available/DOMPoint.webidl @@ -0,0 +1,44 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/fxtf/geometry/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="layout.css.DOMPoint.enabled", + Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, + optional unrestricted double z = 0, optional unrestricted double w = 1)] +interface DOMPointReadOnly { + [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(); +}; + +[Pref="layout.css.DOMPoint.enabled", + Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, + optional unrestricted double z = 0, optional unrestricted double w = 1)] +interface DOMPoint : DOMPointReadOnly { + [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/crates/web-sys/webidls/available/DOMQuad.webidl b/crates/web-sys/webidls/available/DOMQuad.webidl new file mode 100644 index 00000000..7370330b --- /dev/null +++ b/crates/web-sys/webidls/available/DOMQuad.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/fxtf/geometry/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="layout.css.DOMQuad.enabled", + Constructor(optional DOMPointInit p1, optional DOMPointInit p2, + optional DOMPointInit p3, optional DOMPointInit p4), + Constructor(DOMRectReadOnly rect)] +interface DOMQuad { + [SameObject] readonly attribute DOMPoint p1; + [SameObject] readonly attribute DOMPoint p2; + [SameObject] readonly attribute DOMPoint p3; + [SameObject] readonly attribute DOMPoint p4; + [NewObject] DOMRectReadOnly getBounds(); + + [SameObject, Deprecated=DOMQuadBoundsAttr] readonly attribute DOMRectReadOnly bounds; + + DOMQuadJSON toJSON(); +}; + +dictionary DOMQuadJSON { + DOMPoint p1; + DOMPoint p2; + DOMPoint p3; + DOMPoint p4; +}; + +dictionary DOMQuadInit { + DOMPointInit p1; + DOMPointInit p2; + DOMPointInit p3; + DOMPointInit p4; +}; diff --git a/crates/web-sys/webidls/available/DOMRect.webidl b/crates/web-sys/webidls/available/DOMRect.webidl new file mode 100644 index 00000000..b9261ecc --- /dev/null +++ b/crates/web-sys/webidls/available/DOMRect.webidl @@ -0,0 +1,43 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/fxtf/geometry/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, + optional unrestricted double width = 0, optional unrestricted double height = 0)] +interface DOMRect : DOMRectReadOnly { + inherit attribute unrestricted double x; + inherit attribute unrestricted double y; + inherit attribute unrestricted double width; + inherit attribute unrestricted double height; +}; + +[ProbablyShortLivingWrapper, + Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, + optional unrestricted double width = 0, optional unrestricted double height = 0)] +interface DOMRectReadOnly { + 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(); +}; + +dictionary DOMRectInit { + unrestricted double x = 0; + unrestricted double y = 0; + unrestricted double width = 0; + unrestricted double height = 0; +}; diff --git a/crates/web-sys/webidls/available/DOMRectList.webidl b/crates/web-sys/webidls/available/DOMRectList.webidl new file mode 100644 index 00000000..74332bfc --- /dev/null +++ b/crates/web-sys/webidls/available/DOMRectList.webidl @@ -0,0 +1,10 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface DOMRectList { + readonly attribute unsigned long length; + getter DOMRect? item(unsigned long index); +}; diff --git a/crates/web-sys/webidls/available/DOMRequest.webidl b/crates/web-sys/webidls/available/DOMRequest.webidl new file mode 100644 index 00000000..2e25fc19 --- /dev/null +++ b/crates/web-sys/webidls/available/DOMRequest.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +enum DOMRequestReadyState { "pending", "done" }; + +[Exposed=(Window,Worker,System), NoInterfaceObject] +interface DOMRequestShared { + readonly attribute DOMRequestReadyState readyState; + + readonly attribute any result; + readonly attribute DOMException? error; + + attribute EventHandler onsuccess; + attribute EventHandler onerror; +}; + +[Exposed=(Window,Worker,System)] +interface DOMRequest : EventTarget { + // The [TreatNonCallableAsNull] annotation is required since then() should do + // nothing instead of throwing errors when non-callable arguments are passed. + // See documentation for Promise.then to see why we return "any". + [NewObject, Throws] + any then([TreatNonCallableAsNull] optional AnyCallback? fulfillCallback = null, + [TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null); + + [ChromeOnly] + void fireDetailedError(DOMException aError); +}; + +DOMRequest implements DOMRequestShared; diff --git a/crates/web-sys/webidls/available/DOMStringList.webidl b/crates/web-sys/webidls/available/DOMStringList.webidl new file mode 100644 index 00000000..56c5836f --- /dev/null +++ b/crates/web-sys/webidls/available/DOMStringList.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker,System)] +interface DOMStringList { + readonly attribute unsigned long length; + getter DOMString? item(unsigned long index); + boolean contains(DOMString string); +}; diff --git a/crates/web-sys/webidls/available/DOMStringMap.webidl b/crates/web-sys/webidls/available/DOMStringMap.webidl new file mode 100644 index 00000000..e86e37a3 --- /dev/null +++ b/crates/web-sys/webidls/available/DOMStringMap.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#domstringmap-0 + * + * © 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. + */ + +[OverrideBuiltins] +interface DOMStringMap { + getter DOMString (DOMString name); + [CEReactions, Throws] + setter void (DOMString name, DOMString value); + [CEReactions] + deleter void (DOMString name); +}; diff --git a/crates/web-sys/webidls/available/DOMTokenList.webidl b/crates/web-sys/webidls/available/DOMTokenList.webidl new file mode 100644 index 00000000..a662300d --- /dev/null +++ b/crates/web-sys/webidls/available/DOMTokenList.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface DOMTokenList { + readonly attribute unsigned long length; + getter DOMString? item(unsigned long index); + boolean contains(DOMString token); + [CEReactions, Throws] + void add(DOMString... tokens); + [CEReactions, Throws] + void remove(DOMString... tokens); + [CEReactions, Throws] + boolean replace(DOMString token, DOMString newToken); + [CEReactions, Throws] + boolean toggle(DOMString token, optional boolean force); + [Throws] + boolean supports(DOMString token); + [CEReactions, SetterThrows] + attribute DOMString value; + stringifier DOMString (); + iterable; +}; diff --git a/crates/web-sys/webidls/available/DataTransfer.webidl b/crates/web-sys/webidls/available/DataTransfer.webidl new file mode 100644 index 00000000..0fbec23a --- /dev/null +++ b/crates/web-sys/webidls/available/DataTransfer.webidl @@ -0,0 +1,178 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * http://www.whatwg.org/specs/web-apps/current-work/#the-datatransfer-interface + */ + +[Constructor] +interface DataTransfer { + attribute DOMString dropEffect; + attribute DOMString effectAllowed; + + readonly attribute DataTransferItemList items; + + void setDragImage(Element image, long x, long y); + + // ReturnValueNeedsContainsHack on .types because lots of extension + // code was expecting .contains() back when it was a DOMStringList. + [Pure, Cached, Frozen, NeedsCallerType, ReturnValueNeedsContainsHack] + readonly attribute sequence types; + [Throws, NeedsSubjectPrincipal] + DOMString getData(DOMString format); + [Throws, NeedsSubjectPrincipal] + void setData(DOMString format, DOMString data); + [Throws, NeedsSubjectPrincipal] + void clearData(optional DOMString format); + [NeedsSubjectPrincipal] + readonly attribute FileList? files; +}; + +partial interface DataTransfer { + [Throws, Pref="dom.input.dirpicker", NeedsSubjectPrincipal] + Promise> getFilesAndDirectories(); + + [Throws, Pref="dom.input.dirpicker", NeedsSubjectPrincipal] + Promise> getFiles(optional boolean recursiveFlag = false); +}; + +// Mozilla specific stuff +partial interface DataTransfer { + /* + * Set the drag source. Usually you would not change this, but it will + * affect which node the drag and dragend events are fired at. The + * default target is the node that was dragged. + * + * @param element drag source to use + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + [Throws, UseCounter] + void addElement(Element element); + + /** + * The number of items being dragged. + */ + [UseCounter] + readonly attribute unsigned long mozItemCount; + + /** + * Sets the drag cursor state. Primarily used to control the cursor during + * tab drags, but could be expanded to other uses. XXX Currently implemented + * on Win32 only. + * + * Possible values: + * auto - use default system behavior. + * default - set the cursor to an arrow during the drag operation. + * + * Values other than 'default' are indentical to setting mozCursor to + * 'auto'. + */ + [UseCounter] + attribute DOMString mozCursor; + + /** + * Holds a list of the format types of the data that is stored for an item + * at the specified index. If the index is not in the range from 0 to + * itemCount - 1, an empty string list is returned. + */ + [Throws, NeedsCallerType, UseCounter] + DOMStringList mozTypesAt(unsigned long index); + + /** + * Remove the data associated with the given format for an item at the + * specified index. The index is in the range from zero to itemCount - 1. + * + * If the last format for the item is removed, the entire item is removed, + * reducing the itemCount by one. + * + * If format is empty, then the data associated with all formats is removed. + * If the format is not found, then this method has no effect. + * + * @param format the format to remove + * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + [Throws, NeedsSubjectPrincipal, UseCounter] + void mozClearDataAt(DOMString format, unsigned long index); + + /* + * A data transfer may store multiple items, each at a given zero-based + * index. setDataAt may only be called with an index argument less than + * itemCount in which case an existing item is modified, or equal to + * itemCount in which case a new item is added, and the itemCount is + * incremented by one. + * + * Data should be added in order of preference, with the most specific + * format added first and the least specific format added last. If data of + * the given format already exists, it is replaced in the same position as + * the old data. + * + * The data should be either a string, a primitive boolean or number type + * (which will be converted into a string) or an nsISupports. + * + * @param format the format to add + * @param data the data to add + * @throws NS_ERROR_NULL_POINTER if the data is null + * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater than itemCount + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + [Throws, NeedsSubjectPrincipal, UseCounter] + void mozSetDataAt(DOMString format, any data, unsigned long index); + + /** + * Retrieve the data associated with the given format for an item at the + * specified index, or null if it does not exist. The index should be in the + * range from zero to itemCount - 1. + * + * @param format the format of the data to look up + * @returns the data of the given format, or null if it doesn't exist. + * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount + */ + [Throws, NeedsSubjectPrincipal, UseCounter] + any mozGetDataAt(DOMString format, unsigned long index); + + /** + * Update the drag image. Arguments are the same as setDragImage. This is only + * valid within the parent chrome process. + */ + [ChromeOnly] + void updateDragImage(Element image, long x, long y); + + /** + * Will be true when the user has cancelled the drag (typically by pressing + * Escape) and when the drag has been cancelled unexpectedly. This will be + * false otherwise, including when the drop has been rejected by its target. + * This property is only relevant for the dragend event. + */ + [UseCounter] + readonly attribute boolean mozUserCancelled; + + /** + * The node that the mouse was pressed over to begin the drag. For external + * drags, or if the caller cannot access this node, this will be null. + */ + [UseCounter] + readonly attribute Node? mozSourceNode; + + /** + * The URI spec of the triggering principal. This may be different than + * sourceNode's principal when sourceNode is xul:browser and the drag is + * triggered in a browsing context inside it. + */ + [ChromeOnly] + readonly attribute DOMString mozTriggeringPrincipalURISpec; + + /** + * Copy the given DataTransfer for the given event. Used by testing code for + * creating emulated Drag and Drop events in the UI. + * + * NOTE: Don't expose a DataTransfer produced with this method to the web or + * use this for non-testing purposes. It can easily be used to get the + * DataTransfer into an invalid state, and is an unstable implementation + * detail of EventUtils.synthesizeDrag. + */ + [Throws, ChromeOnly] + DataTransfer mozCloneForEvent(DOMString event); +}; diff --git a/crates/web-sys/webidls/available/DataTransferItem.webidl b/crates/web-sys/webidls/available/DataTransferItem.webidl new file mode 100644 index 00000000..44949810 --- /dev/null +++ b/crates/web-sys/webidls/available/DataTransferItem.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * https://html.spec.whatwg.org/multipage/interaction.html#the-datatransferitem-interface + */ + +interface DataTransferItem { + readonly attribute DOMString kind; + readonly attribute DOMString type; + [Throws, NeedsSubjectPrincipal] + void getAsString(FunctionStringCallback? _callback); + [Throws, NeedsSubjectPrincipal] + File? getAsFile(); +}; + +callback FunctionStringCallback = void (DOMString data); + +partial interface DataTransferItem { + [Pref="dom.webkitBlink.filesystem.enabled", BinaryName="getAsEntry", Throws, + NeedsSubjectPrincipal] + FileSystemEntry? webkitGetAsEntry(); +}; diff --git a/crates/web-sys/webidls/available/DataTransferItemList.webidl b/crates/web-sys/webidls/available/DataTransferItemList.webidl new file mode 100644 index 00000000..079afdd1 --- /dev/null +++ b/crates/web-sys/webidls/available/DataTransferItemList.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * https://html.spec.whatwg.org/multipage/interaction.html#the-datatransferitemlist-interface + */ + +interface DataTransferItemList { + readonly attribute unsigned long length; + getter DataTransferItem (unsigned long index); + [Throws, NeedsSubjectPrincipal] + DataTransferItem? add(DOMString data, DOMString type); + [Throws, NeedsSubjectPrincipal] + DataTransferItem? add(File data); + [Throws, NeedsSubjectPrincipal] + void remove(unsigned long index); + [Throws, NeedsSubjectPrincipal] + void clear(); +}; diff --git a/crates/web-sys/webidls/available/DecoderDoctorNotification.webidl b/crates/web-sys/webidls/available/DecoderDoctorNotification.webidl new file mode 100644 index 00000000..c994918b --- /dev/null +++ b/crates/web-sys/webidls/available/DecoderDoctorNotification.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +enum DecoderDoctorNotificationType { + "cannot-play", + "platform-decoder-not-found", + "can-play-but-some-missing-decoders", + "cannot-initialize-pulseaudio", + "unsupported-libavcodec", + "decode-error", + "decode-warning", +}; + +dictionary DecoderDoctorNotification { + required DecoderDoctorNotificationType type; + // True when the issue has been solved. + required boolean isSolved; + // Key from dom.properties, used for telemetry and prefs. + required DOMString decoderDoctorReportId; + // If provided, formats (or key systems) at issue. + DOMString formats; + // If provided, technical details about the decode-error/warning. + DOMString decodeIssue; + // If provided, URL of the document where the issue happened. + DOMString docURL; + // If provided, URL of the media resource that caused a decode-error/warning. + DOMString resourceURL; +}; diff --git a/crates/web-sys/webidls/available/DedicatedWorkerGlobalScope.webidl b/crates/web-sys/webidls/available/DedicatedWorkerGlobalScope.webidl new file mode 100644 index 00000000..57b48839 --- /dev/null +++ b/crates/web-sys/webidls/available/DedicatedWorkerGlobalScope.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#the-workerglobalscope-common-interface + * + * © 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. + */ + +[Global=(Worker,DedicatedWorker), + Exposed=DedicatedWorker] +interface DedicatedWorkerGlobalScope : WorkerGlobalScope { + [Replaceable] + readonly attribute DOMString name; + + [Throws] + void postMessage(any message, optional sequence transfer = []); + + void close(); + + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; diff --git a/crates/web-sys/webidls/available/DelayNode.webidl b/crates/web-sys/webidls/available/DelayNode.webidl new file mode 100644 index 00000000..02575bc5 --- /dev/null +++ b/crates/web-sys/webidls/available/DelayNode.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary DelayOptions : AudioNodeOptions { + double maxDelayTime = 1; + double delayTime = 0; +}; + +[Pref="dom.webaudio.enabled", + Constructor(BaseAudioContext context, optional DelayOptions options)] +interface DelayNode : AudioNode { + + readonly attribute AudioParam delayTime; + +}; + +// Mozilla extension +DelayNode implements AudioNodePassThrough; + diff --git a/crates/web-sys/webidls/available/DeviceLightEvent.webidl b/crates/web-sys/webidls/available/DeviceLightEvent.webidl new file mode 100644 index 00000000..8b44d2f0 --- /dev/null +++ b/crates/web-sys/webidls/available/DeviceLightEvent.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Pref="device.sensors.ambientLight.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", Constructor(DOMString type, optional DeviceLightEventInit eventInitDict)] +interface DeviceLightEvent : Event +{ + readonly attribute unrestricted double value; +}; + +dictionary DeviceLightEventInit : EventInit +{ + unrestricted double value = Infinity; +}; diff --git a/crates/web-sys/webidls/available/DeviceMotionEvent.webidl b/crates/web-sys/webidls/available/DeviceMotionEvent.webidl new file mode 100644 index 00000000..851b913e --- /dev/null +++ b/crates/web-sys/webidls/available/DeviceMotionEvent.webidl @@ -0,0 +1,57 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[NoInterfaceObject] +interface DeviceAcceleration { + readonly attribute double? x; + readonly attribute double? y; + readonly attribute double? z; +}; + +[NoInterfaceObject] +interface DeviceRotationRate { + readonly attribute double? alpha; + readonly attribute double? beta; + readonly attribute double? gamma; +}; + +[Pref="device.sensors.motion.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", Constructor(DOMString type, optional DeviceMotionEventInit eventInitDict)] +interface DeviceMotionEvent : Event { + readonly attribute DeviceAcceleration? acceleration; + readonly attribute DeviceAcceleration? accelerationIncludingGravity; + readonly attribute DeviceRotationRate? rotationRate; + readonly attribute double? interval; +}; + +dictionary DeviceAccelerationInit { + double? x = null; + double? y = null; + double? z = null; +}; + +dictionary DeviceRotationRateInit { + double? alpha = null; + double? beta = null; + double? gamma = null; +}; + +dictionary DeviceMotionEventInit : EventInit { + DeviceAccelerationInit acceleration; + DeviceAccelerationInit accelerationIncludingGravity; + DeviceRotationRateInit rotationRate; + double? interval = null; +}; + +// Mozilla extensions. +partial interface DeviceMotionEvent { + void initDeviceMotionEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional DeviceAccelerationInit acceleration, + optional DeviceAccelerationInit accelerationIncludingGravity, + optional DeviceRotationRateInit rotationRate, + optional double? interval = null); +}; diff --git a/crates/web-sys/webidls/available/DeviceOrientationEvent.webidl b/crates/web-sys/webidls/available/DeviceOrientationEvent.webidl new file mode 100644 index 00000000..511add55 --- /dev/null +++ b/crates/web-sys/webidls/available/DeviceOrientationEvent.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Pref="device.sensors.orientation.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", Constructor(DOMString type, optional DeviceOrientationEventInit eventInitDict), LegacyEventInit] +interface DeviceOrientationEvent : Event +{ + readonly attribute double? alpha; + readonly attribute double? beta; + readonly attribute double? gamma; + readonly attribute boolean absolute; + + // initDeviceOrientationEvent is a Gecko specific deprecated method. + void initDeviceOrientationEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional double? alpha = null, + optional double? beta = null, + optional double? gamma = null, + optional boolean absolute = false); +}; + +dictionary DeviceOrientationEventInit : EventInit +{ + double? alpha = null; + double? beta = null; + double? gamma = null; + boolean absolute = false; +}; diff --git a/crates/web-sys/webidls/available/DeviceProximityEvent.webidl b/crates/web-sys/webidls/available/DeviceProximityEvent.webidl new file mode 100644 index 00000000..70ee70b3 --- /dev/null +++ b/crates/web-sys/webidls/available/DeviceProximityEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Pref="device.sensors.proximity.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", Constructor(DOMString type, optional DeviceProximityEventInit eventInitDict)] +interface DeviceProximityEvent : Event +{ + readonly attribute double value; + readonly attribute double min; + readonly attribute double max; +}; + +dictionary DeviceProximityEventInit : EventInit +{ + unrestricted double value = Infinity; + unrestricted double min = -Infinity; + unrestricted double max = Infinity; +}; diff --git a/crates/web-sys/webidls/available/Directory.webidl b/crates/web-sys/webidls/available/Directory.webidl new file mode 100644 index 00000000..942d50c7 --- /dev/null +++ b/crates/web-sys/webidls/available/Directory.webidl @@ -0,0 +1,53 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + * All functions on Directory that accept DOMString arguments for file or + * directory names only allow relative path to current directory itself. The + * path should be a descendent path like "path/to/file.txt" and not contain a + * segment of ".." or ".". So the paths aren't allowed to walk up the directory + * tree. For example, paths like "../foo", "..", "/foo/bar" or "foo/../bar" are + * not allowed. + * + * http://w3c.github.io/filesystem-api/#idl-def-Directory + * https://microsoftedge.github.io/directory-upload/proposal.html#directory-interface + */ + +// This chromeConstructor is used by the MockFilePicker for testing only. +[ChromeConstructor(DOMString path), + Exposed=(Window,Worker)] +interface Directory { + /* + * The leaf name of the directory. + */ + [Throws] + readonly attribute DOMString name; +}; + +[Exposed=(Window,Worker)] +partial interface Directory { + // Already defined in the main interface declaration: + //readonly attribute DOMString name; + + /* + * The path of the Directory (includes both its basename and leafname). + * The path begins with the name of the ancestor Directory that was + * originally exposed to content (say via a directory picker) and traversed + * to obtain this Directory. Full filesystem paths are not exposed to + * unprivilaged content. + */ + [Throws] + readonly attribute DOMString path; + + /* + * Getter for the immediate children of this directory. + */ + [Throws] + Promise> getFilesAndDirectories(); + + [Throws] + Promise> getFiles(optional boolean recursiveFlag = false); +}; diff --git a/crates/web-sys/webidls/available/Document.webidl b/crates/web-sys/webidls/available/Document.webidl new file mode 100644 index 00000000..eaf8feae --- /dev/null +++ b/crates/web-sys/webidls/available/Document.webidl @@ -0,0 +1,508 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://dom.spec.whatwg.org/#interface-document + * https://html.spec.whatwg.org/multipage/dom.html#the-document-object + * https://html.spec.whatwg.org/multipage/obsolete.html#other-elements%2C-attributes-and-apis + * https://fullscreen.spec.whatwg.org/#api + * https://w3c.github.io/pointerlock/#extensions-to-the-document-interface + * https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin + * https://w3c.github.io/page-visibility/#extensions-to-the-document-interface + * https://drafts.csswg.org/cssom/#extensions-to-the-document-interface + * https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface + */ + +interface WindowProxy; +interface nsISupports; +interface URI; +interface nsIDocShell; +interface nsILoadGroup; + +enum VisibilityState { "hidden", "visible" }; + +/* https://dom.spec.whatwg.org/#dictdef-elementcreationoptions */ +dictionary ElementCreationOptions { + DOMString is; + + [ChromeOnly] + DOMString pseudo; +}; + +/* https://dom.spec.whatwg.org/#interface-document */ +[Constructor] +interface Document : Node { + [Throws] + readonly attribute DOMImplementation implementation; + [Pure, Throws, BinaryName="documentURIFromJS", NeedsCallerType] + readonly attribute DOMString URL; + [Pure, Throws, BinaryName="documentURIFromJS", NeedsCallerType] + readonly attribute DOMString documentURI; + [Pure] + readonly attribute DOMString compatMode; + [Pure] + readonly attribute DOMString characterSet; + [Pure,BinaryName="characterSet"] + readonly attribute DOMString charset; // legacy alias of .characterSet + [Pure,BinaryName="characterSet"] + readonly attribute DOMString inputEncoding; // legacy alias of .characterSet + [Pure] + readonly attribute DOMString contentType; + + [Pure] + readonly attribute DocumentType? doctype; + [Pure] + readonly attribute Element? documentElement; + [Pure] + HTMLCollection getElementsByTagName(DOMString localName); + [Pure, Throws] + HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); + [Pure] + HTMLCollection getElementsByClassName(DOMString classNames); + [Pure] + Element? getElementById(DOMString elementId); + + [CEReactions, NewObject, Throws] + Element createElement(DOMString localName, optional (ElementCreationOptions or DOMString) options); + [CEReactions, NewObject, Throws] + Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional (ElementCreationOptions or DOMString) options); + [NewObject] + DocumentFragment createDocumentFragment(); + [NewObject] + Text createTextNode(DOMString data); + [NewObject] + Comment createComment(DOMString data); + [NewObject, Throws] + ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); + + [CEReactions, Throws] + Node importNode(Node node, optional boolean deep = false); + [CEReactions, Throws] + Node adoptNode(Node node); + + [NewObject, Throws, NeedsCallerType] + Event createEvent(DOMString interface); + + [NewObject, Throws] + Range createRange(); + + // NodeFilter.SHOW_ALL = 0xFFFFFFFF + [NewObject, Throws] + NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); + [NewObject, Throws] + TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); + + // NEW + // No support for prepend/append yet + // void prepend((Node or DOMString)... nodes); + // void append((Node or DOMString)... nodes); + + // These are not in the spec, but leave them for now for backwards compat. + // So sort of like Gecko extensions + [NewObject, Throws] + CDATASection createCDATASection(DOMString data); + [NewObject, Throws] + Attr createAttribute(DOMString name); + [NewObject, Throws] + Attr createAttributeNS(DOMString? namespace, DOMString name); +}; + +// https://html.spec.whatwg.org/multipage/dom.html#the-document-object +partial interface Document { + [PutForwards=href, Unforgeable] readonly attribute Location? location; + //(HTML only) attribute DOMString domain; + readonly attribute DOMString referrer; + //(HTML only) attribute DOMString cookie; + readonly attribute DOMString lastModified; + readonly attribute DOMString readyState; + + // DOM tree accessors + //(Not proxy yet)getter object (DOMString name); + [CEReactions, SetterThrows, Pure] + attribute DOMString title; + [CEReactions, Pure] + attribute DOMString dir; + [CEReactions, Pure, SetterThrows] + attribute HTMLElement? body; + [Pure] + 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; + [Pure] + NodeList getElementsByName(DOMString elementName); + //(Not implemented)readonly attribute DOMElementMap cssElementMap; + + // dynamic markup insertion + //(HTML only)Document open(optional DOMString type, optional DOMString replace); + //(HTML only)WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace); + //(HTML only)void close(); + //(HTML only)void write(DOMString... text); + //(HTML only)void writeln(DOMString... text); + + // user interaction + [Pure] + readonly attribute WindowProxy? defaultView; + [Throws] + boolean hasFocus(); + //(HTML only) attribute DOMString designMode; + //(HTML only)boolean execCommand(DOMString commandId); + //(HTML only)boolean execCommand(DOMString commandId, boolean showUI); + //(HTML only)boolean execCommand(DOMString commandId, boolean showUI, DOMString value); + //(HTML only)boolean queryCommandEnabled(DOMString commandId); + //(HTML only)boolean queryCommandIndeterm(DOMString commandId); + //(HTML only)boolean queryCommandState(DOMString commandId); + //(HTML only)boolean queryCommandSupported(DOMString commandId); + //(HTML only)DOMString queryCommandValue(DOMString commandId); + //(Not implemented)readonly attribute HTMLCollection commands; + + // special event handler IDL attributes that only apply to Document objects + [LenientThis] attribute EventHandler onreadystatechange; + + // Gecko extensions? + attribute EventHandler onbeforescriptexecute; + attribute EventHandler onafterscriptexecute; + + [Pref="dom.select_events.enabled"] + attribute EventHandler onselectionchange; + + /** + * True if this document is synthetic : stand alone image, video, audio file, + * etc. + */ + [Func="IsChromeOrXBL"] readonly attribute boolean mozSyntheticDocument; + /** + * Returns the script element whose script is currently being processed. + * + * @see + */ + [Pure] + readonly attribute Element? currentScript; + /** + * Release the current mouse capture if it is on an element within this + * document. + * + * @see + */ + void releaseCapture(); + /** + * Use the given DOM element as the source image of target |-moz-element()|. + * + * This function introduces a new special ID (called "image element ID"), + * which is only used by |-moz-element()|, and associates it with the given + * DOM element. Image elements ID's have the higher precedence than general + * HTML id's, so if |document.mozSetImageElement(, )| is called, + * |-moz-element(#)| uses || as the source image even if there + * is another element with id attribute = ||. To unregister an image + * element ID ||, call |document.mozSetImageElement(, null)|. + * + * Example: + * + *
+ * + * @param aImageElementId an image element ID to associate with + * |aImageElement| + * @param aImageElement a DOM element to be used as the source image of + * |-moz-element(#aImageElementId)|. If this is null, the function will + * unregister the image element ID |aImageElementId|. + * + * @see + */ + void mozSetImageElement(DOMString aImageElementId, + Element? aImageElement); + + [ChromeOnly] + readonly attribute URI? documentURIObject; + + /** + * Current referrer policy - one of the REFERRER_POLICY_* constants + * from nsIHttpChannel. + */ + [ChromeOnly] + readonly attribute unsigned long referrerPolicy; + +}; + +// https://html.spec.whatwg.org/multipage/obsolete.html#other-elements%2C-attributes-and-apis +partial interface Document { + //(HTML only)[CEReactions] attribute [TreatNullAs=EmptyString] DOMString fgColor; + //(HTML only)[CEReactions] attribute [TreatNullAs=EmptyString] DOMString linkColor; + //(HTML only)[CEReactions] attribute [TreatNullAs=EmptyString] DOMString vlinkColor; + //(HTML only)[CEReactions] attribute [TreatNullAs=EmptyString] DOMString alinkColor; + //(HTML only)[CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor; + + [SameObject] readonly attribute HTMLCollection anchors; + [SameObject] readonly attribute HTMLCollection applets; + + //(HTML only)void clear(); + //(HTML only)void captureEvents(); + //(HTML only)void releaseEvents(); + + //(HTML only)[SameObject] readonly attribute HTMLAllCollection all; +}; + +// https://fullscreen.spec.whatwg.org/#api +partial interface Document { + // Note: Per spec the 'S' in these two is lowercase, but the "Moz" + // versions have it uppercase. + [LenientSetter, Unscopable, Func="nsDocument::IsUnprefixedFullscreenEnabled"] + readonly attribute boolean fullscreen; + [BinaryName="fullscreen"] + readonly attribute boolean mozFullScreen; + [LenientSetter, Func="nsDocument::IsUnprefixedFullscreenEnabled", NeedsCallerType] + readonly attribute boolean fullscreenEnabled; + [BinaryName="fullscreenEnabled", NeedsCallerType] + readonly attribute boolean mozFullScreenEnabled; + + [Func="nsDocument::IsUnprefixedFullscreenEnabled"] + void exitFullscreen(); + [BinaryName="exitFullscreen"] + void mozCancelFullScreen(); + + // Events handlers + [Func="nsDocument::IsUnprefixedFullscreenEnabled"] + attribute EventHandler onfullscreenchange; + [Func="nsDocument::IsUnprefixedFullscreenEnabled"] + attribute EventHandler onfullscreenerror; +}; + +// https://w3c.github.io/pointerlock/#extensions-to-the-document-interface +// https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin +partial interface Document { + void exitPointerLock(); + + // Event handlers + attribute EventHandler onpointerlockchange; + attribute EventHandler onpointerlockerror; +}; + +// https://w3c.github.io/page-visibility/#extensions-to-the-document-interface +partial interface Document { + readonly attribute boolean hidden; + readonly attribute VisibilityState visibilityState; + attribute EventHandler onvisibilitychange; +}; + +// https://drafts.csswg.org/cssom/#extensions-to-the-document-interface +partial interface Document { + attribute DOMString? selectedStyleSheetSet; + readonly attribute DOMString? lastStyleSheetSet; + readonly attribute DOMString? preferredStyleSheetSet; + [Constant] + readonly attribute DOMStringList styleSheetSets; + void enableStyleSheetsForSet (DOMString? name); +}; + +// https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface +partial interface Document { + CaretPosition? caretPositionFromPoint (float x, float y); + + readonly attribute Element? scrollingElement; +}; + +// http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions +partial interface Document { + [Throws, Pure] + Element? querySelector(DOMString selectors); + [Throws, Pure] + NodeList querySelectorAll(DOMString selectors); + + //(Not implemented)Element? find(DOMString selectors, optional (Element or sequence)? refNodes); + //(Not implemented)NodeList findAll(DOMString selectors, optional (Element or sequence)? refNodes); +}; + +// https://drafts.csswg.org/web-animations/#extensions-to-the-document-interface +partial interface Document { + [Func="nsDocument::IsWebAnimationsEnabled"] + readonly attribute DocumentTimeline timeline; + [Func="nsDocument::IsWebAnimationsEnabled"] + sequence getAnimations(); +}; + +// https://svgwg.org/svg2-draft/struct.html#InterfaceDocumentExtensions +partial interface Document { + [BinaryName="SVGRootElement"] + readonly attribute SVGSVGElement? rootElement; +}; + +// Mozilla extensions of various sorts +partial interface Document { + // XBL support. Wish we could make these [ChromeOnly], but + // that would likely break bindings running with the page principal. + [Func="IsChromeOrXBL"] + NodeList? getAnonymousNodes(Element elt); + [Func="IsChromeOrXBL"] + Element? getAnonymousElementByAttribute(Element elt, DOMString attrName, + DOMString attrValue); + [Func="IsChromeOrXBL"] + Element? getBindingParent(Node node); + [Throws, Func="IsChromeOrXBL", NeedsSubjectPrincipal] + void loadBindingDocument(DOMString documentURL); + + // Touch bits + // XXXbz I can't find the sane spec for this stuff, so just cribbing + // from our xpidl for now. + [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"] + Touch createTouch(optional Window? view = null, + optional EventTarget? target = null, + optional long identifier = 0, + optional long pageX = 0, + optional long pageY = 0, + optional long screenX = 0, + optional long screenY = 0, + optional long clientX = 0, + optional long clientY = 0, + optional long radiusX = 0, + optional long radiusY = 0, + optional float rotationAngle = 0, + optional float force = 0); + // XXXbz a hack to get around the fact that we don't support variadics as + // distinguishing arguments yet. Once this hack is removed. we can also + // remove the corresponding overload on nsIDocument, since Touch... and + // sequence look the same in the C++. + [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"] + TouchList createTouchList(Touch touch, Touch... touches); + // XXXbz and another hack for the fact that we can't usefully have optional + // distinguishing arguments but need a working zero-arg form of + // createTouchList(). + [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"] + TouchList createTouchList(); + [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"] + TouchList createTouchList(sequence touches); + + [ChromeOnly] + attribute boolean styleSheetChangeEventsEnabled; + + [ChromeOnly, Throws] + void obsoleteSheet(URI sheetURI); + [ChromeOnly, Throws] + void obsoleteSheet(DOMString sheetURI); + + [ChromeOnly] readonly attribute nsIDocShell? docShell; + + [ChromeOnly] readonly attribute DOMString contentLanguage; + + [ChromeOnly] readonly attribute nsILoadGroup? documentLoadGroup; + + // Blocks the initial document parser until the given promise is settled. + [ChromeOnly, Throws] + Promise blockParsing(Promise promise, + optional BlockParsingOptions options); + + // like documentURI, except that for error pages, it returns the URI we were + // trying to load when we hit an error, rather than the error page's own URI. + [ChromeOnly] readonly attribute URI? mozDocumentURIIfNotForErrorPages; + + // A promise that is resolved, with this document itself, when we have both + // fired DOMContentLoaded and are ready to start layout. This is used for the + // "document_idle" webextension script injection point. + [ChromeOnly, Throws] + readonly attribute Promise documentReadyForIdle; +}; + +dictionary BlockParsingOptions { + /** + * If true, blocks script-created parsers (created via document.open()) in + * addition to network-created parsers. + */ + boolean blockScriptCreated = true; +}; + +// Extension to give chrome JS the ability to determine when a document was +// created to satisfy an iframe with srcdoc attribute. +partial interface Document { + [ChromeOnly] readonly attribute boolean isSrcdocDocument; +}; + + +// Extension to give chrome JS the ability to get the underlying +// sandbox flag attribute +partial interface Document { + [ChromeOnly] readonly attribute DOMString? sandboxFlagsAsString; +}; + + +/** + * Chrome document anonymous content management. + * This is a Chrome-only API that allows inserting fixed positioned anonymous + * content on top of the current page displayed in the document. + * The supplied content is cloned and inserted into the document's CanvasFrame. + * Note that this only works for HTML documents. + */ +partial interface Document { + /** + * Deep-clones the provided element and inserts it into the CanvasFrame. + * Returns an AnonymousContent instance that can be used to manipulate the + * inserted element. + */ + [ChromeOnly, NewObject, Throws] + AnonymousContent insertAnonymousContent(Element aElement); + + /** + * Removes the element inserted into the CanvasFrame given an AnonymousContent + * instance. + */ + [ChromeOnly, Throws] + void removeAnonymousContent(AnonymousContent aContent); +}; + +// http://w3c.github.io/selection-api/#extensions-to-document-interface +partial interface Document { + [Throws] + Selection? getSelection(); +}; + +// Extension to give chrome JS the ability to determine whether +// the user has interacted with the document or not. +partial interface Document { + [ChromeOnly] readonly attribute boolean userHasInteracted; +}; + +// Extension to give chrome JS the ability to simulate activate the docuement +// by user gesture. +partial interface Document { + [ChromeOnly] + void notifyUserGestureActivation(); +}; + +// Extension to give chrome and XBL JS the ability to determine whether +// the document is sandboxed without permission to run scripts +// and whether inline scripts are blocked by the document's CSP. +partial interface Document { + [Func="IsChromeOrXBL"] readonly attribute boolean hasScriptsBlockedBySandbox; + [Func="IsChromeOrXBL"] readonly attribute boolean inlineScriptAllowedByCSP; +}; + +// For more information on Flash classification, see +// toolkit/components/url-classifier/flash-block-lists.rst +enum FlashClassification { + "unclassified", // Denotes a classification that has not yet been computed. + // Allows for lazy classification. + "unknown", // Site is not on the whitelist or blacklist + "allowed", // Site is on the Flash whitelist + "denied" // Site is on the Flash blacklist +}; +partial interface Document { + [ChromeOnly] + readonly attribute FlashClassification documentFlashClassification; +}; + +Document implements XPathEvaluator; +Document implements GlobalEventHandlers; +Document implements DocumentAndElementEventHandlers; +Document implements TouchEventHandlers; +Document implements ParentNode; +Document implements OnErrorEventHandlerForNodes; +Document implements GeometryUtils; +Document implements FontFaceSource; +Document implements DocumentOrShadowRoot; diff --git a/crates/web-sys/webidls/available/DocumentFragment.webidl b/crates/web-sys/webidls/available/DocumentFragment.webidl new file mode 100644 index 00000000..0f814666 --- /dev/null +++ b/crates/web-sys/webidls/available/DocumentFragment.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120405/#interface-documentfragment + * http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor] +interface DocumentFragment : Node { + Element? getElementById(DOMString elementId); +}; + +// http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions +partial interface DocumentFragment { + [Throws] + Element? querySelector(DOMString selectors); + [Throws] + NodeList querySelectorAll(DOMString selectors); +}; + +DocumentFragment implements ParentNode; diff --git a/crates/web-sys/webidls/available/DocumentOrShadowRoot.webidl b/crates/web-sys/webidls/available/DocumentOrShadowRoot.webidl new file mode 100644 index 00000000..8a288f61 --- /dev/null +++ b/crates/web-sys/webidls/available/DocumentOrShadowRoot.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#documentorshadowroot + * http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin + */ + +[NoInterfaceObject] +interface DocumentOrShadowRoot { + // Not implemented yet: bug 1430308. + // Selection? getSelection(); + Element? elementFromPoint (float x, float y); + sequence elementsFromPoint (float x, float y); + // Not implemented yet: bug 1430307. + // CaretPosition? caretPositionFromPoint (float x, float y); + + readonly attribute Element? activeElement; + readonly attribute StyleSheetList styleSheets; + + readonly attribute Element? pointerLockElement; + [LenientSetter, Func="nsIDocument::IsUnprefixedFullscreenEnabled"] + readonly attribute Element? fullscreenElement; + [BinaryName="fullscreenElement"] + readonly attribute Element? mozFullScreenElement; +}; diff --git a/crates/web-sys/webidls/available/DocumentTimeline.webidl b/crates/web-sys/webidls/available/DocumentTimeline.webidl new file mode 100644 index 00000000..c618a20b --- /dev/null +++ b/crates/web-sys/webidls/available/DocumentTimeline.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#documenttimeline + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary DocumentTimelineOptions { + DOMHighResTimeStamp originTime = 0; +}; + +[Func="nsDocument::IsWebAnimationsEnabled", + Constructor (optional DocumentTimelineOptions options)] +interface DocumentTimeline : AnimationTimeline { +}; diff --git a/crates/web-sys/webidls/available/DocumentType.webidl b/crates/web-sys/webidls/available/DocumentType.webidl new file mode 100644 index 00000000..89190266 --- /dev/null +++ b/crates/web-sys/webidls/available/DocumentType.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#documenttype + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface DocumentType : Node { + readonly attribute DOMString name; + readonly attribute DOMString publicId; + readonly attribute DOMString systemId; +}; + +DocumentType implements ChildNode; diff --git a/crates/web-sys/webidls/available/DragEvent.webidl b/crates/web-sys/webidls/available/DragEvent.webidl new file mode 100644 index 00000000..80617779 --- /dev/null +++ b/crates/web-sys/webidls/available/DragEvent.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Constructor(DOMString type, optional DragEventInit eventInitDict)] +interface DragEvent : MouseEvent +{ + readonly attribute DataTransfer? dataTransfer; + + void initDragEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional Window? aView = null, + optional long aDetail = 0, + optional long aScreenX = 0, + optional long aScreenY = 0, + optional long aClientX = 0, + optional long aClientY = 0, + optional boolean aCtrlKey = false, + optional boolean aAltKey = false, + optional boolean aShiftKey = false, + optional boolean aMetaKey = false, + optional unsigned short aButton = 0, + optional EventTarget? aRelatedTarget = null, + optional DataTransfer? aDataTransfer = null); +}; + +dictionary DragEventInit : MouseEventInit +{ + DataTransfer? dataTransfer = null; +}; diff --git a/crates/web-sys/webidls/available/DynamicsCompressorNode.webidl b/crates/web-sys/webidls/available/DynamicsCompressorNode.webidl new file mode 100644 index 00000000..78170756 --- /dev/null +++ b/crates/web-sys/webidls/available/DynamicsCompressorNode.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary DynamicsCompressorOptions : AudioNodeOptions { + float attack = 0.003; + float knee = 30; + float ratio = 12; + float release = 0.25; + float threshold = -24; +}; + +[Pref="dom.webaudio.enabled", + Constructor(BaseAudioContext context, optional DynamicsCompressorOptions options)] +interface DynamicsCompressorNode : AudioNode { + + readonly attribute AudioParam threshold; // in Decibels + readonly attribute AudioParam knee; // in Decibels + readonly attribute AudioParam ratio; // unit-less + readonly attribute float reduction; // in Decibels + readonly attribute AudioParam attack; // in Seconds + readonly attribute AudioParam release; // in Seconds + +}; + +// Mozilla extension +DynamicsCompressorNode implements AudioNodePassThrough; + diff --git a/crates/web-sys/webidls/available/Element.webidl b/crates/web-sys/webidls/available/Element.webidl new file mode 100644 index 00000000..52013769 --- /dev/null +++ b/crates/web-sys/webidls/available/Element.webidl @@ -0,0 +1,291 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#element and + * http://domparsing.spec.whatwg.org/ 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. + */ + +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; + [Constant, PutForwards=value] + readonly attribute DOMTokenList classList; + + [SameObject] + readonly attribute NamedNodeMap attributes; + [Pure] + sequence getAttributeNames(); + [Pure] + DOMString? getAttribute(DOMString name); + [Pure] + DOMString? getAttributeNS(DOMString? namespace, DOMString localName); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + boolean toggleAttribute(DOMString name, optional boolean force); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + void setAttribute(DOMString name, DOMString value); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + void setAttributeNS(DOMString? namespace, DOMString name, DOMString value); + [CEReactions, Throws] + void removeAttribute(DOMString name); + [CEReactions, Throws] + void removeAttributeNS(DOMString? namespace, DOMString localName); + [Pure] + boolean hasAttribute(DOMString name); + [Pure] + boolean hasAttributeNS(DOMString? namespace, DOMString localName); + [Pure] + boolean hasAttributes(); + + [Throws, Pure] + Element? closest(DOMString selector); + + [Throws, Pure] + boolean matches(DOMString selector); + [Throws, Pure, BinaryName="matches"] + boolean webkitMatchesSelector(DOMString selector); + + [Pure] + HTMLCollection getElementsByTagName(DOMString localName); + [Throws, Pure] + HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); + [Pure] + HTMLCollection getElementsByClassName(DOMString classNames); + [ChromeOnly, Pure] + sequence getElementsWithGrid(); + + [CEReactions, Throws, Pure] + Element? insertAdjacentElement(DOMString where, Element element); // historical + + [Throws] + void insertAdjacentText(DOMString where, DOMString data); // historical + + /** + * The ratio of font-size-inflated text font size to computed font + * size for this element. This will query the element for its primary frame, + * and then use this to get font size inflation information about the frame. + * This will be 1.0 if font size inflation is not enabled, and -1.0 if an + * error occurred during the retrieval of the font size inflation. + * + * @note The font size inflation ratio that is returned is actually the + * font size inflation data for the element's _primary frame_, not the + * element itself, but for most purposes, this should be sufficient. + */ + [ChromeOnly] + readonly attribute float fontSizeInflation; + + // Selectors API + /** + * Returns whether this element would be selected by the given selector + * string. + * + * See + */ + [Throws, Pure, BinaryName="matches"] + boolean mozMatchesSelector(DOMString selector); + + // Pointer events methods. + [Throws, Pref="dom.w3c_pointer_events.enabled"] + void setPointerCapture(long pointerId); + + [Throws, Pref="dom.w3c_pointer_events.enabled"] + void releasePointerCapture(long pointerId); + + [Pref="dom.w3c_pointer_events.enabled"] + boolean hasPointerCapture(long pointerId); + + // Proprietary extensions + /** + * Set this during a mousedown event to grab and retarget all mouse events + * to this element until the mouse button is released or releaseCapture is + * called. If retargetToElement is true, then all events are targetted at + * this element. If false, events can also fire at descendants of this + * element. + * + */ + void setCapture(optional boolean retargetToElement = false); + + /** + * If this element has captured the mouse, release the capture. If another + * element has captured the mouse, this method has no effect. + */ + void releaseCapture(); + + /* + * Chrome-only version of setCapture that works outside of a mousedown event. + */ + [ChromeOnly] + void setCaptureAlways(optional boolean retargetToElement = false); + + // Mozilla extensions + + // Obsolete methods. + Attr? getAttributeNode(DOMString name); + [CEReactions, Throws] + Attr? setAttributeNode(Attr newAttr); + [CEReactions, Throws] + Attr? removeAttributeNode(Attr oldAttr); + Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName); + [CEReactions, Throws] + Attr? setAttributeNodeNS(Attr newAttr); + + [ChromeOnly] + /** + * Scrolls the element by (dx, dy) CSS pixels without doing any + * layout flushing. + */ + boolean scrollByNoFlush(long dx, long dy); + + // Support reporting of Flexbox properties + /** + * If this element has a display:flex or display:inline-flex style, + * this property returns an object with computed values for flex + * properties, as well as a property that exposes the flex lines + * in this container. + */ + [ChromeOnly, Pure] + Flex? getAsFlexContainer(); + + // Support reporting of Grid properties + /** + * If this element has a display:grid or display:inline-grid style, + * this property returns an object with computed values for grid + * tracks and lines. + */ + [ChromeOnly, Pure] + sequence getGridFragments(); + + [ChromeOnly] + DOMMatrixReadOnly getTransformToAncestor(Element ancestor); + [ChromeOnly] + DOMMatrixReadOnly getTransformToParent(); + [ChromeOnly] + DOMMatrixReadOnly getTransformToViewport(); +}; + +// http://dev.w3.org/csswg/cssom-view/ +enum ScrollLogicalPosition { "start", "center", "end", "nearest" }; +dictionary ScrollIntoViewOptions : ScrollOptions { + ScrollLogicalPosition block = "start"; + ScrollLogicalPosition inline = "nearest"; +}; + +// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface +partial interface Element { + DOMRectList getClientRects(); + DOMRect getBoundingClientRect(); + + // scrolling + void scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg); + // None of the CSSOM attributes are [Pure], because they flush + attribute long scrollTop; // scroll on setting + attribute long scrollLeft; // scroll on setting + readonly attribute long scrollWidth; + readonly attribute long scrollHeight; + + void scroll(unrestricted double x, unrestricted double y); + void scroll(optional ScrollToOptions options); + void scrollTo(unrestricted double x, unrestricted double y); + void scrollTo(optional ScrollToOptions options); + void scrollBy(unrestricted double x, unrestricted double y); + void scrollBy(optional ScrollToOptions options); + // mozScrollSnap is used by chrome to perform scroll snapping after the + // user performs actions that may affect scroll position + // mozScrollSnap is deprecated, to be replaced by a web accessible API, such + // as an extension to the ScrollOptions dictionary. See bug 1137937. + [ChromeOnly] void mozScrollSnap(); + + readonly attribute long clientTop; + readonly attribute long clientLeft; + readonly attribute long clientWidth; + readonly attribute long clientHeight; + + // Mozilla specific stuff + /* The minimum/maximum offset that the element can be scrolled to + (i.e., the value that scrollLeft/scrollTop would be clamped to if they were + set to arbitrarily large values. */ + [ChromeOnly] readonly attribute long scrollTopMin; + readonly attribute long scrollTopMax; + [ChromeOnly] readonly attribute long scrollLeftMin; + readonly attribute long scrollLeftMax; +}; + +// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface +partial interface Element { + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, Pure, SetterThrows, GetterCanOOM, TreatNullAs=EmptyString] + attribute DOMString innerHTML; + [CEReactions, Pure,SetterThrows,TreatNullAs=EmptyString] + attribute DOMString outerHTML; + [CEReactions, Throws] + void insertAdjacentHTML(DOMString position, DOMString text); +}; + +// http://www.w3.org/TR/selectors-api/#interface-definitions +partial interface Element { + [Throws, Pure] + Element? querySelector(DOMString selectors); + [Throws, Pure] + NodeList querySelectorAll(DOMString selectors); +}; + +// https://dom.spec.whatwg.org/#dictdef-shadowrootinit +dictionary ShadowRootInit { + required ShadowRootMode mode; +}; + +// https://dom.spec.whatwg.org/#element +partial interface Element { + // Shadow DOM v1 + [Throws, Func="nsDocument::IsShadowDOMEnabled"] + ShadowRoot attachShadow(ShadowRootInit shadowRootInitDict); + [BinaryName="shadowRootByMode", Func="nsDocument::IsShadowDOMEnabled"] + readonly attribute ShadowRoot? shadowRoot; + + [ChromeOnly, Func="nsDocument::IsShadowDOMEnabled", BinaryName="shadowRoot"] + readonly attribute ShadowRoot? openOrClosedShadowRoot; + + [BinaryName="assignedSlotByMode", Func="nsDocument::IsShadowDOMEnabled"] + readonly attribute HTMLSlotElement? assignedSlot; + [CEReactions, Unscopable, SetterThrows, Func="nsDocument::IsShadowDOMEnabled"] + attribute DOMString slot; +}; + +Element implements ChildNode; +Element implements NonDocumentTypeChildNode; +Element implements ParentNode; +Element implements Animatable; +Element implements GeometryUtils; + +// https://fullscreen.spec.whatwg.org/#api +partial interface Element { + [Throws, Func="nsDocument::IsUnprefixedFullscreenEnabled", NeedsCallerType] + void requestFullscreen(); + [Throws, BinaryName="requestFullscreen", NeedsCallerType] + void mozRequestFullScreen(); +}; + +// https://w3c.github.io/pointerlock/#extensions-to-the-element-interface +partial interface Element { + [NeedsCallerType] + void requestPointerLock(); +}; diff --git a/crates/web-sys/webidls/available/ErrorEvent.webidl b/crates/web-sys/webidls/available/ErrorEvent.webidl new file mode 100644 index 00000000..cb858dff --- /dev/null +++ b/crates/web-sys/webidls/available/ErrorEvent.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +[Constructor(DOMString type, optional ErrorEventInit eventInitDict), + Exposed=(Window,Worker,System)] +interface ErrorEvent : Event +{ + 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 = 0; + unsigned long colno = 0; + any error = null; +}; diff --git a/crates/web-sys/webidls/available/EventHandler.webidl b/crates/web-sys/webidls/available/EventHandler.webidl new file mode 100644 index 00000000..bbddbd50 --- /dev/null +++ b/crates/web-sys/webidls/available/EventHandler.webidl @@ -0,0 +1,180 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#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. + */ +[TreatNonObjectAsNull] +callback EventHandlerNonNull = any (Event event); +typedef EventHandlerNonNull? EventHandler; + +[TreatNonObjectAsNull] +callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event); +typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler; + +[TreatNonObjectAsNull] +callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error); +typedef OnErrorEventHandlerNonNull? OnErrorEventHandler; + +[NoInterfaceObject] +interface GlobalEventHandlers { + attribute EventHandler onabort; + attribute EventHandler onblur; +// We think the spec is wrong here. See OnErrorEventHandlerForNodes/Window +// below. +// attribute OnErrorEventHandler onerror; + attribute EventHandler onfocus; + //(Not implemented)attribute EventHandler oncancel; + attribute EventHandler onauxclick; + attribute EventHandler oncanplay; + attribute EventHandler oncanplaythrough; + attribute EventHandler onchange; + attribute EventHandler onclick; + attribute EventHandler onclose; + attribute EventHandler oncontextmenu; + //(Not implemented)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 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 onloadend; + attribute EventHandler onloadstart; + attribute EventHandler onmousedown; + [LenientThis] attribute EventHandler onmouseenter; + [LenientThis] 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 onseeked; + attribute EventHandler onseeking; + attribute EventHandler onselect; + attribute EventHandler onshow; + //(Not implemented)attribute EventHandler onsort; + attribute EventHandler onstalled; + attribute EventHandler onsubmit; + attribute EventHandler onsuspend; + attribute EventHandler ontimeupdate; + attribute EventHandler onvolumechange; + attribute EventHandler onwaiting; + + [Pref="dom.select_events.enabled"] + attribute EventHandler onselectstart; + + attribute EventHandler ontoggle; + + // Pointer events handlers + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointercancel; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerdown; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerup; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointermove; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerout; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerover; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerenter; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerleave; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler ongotpointercapture; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onlostpointercapture; + + // Mozilla-specific handlers. Unprefixed handlers live in + // Document rather than here. + attribute EventHandler onmozfullscreenchange; + attribute EventHandler onmozfullscreenerror; + + // CSS-Animation and CSS-Transition handlers. + attribute EventHandler onanimationcancel; + attribute EventHandler onanimationend; + attribute EventHandler onanimationiteration; + attribute EventHandler onanimationstart; + attribute EventHandler ontransitioncancel; + attribute EventHandler ontransitionend; + attribute EventHandler ontransitionrun; + attribute EventHandler ontransitionstart; + + // CSS-Animation and CSS-Transition legacy handlers. + // This handler isn't standard. + attribute EventHandler onwebkitanimationend; + attribute EventHandler onwebkitanimationiteration; + attribute EventHandler onwebkitanimationstart; + attribute EventHandler onwebkittransitionend; +}; + +[NoInterfaceObject] +interface 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 onstorage; + attribute EventHandler onunload; +}; + +[NoInterfaceObject] +interface DocumentAndElementEventHandlers { + attribute EventHandler oncopy; + attribute EventHandler oncut; + attribute EventHandler onpaste; +}; + +// The spec has |attribute OnErrorEventHandler onerror;| on +// GlobalEventHandlers, and calls the handler differently depending on +// whether an ErrorEvent was fired. We don't do that, and until we do we'll +// need to distinguish between onerror on Window or on nodes. + +[NoInterfaceObject] +interface OnErrorEventHandlerForNodes { + attribute EventHandler onerror; +}; + +[NoInterfaceObject] +interface OnErrorEventHandlerForWindow { + attribute OnErrorEventHandler onerror; +}; diff --git a/crates/web-sys/webidls/available/EventListener.webidl b/crates/web-sys/webidls/available/EventListener.webidl new file mode 100644 index 00000000..46aa748d --- /dev/null +++ b/crates/web-sys/webidls/available/EventListener.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +callback interface EventListener { + void handleEvent(Event event); +}; diff --git a/crates/web-sys/webidls/available/EventSource.webidl b/crates/web-sys/webidls/available/EventSource.webidl new file mode 100644 index 00000000..f6d54c3b --- /dev/null +++ b/crates/web-sys/webidls/available/EventSource.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/comms.html#the-eventsource-interface + * + * © 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,DedicatedWorker,SharedWorker), + Constructor(USVString url, optional EventSourceInit eventSourceInitDict)] +interface EventSource : EventTarget { + [Constant] + readonly attribute DOMString url; + [Constant] + 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; + void close(); +}; + +dictionary EventSourceInit { + boolean withCredentials = false; +}; diff --git a/crates/web-sys/webidls/available/EventTarget.webidl b/crates/web-sys/webidls/available/EventTarget.webidl new file mode 100644 index 00000000..6af0f69a --- /dev/null +++ b/crates/web-sys/webidls/available/EventTarget.webidl @@ -0,0 +1,68 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + + +dictionary EventListenerOptions { + boolean capture = false; + /* Setting to true make the listener be added to the system group. */ + [Func="ThreadSafeIsChromeOrXBL"] + boolean mozSystemGroup = false; +}; + +dictionary AddEventListenerOptions : EventListenerOptions { + boolean passive; + boolean once = false; +}; + +[Constructor, + Exposed=(Window,Worker,WorkerDebugger,AudioWorklet,System)] +interface EventTarget { + /* Passing null for wantsUntrusted means "default behavior", which + differs in content and chrome. In content that default boolean + value is true, while in chrome the default boolean value is + false. */ + [Throws] + void addEventListener(DOMString type, + EventListener? listener, + optional (AddEventListenerOptions or boolean) options, + optional boolean? wantsUntrusted = null); + [Throws] + void removeEventListener(DOMString type, + EventListener? listener, + optional (EventListenerOptions or boolean) options); + [Throws, NeedsCallerType] + boolean dispatchEvent(Event event); +}; + +// Mozilla extensions for use by JS-implemented event targets to +// implement on* properties. +partial interface EventTarget { + // The use of [TreatNonCallableAsNull] here is a bit of a hack: it just makes + // the codegen check whether the type involved is either + // [TreatNonCallableAsNull] or [TreatNonObjectAsNull] and if it is handle it + // accordingly. In particular, it will NOT actually treat a non-null + // non-callable object as null here. + [ChromeOnly, Throws] + void setEventHandler(DOMString type, + [TreatNonCallableAsNull] EventHandler handler); + + [ChromeOnly] + EventHandler getEventHandler(DOMString type); +}; + +// Mozilla extension to make firing events on event targets from +// chrome easier. This returns the window which can be used to create +// events to fire at this EventTarget, or null if there isn't one. +partial interface EventTarget { + [ChromeOnly, Exposed=(Window,System), BinaryName="ownerGlobalForBindings"] + readonly attribute WindowProxy? ownerGlobal; +}; diff --git a/crates/web-sys/webidls/available/ExtendableEvent.webidl b/crates/web-sys/webidls/available/ExtendableEvent.webidl new file mode 100644 index 00000000..01dc545e --- /dev/null +++ b/crates/web-sys/webidls/available/ExtendableEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + */ + +[Constructor(DOMString type, optional ExtendableEventInit eventInitDict), + Exposed=ServiceWorker] +interface ExtendableEvent : Event { + // https://github.com/slightlyoff/ServiceWorker/issues/261 + [Throws] + void waitUntil(Promise p); +}; + +dictionary ExtendableEventInit : EventInit { + // Defined for the forward compatibility across the derived events +}; diff --git a/crates/web-sys/webidls/available/ExtendableMessageEvent.webidl b/crates/web-sys/webidls/available/ExtendableMessageEvent.webidl new file mode 100644 index 00000000..b2bdf679 --- /dev/null +++ b/crates/web-sys/webidls/available/ExtendableMessageEvent.webidl @@ -0,0 +1,44 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://w3c.github.io/ServiceWorker/#extendablemessage-event-section + */ + +[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), + Exposed=(ServiceWorker)] +interface ExtendableMessageEvent : ExtendableEvent { + /** + * Custom data associated with this event. + */ + [GetterThrows] + readonly attribute any data; + + /** + * The origin of the site from which this event originated. + */ + readonly attribute DOMString origin; + + /** + * The last event ID string of the event source. + */ + readonly attribute DOMString lastEventId; + + /** + * The client, service worker or port which originated this event. + */ + readonly attribute (Client or ServiceWorker or MessagePort)? source; + + [Constant, Cached, Frozen] + readonly attribute sequence ports; +}; + +dictionary ExtendableMessageEventInit : ExtendableEventInit { + any data = null; + DOMString origin = ""; + DOMString lastEventId = ""; + (Client or ServiceWorker or MessagePort)? source = null; + sequence ports = []; +}; diff --git a/crates/web-sys/webidls/available/External.webidl b/crates/web-sys/webidls/available/External.webidl new file mode 100644 index 00000000..91be6163 --- /dev/null +++ b/crates/web-sys/webidls/available/External.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[NoInterfaceObject, JSImplementation="@mozilla.org/sidebar;1"] +interface External +{ + void AddSearchProvider(DOMString aDescriptionURL); + unsigned long IsSearchProviderInstalled(DOMString aSearchURL); +}; diff --git a/crates/web-sys/webidls/available/FakePluginTagInit.webidl b/crates/web-sys/webidls/available/FakePluginTagInit.webidl new file mode 100644 index 00000000..714be875 --- /dev/null +++ b/crates/web-sys/webidls/available/FakePluginTagInit.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * A fake plugin is fundamentally identified by its handlerURI. + * + * In addition to that, a fake plugin registration needs to provide at least one + * FakePluginMimeEntry so we'll know what types(s) the plugin is registered for. + * Other information is optional, though having usable niceName is highly + * recommended. + */ +dictionary FakePluginTagInit { + required DOMString handlerURI; + required sequence mimeEntries; + + // The niceName should really be provided, and be unique, if possible; it can + // be used as a key to persist state for this plug-in. + DOMString niceName = ""; + + // Other things can be provided but don't really matter that much. + DOMString fullPath = ""; + DOMString name = ""; + DOMString description = ""; + DOMString fileName = ""; + DOMString version = ""; + + /** + * Optional script to run in a sandbox when instantiating a plugin. The script + * runs in a sandbox with system principal in the process that contains the + * element that instantiates the plugin (ie the EMBED or OBJECT element). The + * sandbox global has a 'pluginElement' property that the script can use to + * access the element that instantiates the plugin. + */ + DOMString sandboxScript = ""; +}; + +/** + * A single MIME entry for the fake plugin. + */ +dictionary FakePluginMimeEntry { + required DOMString type; + DOMString description = ""; + DOMString extension = ""; +}; + diff --git a/crates/web-sys/webidls/available/Fetch.webidl b/crates/web-sys/webidls/available/Fetch.webidl new file mode 100644 index 00000000..bbb1faf7 --- /dev/null +++ b/crates/web-sys/webidls/available/Fetch.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://fetch.spec.whatwg.org/ + */ + +typedef object JSON; +typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit; + +[NoInterfaceObject, Exposed=(Window,Worker)] +interface Body { + readonly attribute boolean bodyUsed; + [Throws] + Promise arrayBuffer(); + [Throws] + Promise blob(); + [Throws] + Promise formData(); + [Throws] + Promise json(); + [Throws] + Promise text(); +}; + +// These are helper dictionaries for the parsing of a +// getReader().read().then(data) parsing. +// See more about how these 2 helpers are used in +// dom/fetch/FetchStreamReader.cpp +dictionary FetchReadableStreamReadDataDone { + boolean done = false; +}; + +dictionary FetchReadableStreamReadDataArray { + Uint8Array value; +}; diff --git a/crates/web-sys/webidls/available/FetchEvent.webidl b/crates/web-sys/webidls/available/FetchEvent.webidl new file mode 100644 index 00000000..947f00ed --- /dev/null +++ b/crates/web-sys/webidls/available/FetchEvent.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + */ + +[Constructor(DOMString type, FetchEventInit eventInitDict), + Func="ServiceWorkerVisible", + Exposed=(ServiceWorker)] +interface FetchEvent : ExtendableEvent { + [SameObject] readonly attribute Request request; + readonly attribute DOMString? clientId; + readonly attribute boolean isReload; + + [Throws] + void respondWith(Promise r); +}; + +dictionary FetchEventInit : EventInit { + required Request request; + DOMString? clientId = null; + boolean isReload = false; +}; diff --git a/crates/web-sys/webidls/available/FetchObserver.webidl b/crates/web-sys/webidls/available/FetchObserver.webidl new file mode 100644 index 00000000..8321101a --- /dev/null +++ b/crates/web-sys/webidls/available/FetchObserver.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +callback interface ObserverCallback { + void handleEvent(FetchObserver observer); +}; + +enum FetchState { + // Pending states + "requesting", "responding", + // Final states + "aborted", "errored", "complete" +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::DOMPrefs::FetchObserverEnabled"] +interface FetchObserver : EventTarget { + readonly attribute FetchState state; + + // Events + attribute EventHandler onstatechange; + attribute EventHandler onrequestprogress; + attribute EventHandler onresponseprogress; +}; diff --git a/crates/web-sys/webidls/available/File.webidl b/crates/web-sys/webidls/available/File.webidl new file mode 100644 index 00000000..c291a5b6 --- /dev/null +++ b/crates/web-sys/webidls/available/File.webidl @@ -0,0 +1,55 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/FileAPI/#file + */ + +interface nsIFile; + +[Constructor(sequence fileBits, + USVString fileName, optional FilePropertyBag options), + Exposed=(Window,Worker)] +interface File : Blob { + readonly attribute DOMString name; + + [GetterThrows] + readonly attribute long long lastModified; +}; + +dictionary FilePropertyBag { + DOMString type = ""; + long long lastModified; +}; + +dictionary ChromeFilePropertyBag : FilePropertyBag { + DOMString name = ""; + boolean existenceCheck = true; +}; + +// Mozilla extensions +partial interface File { + [BinaryName="relativePath", Func="mozilla::dom::DOMPrefs::WebkitBlinkDirectoryPickerEnabled"] + readonly attribute USVString webkitRelativePath; + + [GetterThrows, ChromeOnly, NeedsCallerType] + readonly attribute DOMString mozFullPath; +}; + +// Mozilla extensions +// These 2 methods can be used only in these conditions: +// - the main-thread +// - parent process OR file process OR, only for testing, with pref +// `dom.file.createInChild' set to true. +[Exposed=(Window)] +partial interface File { + [ChromeOnly, Throws, NeedsCallerType] + static Promise createFromNsIFile(nsIFile file, + optional ChromeFilePropertyBag options); + + [ChromeOnly, Throws, NeedsCallerType] + static Promise createFromFileName(USVString fileName, + optional ChromeFilePropertyBag options); +}; diff --git a/crates/web-sys/webidls/available/FileList.webidl b/crates/web-sys/webidls/available/FileList.webidl new file mode 100644 index 00000000..5e459034 --- /dev/null +++ b/crates/web-sys/webidls/available/FileList.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2006/webapi/FileAPI/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker)] +interface FileList { + getter File? item(unsigned long index); + readonly attribute unsigned long length; +}; diff --git a/crates/web-sys/webidls/available/FileReader.webidl b/crates/web-sys/webidls/available/FileReader.webidl new file mode 100644 index 00000000..1e79ba09 --- /dev/null +++ b/crates/web-sys/webidls/available/FileReader.webidl @@ -0,0 +1,50 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/FileAPI/#APIASynch + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor, + Exposed=(Window,Worker,System)] +interface FileReader : EventTarget { + // async read methods + [Throws] + void readAsArrayBuffer(Blob blob); + [Throws] + void readAsBinaryString(Blob filedata); + [Throws] + void readAsText(Blob blob, optional DOMString label); + [Throws] + void readAsDataURL(Blob blob); + + void 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 + // bug 858217: readonly attribute (DOMString or ArrayBuffer)? result; + [Throws] + readonly attribute any 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/crates/web-sys/webidls/available/FileReaderSync.webidl b/crates/web-sys/webidls/available/FileReaderSync.webidl new file mode 100644 index 00000000..6628794f --- /dev/null +++ b/crates/web-sys/webidls/available/FileReaderSync.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2006/webapi/FileAPI/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor, + Exposed=(DedicatedWorker,SharedWorker)] +interface FileReaderSync { + + // Synchronously return strings + + [Throws] + ArrayBuffer readAsArrayBuffer(Blob blob); + [Throws] + DOMString readAsBinaryString(Blob blob); + [Throws] + DOMString readAsText(Blob blob, optional DOMString encoding); + [Throws] + DOMString readAsDataURL(Blob blob); +}; diff --git a/crates/web-sys/webidls/available/FileSystem.webidl b/crates/web-sys/webidls/available/FileSystem.webidl new file mode 100644 index 00000000..06b88c5c --- /dev/null +++ b/crates/web-sys/webidls/available/FileSystem.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +dictionary FileSystemFlags { + boolean create = false; + boolean exclusive = false; +}; + +callback interface FileSystemEntryCallback { + void handleEvent(FileSystemEntry entry); +}; + +callback interface VoidCallback { + void handleEvent(); +}; + +callback interface ErrorCallback { + void handleEvent(DOMException err); +}; + +interface FileSystem { + readonly attribute USVString name; + readonly attribute FileSystemDirectoryEntry root; +}; diff --git a/crates/web-sys/webidls/available/FileSystemDirectoryEntry.webidl b/crates/web-sys/webidls/available/FileSystemDirectoryEntry.webidl new file mode 100644 index 00000000..f972d216 --- /dev/null +++ b/crates/web-sys/webidls/available/FileSystemDirectoryEntry.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface FileSystemDirectoryEntry : FileSystemEntry { + FileSystemDirectoryReader createReader(); + + void getFile(optional USVString? path, + optional FileSystemFlags options, + optional FileSystemEntryCallback successCallback, + optional ErrorCallback errorCallback); + + void getDirectory(optional USVString? path, + optional FileSystemFlags options, + optional FileSystemEntryCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/crates/web-sys/webidls/available/FileSystemDirectoryReader.webidl b/crates/web-sys/webidls/available/FileSystemDirectoryReader.webidl new file mode 100644 index 00000000..3be94830 --- /dev/null +++ b/crates/web-sys/webidls/available/FileSystemDirectoryReader.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +callback interface FileSystemEntriesCallback { + void handleEvent(sequence entries); +}; + +interface FileSystemDirectoryReader { + + // readEntries can be called just once. The second time it returns no data. + + [Throws] + void readEntries(FileSystemEntriesCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/crates/web-sys/webidls/available/FileSystemEntry.webidl b/crates/web-sys/webidls/available/FileSystemEntry.webidl new file mode 100644 index 00000000..af112282 --- /dev/null +++ b/crates/web-sys/webidls/available/FileSystemEntry.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface FileSystemEntry { + readonly attribute boolean isFile; + readonly attribute boolean isDirectory; + + [GetterThrows] + readonly attribute USVString name; + + [GetterThrows] + readonly attribute USVString fullPath; + + readonly attribute FileSystem filesystem; + + void getParent(optional FileSystemEntryCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/crates/web-sys/webidls/available/FileSystemFileEntry.webidl b/crates/web-sys/webidls/available/FileSystemFileEntry.webidl new file mode 100644 index 00000000..3f141e54 --- /dev/null +++ b/crates/web-sys/webidls/available/FileSystemFileEntry.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +callback interface FileCallback { + void handleEvent(File file); +}; + +interface FileSystemFileEntry : FileSystemEntry { + [BinaryName="GetFile"] + void file (FileCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/crates/web-sys/webidls/available/Flex.webidl b/crates/web-sys/webidls/available/Flex.webidl new file mode 100644 index 00000000..58c71363 --- /dev/null +++ b/crates/web-sys/webidls/available/Flex.webidl @@ -0,0 +1,54 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * These objects support visualization of flex containers by the + * dev tools. + */ + +[ChromeOnly] +interface Flex +{ + sequence getLines(); +}; + +/** + * Lines with items that have been shrunk are shrinking; with items + * that have grown are growing, and all others are unchanged. + */ +enum FlexLineGrowthState { "unchanged", "shrinking", "growing" }; + +[ChromeOnly] +interface FlexLine +{ + readonly attribute FlexLineGrowthState growthState; + readonly attribute double crossStart; + readonly attribute double crossSize; + + // firstBaselineOffset measures from flex-start edge. + readonly attribute double firstBaselineOffset; + + // lastBaselineOffset measures from flex-end edge. + readonly attribute double lastBaselineOffset; + + /** + * getItems() returns FlexItems only for the Elements in this Flex + * container -- ignoring struts and abs-pos Elements. + */ + sequence getItems(); +}; + +[ChromeOnly] +interface FlexItem +{ + readonly attribute Node? node; + readonly attribute double mainBaseSize; + readonly attribute double mainDeltaSize; + readonly attribute double mainMinSize; + readonly attribute double mainMaxSize; + readonly attribute double crossMinSize; + readonly attribute double crossMaxSize; +}; diff --git a/crates/web-sys/webidls/available/FocusEvent.webidl b/crates/web-sys/webidls/available/FocusEvent.webidl new file mode 100644 index 00000000..52a2f1fd --- /dev/null +++ b/crates/web-sys/webidls/available/FocusEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface please see + * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict)] +interface FocusEvent : UIEvent { + // Introduced in DOM Level 3: + readonly attribute EventTarget? relatedTarget; +}; + +dictionary FocusEventInit : UIEventInit { + EventTarget? relatedTarget = null; +}; diff --git a/crates/web-sys/webidls/available/FontFace.webidl b/crates/web-sys/webidls/available/FontFace.webidl new file mode 100644 index 00000000..5705f5d8 --- /dev/null +++ b/crates/web-sys/webidls/available/FontFace.webidl @@ -0,0 +1,52 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-font-loading/#fontface-interface + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +typedef (ArrayBuffer or ArrayBufferView) BinaryData; + +dictionary FontFaceDescriptors { + DOMString style = "normal"; + DOMString weight = "normal"; + DOMString stretch = "normal"; + DOMString unicodeRange = "U+0-10FFFF"; + DOMString variant = "normal"; + DOMString featureSettings = "normal"; + DOMString variationSettings = "normal"; + DOMString display = "auto"; +}; + +enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" }; + +// Bug 1072107 is for exposing this in workers. +// [Exposed=(Window,Worker)] +[Constructor(DOMString family, + (DOMString or BinaryData) source, + optional FontFaceDescriptors descriptors), + Pref="layout.css.font-loading-api.enabled"] +interface FontFace { + [SetterThrows] attribute DOMString family; + [SetterThrows] attribute DOMString style; + [SetterThrows] attribute DOMString weight; + [SetterThrows] attribute DOMString stretch; + [SetterThrows] attribute DOMString unicodeRange; + [SetterThrows] attribute DOMString variant; + [SetterThrows] attribute DOMString featureSettings; + [SetterThrows, Pref="layout.css.font-variations.enabled"] attribute DOMString variationSettings; + [SetterThrows, Pref="layout.css.font-display.enabled"] attribute DOMString display; + + readonly attribute FontFaceLoadStatus status; + + [Throws] + Promise load(); + + [Throws] + readonly attribute Promise loaded; +}; diff --git a/crates/web-sys/webidls/available/FontFaceSet.webidl b/crates/web-sys/webidls/available/FontFaceSet.webidl new file mode 100644 index 00000000..7f58fbe5 --- /dev/null +++ b/crates/web-sys/webidls/available/FontFaceSet.webidl @@ -0,0 +1,64 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-font-loading/#FontFaceSet-interface + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +// To implement FontFaceSet's iterator until we can use setlike. +dictionary FontFaceSetIteratorResult +{ + required any value; + required boolean done; +}; + +// To implement FontFaceSet's iterator until we can use setlike. +[NoInterfaceObject] +interface FontFaceSetIterator { + [Throws] FontFaceSetIteratorResult next(); +}; + +callback FontFaceSetForEachCallback = void (FontFace value, FontFace key, FontFaceSet set); + +enum FontFaceSetLoadStatus { "loading", "loaded" }; + +// Bug 1072762 is for the FontFaceSet constructor. +// [Constructor(sequence initialFaces)] +[Pref="layout.css.font-loading-api.enabled"] +interface FontFaceSet : EventTarget { + + // Emulate setlike behavior until we can use that directly. + readonly attribute unsigned long size; + [Throws] void add(FontFace font); + boolean has(FontFace font); + boolean delete(FontFace font); + void clear(); + [NewObject] FontFaceSetIterator entries(); + // Iterator keys(); + [NewObject, Alias=keys, Alias="@@iterator"] FontFaceSetIterator values(); + [Throws] void forEach(FontFaceSetForEachCallback cb, optional any thisArg); + + // -- 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 + [NewObject] Promise> load(DOMString font, optional DOMString text = " "); + + // return whether all fonts in the fontlist are loaded + // (does not initiate load if not available) + [Throws] boolean check(DOMString font, optional DOMString text = " "); + + // async notification that font loading and layout operations are done + [Throws] readonly attribute Promise ready; + + // loading state, "loading" while one or more fonts loading, "loaded" otherwise + readonly attribute FontFaceSetLoadStatus status; +}; diff --git a/crates/web-sys/webidls/available/FontFaceSetLoadEvent.webidl b/crates/web-sys/webidls/available/FontFaceSetLoadEvent.webidl new file mode 100644 index 00000000..fee0f306 --- /dev/null +++ b/crates/web-sys/webidls/available/FontFaceSetLoadEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-font-loading/#FontFaceSet-interface + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary FontFaceSetLoadEventInit : EventInit { + sequence fontfaces = []; +}; + +[Constructor(DOMString type, optional FontFaceSetLoadEventInit eventInitDict), + Pref="layout.css.font-loading-api.enabled"] +interface FontFaceSetLoadEvent : Event { + [Cached, Constant, Frozen] readonly attribute sequence fontfaces; +}; diff --git a/crates/web-sys/webidls/available/FontFaceSource.webidl b/crates/web-sys/webidls/available/FontFaceSource.webidl new file mode 100644 index 00000000..96e1c6d7 --- /dev/null +++ b/crates/web-sys/webidls/available/FontFaceSource.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-font-loading/#font-face-source + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[NoInterfaceObject] +interface FontFaceSource { + + [Pref="layout.css.font-loading-api.enabled"] + readonly attribute FontFaceSet fonts; +}; diff --git a/crates/web-sys/webidls/available/FormData.webidl b/crates/web-sys/webidls/available/FormData.webidl new file mode 100644 index 00000000..16f780d5 --- /dev/null +++ b/crates/web-sys/webidls/available/FormData.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://xhr.spec.whatwg.org + */ + +typedef (Blob or Directory or USVString) FormDataEntryValue; + +[Constructor(optional HTMLFormElement form), + Exposed=(Window,Worker)] +interface FormData { + [Throws] + void append(USVString name, Blob value, optional USVString filename); + [Throws] + void append(USVString name, USVString value); + void delete(USVString name); + FormDataEntryValue? get(USVString name); + sequence getAll(USVString name); + boolean has(USVString name); + [Throws] + void set(USVString name, Blob value, optional USVString filename); + [Throws] + void set(USVString name, USVString value); + iterable; +}; diff --git a/crates/web-sys/webidls/available/FrameLoader.webidl b/crates/web-sys/webidls/available/FrameLoader.webidl new file mode 100644 index 00000000..44584502 --- /dev/null +++ b/crates/web-sys/webidls/available/FrameLoader.webidl @@ -0,0 +1,219 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface LoadContext; +interface TabParent; +interface URI; +interface nsIDocShell; +interface nsIPrintSettings; +interface nsIWebBrowserPersistDocumentReceiver; +interface nsIWebProgressListener; + +[ChromeOnly] +interface FrameLoader { + /** + * Get the docshell from the frame loader. + */ + [GetterThrows] + readonly attribute nsIDocShell? docShell; + + /** + * Get this frame loader's TabParent, if it has a remote frame. Otherwise, + * returns null. + */ + readonly attribute TabParent? tabParent; + + /** + * Get an nsILoadContext for the top-level docshell. For remote + * frames, a shim is returned that contains private browsing and app + * information. + */ + readonly attribute LoadContext loadContext; + + /** + * Get the ParentSHistory for the nsFrameLoader. May return null if this + * frameloader is not for a toplevel frame. + */ + readonly attribute ParentSHistory? parentSHistory; + + /** + * Adds a blocking promise for the current cross process navigation. + * This method can only be called while the "BrowserWillChangeProcess" event + * is being fired. + */ + [Throws] + void addProcessChangeBlockingPromise(Promise aPromise); + + /** + * Find out whether the loader's frame is at too great a depth in + * the frame tree. This can be used to decide what operations may + * or may not be allowed on the loader's docshell. + */ + [Pure] + readonly attribute boolean depthTooGreat; + + /** + * Activate remote frame. + * Throws an exception with non-remote frames. + */ + [Throws] + void activateRemoteFrame(); + + /** + * Deactivate remote frame. + * Throws an exception with non-remote frames. + */ + [Throws] + void deactivateRemoteFrame(); + + /** + * @see nsIDOMWindowUtils sendMouseEvent. + */ + [Throws] + void sendCrossProcessMouseEvent(DOMString aType, + float aX, + float aY, + long aButton, + long aClickCount, + long aModifiers, + optional boolean aIgnoreRootScrollFrame = false); + + /** + * Activate event forwarding from client (remote frame) to parent. + */ + [Throws] + void activateFrameEvent(DOMString aType, boolean capture); + + // Note, when frameloaders are swapped, also messageManagers are swapped. + readonly attribute MessageSender? messageManager; + + /** + * Request that the next time a remote layer transaction has been + * received by the Compositor, a MozAfterRemoteFrame event be sent + * to the window. + */ + void requestNotifyAfterRemotePaint(); + + /** + * Close the window through the ownerElement. + */ + [Throws] + void requestFrameLoaderClose(); + + /** + * Force a remote browser to recompute its dimension and screen position. + */ + [Throws] + void requestUpdatePosition(); + + /** + * Print the current document. + * + * @param aOuterWindowID the ID of the outer window to print + * @param aPrintSettings optional print settings to use; printSilent can be + * set to prevent prompting. + * @param aProgressListener optional print progress listener. + */ + [Throws] + void print(unsigned long long aOuterWindowID, + nsIPrintSettings aPrintSettings, + optional nsIWebProgressListener? aProgressListener = null); + + /** + * If false, then the subdocument is not clipped to its CSS viewport, and the + * subdocument's viewport scrollbar(s) are not rendered. + * Defaults to true. + */ + attribute boolean clipSubdocument; + + /** + * If false, then the subdocument's scroll coordinates will not be clamped + * to their scroll boundaries. + * Defaults to true. + */ + attribute boolean clampScrollPosition; + + /** + * The element which owns this frame loader. + * + * For example, if this is a frame loader for an