Create the web-sys crate mechanically from WebIDL (#409)

* Create a new `web-sys` crate

This will eventually contain all the WebIDL-generated bindings to Web APIs.

* ci: Test the new `web-sys` crate in CI

* web-sys: Add a small README

* web-sys: Vendor all the WebIDL files from mozilla-central

* backend: Add a pass to remove AST items that use undefined imports

This is necessary for the WebIDL frontend, which can't translate many WebIDL
constructs into equivalent wasm-bindgen AST things yet. It lets us make
incremental progress: we can generate bindings to methods we can support right
now even though there might be methods on the same interface that we can't
support yet.

* webidl: Add a bunch of missing semicolons

* webidl: Make parsing private

It was only `pub` so that we could test it, but we ended up moving towards
integration tests rather than unit tests that assert particular ASTs are parsed
from WebIDL files.

* webidl: Remove uses of undefined import types

* test-project-builder: Build projects in "very verbose" mode

This helps for debugging failing WebIDL-related tests.

* test-project-builder: Add more profiling timers

* test-project-builder: Detect when webpack-dev-server fails

Instead of going into an infinite loop, detect when webpack-dev-server fails to
start up and early exit the test.

* webidl: Specify version for dev-dependency on wasm-bindgen-backend

Instead of only a relative path.

* guide: Add section about contributing to `web-sys`

* WIP enable Event.webidl

Still need to fix and finish the test.

* Update expected webidl output

* Start out a test's status as incomplete

That way if we don't fill it in the error message doesn't look quite so bizarre

* Fix onerror function in headless mode

Otherwise we don't see any output!

* Fix package.json/node_modules handling in project generation

Make sure these are looked up in the git project root rather than the crate root

* Avoid logging body text

This was meant for debugging and is otherwise pretty noisy

* Fix a relative path

* More expected test fixes

* Fix a typo

* test-project-builder: Allow asynchronous tests

* webidl: Convert [Unforgeable] attributes into `#[wasm_bindgen(structural)]`

Fixes #432

* test-project-builder: Print generated WebIDL bindings for debugging purposes

Helps debug bad WebIDL bindings generation inside tests.

* When we can't find a descriptor, say which one can't be found

This helps when debugging things that need to become structural.

* web-sys: Test bindings for Event

* ci: Use `--manifest-path dir` instead of `cd dir && ...`

* web-sys: Just move .webidl files isntead of symlinking to enable them

* tests: Polyfill Array.prototype.values for older browsers in CI

* test-project-builder: Don't panic on poisoned headless test mutex

We only use it to serialize headless tests so that we don't try to bind the port
concurrently. Its OK to run another headless test if an earlier one panicked.

* JsValue: Add {is,as}_{object,function} methods

Allows dynamically casting values to `js::Object` and `js::Function`.

* tidy: Fix whitespace and missing semicolons

* Allow for dynamic feature detection of methods

If we create bindings to a method that doesn't exist in this implementation,
then it shouldn't fail until if/when we actually try and invoke that missing
method.

* tests: Do feature detection in Array.prototype.values test

* Add JsValue::{is_string, as_js_string} methods

And document all the cast/convert/check methods for js value.

* eslint: allow backtick string literals

* Only generate a fallback import function for non-structural imports
This commit is contained in:
Nick Fitzgerald 2018-07-09 16:35:25 -07:00 committed by GitHub
parent ade4561eba
commit f2f2d7231a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
701 changed files with 31216 additions and 177 deletions

View File

@ -18,7 +18,8 @@
],
"quotes": [
"error",
"single"
"single",
{ "allowTemplateLiterals": true }
],
"semi": [
"error",

View File

@ -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

View File

@ -40,6 +40,7 @@ members = [
"crates/cli",
"crates/typescript",
"crates/webidl",
"crates/web-sys",
"examples/hello_world",
"examples/smorgasboard",
"examples/console_log",

View File

@ -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<F>(&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<F>(&self, f: &mut F)
where
F: FnMut(&Ident);
}
impl<T> ImportedTypeDefinitions for T
where
T: ImportedTypes,
{
fn imported_type_definitions<F>(&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<F>(&self, f: &mut F)
where
F: FnMut(&Ident);
}
impl<T> ImportedTypeReferences for T
where
T: ImportedTypes,
{
fn imported_type_references<F>(&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<F>(&self, f: &mut F)
where
F: FnMut(&Ident, ImportedTypeKind),
{
self.imports.imported_types(f);
self.type_aliases.imported_types(f);
}
}
impl<T> ImportedTypes for Vec<T>
where
T: ImportedTypes,
{
fn imported_types<F>(&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<F>(&self, f: &mut F)
where
F: FnMut(&Ident, ImportedTypeKind),
{
self.kind.imported_types(f)
}
}
impl ImportedTypes for ast::ImportKind {
fn imported_types<F>(&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<F>(&self, f: &mut F)
where
F: FnMut(&Ident, ImportedTypeKind),
{
self.ty.imported_types(f);
}
}
impl ImportedTypes for syn::Type {
fn imported_types<F>(&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<F>(&self, f: &mut F)
where
F: FnMut(&Ident, ImportedTypeKind),
{
self.elem.imported_types(f);
}
}
impl ImportedTypes for syn::TypePath {
fn imported_types<F>(&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<F>(&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<F>(&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<F>(&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<F>(&self, f: &mut F)
where
F: FnMut(&Ident, ImportedTypeKind),
{
self.ty.imported_types(f);
}
}
impl ImportedTypes for ast::ImportType {
fn imported_types<F>(&self, f: &mut F)
where
F: FnMut(&Ident, ImportedTypeKind),
{
f(&self.name, ImportedTypeKind::Definition);
}
}
impl ImportedTypes for ast::TypeAlias {
fn imported_types<F>(&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<F>(&mut self, is_defined: &F)
where
F: Fn(&Ident) -> bool;
}
impl RemoveUndefinedImports for ast::Program {
fn remove_undefined_imports<F>(&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<T> RemoveUndefinedImports for Vec<T>
where
T: ImportedTypeReferences,
{
fn remove_undefined_imports<F>(&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
});
}
}

View File

@ -11,4 +11,5 @@ extern crate wasm_bindgen_shared as shared;
pub mod ast;
mod codegen;
pub mod defined;
pub mod util;

View File

@ -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{}",

View File

@ -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::<Vec<_>>();
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<thread::JoinHandle<io::Result<String>>>,
}
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());

16
crates/web-sys/Cargo.toml Normal file
View File

@ -0,0 +1,16 @@
[package]
name = "web-sys"
version = "0.1.0"
authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]
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' }

3
crates/web-sys/README.md Normal file
View File

@ -0,0 +1,3 @@
# `web-sys`
Raw bindings to Web APIs for projects using `wasm-bindgen`.

50
crates/web-sys/build.rs Normal file
View File

@ -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(())
}

5
crates/web-sys/src/lib.rs Executable file
View File

@ -0,0 +1,5 @@
#![feature(wasm_custom_section, wasm_import_module)]
extern crate wasm_bindgen;
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

View File

@ -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();
}

View File

@ -0,0 +1,4 @@
extern crate wasm_bindgen_test_project_builder as project_builder;
use project_builder::project;
mod event;

View File

@ -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();
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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;

View File

@ -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<Animation> ready;
[Func="nsDocument::IsWebAnimationsEnabled", Throws]
readonly attribute Promise<Animation> 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;
};

View File

@ -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);
};

View File

@ -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 = "";
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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;

View File

@ -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<void> suspend();
[Throws]
Promise<void> close();
[NewObject, Throws]
MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
[NewObject, Throws]
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
// Bug 1324548: MediaStreamTrackAudioSourceNode createMediaStreamTrackSource (AudioMediaStreamTrack mediaStreamTrack);
[NewObject, Throws]
MediaStreamAudioDestinationNode createMediaStreamDestination();
};

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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<DOMString, AudioParam>;
};

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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<DOMString> getSourceIds ();
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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 {
};

View File

@ -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;
};

View File

@ -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<unsigned long> outputChannelCount;
record<DOMString, double> 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;
};

View File

@ -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;
};

View File

@ -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 = "";
};

View File

@ -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;
};

View File

@ -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<void> resume();
attribute EventHandler onstatechange;
[NewObject, Throws]
AudioBuffer createBuffer (unsigned long numberOfChannels,
unsigned long length,
float sampleRate);
[Throws]
Promise<AudioBuffer> 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<double> feedforward, sequence<double> 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);
};

View File

@ -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<double?>) offset = [];
(DOMString or sequence<DOMString>) easing = [];
(CompositeOperation? or sequence<CompositeOperation?>) 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;
};

View File

@ -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<DOMString> supportedNetworks;
sequence<BasicCardType> supportedTypes;
};
dictionary BasicCardResponse {
DOMString cardholderName;
required DOMString cardNumber;
DOMString expiryMonth;
DOMString expiryYear;
DOMString cardSecurityCode;
PaymentAddress? billingAddress;
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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;

View File

@ -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<BlobPart> 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";
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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<unsigned long> identifiers,
sequence<long> x,
sequence<long> y,
sequence<unsigned long> rx,
sequence<unsigned long> ry,
sequence<float> rotationAngles,
sequence<float> 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();
};

View File

@ -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;
};

View File

@ -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();
};

View File

@ -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 {
};

View File

@ -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<DOMString> default-src;
sequence<DOMString> script-src;
sequence<DOMString> object-src;
sequence<DOMString> style-src;
sequence<DOMString> img-src;
sequence<DOMString> media-src;
sequence<DOMString> frame-src;
sequence<DOMString> font-src;
sequence<DOMString> connect-src;
sequence<DOMString> report-uri;
sequence<DOMString> frame-ancestors;
// sequence<DOMString> reflected-xss; // not supported in Firefox
sequence<DOMString> base-uri;
sequence<DOMString> form-action;
sequence<DOMString> referrer;
sequence<DOMString> manifest-src;
sequence<DOMString> upgrade-insecure-requests;
sequence<DOMString> child-src;
sequence<DOMString> block-all-mixed-content;
sequence<DOMString> require-sri-for;
sequence<DOMString> sandbox;
sequence<DOMString> worker-src;
};
dictionary CSPPolicies {
sequence<CSP> csp-policies;
};

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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 <https://bugzilla.mozilla.org/show_bug.cgi?id=1326509>.
[SameObject, PutForwards=mediaText] readonly attribute MediaList? media;
// Per spec, the .styleSheet is never null, but in our implementation it can
// be. See <https://bugzilla.mozilla.org/show_bug.cgi?id=1326509>.
[SameObject] readonly attribute CSSStyleSheet? styleSheet;
};

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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;
};

View File

@ -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.
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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;

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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<DOMString> 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;
};

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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 {
};

View File

@ -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;
};

View File

@ -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<Response> match(RequestInfo request, optional CacheQueryOptions options);
[NewObject]
Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options);
[NewObject, NeedsCallerType]
Promise<void> add(RequestInfo request);
[NewObject, NeedsCallerType]
Promise<void> addAll(sequence<RequestInfo> requests);
[NewObject]
Promise<void> put(RequestInfo request, Response response);
[NewObject]
Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options);
[NewObject]
Promise<sequence<Request>> 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;
};

View File

@ -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<Response> match(RequestInfo request, optional CacheQueryOptions options);
[NewObject]
Promise<boolean> has(DOMString cacheName);
[NewObject]
Promise<Cache> open(DOMString cacheName);
[NewObject]
Promise<boolean> delete(DOMString cacheName);
[NewObject]
Promise<sequence<DOMString>> keys();
};
// chrome-only, gecko specific extension
enum CacheStorageNamespace {
"content", "chrome"
};

View File

@ -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();
};

View File

@ -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<double> segments); // default empty
sequence<double> 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;

View File

@ -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();
};

View File

@ -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;
};

View File

@ -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 {
};

View File

@ -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 {
};

View File

@ -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;

View File

@ -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<CheckerboardReport> 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();
};

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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<object> 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<USVString> ancestorOrigins;
[Throws, NewObject]
Promise<WindowClient> focus();
[Throws, NewObject]
Promise<WindowClient> navigate(USVString url);
};
// Remove FrameType in bug 1290936
enum FrameType {
"auxiliary",
"top-level",
"nested",
"none"
};

View File

@ -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<any> get(DOMString id);
[NewObject]
Promise<sequence<Client>> matchAll(optional ClientQueryOptions options);
[NewObject]
Promise<WindowClient?> openWindow(USVString url);
[NewObject]
Promise<void> claim();
};
dictionary ClientQueryOptions {
boolean includeUncontrolled = false;
ClientType type = "window";
};
enum ClientType {
"window",
"worker",
"sharedworker",
// https://github.com/w3c/ServiceWorker/issues/1036
"serviceworker",
"all"
};

View File

@ -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 = "";
};

View File

@ -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 = "";
};

View File

@ -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;
};

View File

@ -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 {
};

View File

@ -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<TextClause> 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 = "");
};

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