diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/webidl | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/webidl')
753 files changed, 38368 insertions, 0 deletions
diff --git a/dom/webidl/APZTestData.webidl b/dom/webidl/APZTestData.webidl new file mode 100644 index 0000000000..5926e591cd --- /dev/null +++ b/dom/webidl/APZTestData.webidl @@ -0,0 +1,92 @@ +/* -*- 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 data logged by + * various components for the purpose of APZ testing (see bug 961289 and + * gfx/layers/apz/test/APZTestData.h) to JS test code. + */ + +// A single key-value pair in the data. +dictionary ScrollFrameDataEntry { + DOMString key; + DOMString value; +}; + +// All the key-value pairs associated with a given scrollable frame. +// The scrollable frame is identified by a scroll id. +dictionary ScrollFrameData { + unsigned long long scrollId; + sequence<ScrollFrameDataEntry> entries; +}; + +// All the scrollable frames associated with a given paint or repaint request. +// The paint or repaint request is identified by a sequence number. +dictionary APZBucket { + unsigned long sequenceNumber; + sequence<ScrollFrameData> scrollFrames; +}; + +[Pref="apz.test.logging_enabled", + Exposed=Window] +namespace APZHitResultFlags { + // These constants should be kept in sync with mozilla::gfx::CompositorHitTestInfo + const unsigned short INVISIBLE = 0; + const unsigned short VISIBLE = 0x0001; + const unsigned short IRREGULAR_AREA = 0x0002; + const unsigned short APZ_AWARE_LISTENERS = 0x0004; + const unsigned short INACTIVE_SCROLLFRAME = 0x0008; + const unsigned short PAN_X_DISABLED = 0x0010; + const unsigned short PAN_Y_DISABLED = 0x0020; + const unsigned short PINCH_ZOOM_DISABLED = 0x0040; + const unsigned short DOUBLE_TAP_ZOOM_DISABLED = 0x0080; + const unsigned short SCROLLBAR = 0x0100; + const unsigned short SCROLLBAR_THUMB = 0x0200; + const unsigned short SCROLLBAR_VERTICAL = 0x0400; + const unsigned short REQUIRES_TARGET_CONFIRMATION = 0x0800; +}; + +dictionary APZHitResult { + float screenX; + float screenY; + unsigned short hitResult; // combination of the APZHitResultFlags.* flags + unsigned long long layersId; + unsigned long long scrollId; +}; + +dictionary APZSampledResult { + float scrollOffsetX; + float scrollOffsetY; + DOMHighResTimeStamp sampledTimeStamp; + unsigned long long layersId; + unsigned long long scrollId; +}; + +dictionary AdditionalDataEntry { + DOMString key; + DOMString value; +}; + +// All the paints and repaint requests. This is the top-level data structure. +[GenerateConversionToJS] +dictionary APZTestData { + sequence<APZBucket> paints; + sequence<APZBucket> repaintRequests; + sequence<APZHitResult> hitResults; + sequence<APZSampledResult> sampledResults; + sequence<AdditionalDataEntry> additionalData; +}; + +// A frame uniformity measurement for every scrollable layer +dictionary FrameUniformity { + unsigned long layerAddress; + float frameUniformity; +}; + +[GenerateConversionToJS] +dictionary FrameUniformityResults { + sequence<FrameUniformity> layerUniformities; +}; diff --git a/dom/webidl/AbortController.webidl b/dom/webidl/AbortController.webidl new file mode 100644 index 0000000000..2b172b7718 --- /dev/null +++ b/dom/webidl/AbortController.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#abortcontroller + */ + +[Exposed=(Window,Worker)] +interface AbortController { + [Throws] + constructor(); + + [SameObject] readonly attribute AbortSignal signal; + + undefined abort(optional any reason); +}; diff --git a/dom/webidl/AbortSignal.webidl b/dom/webidl/AbortSignal.webidl new file mode 100644 index 0000000000..78734ed4ed --- /dev/null +++ b/dom/webidl/AbortSignal.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#abortsignal + */ + +[Exposed=*] +interface AbortSignal : EventTarget { + [NewObject] static AbortSignal abort(optional any reason); + [Exposed=(Window,Worker), NewObject, Throws] + static AbortSignal timeout([EnforceRange] unsigned long long milliseconds); + [NewObject] static AbortSignal _any(sequence<AbortSignal> signals); + + readonly attribute boolean aborted; + readonly attribute any reason; + [Throws] undefined throwIfAborted(); + + attribute EventHandler onabort; +}; diff --git a/dom/webidl/AbstractRange.webidl b/dom/webidl/AbstractRange.webidl new file mode 100644 index 0000000000..abd4789212 --- /dev/null +++ b/dom/webidl/AbstractRange.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#abstractrange + * + * Copyright 2012 W3C (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface AbstractRange { + [BinaryName="GetStartContainer"] + readonly attribute Node startContainer; + readonly attribute unsigned long startOffset; + [BinaryName="GetEndContainer"] + readonly attribute Node endContainer; + readonly attribute unsigned long endOffset; + readonly attribute boolean collapsed; +}; diff --git a/dom/webidl/AbstractWorker.webidl b/dom/webidl/AbstractWorker.webidl new file mode 100644 index 0000000000..28f5dce589 --- /dev/null +++ b/dom/webidl/AbstractWorker.webidl @@ -0,0 +1,10 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=(Window,Worker)] +interface mixin AbstractWorker { + attribute EventHandler onerror; +}; diff --git a/dom/webidl/AccessibilityRole.webidl b/dom/webidl/AccessibilityRole.webidl new file mode 100644 index 0000000000..3e47e3180d --- /dev/null +++ b/dom/webidl/AccessibilityRole.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://rawgit.com/w3c/aria/master/#AccessibilityRole + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin AccessibilityRole { + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? role; +}; diff --git a/dom/webidl/AccessibleNode.webidl b/dom/webidl/AccessibleNode.webidl new file mode 100644 index 0000000000..fe1d843727 --- /dev/null +++ b/dom/webidl/AccessibleNode.webidl @@ -0,0 +1,80 @@ +/* -*- 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="mozilla::dom::AccessibleNode::IsAOMEnabled", + Exposed=Window] +interface AccessibleNode { + readonly attribute DOMString computedRole; + [Frozen, Cached, Pure] + readonly attribute sequence<DOMString> states; + [Frozen, Cached, Pure] + readonly attribute sequence<DOMString> attributes; + readonly attribute Node? DOMNode; + + boolean is(DOMString... states); + boolean has(DOMString... attributes); + [Throws] + any get(DOMString attribute); + + attribute DOMString? role; + attribute DOMString? roleDescription; + + // Accessible label and descriptor + attribute DOMString? label; + + // Global states and properties + attribute DOMString? current; + + // Accessible properties + attribute DOMString? autocomplete; + attribute DOMString? keyShortcuts; + attribute boolean? modal; + attribute boolean? multiline; + attribute boolean? multiselectable; + attribute DOMString? orientation; + attribute boolean? readOnly; + attribute boolean? required; + attribute DOMString? sort; + + // Range values + attribute DOMString? placeholder; + attribute double? valueMax; + attribute double? valueMin; + attribute double? valueNow; + attribute DOMString? valueText; + + // Accessible states + attribute DOMString? checked; + attribute boolean? disabled; + attribute boolean? expanded; + attribute DOMString? hasPopUp; + attribute boolean? hidden; + attribute DOMString? invalid; + attribute DOMString? pressed; + attribute boolean? selected; + + // Live regions + attribute boolean? atomic; + attribute boolean? busy; + attribute DOMString? live; + attribute DOMString? relevant; + + // Other relationships + attribute AccessibleNode? activeDescendant; + attribute AccessibleNode? details; + attribute AccessibleNode? errorMessage; + + // Collections. + attribute long? colCount; + attribute unsigned long? colIndex; + attribute unsigned long? colSpan; + attribute unsigned long? level; + attribute unsigned long? posInSet; + attribute long? rowCount; + attribute unsigned long? rowIndex; + attribute unsigned long? rowSpan; + attribute long? setSize; +}; diff --git a/dom/webidl/AddonEvent.webidl b/dom/webidl/AddonEvent.webidl new file mode 100644 index 0000000000..5f60705207 --- /dev/null +++ b/dom/webidl/AddonEvent.webidl @@ -0,0 +1,15 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +[Func="mozilla::AddonManagerWebAPI::IsAPIEnabled", + Exposed=Window] +interface AddonEvent : Event { + constructor(DOMString type, AddonEventInit eventInitDict); + + readonly attribute DOMString id; +}; + +dictionary AddonEventInit : EventInit { + required DOMString id; +}; diff --git a/dom/webidl/AddonManager.webidl b/dom/webidl/AddonManager.webidl new file mode 100644 index 0000000000..d392b90fb9 --- /dev/null +++ b/dom/webidl/AddonManager.webidl @@ -0,0 +1,106 @@ +/* This Source Code Form is subject to the terms of 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/. + */ + +/* We need a JSImplementation but cannot get one without a contract ID. + Since Addon and AddonInstall are only ever created from JS they don't need + real contract IDs. */ +[ChromeOnly, JSImplementation="dummy", + Exposed=Window] +interface Addon { + // The add-on's ID. + readonly attribute DOMString id; + // The add-on's version. + readonly attribute DOMString version; + // The add-on's type (extension, theme, etc.). + readonly attribute DOMString type; + // The add-on's name in the current locale. + readonly attribute DOMString name; + // The add-on's description in the current locale. + readonly attribute DOMString description; + // If the user has enabled this add-on, note that it still may not be running + // depending on whether enabling requires a restart or if the add-on is + // incompatible in some way. + readonly attribute boolean isEnabled; + // If the add-on is currently active in the browser. + readonly attribute boolean isActive; + // If the add-on may be uninstalled + readonly attribute boolean canUninstall; + + Promise<boolean> uninstall(); + Promise<undefined> setEnabled(boolean value); +}; + +[ChromeOnly, JSImplementation="dummy", + Exposed=Window] +interface AddonInstall : EventTarget { + // One of the STATE_* symbols from AddonManager.jsm + readonly attribute DOMString state; + // One of the ERROR_* symbols from AddonManager.jsm, or null + readonly attribute DOMString? error; + // How many bytes have been downloaded + readonly attribute long long progress; + // How many total bytes will need to be downloaded or -1 if unknown + readonly attribute long long maxProgress; + + Promise<undefined> install(); + Promise<undefined> cancel(); +}; + +dictionary addonInstallOptions { + required DOMString url; + // If a non-empty string is passed for "hash", it is used to verify the + // checksum of the downloaded XPI before installing. If is omitted or if + // it is null or empty string, no checksum verification is performed. + DOMString? hash = null; +}; + +[HeaderFile="mozilla/AddonManagerWebAPI.h", + Func="mozilla::AddonManagerWebAPI::IsAPIEnabled", + JSImplementation="@mozilla.org/addon-web-api/manager;1", + WantsEventListenerHooks, + Exposed=Window] +interface AddonManager : EventTarget { + /** + * Gets information about an add-on + * + * @param id + * The ID of the add-on to test for. + * @return A promise. It will resolve to an Addon if the add-on is installed. + */ + Promise<Addon> getAddonByID(DOMString id); + + /** + * Creates an AddonInstall object for a given URL. + * + * @param options + * Only one supported option: 'url', the URL of the addon to install. + * @return A promise that resolves to an instance of AddonInstall. + */ + Promise<AddonInstall> createInstall(optional addonInstallOptions options = {}); + + /** + * Opens an Abuse Report dialog window for the addon with the given id. + * The addon may be currently installed (in which case the report will + * include the details available locally), or not (in which case the report + * will include the details that can be retrieved from the AMO API endpoint). + * + * @param id + * The ID of the add-on to report. + * @return A promise that resolves to a boolean (true when the report + * has been submitted successfully, false if the user cancelled + * the report). The Promise is rejected is the report fails + * for a reason other than user cancellation. + */ + Promise<boolean> reportAbuse(DOMString id); + + // Indicator to content whether handing off the reports to the integrated + // abuse report panel is enabled. + readonly attribute boolean abuseReportPanelEnabled; +}; + +[ChromeOnly,Exposed=Window,HeaderFile="mozilla/AddonManagerWebAPI.h"] +namespace AddonManagerPermissions { + boolean isHostPermitted(DOMString host); +}; diff --git a/dom/webidl/AnalyserNode.webidl b/dom/webidl/AnalyserNode.webidl new file mode 100644 index 0000000000..e7ed151d9d --- /dev/null +++ b/dom/webidl/AnalyserNode.webidl @@ -0,0 +1,51 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://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", + Exposed=Window] +interface AnalyserNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, + optional AnalyserOptions options = {}); + + // Real-time frequency-domain data + undefined getFloatFrequencyData(Float32Array array); + undefined getByteFrequencyData(Uint8Array array); + + // Real-time waveform data + undefined getFloatTimeDomainData(Float32Array array); + undefined 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 includes AudioNodePassThrough; diff --git a/dom/webidl/Animatable.webidl b/dom/webidl/Animatable.webidl new file mode 100644 index 0000000000..9d10bfc5ad --- /dev/null +++ b/dom/webidl/Animatable.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/fxtf/web-animations/#the-animatable-interface + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary KeyframeAnimationOptions : KeyframeEffectOptions { + DOMString id = ""; +}; + +dictionary GetAnimationsOptions { + boolean subtree = false; +}; + +interface mixin Animatable { + [Throws] + Animation animate(object? keyframes, + optional UnrestrictedDoubleOrKeyframeAnimationOptions options = {}); + sequence<Animation> getAnimations(optional GetAnimationsOptions options = {}); +}; diff --git a/dom/webidl/Animation.webidl b/dom/webidl/Animation.webidl new file mode 100644 index 0000000000..06a07784d5 --- /dev/null +++ b/dom/webidl/Animation.webidl @@ -0,0 +1,67 @@ +/* -*- 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" }; + +enum AnimationReplaceState { "active", "removed", "persisted" }; + +[Exposed=Window] +interface Animation : EventTarget { + [Throws] + constructor(optional AnimationEffect? effect = null, + optional AnimationTimeline? timeline); + + attribute DOMString id; + [Pure] + attribute AnimationEffect? effect; + // Bug 1676794. Drop BinaryName once we support ScrollTimeline interface. + [Func="Document::AreWebAnimationsTimelinesEnabled", + BinaryName="timelineFromJS"] + 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; + readonly attribute AnimationReplaceState replaceState; + [Throws] + readonly attribute Promise<Animation> ready; + [Throws] + readonly attribute Promise<Animation> finished; + attribute EventHandler onfinish; + attribute EventHandler oncancel; + attribute EventHandler onremove; + undefined cancel(); + [Throws] + undefined finish(); + [Throws, BinaryName="playFromJS"] + undefined play(); + [Throws, BinaryName="pauseFromJS"] + undefined pause(); + undefined updatePlaybackRate (double playbackRate); + [Throws] + undefined reverse(); + undefined persist(); + [CEReactions, Throws] + undefined commitStyles(); +}; + +// Non-standard extensions +partial interface Animation { + [ChromeOnly] readonly attribute boolean isRunningOnCompositor; +}; diff --git a/dom/webidl/AnimationEffect.webidl b/dom/webidl/AnimationEffect.webidl new file mode 100644 index 0000000000..3e846868a1 --- /dev/null +++ b/dom/webidl/AnimationEffect.webidl @@ -0,0 +1,65 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#animationeffectreadonly + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum FillMode { + "none", + "forwards", + "backwards", + "both", + "auto" +}; + +enum PlaybackDirection { + "normal", + "reverse", + "alternate", + "alternate-reverse" +}; + +dictionary EffectTiming { + double delay = 0.0; + double endDelay = 0.0; + FillMode fill = "auto"; + double iterationStart = 0.0; + unrestricted double iterations = 1.0; + (unrestricted double or DOMString) duration = "auto"; + PlaybackDirection direction = "normal"; + UTF8String easing = "linear"; +}; + +dictionary OptionalEffectTiming { + double delay; + double endDelay; + FillMode fill; + double iterationStart; + unrestricted double iterations; + (unrestricted double or DOMString) duration; + PlaybackDirection direction; + UTF8String easing; +}; + +dictionary ComputedEffectTiming : EffectTiming { + unrestricted double endTime = 0.0; + unrestricted double activeDuration = 0.0; + double? localTime = null; + double? progress = null; + unrestricted double? currentIteration = null; +}; + +[Exposed=Window] +interface AnimationEffect { + EffectTiming getTiming(); + [BinaryName="getComputedTimingAsDict"] + ComputedEffectTiming getComputedTiming(); + [Throws] + undefined updateTiming(optional OptionalEffectTiming timing = {}); +}; diff --git a/dom/webidl/AnimationEvent.webidl b/dom/webidl/AnimationEvent.webidl new file mode 100644 index 0000000000..ae401948a7 --- /dev/null +++ b/dom/webidl/AnimationEvent.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/css3-animations/#animation-events- + * http://dev.w3.org/csswg/css3-animations/#animation-events- + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface AnimationEvent : Event { + constructor(DOMString type, optional AnimationEventInit eventInitDict = {}); + + readonly attribute DOMString animationName; + readonly attribute float elapsedTime; + readonly attribute DOMString pseudoElement; +}; + +dictionary AnimationEventInit : EventInit { + DOMString animationName = ""; + float elapsedTime = 0; + DOMString pseudoElement = ""; +}; diff --git a/dom/webidl/AnimationFrameProvider.webidl b/dom/webidl/AnimationFrameProvider.webidl new file mode 100644 index 0000000000..2932698c3b --- /dev/null +++ b/dom/webidl/AnimationFrameProvider.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames + */ + +callback FrameRequestCallback = undefined (DOMHighResTimeStamp time); + +interface mixin AnimationFrameProvider { + [Throws] long requestAnimationFrame(FrameRequestCallback callback); + [Throws] undefined cancelAnimationFrame(long handle); +}; diff --git a/dom/webidl/AnimationPlaybackEvent.webidl b/dom/webidl/AnimationPlaybackEvent.webidl new file mode 100644 index 0000000000..a5bb8f3bc9 --- /dev/null +++ b/dom/webidl/AnimationPlaybackEvent.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#animationplaybackevent + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface AnimationPlaybackEvent : Event { + constructor(DOMString type, + optional AnimationPlaybackEventInit eventInitDict = {}); + + readonly attribute double? currentTime; + readonly attribute double? timelineTime; +}; + +dictionary AnimationPlaybackEventInit : EventInit { + double? currentTime = null; + double? timelineTime = null; +}; diff --git a/dom/webidl/AnimationTimeline.webidl b/dom/webidl/AnimationTimeline.webidl new file mode 100644 index 0000000000..5b46c9cf95 --- /dev/null +++ b/dom/webidl/AnimationTimeline.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#animationtimeline + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Func="Document::AreWebAnimationsTimelinesEnabled", + Exposed=Window] +interface AnimationTimeline { + [BinaryName="currentTimeAsDouble"] + readonly attribute double? currentTime; +}; diff --git a/dom/webidl/AnonymousContent.webidl b/dom/webidl/AnonymousContent.webidl new file mode 100644 index 0000000000..33a7cf0a59 --- /dev/null +++ b/dom/webidl/AnonymousContent.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + * This file declares the AnonymousContent interface which is used to + * manipulate content that has been inserted into the document's canvasFrame + * anonymous container. See Document.insertAnonymousContent. + * Users of this API must never remove the host of the shadow root. + */ + +[ChromeOnly, Exposed=Window] +interface AnonymousContent { + readonly attribute ShadowRoot root; +}; diff --git a/dom/webidl/AppInfo.webidl b/dom/webidl/AppInfo.webidl new file mode 100644 index 0000000000..a4f44d46c2 --- /dev/null +++ b/dom/webidl/AppInfo.webidl @@ -0,0 +1,12 @@ +/* This Source Code Form is subject to the terms of 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 dictionnary holds the parameters supporting the app:// protocol. + */ +dictionary AppInfo +{ + DOMString path = ""; + boolean isCoreApp = false; +}; diff --git a/dom/webidl/AppNotificationServiceOptions.webidl b/dom/webidl/AppNotificationServiceOptions.webidl new file mode 100644 index 0000000000..809857e59b --- /dev/null +++ b/dom/webidl/AppNotificationServiceOptions.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface MozObserver; + +dictionary AppNotificationServiceOptions { + boolean textClickable = false; + DOMString manifestURL = ""; + DOMString id = ""; + DOMString dbId = ""; + DOMString dir = ""; + DOMString lang = ""; + DOMString tag = ""; + DOMString data = ""; + NotificationBehavior mozbehavior = {}; +}; diff --git a/dom/webidl/AriaAttributes.webidl b/dom/webidl/AriaAttributes.webidl new file mode 100644 index 0000000000..f6c34f01dc --- /dev/null +++ b/dom/webidl/AriaAttributes.webidl @@ -0,0 +1,136 @@ +/* -*- 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://rawgit.com/w3c/aria/master/#AriaAttributes + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin AriaAttributes { + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaAtomic; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaAutoComplete; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaBusy; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaChecked; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaColCount; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaColIndex; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaColIndexText; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaColSpan; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaCurrent; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaDescription; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaDisabled; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaExpanded; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaHasPopup; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaHidden; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaInvalid; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaKeyShortcuts; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaLabel; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaLevel; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaLive; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaModal; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaMultiLine; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaMultiSelectable; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaOrientation; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaPlaceholder; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaPosInSet; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaPressed; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaReadOnly; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaRelevant; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaRequired; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaRoleDescription; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaRowCount; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaRowIndex; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaRowIndexText; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaRowSpan; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaSelected; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaSetSize; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaSort; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaValueMax; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaValueMin; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaValueNow; + + [Pref="accessibility.ARIAReflection.enabled", CEReactions, SetterThrows] + attribute DOMString? ariaValueText; +}; diff --git a/dom/webidl/Attr.webidl b/dom/webidl/Attr.webidl new file mode 100644 index 0000000000..52759b29ba --- /dev/null +++ b/dom/webidl/Attr.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +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 { + readonly attribute Element? ownerElement; +}; diff --git a/dom/webidl/AudioBuffer.webidl b/dom/webidl/AudioBuffer.webidl new file mode 100644 index 0000000000..f94cf43f9c --- /dev/null +++ b/dom/webidl/AudioBuffer.webidl @@ -0,0 +1,40 @@ +/* -*- 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", + Exposed=Window] +interface AudioBuffer { + [Throws] + constructor(AudioBufferOptions options); + + 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] + undefined copyFromChannel(Float32Array destination, unsigned long channelNumber, optional unsigned long startInChannel = 0); + [Throws] + undefined copyToChannel(Float32Array source, unsigned long channelNumber, optional unsigned long startInChannel = 0); +}; diff --git a/dom/webidl/AudioBufferSourceNode.webidl b/dom/webidl/AudioBufferSourceNode.webidl new file mode 100644 index 0000000000..7c0f91441a --- /dev/null +++ b/dom/webidl/AudioBufferSourceNode.webidl @@ -0,0 +1,44 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * 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", + Exposed=Window] +interface AudioBufferSourceNode : AudioScheduledSourceNode { + constructor(BaseAudioContext context, + optional AudioBufferSourceOptions options = {}); + + [SetterThrows] + attribute AudioBuffer? buffer; + + readonly attribute AudioParam playbackRate; + readonly attribute AudioParam detune; + + attribute boolean loop; + attribute double loopStart; + attribute double loopEnd; + + [Throws] + undefined start(optional double when = 0, optional double grainOffset = 0, + optional double grainDuration); +}; + +// Mozilla extensions +AudioBufferSourceNode includes AudioNodePassThrough; diff --git a/dom/webidl/AudioContext.webidl b/dom/webidl/AudioContext.webidl new file mode 100644 index 0000000000..804cb127a7 --- /dev/null +++ b/dom/webidl/AudioContext.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary AudioContextOptions { + float sampleRate; +}; + +dictionary AudioTimestamp { + double contextTime; + DOMHighResTimeStamp performanceTime; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface AudioContext : BaseAudioContext { + [Throws] + constructor(optional AudioContextOptions contextOptions = {}); + + readonly attribute double baseLatency; + readonly attribute double outputLatency; + AudioTimestamp getOutputTimestamp(); + + [NewObject] + Promise<undefined> suspend(); + [NewObject] + Promise<undefined> close(); + + [NewObject, Throws] + MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); + + [NewObject, Throws] + MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); + + [NewObject, Throws] + MediaStreamTrackAudioSourceNode createMediaStreamTrackSource(MediaStreamTrack mediaStreamTrack); + + [NewObject, Throws] + MediaStreamAudioDestinationNode createMediaStreamDestination(); +}; diff --git a/dom/webidl/AudioDestinationNode.webidl b/dom/webidl/AudioDestinationNode.webidl new file mode 100644 index 0000000000..1e27b141ad --- /dev/null +++ b/dom/webidl/AudioDestinationNode.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface AudioDestinationNode : AudioNode { + + readonly attribute unsigned long maxChannelCount; + +}; diff --git a/dom/webidl/AudioListener.webidl b/dom/webidl/AudioListener.webidl new file mode 100644 index 0000000000..8b9acc3dff --- /dev/null +++ b/dom/webidl/AudioListener.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface AudioListener { + // Uses a 3D cartesian coordinate system + undefined setPosition(double x, double y, double z); + undefined setOrientation(double x, double y, double z, double xUp, double yUp, double zUp); +}; diff --git a/dom/webidl/AudioNode.webidl b/dom/webidl/AudioNode.webidl new file mode 100644 index 0000000000..fbeed0e0b6 --- /dev/null +++ b/dom/webidl/AudioNode.webidl @@ -0,0 +1,75 @@ +/* -*- 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", + Exposed=Window] +interface AudioNode : EventTarget { + + [Throws] + AudioNode connect(AudioNode destination, optional unsigned long output = 0, optional unsigned long input = 0); + [Throws] + undefined connect(AudioParam destination, optional unsigned long output = 0); + [Throws] + undefined disconnect(); + [Throws] + undefined disconnect(unsigned long output); + [Throws] + undefined disconnect(AudioNode destination); + [Throws] + undefined disconnect(AudioNode destination, unsigned long output); + [Throws] + undefined disconnect(AudioNode destination, unsigned long output, unsigned long input); + [Throws] + undefined disconnect(AudioParam destination); + [Throws] + undefined disconnect(AudioParam destination, unsigned long output); + + readonly attribute BaseAudioContext context; + readonly attribute unsigned long numberOfInputs; + readonly attribute unsigned long numberOfOutputs; + + // Channel up-mixing and down-mixing rules for all inputs. + [SetterThrows] + attribute unsigned long channelCount; + [SetterThrows, BinaryName="channelCountModeValue"] + attribute ChannelCountMode channelCountMode; + [SetterThrows, BinaryName="channelInterpretationValue"] + attribute ChannelInterpretation channelInterpretation; + +}; + +// Mozilla extension +partial interface AudioNode { + [ChromeOnly] + readonly attribute unsigned long id; +}; +interface mixin AudioNodePassThrough { + [ChromeOnly] + attribute boolean passThrough; +}; diff --git a/dom/webidl/AudioParam.webidl b/dom/webidl/AudioParam.webidl new file mode 100644 index 0000000000..e9b2b30ea6 --- /dev/null +++ b/dom/webidl/AudioParam.webidl @@ -0,0 +1,65 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#enumdef-automationrate + * https://webaudio.github.io/web-audio-api/#audioparam + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum AutomationRate { + "a-rate", + "k-rate" +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface AudioParam { + [SetterThrows] + 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(sequence<float> 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; +}; + +partial interface AudioParam { + // This attribute is used for mochitest only. + [ChromeOnly] + readonly attribute boolean isTrackSuspended; +}; diff --git a/dom/webidl/AudioParamDescriptor.webidl b/dom/webidl/AudioParamDescriptor.webidl new file mode 100644 index 0000000000..de2b007da0 --- /dev/null +++ b/dom/webidl/AudioParamDescriptor.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#dictdef-audioparamdescriptor + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[GenerateInit] +dictionary AudioParamDescriptor { + required DOMString name; + float defaultValue = 0; + float minValue = -3.4028235e38; + float maxValue = 3.4028235e38; + // AutomationRate for AudioWorklet is not needed until bug 1504984 is + // implemented + // AutomationRate automationRate = "a-rate"; +}; diff --git a/dom/webidl/AudioParamMap.webidl b/dom/webidl/AudioParamMap.webidl new file mode 100644 index 0000000000..1ca8dbcc7f --- /dev/null +++ b/dom/webidl/AudioParamMap.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#audioparammap + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[SecureContext, Exposed=Window] +interface AudioParamMap { + readonly maplike<DOMString, AudioParam>; +}; diff --git a/dom/webidl/AudioProcessingEvent.webidl b/dom/webidl/AudioProcessingEvent.webidl new file mode 100644 index 0000000000..ea86cff7eb --- /dev/null +++ b/dom/webidl/AudioProcessingEvent.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface AudioProcessingEvent : Event { + + readonly attribute double playbackTime; + + [Throws] + readonly attribute AudioBuffer inputBuffer; + [Throws] + readonly attribute AudioBuffer outputBuffer; + +}; diff --git a/dom/webidl/AudioScheduledSourceNode.webidl b/dom/webidl/AudioScheduledSourceNode.webidl new file mode 100644 index 0000000000..1b383f3e65 --- /dev/null +++ b/dom/webidl/AudioScheduledSourceNode.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#idl-def-AudioScheduledSourceNode + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface AudioScheduledSourceNode : AudioNode { + attribute EventHandler onended; + [Throws] + undefined start (optional double when = 0); + + [Throws] + undefined stop (optional double when = 0); +}; diff --git a/dom/webidl/AudioTrack.webidl b/dom/webidl/AudioTrack.webidl new file mode 100644 index 0000000000..0f1ba81a24 --- /dev/null +++ b/dom/webidl/AudioTrack.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#audiotrack + */ + +[Pref="media.track.enabled", + Exposed=Window] +interface AudioTrack { + readonly attribute DOMString id; + readonly attribute DOMString kind; + readonly attribute DOMString label; + readonly attribute DOMString language; + attribute boolean enabled; +}; diff --git a/dom/webidl/AudioTrackList.webidl b/dom/webidl/AudioTrackList.webidl new file mode 100644 index 0000000000..0a56d3ab3f --- /dev/null +++ b/dom/webidl/AudioTrackList.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#audiotracklist + */ + +[Pref="media.track.enabled", + Exposed=Window] +interface AudioTrackList : EventTarget { + readonly attribute unsigned long length; + getter AudioTrack (unsigned long index); + AudioTrack? getTrackById(DOMString id); + + attribute EventHandler onchange; + attribute EventHandler onaddtrack; + attribute EventHandler onremovetrack; +}; diff --git a/dom/webidl/AudioWorklet.webidl b/dom/webidl/AudioWorklet.webidl new file mode 100644 index 0000000000..92d566f6d6 --- /dev/null +++ b/dom/webidl/AudioWorklet.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window, SecureContext] +interface AudioWorklet : Worklet { +}; diff --git a/dom/webidl/AudioWorkletGlobalScope.webidl b/dom/webidl/AudioWorkletGlobalScope.webidl new file mode 100644 index 0000000000..b88ac82c66 --- /dev/null +++ b/dom/webidl/AudioWorkletGlobalScope.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#audioworkletglobalscope + */ + +callback constructor AudioWorkletProcessorConstructor = AudioWorkletProcessor (object options); + +[Global=(Worklet,AudioWorklet),Exposed=AudioWorklet] +interface AudioWorkletGlobalScope : WorkletGlobalScope { + [Throws] + undefined registerProcessor (DOMString name, AudioWorkletProcessorConstructor processorCtor); + readonly attribute unsigned long long currentFrame; + readonly attribute double currentTime; + readonly attribute float sampleRate; +}; diff --git a/dom/webidl/AudioWorkletNode.webidl b/dom/webidl/AudioWorkletNode.webidl new file mode 100644 index 0000000000..a7e48c9c7b --- /dev/null +++ b/dom/webidl/AudioWorkletNode.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[GenerateConversionToJS] +dictionary AudioWorkletNodeOptions : AudioNodeOptions { + unsigned long numberOfInputs = 1; + unsigned long numberOfOutputs = 1; + sequence<unsigned long> outputChannelCount; + record<DOMString, double> parameterData; + object processorOptions; +}; + +[SecureContext, Exposed=Window] +interface AudioWorkletNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, DOMString name, + optional AudioWorkletNodeOptions options = {}); + + [Throws] + readonly attribute AudioParamMap parameters; + readonly attribute MessagePort port; + attribute EventHandler onprocessorerror; +}; diff --git a/dom/webidl/AudioWorkletProcessor.webidl b/dom/webidl/AudioWorkletProcessor.webidl new file mode 100644 index 0000000000..3cbb226a76 --- /dev/null +++ b/dom/webidl/AudioWorkletProcessor.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#audioworkletprocessor + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=AudioWorklet] +interface AudioWorkletProcessor { + [Throws] + constructor(); + + readonly attribute MessagePort port; +}; diff --git a/dom/webidl/AutocompleteInfo.webidl b/dom/webidl/AutocompleteInfo.webidl new file mode 100644 index 0000000000..c75f6e4b8c --- /dev/null +++ b/dom/webidl/AutocompleteInfo.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * This dictionary is used for the input, textarea and select element's + * getAutocompleteInfo method. + */ + +dictionary AutocompleteInfo { + DOMString section = ""; + DOMString addressType = ""; + DOMString contactType = ""; + DOMString fieldName = ""; + DOMString credentialType = ""; + boolean canAutomaticallyPersist = true; +}; diff --git a/dom/webidl/BarProp.webidl b/dom/webidl/BarProp.webidl new file mode 100644 index 0000000000..ccbeccca33 --- /dev/null +++ b/dom/webidl/BarProp.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface BarProp +{ + [Throws, NeedsCallerType] + attribute boolean visible; +}; diff --git a/dom/webidl/BaseAudioContext.webidl b/dom/webidl/BaseAudioContext.webidl new file mode 100644 index 0000000000..7bdd15ddfc --- /dev/null +++ b/dom/webidl/BaseAudioContext.webidl @@ -0,0 +1,102 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/#idl-def-BaseAudioContext + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +callback DecodeSuccessCallback = undefined (AudioBuffer decodedData); +callback DecodeErrorCallback = undefined (DOMException error); + +enum AudioContextState { + "suspended", + "running", + "closed" +}; + +[Exposed=Window] +interface BaseAudioContext : EventTarget { + readonly attribute AudioDestinationNode destination; + readonly attribute float sampleRate; + readonly attribute double currentTime; + readonly attribute AudioListener listener; + readonly attribute AudioContextState state; + [Throws, SameObject, SecureContext] + readonly attribute AudioWorklet audioWorklet; + + [NewObject] + Promise<undefined> resume(); + + attribute EventHandler onstatechange; + + [NewObject, Throws] + AudioBuffer createBuffer (unsigned long numberOfChannels, + unsigned long length, + float sampleRate); + + [NewObject] + Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, + optional DecodeSuccessCallback successCallback, + optional DecodeErrorCallback errorCallback); + + // AudioNode creation + [NewObject] + AudioBufferSourceNode createBufferSource(); + + [NewObject] + 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(sequence<float> real, + sequence<float> imag, + optional PeriodicWaveConstraints constraints = {}); +}; diff --git a/dom/webidl/BaseKeyframeTypes.webidl b/dom/webidl/BaseKeyframeTypes.webidl new file mode 100644 index 0000000000..a6e94b1e3a --- /dev/null +++ b/dom/webidl/BaseKeyframeTypes.webidl @@ -0,0 +1,62 @@ +/* -*- 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" }; + +// NOTE: The order of the values in this enum are important. +// +// We assume that CompositeOperation is a subset of CompositeOperationOrAuto so +// that we can cast between the two types (provided the value is not "auto"). +// +// If that assumption ceases to hold we will need to update the conversion +// in KeyframeUtils::GetAnimationPropertiesFromKeyframes. +enum CompositeOperationOrAuto { "replace", "add", "accumulate", "auto" }; + +// 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. + +[GenerateInit] +dictionary BasePropertyIndexedKeyframe { + (double? or sequence<double?>) offset = []; + (UTF8String or sequence<UTF8String>) easing = []; + (CompositeOperationOrAuto or sequence<CompositeOperationOrAuto>) composite = []; +}; + +[GenerateInit] +dictionary BaseKeyframe { + double? offset = null; + UTF8String easing = "linear"; + [Pref="dom.animations-api.compositing.enabled"] + CompositeOperationOrAuto composite = "auto"; + + // 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; +}; + +[GenerateConversionToJS] +dictionary BaseComputedKeyframe : BaseKeyframe { + double computedOffset; +}; diff --git a/dom/webidl/BasicCardPayment.webidl b/dom/webidl/BasicCardPayment.webidl new file mode 100644 index 0000000000..2531c5601c --- /dev/null +++ b/dom/webidl/BasicCardPayment.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this WebIDL file is + * https://www.w3.org/TR/payment-method-basic-card/ + */ + +[GenerateInit] +dictionary BasicCardRequest { + sequence<DOMString> supportedNetworks = []; + boolean requestSecurityCode = true; +}; + +[GenerateConversionToJS] +dictionary BasicCardResponse { + DOMString cardholderName = ""; + required DOMString cardNumber; + DOMString expiryMonth = ""; + DOMString expiryYear = ""; + DOMString cardSecurityCode = ""; + PaymentAddress? billingAddress = null; +}; + +[GenerateConversionToJS] +dictionary BasicCardChangeDetails { + PaymentAddress? billingAddress = null; +}; + +[GenerateInit] +dictionary BasicCardErrors { + DOMString cardNumber; + DOMString cardholderName; + DOMString cardSecurityCode; + DOMString expiryMonth; + DOMString expiryYear; + AddressErrors billingAddress; +}; diff --git a/dom/webidl/BatteryManager.webidl b/dom/webidl/BatteryManager.webidl new file mode 100644 index 0000000000..2a09a514b8 --- /dev/null +++ b/dom/webidl/BatteryManager.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/battery-status/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[ChromeOnly, Exposed=Window] +interface BatteryManager : EventTarget { + readonly attribute boolean charging; + readonly attribute unrestricted double chargingTime; + readonly attribute unrestricted double dischargingTime; + readonly attribute double level; + + attribute EventHandler onchargingchange; + attribute EventHandler onchargingtimechange; + attribute EventHandler ondischargingtimechange; + attribute EventHandler onlevelchange; +}; diff --git a/dom/webidl/BeforeUnloadEvent.webidl b/dom/webidl/BeforeUnloadEvent.webidl new file mode 100644 index 0000000000..e1caf63e40 --- /dev/null +++ b/dom/webidl/BeforeUnloadEvent.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * http://www.whatwg.org/specs/web-apps/current-work/#beforeunloadevent + */ + +[Exposed=Window] +interface BeforeUnloadEvent : Event { + attribute DOMString returnValue; +}; diff --git a/dom/webidl/BiquadFilterNode.webidl b/dom/webidl/BiquadFilterNode.webidl new file mode 100644 index 0000000000..14f3b6c69d --- /dev/null +++ b/dom/webidl/BiquadFilterNode.webidl @@ -0,0 +1,53 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * 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", + Exposed=Window] +interface BiquadFilterNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, + optional BiquadFilterOptions options = {}); + + 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 + + [Throws] + undefined getFrequencyResponse(Float32Array frequencyHz, + Float32Array magResponse, + Float32Array phaseResponse); + +}; + +// Mozilla extension +BiquadFilterNode includes AudioNodePassThrough; diff --git a/dom/webidl/Blob.webidl b/dom/webidl/Blob.webidl new file mode 100644 index 0000000000..832f90ad4b --- /dev/null +++ b/dom/webidl/Blob.webidl @@ -0,0 +1,50 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/FileAPI/#blob + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +typedef (BufferSource or Blob or UTF8String) BlobPart; + +[Exposed=(Window,Worker)] +interface Blob { + [Throws] + constructor(optional sequence<BlobPart> blobParts, + optional BlobPropertyBag options = {}); + + [GetterThrows] + readonly attribute unsigned long long size; + + readonly attribute DOMString type; + + //slice Blob into byte-ranged chunks + + [Throws] + Blob slice(optional [Clamp] long long start, + optional [Clamp] long long end, + optional DOMString contentType); + + // read from the Blob. + [NewObject, Throws] ReadableStream stream(); + [NewObject] Promise<USVString> text(); + [NewObject] Promise<ArrayBuffer> arrayBuffer(); +}; + +enum EndingType { "transparent", "native" }; + +dictionary BlobPropertyBag { + DOMString type = ""; + EndingType endings = "transparent"; +}; + +partial interface Blob { + // This returns the type of BlobImpl used for this Blob. + [ChromeOnly] + readonly attribute DOMString blobImplType; +}; diff --git a/dom/webidl/BlobEvent.webidl b/dom/webidl/BlobEvent.webidl new file mode 100644 index 0000000000..8f13adc2ee --- /dev/null +++ b/dom/webidl/BlobEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * https://w3c.github.io/mediacapture-record/#blobevent-section + */ + +[Exposed=Window] +interface BlobEvent : Event +{ + constructor(DOMString type, BlobEventInit eventInitDict); + readonly attribute Blob data; +}; + +dictionary BlobEventInit : EventInit +{ + required Blob data; +}; diff --git a/dom/webidl/BroadcastChannel.webidl b/dom/webidl/BroadcastChannel.webidl new file mode 100644 index 0000000000..196ff2eff9 --- /dev/null +++ b/dom/webidl/BroadcastChannel.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://html.spec.whatwg.org/#broadcastchannel + */ + +[Exposed=(Window,Worker)] +interface BroadcastChannel : EventTarget { + [Throws] + constructor(DOMString channel); + + readonly attribute DOMString name; + + [Throws] + undefined postMessage(any message); + + undefined close(); + + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; diff --git a/dom/webidl/BrowserElementDictionaries.webidl b/dom/webidl/BrowserElementDictionaries.webidl new file mode 100644 index 0000000000..7058aaeb5b --- /dev/null +++ b/dom/webidl/BrowserElementDictionaries.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[GenerateConversionToJS] +dictionary OpenWindowEventDetail { + DOMString url = ""; + DOMString name = ""; + DOMString features = ""; + Node? frameElement = null; + boolean forceNoReferrer = false; +}; + +[GenerateConversionToJS] +dictionary DOMWindowResizeEventDetail { + long width = 0; + long height = 0; +}; diff --git a/dom/webidl/CDATASection.webidl b/dom/webidl/CDATASection.webidl new file mode 100644 index 0000000000..cc0e8e88b9 --- /dev/null +++ b/dom/webidl/CDATASection.webidl @@ -0,0 +1,9 @@ +/* -*- 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/. + */ + +[Exposed=Window] +interface CDATASection : Text { +}; diff --git a/dom/webidl/CSPDictionaries.webidl b/dom/webidl/CSPDictionaries.webidl new file mode 100644 index 0000000000..a84162c6e5 --- /dev/null +++ b/dom/webidl/CSPDictionaries.webidl @@ -0,0 +1,40 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * 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> sandbox; + sequence<DOMString> worker-src; + sequence<DOMString> script-src-elem; + sequence<DOMString> script-src-attr; +}; + +[GenerateToJSON] +dictionary CSPPolicies { + sequence<CSP> csp-policies; +}; diff --git a/dom/webidl/CSPReport.webidl b/dom/webidl/CSPReport.webidl new file mode 100644 index 0000000000..e8141ddfee --- /dev/null +++ b/dom/webidl/CSPReport.webidl @@ -0,0 +1,33 @@ +/* This Source Code Form is subject to the terms of 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. + * + * Based on https://w3c.github.io/webappsec-csp/#deprecated-serialize-violation + */ + +dictionary CSPReportProperties { + DOMString document-uri = ""; + DOMString referrer = ""; + DOMString blocked-uri = ""; + DOMString effective-directive = ""; + DOMString violated-directive = ""; + DOMString original-policy= ""; + SecurityPolicyViolationEventDisposition disposition = "report"; + long status-code = 0; + + DOMString source-file; + DOMString script-sample; + long line-number; + long column-number; +}; + +[GenerateToJSON] +dictionary CSPReport { + // We always want to have a "csp-report" property, so just pre-initialize it + // to an empty dictionary.. + CSPReportProperties csp-report = {}; +}; diff --git a/dom/webidl/CSS.webidl b/dom/webidl/CSS.webidl new file mode 100644 index 0000000000..3ea44e3384 --- /dev/null +++ b/dom/webidl/CSS.webidl @@ -0,0 +1,43 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css3-conditional/ + * http://dev.w3.org/csswg/cssom/#the-css.escape%28%29-method + * https://www.w3.org/TR/css-highlight-api-1/#registration + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +namespace CSS { + boolean supports(UTF8String property, UTF8String value); + boolean supports(UTF8String conditionText); +}; + +// http://dev.w3.org/csswg/cssom/#the-css.escape%28%29-method +partial namespace CSS { + DOMString escape(DOMString ident); +}; + +// https://www.w3.org/TR/css-highlight-api-1/#registration +partial namespace CSS { + [Pref="dom.customHighlightAPI.enabled", GetterThrows] + readonly attribute HighlightRegistry highlights; +}; + +// https://drafts.css-houdini.org/css-properties-values-api-1/#registering-custom-properties +// See https://github.com/w3c/css-houdini-drafts/pull/1100 for DOMString vs. UTF8String +dictionary PropertyDefinition { + required UTF8String name; + UTF8String syntax = "*"; + required boolean inherits; + UTF8String initialValue; +}; +partial namespace CSS { + [Pref="layout.css.properties-and-values.enabled", Throws] + undefined registerProperty(PropertyDefinition definition); +}; diff --git a/dom/webidl/CSS2Properties.webidl.in b/dom/webidl/CSS2Properties.webidl.in new file mode 100644 index 0000000000..0f7853946c --- /dev/null +++ b/dom/webidl/CSS2Properties.webidl.in @@ -0,0 +1,4 @@ +[Exposed=Window] +interface CSS2Properties : CSSStyleDeclaration { +${props} +}; diff --git a/dom/webidl/CSSAnimation.webidl b/dom/webidl/CSSAnimation.webidl new file mode 100644 index 0000000000..f32b52aa33 --- /dev/null +++ b/dom/webidl/CSSAnimation.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-animations-2/#the-CSSAnimation-interface + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[HeaderFile="nsAnimationManager.h", Exposed=Window] +interface CSSAnimation : Animation { + [Constant] readonly attribute DOMString animationName; +}; diff --git a/dom/webidl/CSSConditionRule.webidl b/dom/webidl/CSSConditionRule.webidl new file mode 100644 index 0000000000..a799498494 --- /dev/null +++ b/dom/webidl/CSSConditionRule.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface + */ + +// https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface +[Exposed=Window] +interface CSSConditionRule : CSSGroupingRule { + readonly attribute UTF8String conditionText; +}; diff --git a/dom/webidl/CSSContainerRule.webidl b/dom/webidl/CSSContainerRule.webidl new file mode 100644 index 0000000000..0a4c96fdba --- /dev/null +++ b/dom/webidl/CSSContainerRule.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-contain-3/#the-csscontainerrule-interface + */ + +// https://drafts.csswg.org/css-contain-3/#the-csscontainerrule-interface +[Exposed=Window, Pref="layout.css.container-queries.enabled"] +interface CSSContainerRule : CSSConditionRule { + readonly attribute UTF8String containerName; + readonly attribute UTF8String containerQuery; + + // Performs a container query look-up for an element. + [ChromeOnly] Element? queryContainerFor(Element element); +}; diff --git a/dom/webidl/CSSCounterStyleRule.webidl b/dom/webidl/CSSCounterStyleRule.webidl new file mode 100644 index 0000000000..a7678f0fd7 --- /dev/null +++ b/dom/webidl/CSSCounterStyleRule.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-counter-styles-3/#the-csscounterstylerule-interface + */ + +// https://drafts.csswg.org/css-counter-styles-3/#the-csscounterstylerule-interface +[Exposed=Window] +interface CSSCounterStyleRule : CSSRule { + attribute DOMString name; + attribute UTF8String system; + attribute UTF8String symbols; + attribute UTF8String additiveSymbols; + attribute UTF8String negative; + attribute UTF8String prefix; + attribute UTF8String suffix; + attribute UTF8String range; + attribute UTF8String pad; + attribute UTF8String speakAs; + attribute UTF8String fallback; +}; diff --git a/dom/webidl/CSSFontFaceRule.webidl b/dom/webidl/CSSFontFaceRule.webidl new file mode 100644 index 0000000000..fe5028d440 --- /dev/null +++ b/dom/webidl/CSSFontFaceRule.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://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. +[Exposed=Window] +interface CSSFontFaceRule : CSSRule { + [SameObject] readonly attribute CSSStyleDeclaration style; +}; diff --git a/dom/webidl/CSSFontFeatureValuesRule.webidl b/dom/webidl/CSSFontFeatureValuesRule.webidl new file mode 100644 index 0000000000..0eb6364d43 --- /dev/null +++ b/dom/webidl/CSSFontFeatureValuesRule.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://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. +[Exposed=Window] +interface CSSFontFeatureValuesRule : CSSRule { + [SetterThrows] + attribute UTF8String 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 UTF8String valueText; +}; diff --git a/dom/webidl/CSSFontPaletteValuesRule.webidl b/dom/webidl/CSSFontPaletteValuesRule.webidl new file mode 100644 index 0000000000..4ec58c8a15 --- /dev/null +++ b/dom/webidl/CSSFontPaletteValuesRule.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-fonts/#om-fontpalettevalues + */ + +[Exposed=Window, Pref="layout.css.font-palette.enabled"] +interface CSSFontPaletteValuesRule : CSSRule { + readonly attribute UTF8String name; + readonly attribute UTF8String fontFamily; + readonly attribute UTF8String basePalette; + readonly attribute UTF8String overrideColors; +}; diff --git a/dom/webidl/CSSGroupingRule.webidl b/dom/webidl/CSSGroupingRule.webidl new file mode 100644 index 0000000000..1cb6d49cb9 --- /dev/null +++ b/dom/webidl/CSSGroupingRule.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#cssgroupingrule + */ + +// https://drafts.csswg.org/cssom/#cssgroupingrule +[Exposed=Window] +interface CSSGroupingRule : CSSRule { + [SameObject] readonly attribute CSSRuleList cssRules; + [Throws] + unsigned long insertRule(UTF8String rule, optional unsigned long index = 0); + [Throws] + undefined deleteRule(unsigned long index); +}; diff --git a/dom/webidl/CSSImportRule.webidl b/dom/webidl/CSSImportRule.webidl new file mode 100644 index 0000000000..965da60d1c --- /dev/null +++ b/dom/webidl/CSSImportRule.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#cssimportrule + */ + +// https://drafts.csswg.org/cssom/#cssimportrule +[Exposed=Window] +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; + [SameObject, BinaryName="styleSheetForBindings"] readonly attribute CSSStyleSheet? styleSheet; + readonly attribute UTF8String? layerName; + readonly attribute UTF8String? supportsText; +}; diff --git a/dom/webidl/CSSKeyframeRule.webidl b/dom/webidl/CSSKeyframeRule.webidl new file mode 100644 index 0000000000..6647b3fb2c --- /dev/null +++ b/dom/webidl/CSSKeyframeRule.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-animations/#interface-csskeyframerule + */ + +// https://drafts.csswg.org/css-animations/#interface-csskeyframerule +[Exposed=Window] +interface CSSKeyframeRule : CSSRule { + attribute UTF8String keyText; + [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; +}; diff --git a/dom/webidl/CSSKeyframesRule.webidl b/dom/webidl/CSSKeyframesRule.webidl new file mode 100644 index 0000000000..701ef67b06 --- /dev/null +++ b/dom/webidl/CSSKeyframesRule.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-animations/#interface-csskeyframesrule + */ + +// https://drafts.csswg.org/css-animations/#interface-csskeyframesrule +[Exposed=Window] +interface CSSKeyframesRule : CSSRule { + attribute DOMString name; + readonly attribute CSSRuleList cssRules; + + getter CSSKeyframeRule (unsigned long index); + readonly attribute unsigned long length; + + undefined appendRule(DOMString rule); + undefined deleteRule(DOMString select); + CSSKeyframeRule? findRule(DOMString select); +}; diff --git a/dom/webidl/CSSLayerBlockRule.webidl b/dom/webidl/CSSLayerBlockRule.webidl new file mode 100644 index 0000000000..89b2828a6b --- /dev/null +++ b/dom/webidl/CSSLayerBlockRule.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-cascade-5/#the-csslayerblockrule-interface + */ +[Exposed=Window] +interface CSSLayerBlockRule : CSSGroupingRule { + readonly attribute UTF8String name; +}; diff --git a/dom/webidl/CSSLayerStatementRule.webidl b/dom/webidl/CSSLayerStatementRule.webidl new file mode 100644 index 0000000000..13871e29d3 --- /dev/null +++ b/dom/webidl/CSSLayerStatementRule.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-cascade-5/#the-csslayerstatementrule-interface + */ +[Exposed=Window] +interface CSSLayerStatementRule : CSSRule { + // readonly attribute FrozenArray<CSSOMString> nameList; + [Frozen, Cached, Pure] + readonly attribute sequence<UTF8String> nameList; +}; diff --git a/dom/webidl/CSSMediaRule.webidl b/dom/webidl/CSSMediaRule.webidl new file mode 100644 index 0000000000..10d7573d8a --- /dev/null +++ b/dom/webidl/CSSMediaRule.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/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. +[Exposed=Window] +interface CSSMediaRule : CSSConditionRule { + [SameObject, PutForwards=mediaText] readonly attribute MediaList media; +}; diff --git a/dom/webidl/CSSMozDocumentRule.webidl b/dom/webidl/CSSMozDocumentRule.webidl new file mode 100644 index 0000000000..47bd3933fd --- /dev/null +++ b/dom/webidl/CSSMozDocumentRule.webidl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// This is a non-standard interface for @-moz-document rules +[Exposed=Window] +interface CSSMozDocumentRule : CSSConditionRule { + // XXX Add access to the URL list. +}; diff --git a/dom/webidl/CSSNamespaceRule.webidl b/dom/webidl/CSSNamespaceRule.webidl new file mode 100644 index 0000000000..6044c3a6f2 --- /dev/null +++ b/dom/webidl/CSSNamespaceRule.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#cssnamespacerule + */ + +// https://drafts.csswg.org/cssom/#cssnamespacerule +[Exposed=Window] +interface CSSNamespaceRule : CSSRule { + readonly attribute DOMString namespaceURI; + readonly attribute DOMString prefix; +}; diff --git a/dom/webidl/CSSPageRule.webidl b/dom/webidl/CSSPageRule.webidl new file mode 100644 index 0000000000..afc999a7ee --- /dev/null +++ b/dom/webidl/CSSPageRule.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#the-csspagerule-interface + */ + +// https://drafts.csswg.org/cssom/#the-csspagerule-interface +// Per spec, this should inherit from CSSGroupingRule, but we don't +// implement this yet. +[Exposed=Window] +interface CSSPageRule : CSSRule { + attribute UTF8String selectorText; + [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; +}; diff --git a/dom/webidl/CSSPropertyRule.webidl b/dom/webidl/CSSPropertyRule.webidl new file mode 100644 index 0000000000..20b03a738b --- /dev/null +++ b/dom/webidl/CSSPropertyRule.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.css-houdini.org/css-properties-values-api-1/#the-css-property-rule-interface + */ + +// https://drafts.css-houdini.org/css-properties-values-api-1/#the-css-property-rule-interface +[Exposed=Window, Pref="layout.css.properties-and-values.enabled"] +interface CSSPropertyRule : CSSRule { + readonly attribute UTF8String name; + readonly attribute UTF8String syntax; + readonly attribute boolean inherits; + readonly attribute UTF8String? initialValue; +}; diff --git a/dom/webidl/CSSPseudoElement.webidl b/dom/webidl/CSSPseudoElement.webidl new file mode 100644 index 0000000000..c0e49a8d6e --- /dev/null +++ b/dom/webidl/CSSPseudoElement.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/css-pseudo-4/#csspseudoelement + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.css_pseudo_element.enabled", + Exposed=Window] +interface CSSPseudoElement { + readonly attribute DOMString type; + readonly attribute Element element; +}; diff --git a/dom/webidl/CSSRule.webidl b/dom/webidl/CSSRule.webidl new file mode 100644 index 0000000000..10b4585eb0 --- /dev/null +++ b/dom/webidl/CSSRule.webidl @@ -0,0 +1,59 @@ +/* -*- 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 +[Exposed=Window] +interface CSSRule { + + const unsigned short STYLE_RULE = 1; + const unsigned short CHARSET_RULE = 2; // historical + const unsigned short IMPORT_RULE = 3; + const unsigned short MEDIA_RULE = 4; + const unsigned short FONT_FACE_RULE = 5; + const unsigned short PAGE_RULE = 6; + // 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; + [BinaryName="typeForBindings"] readonly attribute unsigned short type; + attribute UTF8String cssText; + readonly attribute CSSRule? parentRule; + readonly attribute CSSStyleSheet? parentStyleSheet; +}; + +// https://drafts.csswg.org/css-animations/#interface-cssrule +partial interface CSSRule { + const unsigned short KEYFRAMES_RULE = 7; + const unsigned short KEYFRAME_RULE = 8; +}; + +// https://drafts.csswg.org/css-counter-styles-3/#extentions-to-cssrule-interface +partial interface CSSRule { + const unsigned short COUNTER_STYLE_RULE = 11; +}; + +// https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface +partial interface CSSRule { + const unsigned short SUPPORTS_RULE = 12; +}; + +// Non-standard extension for @-moz-document rules. +partial interface CSSRule { + [ChromeOnly] + const unsigned short DOCUMENT_RULE = 13; +}; + +// https://drafts.csswg.org/css-fonts-3/#om-fontfeaturevalues +partial interface CSSRule { + const unsigned short FONT_FEATURE_VALUES_RULE = 14; +}; diff --git a/dom/webidl/CSSRuleList.webidl b/dom/webidl/CSSRuleList.webidl new file mode 100644 index 0000000000..bd263d419e --- /dev/null +++ b/dom/webidl/CSSRuleList.webidl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface CSSRuleList { + readonly attribute unsigned long length; + getter CSSRule? item(unsigned long index); +}; diff --git a/dom/webidl/CSSStyleDeclaration.webidl b/dom/webidl/CSSStyleDeclaration.webidl new file mode 100644 index 0000000000..76050b75a0 --- /dev/null +++ b/dom/webidl/CSSStyleDeclaration.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/cssom/ + */ + + // Because of getComputedStyle, many CSSStyleDeclaration objects can be + // short-living. +[ProbablyShortLivingWrapper, + Exposed=Window] +interface CSSStyleDeclaration { + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute UTF8String cssText; + + readonly attribute unsigned long length; + getter UTF8String item(unsigned long index); + + [Throws, ChromeOnly] + sequence<UTF8String> getCSSImageURLs(UTF8String property); + + UTF8String getPropertyValue(UTF8String property); + UTF8String getPropertyPriority(UTF8String property); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + undefined setProperty(UTF8String property, [LegacyNullToEmptyString] UTF8String value, optional [LegacyNullToEmptyString] UTF8String priority = ""); + [CEReactions, Throws] + UTF8String removeProperty(UTF8String property); + + readonly attribute CSSRule? parentRule; +}; diff --git a/dom/webidl/CSSStyleRule.webidl b/dom/webidl/CSSStyleRule.webidl new file mode 100644 index 0000000000..652e456f65 --- /dev/null +++ b/dom/webidl/CSSStyleRule.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom/#the-cssstylerule-interface + */ + +// https://drafts.csswg.org/cssom/#the-cssstylerule-interface +[Exposed=Window] +interface CSSStyleRule : CSSGroupingRule { + attribute UTF8String selectorText; + [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; + + [ChromeOnly] readonly attribute unsigned long selectorCount; + [ChromeOnly] UTF8String selectorTextAt(unsigned long index, optional boolean desugared = false); + [ChromeOnly] unsigned long long selectorSpecificityAt(unsigned long index, optional boolean desugared = false); + [ChromeOnly] boolean selectorMatchesElement( + unsigned long selectorIndex, + Element element, + optional [LegacyNullToEmptyString] DOMString pseudo = "", + optional boolean includeVisitedStyle = false); + [ChromeOnly] sequence<SelectorWarning> getSelectorWarnings(); +}; + +enum SelectorWarningKind { + "UnconstrainedHas", +}; + +dictionary SelectorWarning { + required unsigned long index; + required SelectorWarningKind kind; +}; diff --git a/dom/webidl/CSSStyleSheet.webidl b/dom/webidl/CSSStyleSheet.webidl new file mode 100644 index 0000000000..9236ddd74d --- /dev/null +++ b/dom/webidl/CSSStyleSheet.webidl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/cssom/ + * https://wicg.github.io/construct-stylesheets/ + */ + +enum CSSStyleSheetParsingMode { + "author", + "user", + "agent" +}; + +dictionary CSSStyleSheetInit { + (MediaList or UTF8String) media = ""; + boolean disabled = false; + UTF8String baseURL; +}; + +[Exposed=Window] +interface CSSStyleSheet : StyleSheet { + [Throws] + constructor(optional CSSStyleSheetInit options = {}); + [Pure, BinaryName="DOMOwnerRule"] + readonly attribute CSSRule? ownerRule; + [Throws, NeedsSubjectPrincipal] + readonly attribute CSSRuleList cssRules; + [ChromeOnly, BinaryName="parsingModeDOM"] + readonly attribute CSSStyleSheetParsingMode parsingMode; + [Throws, NeedsSubjectPrincipal] + unsigned long insertRule(UTF8String rule, optional unsigned long index = 0); + [Throws, NeedsSubjectPrincipal] + undefined deleteRule(unsigned long index); + [NewObject] + Promise<CSSStyleSheet> replace(UTF8String text); + [Throws] + undefined replaceSync(UTF8String text); + + // Non-standard WebKit things. + [Throws, NeedsSubjectPrincipal, BinaryName="cssRules"] + readonly attribute CSSRuleList rules; + [Throws, NeedsSubjectPrincipal, BinaryName="deleteRule"] + undefined removeRule(optional unsigned long index = 0); + [Throws, NeedsSubjectPrincipal] + long addRule(optional UTF8String selector = "undefined", optional UTF8String style = "undefined", optional unsigned long index); +}; diff --git a/dom/webidl/CSSSupportsRule.webidl b/dom/webidl/CSSSupportsRule.webidl new file mode 100644 index 0000000000..3040f34507 --- /dev/null +++ b/dom/webidl/CSSSupportsRule.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * 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 +[Exposed=Window] +interface CSSSupportsRule : CSSConditionRule { +}; diff --git a/dom/webidl/CSSTransition.webidl b/dom/webidl/CSSTransition.webidl new file mode 100644 index 0000000000..859d9ba081 --- /dev/null +++ b/dom/webidl/CSSTransition.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-transitions-2/#the-CSSTransition-interface + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[HeaderFile="nsTransitionManager.h", Exposed=Window] +interface CSSTransition : Animation { + [Constant] readonly attribute DOMString transitionProperty; +}; diff --git a/dom/webidl/Cache.webidl b/dom/webidl/Cache.webidl new file mode 100644 index 0000000000..b7f676e3fe --- /dev/null +++ b/dom/webidl/Cache.webidl @@ -0,0 +1,40 @@ +/* -*- 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/#cache-interface + */ + +[Exposed=(Window,Worker), + Func="nsGlobalWindowInner::CachesEnabled"] +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<undefined> add(RequestInfo request); + [NewObject, NeedsCallerType] + Promise<undefined> addAll(sequence<RequestInfo> requests); + [NewObject] + Promise<undefined> 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; +}; + +dictionary CacheBatchOperation { + DOMString type; + Request request; + Response response; + CacheQueryOptions options; +}; diff --git a/dom/webidl/CacheStorage.webidl b/dom/webidl/CacheStorage.webidl new file mode 100644 index 0000000000..7ece3197c6 --- /dev/null +++ b/dom/webidl/CacheStorage.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/ServiceWorker/#cachestorage-interface + */ + +interface Principal; + +[Exposed=(Window,Worker), + Func="nsGlobalWindowInner::CachesEnabled"] +interface CacheStorage { + [Throws, ChromeOnly] + constructor(CacheStorageNamespace namespace, Principal principal); + + [NewObject] + Promise<Response> match(RequestInfo request, optional MultiCacheQueryOptions options = {}); + [NewObject] + Promise<boolean> has(DOMString cacheName); + [NewObject] + Promise<Cache> open(DOMString cacheName); + [NewObject] + Promise<boolean> delete(DOMString cacheName); + [NewObject] + Promise<sequence<DOMString>> keys(); +}; + +dictionary MultiCacheQueryOptions : CacheQueryOptions { + DOMString cacheName; +}; + +// chrome-only, gecko specific extension +enum CacheStorageNamespace { + "content", "chrome" +}; diff --git a/dom/webidl/CancelContentJSOptions.webidl b/dom/webidl/CancelContentJSOptions.webidl new file mode 100644 index 0000000000..6b07534adc --- /dev/null +++ b/dom/webidl/CancelContentJSOptions.webidl @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of 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/. */ + +[GenerateInit] +dictionary CancelContentJSOptions { + long index = 0; + URI? uri = null; + long epoch = 0; +}; diff --git a/dom/webidl/CanvasCaptureMediaStream.webidl b/dom/webidl/CanvasCaptureMediaStream.webidl new file mode 100644 index 0000000000..e9ae22a5f3 --- /dev/null +++ b/dom/webidl/CanvasCaptureMediaStream.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/mediacapture-fromelement/index.html + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface CanvasCaptureMediaStream : MediaStream { + readonly attribute HTMLCanvasElement canvas; + undefined requestFrame(); +}; diff --git a/dom/webidl/CanvasRenderingContext2D.webidl b/dom/webidl/CanvasRenderingContext2D.webidl new file mode 100644 index 0000000000..c89c098928 --- /dev/null +++ b/dom/webidl/CanvasRenderingContext2D.webidl @@ -0,0 +1,414 @@ +/* -*- 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" }; + +enum CanvasLineCap { "butt", "round", "square" }; +enum CanvasLineJoin { "round", "bevel", "miter" }; +enum CanvasTextAlign { "start", "end", "left", "right", "center" }; +enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" }; +enum CanvasDirection { "ltr", "rtl", "inherit" }; +enum CanvasFontKerning { "auto", "normal", "none" }; +enum CanvasFontStretch { "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" }; +enum CanvasFontVariantCaps { "normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps" }; +enum CanvasTextRendering { "auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision" }; + +[GenerateInit] +dictionary CanvasRenderingContext2DSettings { + // signal if the canvas contains an alpha channel + boolean alpha = true; + + boolean desynchronized = false; + + PredefinedColorSpace colorSpace = "srgb"; + + // whether or not we're planning to do a lot of readback operations + boolean willReadFrequently = false; +}; + +dictionary HitRegionOptions { + Path2D? path = null; + DOMString id = ""; + Element? control = null; +}; + +typedef (HTMLImageElement or + SVGImageElement) HTMLOrSVGImageElement; + +typedef (HTMLOrSVGImageElement or + HTMLCanvasElement or + HTMLVideoElement or + OffscreenCanvas or + ImageBitmap or + VideoFrame) CanvasImageSource; + +[Exposed=Window] +interface CanvasRenderingContext2D { + + // back-reference to the canvas. Might be null if we're not + // associated with a canvas. + readonly attribute HTMLCanvasElement? canvas; + + CanvasRenderingContext2DSettings getContextAttributes(); + + // 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, NeedsSubjectPrincipal, Func="CanvasUtils::HasDrawWindowPrivilege"] + undefined drawWindow(Window window, double x, double y, double w, double h, + UTF8String 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] + undefined demote(); +}; + +CanvasRenderingContext2D includes CanvasState; +CanvasRenderingContext2D includes CanvasTransform; +CanvasRenderingContext2D includes CanvasCompositing; +CanvasRenderingContext2D includes CanvasImageSmoothing; +CanvasRenderingContext2D includes CanvasFillStrokeStyles; +CanvasRenderingContext2D includes CanvasShadowStyles; +CanvasRenderingContext2D includes CanvasFilters; +CanvasRenderingContext2D includes CanvasRect; +CanvasRenderingContext2D includes CanvasDrawPath; +CanvasRenderingContext2D includes CanvasUserInterface; +CanvasRenderingContext2D includes CanvasText; +CanvasRenderingContext2D includes CanvasDrawImage; +CanvasRenderingContext2D includes CanvasImageData; +CanvasRenderingContext2D includes CanvasPathDrawingStyles; +CanvasRenderingContext2D includes CanvasTextDrawingStyles; +CanvasRenderingContext2D includes CanvasPathMethods; + + +interface mixin CanvasState { + // state + undefined save(); // push state on state stack + undefined restore(); // pop state stack and restore state + undefined reset(); // reset the rendering context to its default state +}; + +interface mixin CanvasTransform { + // transformations (default transform is the identity matrix) + [Throws, LenientFloat] + undefined scale(double x, double y); + [Throws, LenientFloat] + undefined rotate(double angle); + [Throws, LenientFloat] + undefined translate(double x, double y); + [Throws, LenientFloat] + undefined transform(double a, double b, double c, double d, double e, double f); + + [NewObject, Throws] DOMMatrix getTransform(); + [Throws, LenientFloat] + undefined setTransform(double a, double b, double c, double d, double e, double f); + [Throws] + undefined setTransform(optional DOMMatrix2DInit transform = {}); + [Throws] + undefined resetTransform(); +}; + +interface mixin CanvasCompositing { + attribute unrestricted double globalAlpha; // (default 1.0) + [Throws] + attribute DOMString globalCompositeOperation; // (default source-over) +}; + +interface mixin CanvasImageSmoothing { + // drawing images + attribute boolean imageSmoothingEnabled; +}; + +interface mixin CanvasFillStrokeStyles { + // colors and styles (see also the CanvasPathDrawingStyles interface) + attribute (UTF8String or CanvasGradient or CanvasPattern) strokeStyle; // (default black) + attribute (UTF8String 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] + CanvasGradient createConicGradient(double angle, double cx, double cy); + [NewObject, Throws] + CanvasPattern? createPattern(CanvasImageSource image, [LegacyNullToEmptyString] DOMString repetition); +}; + +interface mixin CanvasShadowStyles { + [LenientFloat] + attribute double shadowOffsetX; // (default 0) + [LenientFloat] + attribute double shadowOffsetY; // (default 0) + [LenientFloat] + attribute double shadowBlur; // (default 0) + attribute UTF8String shadowColor; // (default transparent black) +}; + +interface mixin CanvasFilters { + [SetterThrows] + attribute UTF8String filter; // (default empty string = no filter) +}; + +interface mixin CanvasRect { + [LenientFloat] + undefined clearRect(double x, double y, double w, double h); + [LenientFloat] + undefined fillRect(double x, double y, double w, double h); + [LenientFloat] + undefined strokeRect(double x, double y, double w, double h); +}; + +interface mixin CanvasDrawPath { + // path API (see also CanvasPathMethods) + undefined beginPath(); + undefined fill(optional CanvasWindingRule winding = "nonzero"); + undefined fill(Path2D path, optional CanvasWindingRule winding = "nonzero"); + undefined stroke(); + undefined stroke(Path2D path); + undefined clip(optional CanvasWindingRule winding = "nonzero"); + undefined clip(Path2D path, optional CanvasWindingRule winding = "nonzero"); +// NOT IMPLEMENTED undefined 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); +}; + +interface mixin CanvasUserInterface { + [Throws] undefined drawFocusIfNeeded(Element element); +// NOT IMPLEMENTED undefined scrollPathIntoView(); +// NOT IMPLEMENTED undefined scrollPathIntoView(Path path); +}; + +interface mixin CanvasText { + // text (see also the CanvasPathDrawingStyles interface) + [Throws, LenientFloat] + undefined fillText(DOMString text, double x, double y, optional double maxWidth); + [Throws, LenientFloat] + undefined strokeText(DOMString text, double x, double y, optional double maxWidth); + [NewObject, Throws] + TextMetrics measureText(DOMString text); +}; + +interface mixin CanvasDrawImage { + [Throws, LenientFloat] + undefined drawImage(CanvasImageSource image, double dx, double dy); + [Throws, LenientFloat] + undefined drawImage(CanvasImageSource image, double dx, double dy, double dw, double dh); + [Throws, LenientFloat] + undefined drawImage(CanvasImageSource image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh); +}; + +// See https://github.com/whatwg/html/issues/6262 for [EnforceRange] usage. +interface mixin CanvasImageData { + // pixel manipulation + [NewObject, Throws] + ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh); + [NewObject, Throws] + ImageData createImageData(ImageData imagedata); + [NewObject, Throws, NeedsSubjectPrincipal] + ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh); + [Throws] + undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy); + [Throws] + undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight); +}; + +interface mixin CanvasPathDrawingStyles { + // line caps/joins + [LenientFloat] + attribute double lineWidth; // (default 1) + attribute CanvasLineCap lineCap; // (default "butt") + attribute CanvasLineJoin lineJoin; // (default "miter") + [LenientFloat] + attribute double miterLimit; // (default 10) + + // dashed lines + [LenientFloat, Throws] undefined setLineDash(sequence<double> segments); // default empty + sequence<double> getLineDash(); + [LenientFloat] attribute double lineDashOffset; +}; + +interface mixin CanvasTextDrawingStyles { + // text + [SetterThrows] + attribute UTF8String font; // (default 10px sans-serif) + attribute CanvasTextAlign textAlign; // (default: "start") + attribute CanvasTextBaseline textBaseline; // (default: "alphabetic") + attribute CanvasDirection direction; // (default: "inherit") + attribute UTF8String letterSpacing; // default: "0px" + attribute CanvasFontKerning fontKerning; // (default: "auto") + attribute CanvasFontStretch fontStretch; // (default: "normal") + attribute CanvasFontVariantCaps fontVariantCaps; // (default: "normal") + attribute CanvasTextRendering textRendering; // (default: "auto") + attribute UTF8String wordSpacing; // default: "0px" +}; + +interface mixin CanvasPathMethods { + // shared path API methods + undefined closePath(); + [LenientFloat] + undefined moveTo(double x, double y); + [LenientFloat] + undefined lineTo(double x, double y); + [LenientFloat] + undefined quadraticCurveTo(double cpx, double cpy, double x, double y); + + [LenientFloat] + undefined bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); + + [Throws, LenientFloat] + undefined arcTo(double x1, double y1, double x2, double y2, double radius); +// NOT IMPLEMENTED [LenientFloat] undefined arcTo(double x1, double y1, double x2, double y2, double radiusX, double radiusY, double rotation); + + [LenientFloat] + undefined rect(double x, double y, double w, double h); + + [Throws] + undefined roundRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h, optional (unrestricted double or DOMPointInit or sequence<(unrestricted double or DOMPointInit)>) radii = 0); + + [Throws, LenientFloat] + undefined arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise = false); + + [Throws, LenientFloat] + undefined ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, optional boolean anticlockwise = false); +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface CanvasGradient { + // opaque object + [Throws] + // addColorStop should take a double + undefined addColorStop(float offset, UTF8String color); +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface CanvasPattern { + // opaque object + // [Throws, LenientFloat] - could not do this overload because of bug 1020975 + // undefined setTransform(double a, double b, double c, double d, double e, double f); + + [Throws] + undefined setTransform(optional DOMMatrix2DInit matrix = {}); +}; + +[Exposed=(Window,Worker)] +interface TextMetrics { + + // x-direction + readonly attribute double width; // advance width + + // [experimental] actualBoundingBox* attributes + [Pref="dom.textMetrics.actualBoundingBox.enabled"] + readonly attribute double actualBoundingBoxLeft; + [Pref="dom.textMetrics.actualBoundingBox.enabled"] + readonly attribute double actualBoundingBoxRight; + + // y-direction + // [experimental] fontBoundingBox* attributes + [Pref="dom.textMetrics.fontBoundingBox.enabled"] + readonly attribute double fontBoundingBoxAscent; + [Pref="dom.textMetrics.fontBoundingBox.enabled"] + readonly attribute double fontBoundingBoxDescent; + + // [experimental] actualBoundingBox* attributes + [Pref="dom.textMetrics.actualBoundingBox.enabled"] + readonly attribute double actualBoundingBoxAscent; + [Pref="dom.textMetrics.actualBoundingBox.enabled"] + readonly attribute double actualBoundingBoxDescent; + + // [experimental] emHeight* attributes + [Pref="dom.textMetrics.emHeight.enabled"] + readonly attribute double emHeightAscent; + [Pref="dom.textMetrics.emHeight.enabled"] + readonly attribute double emHeightDescent; + + // [experimental] *Baseline attributes + [Pref="dom.textMetrics.baselines.enabled"] + readonly attribute double hangingBaseline; + [Pref="dom.textMetrics.baselines.enabled"] + readonly attribute double alphabeticBaseline; + [Pref="dom.textMetrics.baselines.enabled"] + readonly attribute double ideographicBaseline; +}; + +[Exposed=(Window,Worker)] +interface Path2D +{ + constructor(); + constructor(Path2D other); + constructor(DOMString pathString); + + [Throws] undefined addPath(Path2D path, optional DOMMatrix2DInit transform = {}); +}; +Path2D includes CanvasPathMethods; diff --git a/dom/webidl/CaretPosition.webidl b/dom/webidl/CaretPosition.webidl new file mode 100644 index 0000000000..2deb7d2d3f --- /dev/null +++ b/dom/webidl/CaretPosition.webidl @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of 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/. */ + +[Exposed=Window] +interface CaretPosition { + + /** + * The offsetNode could potentially be null due to anonymous content. + */ + readonly attribute Node? offsetNode; + readonly attribute unsigned long offset; + +}; + +/** + * Gecko specific methods and properties for CaretPosition. + */ +partial interface CaretPosition { + DOMRect? getClientRect(); +}; diff --git a/dom/webidl/CaretStateChangedEvent.webidl b/dom/webidl/CaretStateChangedEvent.webidl new file mode 100644 index 0000000000..0a661fe737 --- /dev/null +++ b/dom/webidl/CaretStateChangedEvent.webidl @@ -0,0 +1,50 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +enum CaretChangedReason { + "visibilitychange", + "updateposition", + "longpressonemptycontent", + "taponcaret", + "presscaret", + "releasecaret", + "scroll", + "dragcaret" +}; + +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 = ""; + long clientX = 0; + long clientY = 0; +}; + +[ChromeOnly, + Exposed=Window] +interface CaretStateChangedEvent : Event { + constructor(DOMString type, + optional CaretStateChangedEventInit eventInit = {}); + + readonly attribute boolean collapsed; + /* The bounding client rect is relative to the visual viewport. */ + 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; + [Pref="layout.accessiblecaret.magnifier.enabled"] + readonly attribute long clientX; + [Pref="layout.accessiblecaret.magnifier.enabled"] + readonly attribute long clientY; +}; diff --git a/dom/webidl/ChannelMergerNode.webidl b/dom/webidl/ChannelMergerNode.webidl new file mode 100644 index 0000000000..00fbf1bac4 --- /dev/null +++ b/dom/webidl/ChannelMergerNode.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://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", + Exposed=Window] +interface ChannelMergerNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, + optional ChannelMergerOptions options = {}); +}; diff --git a/dom/webidl/ChannelSplitterNode.webidl b/dom/webidl/ChannelSplitterNode.webidl new file mode 100644 index 0000000000..e6cacbb7c3 --- /dev/null +++ b/dom/webidl/ChannelSplitterNode.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://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", + Exposed=Window] +interface ChannelSplitterNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, + optional ChannelSplitterOptions options = {}); +}; diff --git a/dom/webidl/CharacterData.webidl b/dom/webidl/CharacterData.webidl new file mode 100644 index 0000000000..6b447af94b --- /dev/null +++ b/dom/webidl/CharacterData.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#characterdata + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface CharacterData : Node { + [Pure, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString data; + [Pure] + readonly attribute unsigned long length; + [Throws] + DOMString substringData(unsigned long offset, unsigned long count); + [Throws] + undefined appendData(DOMString data); + [Throws] + undefined insertData(unsigned long offset, DOMString data); + [Throws] + undefined deleteData(unsigned long offset, unsigned long count); + [Throws] + undefined replaceData(unsigned long offset, unsigned long count, DOMString data); +}; + +CharacterData includes ChildNode; +CharacterData includes NonDocumentTypeChildNode; diff --git a/dom/webidl/CheckerboardReportService.webidl b/dom/webidl/CheckerboardReportService.webidl new file mode 100644 index 0000000000..0869df7475 --- /dev/null +++ b/dom/webidl/CheckerboardReportService.webidl @@ -0,0 +1,60 @@ +/* -*- 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", + Exposed=Window] +interface CheckerboardReportService { + constructor(); + + /** + * 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. + */ + undefined 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. + */ + undefined flushActiveReports(); +}; diff --git a/dom/webidl/ChildNode.webidl b/dom/webidl/ChildNode.webidl new file mode 100644 index 0000000000..a82d192980 --- /dev/null +++ b/dom/webidl/ChildNode.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#interface-childnode + */ + +interface mixin ChildNode { + [CEReactions, Throws, Unscopable] + undefined before((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + undefined after((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + undefined replaceWith((Node or DOMString)... nodes); + [CEReactions, Unscopable] + undefined remove(); +}; + +interface mixin NonDocumentTypeChildNode { + [Pure] + readonly attribute Element? previousElementSibling; + [Pure] + readonly attribute Element? nextElementSibling; +}; diff --git a/dom/webidl/Client.webidl b/dom/webidl/Client.webidl new file mode 100644 index 0000000000..5dc9b6ea48 --- /dev/null +++ b/dom/webidl/Client.webidl @@ -0,0 +1,53 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * 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] + undefined postMessage(any message, sequence<object> transfer); + [Throws] + undefined postMessage(any message, optional StructuredSerializeOptions aOptions = {}); +}; + +[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, NeedsCallerType] + Promise<WindowClient> focus(); + + [Throws, NewObject] + Promise<WindowClient> navigate(USVString url); +}; + +// Remove FrameType in bug 1290936 +enum FrameType { + "auxiliary", + "top-level", + "nested", + "none" +}; diff --git a/dom/webidl/Clients.webidl b/dom/webidl/Clients.webidl new file mode 100644 index 0000000000..4eda1dd7bd --- /dev/null +++ b/dom/webidl/Clients.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * 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<(Client or undefined)> get(DOMString id); + [NewObject] + Promise<sequence<Client>> matchAll(optional ClientQueryOptions options = {}); + [NewObject] + Promise<WindowClient?> openWindow(USVString url); + [NewObject] + Promise<undefined> claim(); +}; + +dictionary ClientQueryOptions { + boolean includeUncontrolled = false; + ClientType type = "window"; +}; + +enum ClientType { + "window", + "worker", + "sharedworker", + // https://github.com/w3c/ServiceWorker/issues/1036 + "serviceworker", + "all" +}; diff --git a/dom/webidl/Clipboard.webidl b/dom/webidl/Clipboard.webidl new file mode 100644 index 0000000000..5bc5cd51bc --- /dev/null +++ b/dom/webidl/Clipboard.webidl @@ -0,0 +1,62 @@ +/* -*- 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/clipboard-apis/ + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +typedef sequence<ClipboardItem> ClipboardItems; + +[SecureContext, + Exposed=Window, + InstrumentedProps=(read,readText,write)] +interface Clipboard : EventTarget { + [Pref="dom.events.asyncClipboard.clipboardItem", NewObject, NeedsSubjectPrincipal] + Promise<ClipboardItems> read(); + [Func="Clipboard::ReadTextEnabled", NewObject, NeedsSubjectPrincipal] + Promise<DOMString> readText(); + + [Pref="dom.events.asyncClipboard.clipboardItem", NewObject, NeedsSubjectPrincipal] + Promise<undefined> write(ClipboardItems data); + + [NewObject, NeedsSubjectPrincipal] + Promise<undefined> writeText(DOMString data); +}; + +typedef (DOMString or Blob) ClipboardItemDataType; +typedef Promise<ClipboardItemDataType> ClipboardItemData; +// callback ClipboardItemDelayedCallback = ClipboardItemData (); + +[SecureContext, Exposed=Window, Pref="dom.events.asyncClipboard.clipboardItem"] +interface ClipboardItem { + [Throws] + constructor(record<DOMString, ClipboardItemData> items, + optional ClipboardItemOptions options = {}); + + // static ClipboardItem createDelayed( + // record<DOMString, ClipboardItemDelayedCallback> items, + // optional ClipboardItemOptions options = {}); + + readonly attribute PresentationStyle presentationStyle; + // readonly attribute long long lastModified; + // readonly attribute boolean delayed; + + // TODO: Use FrozenArray once available. (Bug 1236777) + // readonly attribute FrozenArray<DOMString> types; + [Frozen, Cached, Pure] + readonly attribute sequence<DOMString> types; + + [NewObject] + Promise<Blob> getType(DOMString type); +}; + +enum PresentationStyle { "unspecified", "inline", "attachment" }; + +dictionary ClipboardItemOptions { + PresentationStyle presentationStyle = "unspecified"; +}; diff --git a/dom/webidl/ClipboardEvent.webidl b/dom/webidl/ClipboardEvent.webidl new file mode 100644 index 0000000000..90ecfdb67d --- /dev/null +++ b/dom/webidl/ClipboardEvent.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface please see + * http://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. + */ + +[Exposed=Window] +interface ClipboardEvent : Event +{ + [Throws] + constructor(DOMString type, optional ClipboardEventInit eventInitDict = {}); + + readonly attribute DataTransfer? clipboardData; +}; + +dictionary ClipboardEventInit : EventInit +{ + DOMString data = ""; + DOMString dataType = ""; +}; diff --git a/dom/webidl/CloseEvent.webidl b/dom/webidl/CloseEvent.webidl new file mode 100644 index 0000000000..a74e219fc4 --- /dev/null +++ b/dom/webidl/CloseEvent.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The 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 + */ + +[LegacyEventInit, + Exposed=(Window,Worker)] +interface CloseEvent : Event +{ + constructor(DOMString type, optional CloseEventInit eventInitDict = {}); + + readonly attribute boolean wasClean; + readonly attribute unsigned short code; + readonly attribute DOMString reason; +}; + +dictionary CloseEventInit : EventInit +{ + boolean wasClean = false; + unsigned short code = 0; + DOMString reason = ""; +}; diff --git a/dom/webidl/Comment.webidl b/dom/webidl/Comment.webidl new file mode 100644 index 0000000000..e3662a4d6c --- /dev/null +++ b/dom/webidl/Comment.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#comment + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface Comment : CharacterData { + [Throws] + constructor(optional DOMString data = ""); +}; diff --git a/dom/webidl/CompositionEvent.webidl b/dom/webidl/CompositionEvent.webidl new file mode 100644 index 0000000000..4ebaa919f6 --- /dev/null +++ b/dom/webidl/CompositionEvent.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://w3c.github.io/uievents/#interface-compositionevent + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface CompositionEvent : UIEvent +{ + constructor(DOMString type, optional CompositionEventInit eventInitDict = {}); + + 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 +{ + undefined initCompositionEvent(DOMString typeArg, + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional Window? viewArg = null, + optional DOMString? dataArg = null, + optional DOMString localeArg = ""); +}; diff --git a/dom/webidl/CompressionStream.webidl b/dom/webidl/CompressionStream.webidl new file mode 100644 index 0000000000..16c9af0ac1 --- /dev/null +++ b/dom/webidl/CompressionStream.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://wicg.github.io/compression/#compression-stream + */ + +enum CompressionFormat { + "deflate", + "deflate-raw", + "gzip", +}; + +[Exposed=*, Pref="dom.compression_streams.enabled"] +interface CompressionStream { + [Throws] + constructor(CompressionFormat format); +}; +CompressionStream includes GenericTransformStream; diff --git a/dom/webidl/Console.webidl b/dom/webidl/Console.webidl new file mode 100644 index 0000000000..1f43ee19b6 --- /dev/null +++ b/dom/webidl/Console.webidl @@ -0,0 +1,250 @@ +/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://console.spec.whatwg.org/#console-namespace + */ + +[Exposed=(Window,Worker,WorkerDebugger,Worklet), + ClassString="Console", + ProtoObjectHack] +namespace console { + + // NOTE: if you touch this namespace, remember to update the ConsoleInstance + // interface as well! + + // Logging + [UseCounter] + undefined assert(optional boolean condition = false, any... data); + [UseCounter] + undefined clear(); + [UseCounter] + undefined count(optional DOMString label = "default"); + [UseCounter] + undefined countReset(optional DOMString label = "default"); + [UseCounter] + undefined debug(any... data); + [UseCounter] + undefined error(any... data); + [UseCounter] + undefined info(any... data); + [UseCounter] + undefined log(any... data); + [UseCounter] + undefined table(any... data); // FIXME: The spec is still unclear about this. + [UseCounter] + undefined trace(any... data); + [UseCounter] + undefined warn(any... data); + [UseCounter] + undefined dir(any... data); // FIXME: This doesn't follow the spec yet. + [UseCounter] + undefined dirxml(any... data); + + // Grouping + [UseCounter] + undefined group(any... data); + [UseCounter] + undefined groupCollapsed(any... data); + [UseCounter] + undefined groupEnd(); + + // Timing + [UseCounter] + undefined time(optional DOMString label = "default"); + [UseCounter] + undefined timeLog(optional DOMString label = "default", any... data); + [UseCounter] + undefined timeEnd(optional DOMString label = "default"); + + // Mozilla only or Webcompat methods + + [UseCounter] + undefined _exception(any... data); + [UseCounter] + undefined timeStamp(optional any data); + + [UseCounter] + undefined profile(any... data); + [UseCounter] + undefined profileEnd(any... data); + + [ChromeOnly] + const boolean IS_NATIVE_CONSOLE = true; + + [ChromeOnly, NewObject] + ConsoleInstance createInstance(optional ConsoleInstanceOptions options = {}); +}; + +// This is used to propagate console events to the observers. +[GenerateConversionToJS] +dictionary ConsoleEvent { + (unsigned long long or DOMString) ID; + (unsigned long long or DOMString) innerID; + DOMString consoleID = ""; + DOMString addonId = ""; + DOMString level = ""; + DOMString filename = ""; + // Unique identifier within the process for the script source this event is + // associated with, or zero. + unsigned long sourceId = 0; + unsigned long lineNumber = 0; + unsigned long columnNumber = 0; + DOMString functionName = ""; + double timeStamp = 0; + double microSecondTimeStamp = 0; + sequence<any> arguments; + sequence<DOMString?> styles; + boolean private = false; + // stacktrace is handled via a getter in some cases so we can construct it + // lazily. Note that we're not making this whole thing an interface because + // consumers expect to see own properties on it, which would mean making the + // props unforgeable, which means lots of JSFunction allocations. Maybe we + // should fix those consumers, of course.... + // sequence<ConsoleStackEntry> stacktrace; + DOMString groupName = ""; + any timer = null; + any counter = null; + DOMString prefix = ""; + boolean chromeContext = false; +}; + +// Event for profile operations +[GenerateConversionToJS] +dictionary ConsoleProfileEvent { + DOMString action = ""; + sequence<any> arguments; + boolean chromeContext = false; +}; + +// This dictionary is used to manage stack trace data. +[GenerateConversionToJS] +dictionary ConsoleStackEntry { + DOMString filename = ""; + // Unique identifier within the process for the script source this entry is + // associated with, or zero. + unsigned long sourceId = 0; + unsigned long lineNumber = 0; + unsigned long columnNumber = 0; + DOMString functionName = ""; + DOMString? asyncCause; +}; + +[GenerateConversionToJS] +dictionary ConsoleTimerStart { + DOMString name = ""; +}; + +[GenerateConversionToJS] +dictionary ConsoleTimerLogOrEnd { + DOMString name = ""; + double duration = 0; +}; + +[GenerateConversionToJS] +dictionary ConsoleTimerError { + DOMString error = ""; + DOMString name = ""; +}; + +[GenerateConversionToJS] +dictionary ConsoleCounter { + DOMString label = ""; + unsigned long count = 0; +}; + +[GenerateConversionToJS] +dictionary ConsoleCounterError { + DOMString label = ""; + DOMString error = ""; +}; + +[ChromeOnly, + Exposed=(Window,Worker,WorkerDebugger,Worklet)] +// This is basically a copy of the console namespace. +interface ConsoleInstance { + // Logging + undefined assert(optional boolean condition = false, any... data); + undefined clear(); + undefined count(optional DOMString label = "default"); + undefined countReset(optional DOMString label = "default"); + undefined debug(any... data); + undefined error(any... data); + undefined info(any... data); + undefined log(any... data); + undefined table(any... data); // FIXME: The spec is still unclear about this. + undefined trace(any... data); + undefined warn(any... data); + undefined dir(any... data); // FIXME: This doesn't follow the spec yet. + undefined dirxml(any... data); + + // Grouping + undefined group(any... data); + undefined groupCollapsed(any... data); + undefined groupEnd(); + + // Timing + undefined time(optional DOMString label = "default"); + undefined timeLog(optional DOMString label = "default", any... data); + undefined timeEnd(optional DOMString label = "default"); + + // Mozilla only or Webcompat methods + + undefined _exception(any... data); + undefined timeStamp(optional any data); + + undefined profile(any... data); + undefined profileEnd(any... data); + + // Returns true if the given level would log a message. Used for avoiding + // long/significant processing when logging messages. + boolean shouldLog(ConsoleLogLevel level); +}; + +callback ConsoleInstanceDumpCallback = undefined (DOMString message); + +enum ConsoleLogLevel { + "All", "Debug", "Log", "Info", "Clear", "Trace", "TimeLog", "TimeEnd", "Time", + "Group", "GroupEnd", "Profile", "ProfileEnd", "Dir", "Dirxml", "Warn", "Error", + "Off" +}; + +dictionary ConsoleInstanceOptions { + // An optional function to intercept all strings written to stdout. + ConsoleInstanceDumpCallback dump; + + // An optional prefix string to be printed before the actual logged message. + DOMString prefix = ""; + + // An ID representing the source of the message. Normally the inner ID of a + // DOM window. + DOMString innerID = ""; + + // String identified for the console, this will be passed through the console + // notifications. + DOMString consoleID = ""; + + // Identifier that allows to filter which messages are logged based on their + // log level. + ConsoleLogLevel maxLogLevel; + + // String pref name which contains the level to use for maxLogLevel. If the + // pref doesn't exist, gets removed or it is used in workers, the maxLogLevel + // will default to the value passed to this constructor (or "all" if it wasn't + // specified). + DOMString maxLogLevelPref = ""; +}; + +enum ConsoleLevel { "log", "warning", "error" }; + +// this interface is just for testing +partial interface ConsoleInstance { + [ChromeOnly] + undefined reportForServiceWorkerScope(DOMString scope, DOMString message, + DOMString filename, unsigned long lineNumber, + unsigned long columnNumber, + ConsoleLevel level); +}; diff --git a/dom/webidl/ConstantSourceNode.webidl b/dom/webidl/ConstantSourceNode.webidl new file mode 100644 index 0000000000..a7106b04db --- /dev/null +++ b/dom/webidl/ConstantSourceNode.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary ConstantSourceOptions { + float offset = 1; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface ConstantSourceNode : AudioScheduledSourceNode { + constructor(BaseAudioContext context, + optional ConstantSourceOptions options = {}); + + readonly attribute AudioParam offset; +}; diff --git a/dom/webidl/ContentVisibilityAutoStateChangeEvent.webidl b/dom/webidl/ContentVisibilityAutoStateChangeEvent.webidl new file mode 100644 index 0000000000..91b7ca2e14 --- /dev/null +++ b/dom/webidl/ContentVisibilityAutoStateChangeEvent.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://drafts.csswg.org/css-contain-2/#content-visibility-auto-state-changed + */ + +[Exposed=Window, Pref="layout.css.content-visibility.enabled"] +interface ContentVisibilityAutoStateChangeEvent : Event { + constructor(DOMString type, + optional ContentVisibilityAutoStateChangeEventInit eventInitDict = {}); + readonly attribute boolean skipped; +}; + +dictionary ContentVisibilityAutoStateChangeEventInit : EventInit { + boolean skipped = false; +}; diff --git a/dom/webidl/ConvolverNode.webidl b/dom/webidl/ConvolverNode.webidl new file mode 100644 index 0000000000..cde74514a4 --- /dev/null +++ b/dom/webidl/ConvolverNode.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary ConvolverOptions : AudioNodeOptions { + AudioBuffer? buffer; + boolean disableNormalization = false; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface ConvolverNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, optional + ConvolverOptions options = {}); + + [SetterThrows] + attribute AudioBuffer? buffer; + attribute boolean normalize; + +}; + +// Mozilla extension +ConvolverNode includes AudioNodePassThrough; diff --git a/dom/webidl/CreateOfferRequest.webidl b/dom/webidl/CreateOfferRequest.webidl new file mode 100644 index 0000000000..f6ceb800ea --- /dev/null +++ b/dom/webidl/CreateOfferRequest.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This is an internal IDL file + */ + +[ChromeOnly, + JSImplementation="@mozilla.org/dom/createofferrequest;1", + Exposed=Window] +interface CreateOfferRequest { + readonly attribute unsigned long long windowID; + readonly attribute unsigned long long innerWindowID; + readonly attribute DOMString callID; + readonly attribute boolean isSecure; +}; diff --git a/dom/webidl/CredentialManagement.webidl b/dom/webidl/CredentialManagement.webidl new file mode 100644 index 0000000000..cc67bf5f15 --- /dev/null +++ b/dom/webidl/CredentialManagement.webidl @@ -0,0 +1,58 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/webappsec-credential-management/ + * and + * https://w3c.github.io/webauthn/ + * and + * https://fedidcg.github.io/FedCM/ + */ + +[Exposed=Window, SecureContext] +interface Credential { + readonly attribute USVString id; + readonly attribute DOMString type; +}; + +[Exposed=Window, SecureContext] +interface CredentialsContainer { + [NewObject] + Promise<Credential?> get(optional CredentialRequestOptions options = {}); + [NewObject] + Promise<Credential?> create(optional CredentialCreationOptions options = {}); + [NewObject] + Promise<Credential> store(Credential credential); + [NewObject] + Promise<undefined> preventSilentAccess(); +}; + +dictionary CredentialRequestOptions { + CredentialMediationRequirement mediation = "optional"; + AbortSignal signal; + // This is taken from the partial definition in + // https://w3c.github.io/webauthn/#sctn-credentialrequestoptions-extension + [Pref="security.webauth.webauthn"] + PublicKeyCredentialRequestOptions publicKey; + // This is taken from the partial definition in + // https://fedidcg.github.io/FedCM/#browser-api-credential-request-options + [Pref="dom.security.credentialmanagement.identity.enabled"] + IdentityCredentialRequestOptions identity; +}; + +enum CredentialMediationRequirement { + "silent", + "optional", + "conditional", + "required" +}; + +dictionary CredentialCreationOptions { + // This is taken from the partial definition in + // https://w3c.github.io/webauthn/#sctn-credentialcreationoptions-extension + [Pref="security.webauth.webauthn"] + PublicKeyCredentialCreationOptions publicKey; + AbortSignal signal; +}; diff --git a/dom/webidl/Crypto.webidl b/dom/webidl/Crypto.webidl new file mode 100644 index 0000000000..70cae1b0c7 --- /dev/null +++ b/dom/webidl/Crypto.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#crypto-interface + */ + +[Exposed=(Window,Worker)] +interface mixin GlobalCrypto { + [Throws] readonly attribute Crypto crypto; +}; + +[Exposed=(Window,Worker)] +interface Crypto { + [SecureContext] + readonly attribute SubtleCrypto subtle; + + [Throws] + ArrayBufferView getRandomValues(ArrayBufferView array); + + [SecureContext] + UTF8String randomUUID(); +}; diff --git a/dom/webidl/CustomElementRegistry.webidl b/dom/webidl/CustomElementRegistry.webidl new file mode 100644 index 0000000000..581915cc2d --- /dev/null +++ b/dom/webidl/CustomElementRegistry.webidl @@ -0,0 +1,73 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// https://html.spec.whatwg.org/#dom-window-customelements +[Exposed=Window] +interface CustomElementRegistry { + [CEReactions, Throws, UseCounter] + undefined define(DOMString name, CustomElementConstructor constructor, + optional ElementDefinitionOptions options = {}); + [ChromeOnly, Throws] + undefined setElementCreationCallback(DOMString name, CustomElementCreationCallback callback); + (CustomElementConstructor or undefined) get(DOMString name); + DOMString? getName(CustomElementConstructor constructor); + [Throws] + Promise<CustomElementConstructor> whenDefined(DOMString name); + [CEReactions] undefined upgrade(Node root); +}; + +dictionary ElementDefinitionOptions { + DOMString extends; +}; + +enum RestoreReason { + "restore", + "autocomplete", +}; + +callback constructor CustomElementConstructor = any (); + +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback CustomElementCreationCallback = undefined (DOMString name); + +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleConnectedCallback = undefined(); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleDisconnectedCallback = undefined(); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleAdoptedCallback = undefined(Document? oldDocument, + Document? newDocment); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleAttributeChangedCallback = undefined(DOMString attrName, + DOMString? oldValue, + DOMString? newValue, + DOMString? namespaceURI); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleFormAssociatedCallback = undefined(HTMLFormElement? form); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleFormResetCallback = undefined(); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleFormDisabledCallback = undefined(boolean disabled); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleFormStateRestoreCallback = undefined((File or USVString or FormData)? state, RestoreReason reason); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleGetCustomInterfaceCallback = object?(any iid); + +// Unsorted is necessary until https://github.com/whatwg/html/issues/3580 is resolved. +[GenerateInit, Unsorted] +dictionary LifecycleCallbacks { + LifecycleConnectedCallback connectedCallback; + LifecycleDisconnectedCallback disconnectedCallback; + LifecycleAdoptedCallback adoptedCallback; + LifecycleAttributeChangedCallback attributeChangedCallback; + [ChromeOnly] LifecycleGetCustomInterfaceCallback getCustomInterfaceCallback; +}; + +[GenerateInit, Unsorted] +dictionary FormAssociatedLifecycleCallbacks { + LifecycleFormAssociatedCallback formAssociatedCallback; + LifecycleFormResetCallback formResetCallback; + LifecycleFormDisabledCallback formDisabledCallback; + LifecycleFormStateRestoreCallback formStateRestoreCallback; +}; diff --git a/dom/webidl/CustomEvent.webidl b/dom/webidl/CustomEvent.webidl new file mode 100644 index 0000000000..6543bb1e86 --- /dev/null +++ b/dom/webidl/CustomEvent.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window, Worker)] +interface CustomEvent : Event +{ + constructor(DOMString type, optional CustomEventInit eventInitDict = {}); + + readonly attribute any detail; + + // initCustomEvent is a Gecko specific deprecated method. + undefined initCustomEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional any detail = null); +}; + +dictionary CustomEventInit : EventInit +{ + any detail = null; +}; diff --git a/dom/webidl/DOMException.webidl b/dom/webidl/DOMException.webidl new file mode 100644 index 0000000000..44f93a4a1a --- /dev/null +++ b/dom/webidl/DOMException.webidl @@ -0,0 +1,109 @@ +/* -*- 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://webidl.spec.whatwg.org/#idl-DOMException + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + + +// This is the WebIDL version of nsIException. This is mostly legacy stuff. + +interface StackFrame; + +interface mixin ExceptionMembers +{ + // The nsresult associated with this exception. + readonly attribute unsigned long result; + + // Filename location. This is the location that caused the + // error, which may or may not be a source file location. + // For example, standard language errors would generally have + // the same location as their top stack entry. File + // parsers may put the location of the file they were parsing, + // etc. + + // null indicates "no data" + readonly attribute DOMString filename; + // Valid line numbers begin at '1'. '0' indicates unknown. + readonly attribute unsigned long lineNumber; + // Valid column numbers begin at 0. + // We don't have an unambiguous indicator for unknown. + readonly attribute unsigned long columnNumber; + + // A stack trace, if available. nsIStackFrame does not have classinfo so + // this was only ever usefully available to chrome JS. + [ChromeOnly, Exposed=Window] + readonly attribute StackFrame? location; + + // Arbitary data for the implementation. + [Exposed=Window] + readonly attribute nsISupports? data; + + // Formatted exception stack + [Replaceable] + readonly attribute DOMString stack; +}; + +[LegacyNoInterfaceObject, Exposed=(Window,Worker)] +interface Exception { + // The name of the error code (ie, a string repr of |result|). + readonly attribute DOMString name; + // A custom message set by the thrower. + [BinaryName="messageMoz"] + readonly attribute DOMString message; + // A generic formatter - make it suitable to print, etc. + stringifier; +}; + +Exception includes ExceptionMembers; + +// XXXkhuey this is an 'exception', not an interface, but we don't have any +// parser or codegen mechanisms for dealing with exceptions. +[ExceptionClass, + Exposed=(Window, Worker), + Serializable] +interface DOMException { + constructor(optional DOMString message = "", optional DOMString name); + + // The name of the error code (ie, a string repr of |result|). + readonly attribute DOMString name; + // A custom message set by the thrower. + [BinaryName="messageMoz"] + readonly attribute DOMString message; + readonly attribute unsigned short code; + + const unsigned short INDEX_SIZE_ERR = 1; + const unsigned short DOMSTRING_SIZE_ERR = 2; // historical + const unsigned short HIERARCHY_REQUEST_ERR = 3; + const unsigned short WRONG_DOCUMENT_ERR = 4; + const unsigned short INVALID_CHARACTER_ERR = 5; + const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical + const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; + const unsigned short NOT_FOUND_ERR = 8; + const unsigned short NOT_SUPPORTED_ERR = 9; + const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical + const unsigned short INVALID_STATE_ERR = 11; + const unsigned short SYNTAX_ERR = 12; + const unsigned short INVALID_MODIFICATION_ERR = 13; + const unsigned short NAMESPACE_ERR = 14; + const unsigned short INVALID_ACCESS_ERR = 15; + const unsigned short VALIDATION_ERR = 16; // historical + const unsigned short TYPE_MISMATCH_ERR = 17; // historical; use JavaScript's TypeError instead + const unsigned short SECURITY_ERR = 18; + const unsigned short NETWORK_ERR = 19; + const unsigned short ABORT_ERR = 20; + const unsigned short URL_MISMATCH_ERR = 21; + const unsigned short QUOTA_EXCEEDED_ERR = 22; + const unsigned short TIMEOUT_ERR = 23; + const unsigned short INVALID_NODE_TYPE_ERR = 24; + const unsigned short DATA_CLONE_ERR = 25; +}; + +// XXXkhuey copy all of Gecko's non-standard stuff onto DOMException, but leave +// the prototype chain sane. +DOMException includes ExceptionMembers; diff --git a/dom/webidl/DOMImplementation.webidl b/dom/webidl/DOMImplementation.webidl new file mode 100644 index 0000000000..9f3be87557 --- /dev/null +++ b/dom/webidl/DOMImplementation.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#interface-domimplementation + * + * Copyright: + * To the extent possible under law, the editors have waived all copyright and + * related or neighboring rights to this work. + */ + +[Exposed=Window] +interface DOMImplementation { + boolean hasFeature(); + + [Throws] + DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, + DOMString systemId); + [Throws] + Document createDocument(DOMString? namespace, + [LegacyNullToEmptyString] DOMString qualifiedName, + optional DocumentType? doctype = null); + [Throws] + Document createHTMLDocument(optional DOMString title); +}; diff --git a/dom/webidl/DOMLocalization.webidl b/dom/webidl/DOMLocalization.webidl new file mode 100644 index 0000000000..b229f37c5e --- /dev/null +++ b/dom/webidl/DOMLocalization.webidl @@ -0,0 +1,166 @@ +/* -*- Mode: C++; 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/. */ + +/** + * DOMLocalization is an extension of the Fluent Localization API. + * + * DOMLocalization adds a state for storing `roots` - DOM elements + * which translation status is controlled by the DOMLocalization + * instance and monitored for mutations. + * DOMLocalization also adds methods dedicated to DOM manipulation. + * + * Methods: + * - connectRoot - add a root + * - disconnectRoot - remove a root + * - pauseObserving - pause observing of roots + * - resumeObserving - resume observing of roots + * - setAttributes - set l10n attributes of an element + * - getAttributes - retrieve l10n attributes of an element + * - translateFragment - translate a DOM fragment + * - translateElements - translate a list of DOM elements + * - translateRoots - translate all attached roots + * + */ + +[Func="IsChromeOrUAWidget", Exposed=Window] +interface DOMLocalization : Localization { + /** + * Constructor arguments: + * - aResourceids - a list of localization resource URIs + * which will provide messages for this + * Localization instance. + * - aSync - Specifies if the initial state of the DOMLocalization + * and the underlying Localization API is synchronous. + * This enables a number of synchronous methods on the + * Localization API and uses it for `TranslateElements` + * making the method return a synchronusly resolved promise. + * - aRegistry - optional custom L10nRegistry to be used by this Localization instance. + * - aLocales - custom set of locales to be used for this Localization. + */ + [Throws] + constructor(sequence<L10nResourceId> aResourceIds, + optional boolean aSync = false, + optional L10nRegistry aRegistry, + optional sequence<UTF8String> aLocales); + + /** + * Adds a node to nodes observed for localization + * related changes. + */ + undefined connectRoot(Node aElement); + + /** + * Removes a node from nodes observed for localization + * related changes. + */ + undefined disconnectRoot(Node aElement); + + /** + * Pauses the MutationObserver set to observe + * localization related DOM mutations. + */ + undefined pauseObserving(); + + /** + * Resumes the MutationObserver set to observe + * localization related DOM mutations. + */ + undefined resumeObserving(); + + /** + * A helper function which allows the user to set localization-specific attributes + * on an element. + * This method lives on `document.l10n` for compatibility reasons with the + * JS FluentDOM implementation. We may consider moving it onto Element. + * + * Example: + * document.l10n.setAttributes(h1, "key1", { emailCount: 5 }); + * + * <h1 data-l10n-id="key1" data-l10n-args="{\"emailCount\": 5}"/> + */ + [Throws] undefined setAttributes(Element aElement, DOMString aId, optional object? aArgs); + + /** + * A helper function which allows the user to retrieve a set of localization-specific + * attributes from an element. + * This method lives on `document.l10n` for compatibility reasons with the + * JS FluentDOM implementation. We may consider moving it onto Element. + * + * Example: + * let l10nAttrs = document.l10n.getAttributes(h1); + * assert.deepEqual(l10nAttrs, {id: "key1", args: { emailCount: 5}); + */ + [Throws] L10nIdArgs getAttributes(Element aElement); + + /** + * A helper function which allows the user to set the l10n args for an element. This + * is similar to the setAttributes method, but does not require the l10n ID. + * + * Example: + * + * <h1 data-l10n-id="key1" /> + * + * document.l10n.setArgs(h1, { emailCount: 5 }); + * + * <h1 data-l10n-id="key1" data-l10n-args="{\"emailCount\": 5}" /> + * + * document.l10n.setArgs(h1); + * + * <h1 data-l10n-id="key1" /> + */ + [Throws] undefined setArgs(Element aElement, optional object? aArgs); + + /** + * Triggers translation of a subtree rooted at aNode. + * + * The method finds all translatable descendants of the argument and + * localizes them. + * + * This method is mainly useful to trigger translation not covered by the + * DOMLocalization's MutationObserver - for example before it gets attached + * to the tree. + * In such cases, when the already-translated fragment gets + * injected into the observed root, one should `pauseObserving`, + * then append the fragment, and finally `resumeObserving`. + * + * Example: + * await document.l10n.translatFragment(frag); + * root.pauseObserving(); + * parent.appendChild(frag); + * root.resumeObserving(); + */ + [NewObject] Promise<any> translateFragment(Node aNode); + + /** + * Triggers translation of a list of Elements using the localization context. + * + * The method only translates the elements directly passed to the method, + * not any descendant nodes. + * + * This method is mainly useful to trigger translation not covered by the + * DOMLocalization's MutationObserver - for example before it gets attached + * to the tree. + * In such cases, when the already-translated fragment gets + * injected into the observed root, one should `pauseObserving`, + * then append the fragment, and finally `resumeObserving`. + * + * Example: + * await document.l10n.translateElements([elem1, elem2]); + * root.pauseObserving(); + * parent.appendChild(elem1); + * root.resumeObserving(); + * alert(elem2.textContent); + */ + [NewObject] Promise<undefined> translateElements(sequence<Element> aElements); + + /** + * Triggers translation of all attached roots and sets their + * locale info and directionality attributes. + * + * Example: + * await document.l10n.translateRoots(); + */ + [NewObject] Promise<undefined> translateRoots(); +}; diff --git a/dom/webidl/DOMMatrix.webidl b/dom/webidl/DOMMatrix.webidl new file mode 100644 index 0000000000..5f7a1dcfe6 --- /dev/null +++ b/dom/webidl/DOMMatrix.webidl @@ -0,0 +1,186 @@ +/* -*- 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.fxtf.org/geometry/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker), + Serializable] +interface DOMMatrixReadOnly { + [Throws] + constructor(optional (UTF8String or sequence<unrestricted double> or DOMMatrixReadOnly) init); + + [NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other = {}); + [NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32); + [NewObject, Throws] static DOMMatrixReadOnly fromFloat64Array(Float64Array array64); + + + // These attributes are simple aliases for certain elements of the 4x4 matrix + readonly attribute unrestricted double a; + readonly attribute unrestricted double b; + readonly attribute unrestricted double c; + readonly attribute unrestricted double d; + readonly attribute unrestricted double e; + readonly attribute unrestricted double f; + + readonly attribute unrestricted double m11; + readonly attribute unrestricted double m12; + readonly attribute unrestricted double m13; + readonly attribute unrestricted double m14; + readonly attribute unrestricted double m21; + readonly attribute unrestricted double m22; + readonly attribute unrestricted double m23; + readonly attribute unrestricted double m24; + readonly attribute unrestricted double m31; + readonly attribute unrestricted double m32; + readonly attribute unrestricted double m33; + readonly attribute unrestricted double m34; + readonly attribute unrestricted double m41; + readonly attribute unrestricted double m42; + readonly attribute unrestricted double m43; + readonly attribute unrestricted double m44; + + // Immutable transform methods + DOMMatrix translate(optional unrestricted double tx = 0, + optional unrestricted double ty = 0, + optional unrestricted double tz = 0); + [NewObject] DOMMatrix scale(optional unrestricted double scaleX = 1, + optional unrestricted double scaleY, + optional unrestricted double scaleZ = 1, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0, + optional unrestricted double originZ = 0); + [NewObject] DOMMatrix scaleNonUniform(optional unrestricted double scaleX = 1, + optional unrestricted double scaleY = 1); + DOMMatrix scale3d(optional unrestricted double scale = 1, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0, + optional unrestricted double originZ = 0); + [NewObject] DOMMatrix rotate(optional unrestricted double rotX = 0, + optional unrestricted double rotY, + optional unrestricted double rotZ); + [NewObject] DOMMatrix rotateFromVector(optional unrestricted double x = 0, + optional unrestricted double y = 0); + [NewObject] DOMMatrix rotateAxisAngle(optional unrestricted double x = 0, + optional unrestricted double y = 0, + optional unrestricted double z = 0, + optional unrestricted double angle = 0); + DOMMatrix skewX(optional unrestricted double sx = 0); + DOMMatrix skewY(optional unrestricted double sy = 0); + [NewObject, Throws] DOMMatrix multiply(optional DOMMatrixInit other = {}); + DOMMatrix flipX(); + DOMMatrix flipY(); + DOMMatrix inverse(); + + // Helper methods + readonly attribute boolean is2D; + readonly attribute boolean isIdentity; + DOMPoint transformPoint(optional DOMPointInit point = {}); + [Throws] Float32Array toFloat32Array(); + [Throws] Float64Array toFloat64Array(); + [Exposed=Window, Throws] stringifier; + [Default] object toJSON(); +}; + +[Exposed=(Window,Worker), + Serializable, + LegacyWindowAlias=WebKitCSSMatrix] +interface DOMMatrix : DOMMatrixReadOnly { + [Throws] + constructor(optional (UTF8String or sequence<unrestricted double> or DOMMatrixReadOnly) init); + + [NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other = {}); + [NewObject, Throws] static DOMMatrix fromFloat32Array(Float32Array array32); + [NewObject, Throws] static DOMMatrix fromFloat64Array(Float64Array array64); + + + // These attributes are simple aliases for certain elements of the 4x4 matrix + inherit attribute unrestricted double a; + inherit attribute unrestricted double b; + inherit attribute unrestricted double c; + inherit attribute unrestricted double d; + inherit attribute unrestricted double e; + inherit attribute unrestricted double f; + + inherit attribute unrestricted double m11; + inherit attribute unrestricted double m12; + inherit attribute unrestricted double m13; + inherit attribute unrestricted double m14; + inherit attribute unrestricted double m21; + inherit attribute unrestricted double m22; + inherit attribute unrestricted double m23; + inherit attribute unrestricted double m24; + inherit attribute unrestricted double m31; + inherit attribute unrestricted double m32; + inherit attribute unrestricted double m33; + inherit attribute unrestricted double m34; + inherit attribute unrestricted double m41; + inherit attribute unrestricted double m42; + inherit attribute unrestricted double m43; + inherit attribute unrestricted double m44; + + // Mutable transform methods + [Throws] DOMMatrix multiplySelf(optional DOMMatrixInit other = {}); + [Throws] DOMMatrix preMultiplySelf(optional DOMMatrixInit other = {}); + DOMMatrix translateSelf(optional unrestricted double tx = 0, + optional unrestricted double ty = 0, + optional unrestricted double tz = 0); + DOMMatrix scaleSelf(optional unrestricted double scaleX = 1, + optional unrestricted double scaleY, + optional unrestricted double scaleZ = 1, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0, + optional unrestricted double originZ = 0); + DOMMatrix scale3dSelf(optional unrestricted double scale = 1, + optional unrestricted double originX = 0, + optional unrestricted double originY = 0, + optional unrestricted double originZ = 0); + DOMMatrix rotateSelf(optional unrestricted double rotX = 0, + optional unrestricted double rotY, + optional unrestricted double rotZ); + DOMMatrix rotateFromVectorSelf(optional unrestricted double x = 0, + optional unrestricted double y = 0); + DOMMatrix rotateAxisAngleSelf(optional unrestricted double x = 0, + optional unrestricted double y = 0, + optional unrestricted double z = 0, + optional unrestricted double angle = 0); + DOMMatrix skewXSelf(optional unrestricted double sx = 0); + DOMMatrix skewYSelf(optional unrestricted double sy = 0); + DOMMatrix invertSelf(); + [Exposed=Window, Throws] DOMMatrix setMatrixValue(UTF8String transformList); +}; + +dictionary DOMMatrix2DInit { + unrestricted double a; + unrestricted double b; + unrestricted double c; + unrestricted double d; + unrestricted double e; + unrestricted double f; + unrestricted double m11; + unrestricted double m12; + unrestricted double m21; + unrestricted double m22; + unrestricted double m41; + unrestricted double m42; +}; + +dictionary DOMMatrixInit : DOMMatrix2DInit { + unrestricted double m13 = 0; + unrestricted double m14 = 0; + unrestricted double m23 = 0; + unrestricted double m24 = 0; + unrestricted double m31 = 0; + unrestricted double m32 = 0; + unrestricted double m33 = 1; + unrestricted double m34 = 0; + unrestricted double m43 = 0; + unrestricted double m44 = 1; + boolean is2D; +}; diff --git a/dom/webidl/DOMParser.webidl b/dom/webidl/DOMParser.webidl new file mode 100644 index 0000000000..8c8e62cdbf --- /dev/null +++ b/dom/webidl/DOMParser.webidl @@ -0,0 +1,49 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://domparsing.spec.whatwg.org/#the-domparser-interface + */ + +interface Principal; +interface URI; +interface InputStream; + +enum SupportedType { + "text/html", + "text/xml", + "application/xml", + "application/xhtml+xml", + "image/svg+xml" +}; + +[Exposed=Window] +interface DOMParser { + [Throws] + constructor(); + + [NewObject, Throws, UseCounter] + Document parseFromString(DOMString str, SupportedType type); + + [NewObject, ChromeOnly, Throws] + Document parseFromSafeString(DOMString str, SupportedType type); + + // Mozilla-specific stuff + [NewObject, Throws, ChromeOnly] + Document parseFromBuffer(sequence<octet> buf, SupportedType type); + [NewObject, Throws, ChromeOnly] + Document parseFromBuffer(Uint8Array buf, SupportedType type); + [NewObject, Throws, ChromeOnly] + Document parseFromStream(InputStream stream, DOMString? charset, + long contentLength, SupportedType type); + // Can be used to allow a DOMParser to parse XUL/XBL no matter what + // principal it's using for the document. + [ChromeOnly] + undefined forceEnableXULXBL(); + + // Can be used to allow a DOMParser to load DTDs from URLs that + // normally would not be allowed based on the document principal. + [Func="IsChromeOrUAWidget"] + undefined forceEnableDTD(); +}; diff --git a/dom/webidl/DOMPoint.webidl b/dom/webidl/DOMPoint.webidl new file mode 100644 index 0000000000..ad95b2f716 --- /dev/null +++ b/dom/webidl/DOMPoint.webidl @@ -0,0 +1,54 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.fxtf.org/geometry/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker), + Serializable] +interface DOMPointReadOnly { + constructor(optional unrestricted double x = 0, + optional unrestricted double y = 0, + optional unrestricted double z = 0, + optional unrestricted double w = 1); + + [NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = {}); + + readonly attribute unrestricted double x; + readonly attribute unrestricted double y; + readonly attribute unrestricted double z; + readonly attribute unrestricted double w; + + [NewObject, Throws] DOMPoint matrixTransform(optional DOMMatrixInit matrix = {}); + + [Default] object toJSON(); +}; + +[Exposed=(Window,Worker), + Serializable] +interface DOMPoint : DOMPointReadOnly { + constructor(optional unrestricted double x = 0, + optional unrestricted double y = 0, + optional unrestricted double z = 0, + optional unrestricted double w = 1); + + [NewObject] static DOMPoint fromPoint(optional DOMPointInit other = {}); + + inherit attribute unrestricted double x; + inherit attribute unrestricted double y; + inherit attribute unrestricted double z; + inherit attribute unrestricted double w; +}; + +dictionary DOMPointInit { + unrestricted double x = 0; + unrestricted double y = 0; + unrestricted double z = 0; + unrestricted double w = 1; +}; diff --git a/dom/webidl/DOMQuad.webidl b/dom/webidl/DOMQuad.webidl new file mode 100644 index 0000000000..bc3518890a --- /dev/null +++ b/dom/webidl/DOMQuad.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.fxtf.org/geometry/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker), + Serializable] +interface DOMQuad { + constructor(optional DOMPointInit p1 = {}, optional DOMPointInit p2 = {}, + optional DOMPointInit p3 = {}, optional DOMPointInit p4 = {}); + constructor(DOMRectReadOnly rect); + + [NewObject] static DOMQuad fromRect(optional DOMRectInit other = {}); + [NewObject] static DOMQuad fromQuad(optional DOMQuadInit other = {}); + + [SameObject] readonly attribute DOMPoint p1; + [SameObject] readonly attribute DOMPoint p2; + [SameObject] readonly attribute DOMPoint p3; + [SameObject] readonly attribute DOMPoint p4; + [NewObject] DOMRectReadOnly getBounds(); + + [Default] object toJSON(); +}; + +dictionary DOMQuadInit { + DOMPointInit p1 = {}; + DOMPointInit p2 = {}; + DOMPointInit p3 = {}; + DOMPointInit p4 = {}; +}; diff --git a/dom/webidl/DOMRect.webidl b/dom/webidl/DOMRect.webidl new file mode 100644 index 0000000000..c1c7e5c8c4 --- /dev/null +++ b/dom/webidl/DOMRect.webidl @@ -0,0 +1,57 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.fxtf.org/geometry/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker), + Serializable] +interface DOMRect : DOMRectReadOnly { + constructor(optional unrestricted double x = 0, + optional unrestricted double y = 0, + optional unrestricted double width = 0, + optional unrestricted double height = 0); + + [NewObject] static DOMRect fromRect(optional DOMRectInit other = {}); + + inherit attribute unrestricted double x; + inherit attribute unrestricted double y; + inherit attribute unrestricted double width; + inherit attribute unrestricted double height; +}; + +[ProbablyShortLivingWrapper, + Exposed=(Window,Worker), + Serializable] +interface DOMRectReadOnly { + constructor(optional unrestricted double x = 0, + optional unrestricted double y = 0, + optional unrestricted double width = 0, + optional unrestricted double height = 0); + + [NewObject] static DOMRectReadOnly fromRect(optional DOMRectInit other = {}); + + readonly attribute unrestricted double x; + readonly attribute unrestricted double y; + readonly attribute unrestricted double width; + readonly attribute unrestricted double height; + readonly attribute unrestricted double top; + readonly attribute unrestricted double right; + readonly attribute unrestricted double bottom; + readonly attribute unrestricted double left; + + [Default] object toJSON(); +}; + +dictionary DOMRectInit { + unrestricted double x = 0; + unrestricted double y = 0; + unrestricted double width = 0; + unrestricted double height = 0; +}; diff --git a/dom/webidl/DOMRectList.webidl b/dom/webidl/DOMRectList.webidl new file mode 100644 index 0000000000..8257f73327 --- /dev/null +++ b/dom/webidl/DOMRectList.webidl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface DOMRectList { + readonly attribute unsigned long length; + getter DOMRect? item(unsigned long index); +}; diff --git a/dom/webidl/DOMRequest.webidl b/dom/webidl/DOMRequest.webidl new file mode 100644 index 0000000000..606b33b02f --- /dev/null +++ b/dom/webidl/DOMRequest.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +enum DOMRequestReadyState { "pending", "done" }; + +[Exposed=(Window,Worker)] +interface mixin DOMRequestShared { + readonly attribute DOMRequestReadyState readyState; + + readonly attribute any result; + readonly attribute DOMException? error; + + attribute EventHandler onsuccess; + attribute EventHandler onerror; +}; + +[Pref="dom.domrequest.enabled", Exposed=(Window,Worker)] +interface DOMRequest : EventTarget { + // The [TreatNonCallableAsNull] annotation is required since then() should do + // nothing instead of throwing errors when non-callable arguments are passed. + // See documentation for Promise.then to see why we return "any". + [NewObject, Throws] + any then([TreatNonCallableAsNull] optional AnyCallback? fulfillCallback = null, + [TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null); + + [ChromeOnly] + undefined fireDetailedError(DOMException aError); +}; + +DOMRequest includes DOMRequestShared; diff --git a/dom/webidl/DOMStringList.webidl b/dom/webidl/DOMStringList.webidl new file mode 100644 index 0000000000..023956b5b6 --- /dev/null +++ b/dom/webidl/DOMStringList.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker)] +interface DOMStringList { + readonly attribute unsigned long length; + getter DOMString? item(unsigned long index); + boolean contains(DOMString string); +}; diff --git a/dom/webidl/DOMStringMap.webidl b/dom/webidl/DOMStringMap.webidl new file mode 100644 index 0000000000..5f9dcf54c1 --- /dev/null +++ b/dom/webidl/DOMStringMap.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#domstringmap-0 + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[LegacyOverrideBuiltIns, + Exposed=Window] +interface DOMStringMap { + getter DOMString (DOMString name); + [CEReactions, Throws] + setter undefined (DOMString name, DOMString value); + [CEReactions] + deleter undefined (DOMString name); +}; diff --git a/dom/webidl/DOMTokenList.webidl b/dom/webidl/DOMTokenList.webidl new file mode 100644 index 0000000000..c048b2228c --- /dev/null +++ b/dom/webidl/DOMTokenList.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#interface-domtokenlist + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface DOMTokenList { + [Pure] + readonly attribute unsigned long length; + [Pure] + getter DOMString? item(unsigned long index); + [Pure] + boolean contains(DOMString token); + [CEReactions, Throws] + undefined add(DOMString... tokens); + [CEReactions, Throws] + undefined remove(DOMString... tokens); + [CEReactions, Throws] + boolean replace(DOMString token, DOMString newToken); + [CEReactions, Throws] + boolean toggle(DOMString token, optional boolean force); + [Throws] + boolean supports(DOMString token); + [CEReactions, SetterThrows, Pure] + stringifier attribute DOMString value; + iterable<DOMString?>; +}; diff --git a/dom/webidl/DataTransfer.webidl b/dom/webidl/DataTransfer.webidl new file mode 100644 index 0000000000..bcdb98f547 --- /dev/null +++ b/dom/webidl/DataTransfer.webidl @@ -0,0 +1,190 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * http://www.whatwg.org/specs/web-apps/current-work/#the-datatransfer-interface + */ +interface ContentSecurityPolicy; + +[Exposed=Window] +interface DataTransfer { + constructor(); + + attribute DOMString dropEffect; + attribute DOMString effectAllowed; + + readonly attribute DataTransferItemList items; + + undefined setDragImage(Element image, long x, long y); + + [Frozen, Cached, Pure, NeedsCallerType] + readonly attribute sequence<DOMString> types; + [Throws, NeedsSubjectPrincipal] + DOMString getData(DOMString format); + [Throws, NeedsSubjectPrincipal] + undefined setData(DOMString format, DOMString data); + [Throws, NeedsSubjectPrincipal] + undefined clearData(optional DOMString format); + [NeedsSubjectPrincipal] + readonly attribute FileList? files; +}; + +// Mozilla specific stuff +partial interface DataTransfer { + /* + * Set the drag source. Usually you would not change this, but it will + * affect which node the drag and dragend events are fired at. The + * default target is the node that was dragged. + * + * @param element drag source to use + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + [Throws, UseCounter] + undefined addElement(Element element); + + /** + * The number of items being dragged. + */ + [ChromeOnly] + readonly attribute unsigned long mozItemCount; + + /** + * Sets the drag cursor state. Primarily used to control the cursor during + * tab drags, but could be expanded to other uses. XXX Currently implemented + * on Win32 only. + * + * Possible values: + * auto - use default system behavior. + * default - set the cursor to an arrow during the drag operation. + * + * Values other than 'default' are indentical to setting mozCursor to + * 'auto'. + */ + [UseCounter] + attribute DOMString mozCursor; + + /** + * Holds a list of the format types of the data that is stored for an item + * at the specified index. If the index is not in the range from 0 to + * itemCount - 1, an empty string list is returned. + */ + [Throws, ChromeOnly] + DOMStringList mozTypesAt(unsigned long index); + + /** + * Remove the data associated with the given format for an item at the + * specified index. The index is in the range from zero to itemCount - 1. + * + * If the last format for the item is removed, the entire item is removed, + * reducing the itemCount by one. + * + * If format is empty, then the data associated with all formats is removed. + * If the format is not found, then this method has no effect. + * + * @param format the format to remove + * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + [Throws, ChromeOnly] + undefined mozClearDataAt(DOMString format, unsigned long index); + + /* + * A data transfer may store multiple items, each at a given zero-based + * index. setDataAt may only be called with an index argument less than + * itemCount in which case an existing item is modified, or equal to + * itemCount in which case a new item is added, and the itemCount is + * incremented by one. + * + * Data should be added in order of preference, with the most specific + * format added first and the least specific format added last. If data of + * the given format already exists, it is replaced in the same position as + * the old data. + * + * The data should be either a string, a primitive boolean or number type + * (which will be converted into a string) or an nsISupports. + * + * @param format the format to add + * @param data the data to add + * @throws NS_ERROR_NULL_POINTER if the data is null + * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater than itemCount + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + [Throws, ChromeOnly] + undefined mozSetDataAt(DOMString format, any data, unsigned long index); + + /** + * Retrieve the data associated with the given format for an item at the + * specified index, or null if it does not exist. The index should be in the + * range from zero to itemCount - 1. + * + * @param format the format of the data to look up + * @returns the data of the given format, or null if it doesn't exist. + * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount + */ + [Throws, ChromeOnly] + any mozGetDataAt(DOMString format, unsigned long index); + + /** + * Update the drag image. Arguments are the same as setDragImage. This is only + * valid within the parent chrome process. + */ + [ChromeOnly] + undefined updateDragImage(Element image, long x, long y); + + /** + * Will be true when the user has cancelled the drag (typically by pressing + * Escape) and when the drag has been cancelled unexpectedly. This will be + * false otherwise, including when the drop has been rejected by its target. + * This property is only relevant for the dragend event. + */ + [UseCounter] + readonly attribute boolean mozUserCancelled; + + /** + * The node that the mouse was pressed over to begin the drag. For external + * drags, or if the caller cannot access this node, this will be null. + */ + [UseCounter] + readonly attribute Node? mozSourceNode; + + /** + * The top-level window context that mouse was pressed over to begin the drag. + * For external drags, this will be null. + */ + [ChromeOnly] + readonly attribute WindowContext? sourceTopWindowContext; + + /** + * The URI spec of the triggering principal. This may be different than + * sourceNode's principal when sourceNode is xul:browser and the drag is + * triggered in a browsing context inside it. + */ + [ChromeOnly] + readonly attribute DOMString mozTriggeringPrincipalURISpec; + + [ChromeOnly] + readonly attribute ContentSecurityPolicy? mozCSP; + + /** + * Copy the given DataTransfer for the given event. Used by testing code for + * creating emulated Drag and Drop events in the UI. + * + * NOTE: Don't expose a DataTransfer produced with this method to the web or + * use this for non-testing purposes. It can easily be used to get the + * DataTransfer into an invalid state, and is an unstable implementation + * detail of EventUtils.synthesizeDrag. + */ + [Throws, ChromeOnly] + DataTransfer mozCloneForEvent(DOMString event); + + /** + * Whether to show the "fail" animation that returns a dragged item + * to its source. Only works on macOS, and has to be set early in the drag + * on that platform. + * Defaults to true. + */ + [ChromeOnly] + attribute boolean mozShowFailAnimation; +}; diff --git a/dom/webidl/DataTransferItem.webidl b/dom/webidl/DataTransferItem.webidl new file mode 100644 index 0000000000..bdcf354a66 --- /dev/null +++ b/dom/webidl/DataTransferItem.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * https://html.spec.whatwg.org/multipage/interaction.html#the-datatransferitem-interface + * https://wicg.github.io/entries-api/#idl-index + */ + +[InstrumentedProps=(webkitGetAsEntry),Exposed=Window] +interface DataTransferItem { + readonly attribute DOMString kind; + readonly attribute DOMString type; + [Throws, NeedsSubjectPrincipal] + undefined getAsString(FunctionStringCallback? callback); + [Throws, NeedsSubjectPrincipal] + File? getAsFile(); +}; + +callback FunctionStringCallback = undefined (DOMString data); + +// https://wicg.github.io/entries-api/#idl-index +partial interface DataTransferItem { + [Pref="dom.webkitBlink.filesystem.enabled", BinaryName="getAsEntry", Throws, + NeedsSubjectPrincipal] + FileSystemEntry? webkitGetAsEntry(); +}; diff --git a/dom/webidl/DataTransferItemList.webidl b/dom/webidl/DataTransferItemList.webidl new file mode 100644 index 0000000000..fbcdd9d322 --- /dev/null +++ b/dom/webidl/DataTransferItemList.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * https://html.spec.whatwg.org/multipage/interaction.html#the-datatransferitemlist-interface + */ + +[Exposed=Window] +interface DataTransferItemList { + readonly attribute unsigned long length; + getter DataTransferItem (unsigned long index); + [Throws, NeedsSubjectPrincipal] + DataTransferItem? add(DOMString data, DOMString type); + [Throws, NeedsSubjectPrincipal] + DataTransferItem? add(File data); + [Throws, NeedsSubjectPrincipal] + undefined remove(unsigned long index); + [Throws, NeedsSubjectPrincipal] + undefined clear(); +}; diff --git a/dom/webidl/DecoderDoctorNotification.webidl b/dom/webidl/DecoderDoctorNotification.webidl new file mode 100644 index 0000000000..6c6ad6835e --- /dev/null +++ b/dom/webidl/DecoderDoctorNotification.webidl @@ -0,0 +1,44 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +enum DecoderDoctorNotificationType { + "cannot-play", + "platform-decoder-not-found", + "can-play-but-some-missing-decoders", + "cannot-initialize-pulseaudio", + "unsupported-libavcodec", + "decode-error", + "decode-warning", +}; + +enum DecoderDoctorReportType { + "mediawidevinenowmf", + "mediawmfneeded", + "mediaplatformdecodernotfound", + "mediacannotplaynodecoders", + "medianodecoders", + "mediacannotinitializepulseaudio", + "mediaunsupportedlibavcodec", + "mediadecodeerror", + "mediadecodewarning", +}; + +[GenerateToJSON] +dictionary DecoderDoctorNotification { + required DecoderDoctorNotificationType type; + // True when the issue has been solved. + required boolean isSolved; + // Key from dom.properties, used for telemetry and prefs. + required DOMString decoderDoctorReportId; + // If provided, formats (or key systems) at issue. + DOMString formats; + // If provided, technical details about the decode-error/warning. + DOMString decodeIssue; + // If provided, URL of the document where the issue happened. + DOMString docURL; + // If provided, URL of the media resource that caused a decode-error/warning. + DOMString resourceURL; +}; diff --git a/dom/webidl/DecompressionStream.webidl b/dom/webidl/DecompressionStream.webidl new file mode 100644 index 0000000000..120c16b1aa --- /dev/null +++ b/dom/webidl/DecompressionStream.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://wicg.github.io/compression/#decompression-stream + */ + +[Exposed=*, Pref="dom.compression_streams.enabled"] +interface DecompressionStream { + [Throws] + constructor(CompressionFormat format); +}; +DecompressionStream includes GenericTransformStream; diff --git a/dom/webidl/DedicatedWorkerGlobalScope.webidl b/dom/webidl/DedicatedWorkerGlobalScope.webidl new file mode 100644 index 0000000000..bd772b2e01 --- /dev/null +++ b/dom/webidl/DedicatedWorkerGlobalScope.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#the-workerglobalscope-common-interface + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera + * Software ASA. + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +[Global=(Worker,DedicatedWorker), + Exposed=DedicatedWorker] +interface DedicatedWorkerGlobalScope : WorkerGlobalScope { + [Replaceable] + readonly attribute DOMString name; + + [Throws] + undefined postMessage(any message, sequence<object> transfer); + [Throws] + undefined postMessage(any message, optional StructuredSerializeOptions options = {}); + + undefined close(); + + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; + +// https://w3c.github.io/webrtc-encoded-transform/#RTCEncodedAudioFrame-methods +partial interface DedicatedWorkerGlobalScope { + [Pref="media.peerconnection.enabled", + Pref="media.peerconnection.scripttransform.enabled"] attribute EventHandler onrtctransform; +}; + +// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames +DedicatedWorkerGlobalScope includes AnimationFrameProvider; diff --git a/dom/webidl/DelayNode.webidl b/dom/webidl/DelayNode.webidl new file mode 100644 index 0000000000..16e973f92f --- /dev/null +++ b/dom/webidl/DelayNode.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary DelayOptions : AudioNodeOptions { + double maxDelayTime = 1; + double delayTime = 0; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface DelayNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, optional DelayOptions options = {}); + + readonly attribute AudioParam delayTime; + +}; + +// Mozilla extension +DelayNode includes AudioNodePassThrough; diff --git a/dom/webidl/DeviceLightEvent.webidl b/dom/webidl/DeviceLightEvent.webidl new file mode 100644 index 0000000000..6d0c86718f --- /dev/null +++ b/dom/webidl/DeviceLightEvent.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Pref="device.sensors.ambientLight.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", + Exposed=Window] +interface DeviceLightEvent : Event +{ + constructor(DOMString type, optional DeviceLightEventInit eventInitDict = {}); + + readonly attribute unrestricted double value; +}; + +dictionary DeviceLightEventInit : EventInit +{ + unrestricted double value = Infinity; +}; diff --git a/dom/webidl/DeviceMotionEvent.webidl b/dom/webidl/DeviceMotionEvent.webidl new file mode 100644 index 0000000000..4d8ae105c7 --- /dev/null +++ b/dom/webidl/DeviceMotionEvent.webidl @@ -0,0 +1,68 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://w3c.github.io/deviceorientation/ + */ + +[LegacyNoInterfaceObject, + Exposed=Window] +interface DeviceAcceleration { + readonly attribute double? x; + readonly attribute double? y; + readonly attribute double? z; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface DeviceRotationRate { + readonly attribute double? alpha; + readonly attribute double? beta; + readonly attribute double? gamma; +}; + +[Pref="device.sensors.motion.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", + Exposed=Window] +interface DeviceMotionEvent : Event { + constructor(DOMString type, + optional DeviceMotionEventInit eventInitDict = {}); + + readonly attribute DeviceAcceleration? acceleration; + readonly attribute DeviceAcceleration? accelerationIncludingGravity; + readonly attribute DeviceRotationRate? rotationRate; + readonly attribute double? interval; +}; + +dictionary DeviceAccelerationInit { + double? x = null; + double? y = null; + double? z = null; +}; + +dictionary DeviceRotationRateInit { + double? alpha = null; + double? beta = null; + double? gamma = null; +}; + +dictionary DeviceMotionEventInit : EventInit { + // FIXME: bug 1493860: should this "= {}" be here? + DeviceAccelerationInit acceleration = {}; + // FIXME: bug 1493860: should this "= {}" be here? + DeviceAccelerationInit accelerationIncludingGravity = {}; + // FIXME: bug 1493860: should this "= {}" be here? + DeviceRotationRateInit rotationRate = {}; + double? interval = null; +}; + +// Mozilla extensions. +partial interface DeviceMotionEvent { + undefined initDeviceMotionEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional DeviceAccelerationInit acceleration = {}, + optional DeviceAccelerationInit accelerationIncludingGravity = {}, + optional DeviceRotationRateInit rotationRate = {}, + optional double? interval = null); +}; diff --git a/dom/webidl/DeviceOrientationEvent.webidl b/dom/webidl/DeviceOrientationEvent.webidl new file mode 100644 index 0000000000..6d2e44f0be --- /dev/null +++ b/dom/webidl/DeviceOrientationEvent.webidl @@ -0,0 +1,35 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Pref="device.sensors.orientation.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", LegacyEventInit, + Exposed=Window] +interface DeviceOrientationEvent : Event +{ + constructor(DOMString type, + optional DeviceOrientationEventInit eventInitDict = {}); + + readonly attribute double? alpha; + readonly attribute double? beta; + readonly attribute double? gamma; + readonly attribute boolean absolute; + + // initDeviceOrientationEvent is a Gecko specific deprecated method. + undefined initDeviceOrientationEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional double? alpha = null, + optional double? beta = null, + optional double? gamma = null, + optional boolean absolute = false); +}; + +dictionary DeviceOrientationEventInit : EventInit +{ + double? alpha = null; + double? beta = null; + double? gamma = null; + boolean absolute = false; +}; diff --git a/dom/webidl/Directory.webidl b/dom/webidl/Directory.webidl new file mode 100644 index 0000000000..c76a1ab098 --- /dev/null +++ b/dom/webidl/Directory.webidl @@ -0,0 +1,55 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + * All functions on Directory that accept DOMString arguments for file or + * directory names only allow relative path to current directory itself. The + * path should be a descendent path like "path/to/file.txt" and not contain a + * segment of ".." or ".". So the paths aren't allowed to walk up the directory + * tree. For example, paths like "../foo", "..", "/foo/bar" or "foo/../bar" are + * not allowed. + * + * http://w3c.github.io/filesystem-api/#idl-def-Directory + * https://microsoftedge.github.io/directory-upload/proposal.html#directory-interface + */ + +[Exposed=(Window,Worker)] +interface Directory { + // This ChromeOnly constructor is used by the MockFilePicker for testing only. + [Throws, ChromeOnly] + constructor(DOMString path); + + /* + * The leaf name of the directory. + */ + [Throws] + readonly attribute DOMString name; +}; + +[Exposed=(Window,Worker)] +partial interface Directory { + // Already defined in the main interface declaration: + //readonly attribute DOMString name; + + /* + * The path of the Directory (includes both its basename and leafname). + * The path begins with the name of the ancestor Directory that was + * originally exposed to content (say via a directory picker) and traversed + * to obtain this Directory. Full filesystem paths are not exposed to + * unprivilaged content. + */ + [Throws] + readonly attribute DOMString path; + + /* + * Getter for the immediate children of this directory. + */ + [NewObject] + Promise<sequence<(File or Directory)>> getFilesAndDirectories(); + + [NewObject] + Promise<sequence<File>> getFiles(optional boolean recursiveFlag = false); +}; diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl new file mode 100644 index 0000000000..c82710bf8f --- /dev/null +++ b/dom/webidl/Document.webidl @@ -0,0 +1,760 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://dom.spec.whatwg.org/#interface-document + * https://html.spec.whatwg.org/multipage/dom.html#the-document-object + * https://html.spec.whatwg.org/multipage/obsolete.html#other-elements%2C-attributes-and-apis + * https://fullscreen.spec.whatwg.org/#api + * https://w3c.github.io/pointerlock/#extensions-to-the-document-interface + * https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin + * https://w3c.github.io/page-visibility/#extensions-to-the-document-interface + * https://drafts.csswg.org/cssom/#extensions-to-the-document-interface + * https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface + * https://wicg.github.io/feature-policy/#policy + */ + +interface ContentSecurityPolicy; +interface Principal; +interface WindowProxy; +interface nsISupports; +interface URI; +interface nsIDocShell; +interface nsILoadGroup; +interface nsIReferrerInfo; +interface nsICookieJarSettings; +interface nsIPermissionDelegateHandler; +interface XULCommandDispatcher; + +enum VisibilityState { "hidden", "visible" }; + +/* https://dom.spec.whatwg.org/#dictdef-elementcreationoptions */ +dictionary ElementCreationOptions { + DOMString is; + + [ChromeOnly] + DOMString pseudo; +}; + +/* https://dom.spec.whatwg.org/#interface-document */ +[Exposed=Window, + InstrumentedProps=(caretRangeFromPoint, + exitPictureInPicture, + featurePolicy, + onbeforecopy, + onbeforecut, + onbeforepaste, + oncancel, + onfreeze, + onmousewheel, + onresume, + onsearch, + onwebkitfullscreenchange, + onwebkitfullscreenerror, + pictureInPictureElement, + pictureInPictureEnabled, + registerElement, + wasDiscarded, + webkitCancelFullScreen, + webkitCurrentFullScreenElement, + webkitExitFullscreen, + webkitFullscreenElement, + webkitFullscreenEnabled, + webkitHidden, + webkitIsFullScreen, + webkitVisibilityState, + xmlEncoding, + xmlStandalone, + xmlVersion)] +interface Document : Node { + [Throws] + constructor(); + + [Throws] + readonly attribute DOMImplementation implementation; + [Pure, Throws, BinaryName="documentURIFromJS", NeedsCallerType] + readonly attribute DOMString URL; + [Pure, Throws, BinaryName="documentURIFromJS", NeedsCallerType] + readonly attribute DOMString documentURI; + [Pure] + readonly attribute DOMString compatMode; + [Pure] + readonly attribute DOMString characterSet; + [Pure,BinaryName="characterSet"] + readonly attribute DOMString charset; // legacy alias of .characterSet + [Pure,BinaryName="characterSet"] + readonly attribute DOMString inputEncoding; // legacy alias of .characterSet + [Pure] + readonly attribute DOMString contentType; + + [Pure] + readonly attribute DocumentType? doctype; + [Pure] + readonly attribute Element? documentElement; + [Pure] + HTMLCollection getElementsByTagName(DOMString localName); + [Pure, Throws] + HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); + [Pure] + HTMLCollection getElementsByClassName(DOMString classNames); + [Pure] + Element? getElementById(DOMString elementId); + + // These DOM methods cannot be accessed by UA Widget scripts + // because the DOM element reflectors will be in the content scope, + // instead of the desired UA Widget scope. + [CEReactions, NewObject, Throws, Func="IsNotUAWidget"] + Element createElement(DOMString localName, optional (ElementCreationOptions or DOMString) options = {}); + [CEReactions, NewObject, Throws, Func="IsNotUAWidget"] + Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional (ElementCreationOptions or DOMString) options = {}); + [NewObject] + DocumentFragment createDocumentFragment(); + [NewObject, Func="IsNotUAWidget"] + Text createTextNode(DOMString data); + [NewObject, Func="IsNotUAWidget"] + Comment createComment(DOMString data); + [NewObject, Throws] + ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); + + [CEReactions, Throws, Func="IsNotUAWidget"] + Node importNode(Node node, optional boolean deep = false); + [CEReactions, Throws, Func="IsNotUAWidget"] + Node adoptNode(Node node); + + [NewObject, Throws, NeedsCallerType] + Event createEvent(DOMString interface); + + [NewObject, Throws] + Range createRange(); + + // NodeFilter.SHOW_ALL = 0xFFFFFFFF + [NewObject, Throws] + NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); + [NewObject, Throws] + TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); + + // NEW + // No support for prepend/append yet + // undefined prepend((Node or DOMString)... nodes); + // undefined append((Node or DOMString)... nodes); + + // These are not in the spec, but leave them for now for backwards compat. + // So sort of like Gecko extensions + [NewObject, Throws] + CDATASection createCDATASection(DOMString data); + [NewObject, Throws] + Attr createAttribute(DOMString name); + [NewObject, Throws] + Attr createAttributeNS(DOMString? namespace, DOMString name); +}; + +// https://html.spec.whatwg.org/multipage/dom.html#the-document-object +partial interface Document { + [Pref="dom.webcomponents.shadowdom.declarative.enabled"] + static Document parseHTMLUnsafe(DOMString html); + + [PutForwards=href, LegacyUnforgeable] readonly attribute Location? location; + [SetterThrows] attribute DOMString domain; + readonly attribute DOMString referrer; + [Throws] attribute DOMString cookie; + readonly attribute DOMString lastModified; + readonly attribute DOMString readyState; + + // DOM tree accessors + //(Not proxy yet)getter object (DOMString name); + [CEReactions, SetterThrows, Pure] + attribute DOMString title; + [CEReactions, Pure] + attribute DOMString dir; + [CEReactions, Pure, SetterThrows] + attribute HTMLElement? body; + [Pure] + readonly attribute HTMLHeadElement? head; + [SameObject] readonly attribute HTMLCollection images; + [SameObject] readonly attribute HTMLCollection embeds; + [SameObject] readonly attribute HTMLCollection plugins; + [SameObject] readonly attribute HTMLCollection links; + [SameObject] readonly attribute HTMLCollection forms; + [SameObject] readonly attribute HTMLCollection scripts; + [Pure] + NodeList getElementsByName(DOMString elementName); + //(Not implemented)readonly attribute DOMElementMap cssElementMap; + + // dynamic markup insertion + [CEReactions, Throws] + Document open(optional DOMString unused1, optional DOMString unused2); // both arguments are ignored + [CEReactions, Throws] + WindowProxy? open(USVString url, DOMString name, DOMString features); + [CEReactions, Throws] + undefined close(); + [CEReactions, Throws] + undefined write(DOMString... text); + [CEReactions, Throws] + undefined writeln(DOMString... text); + + // user interaction + [Pure] + readonly attribute WindowProxy? defaultView; + [Throws] + boolean hasFocus(); + [CEReactions, SetterThrows, SetterNeedsSubjectPrincipal] + attribute DOMString designMode; + [CEReactions, Throws, NeedsSubjectPrincipal] + boolean execCommand(DOMString commandId, optional boolean showUI = false, + optional DOMString value = ""); + [Throws, NeedsSubjectPrincipal] + boolean queryCommandEnabled(DOMString commandId); + [Throws] + boolean queryCommandIndeterm(DOMString commandId); + [Throws] + boolean queryCommandState(DOMString commandId); + [Throws, NeedsCallerType] + boolean queryCommandSupported(DOMString commandId); + [Throws] + DOMString queryCommandValue(DOMString commandId); + //(Not implemented)readonly attribute HTMLCollection commands; + + // special event handler IDL attributes that only apply to Document objects + [LegacyLenientThis] attribute EventHandler onreadystatechange; + + // Gecko extensions? + attribute EventHandler onbeforescriptexecute; + attribute EventHandler onafterscriptexecute; + + /** + * True if this document is synthetic : stand alone image, video, audio file, + * etc. + */ + [Func="IsChromeOrUAWidget"] readonly attribute boolean mozSyntheticDocument; + /** + * Returns the script element whose script is currently being processed. + * + * @see <https://developer.mozilla.org/en/DOM/document.currentScript> + */ + [Pure] + readonly attribute Element? currentScript; + /** + * Release the current mouse capture if it is on an element within this + * document. + * + * @see <https://developer.mozilla.org/en/DOM/document.releaseCapture> + */ + [Deprecated=DocumentReleaseCapture, Pref="dom.mouse_capture.enabled"] + undefined releaseCapture(); + /** + * Use the given DOM element as the source image of target |-moz-element()|. + * + * This function introduces a new special ID (called "image element ID"), + * which is only used by |-moz-element()|, and associates it with the given + * DOM element. Image elements ID's have the higher precedence than general + * HTML id's, so if |document.mozSetImageElement(<id>, <element>)| is called, + * |-moz-element(#<id>)| uses |<element>| as the source image even if there + * is another element with id attribute = |<id>|. To unregister an image + * element ID |<id>|, call |document.mozSetImageElement(<id>, null)|. + * + * Example: + * <script> + * canvas = document.createElement("canvas"); + * canvas.setAttribute("width", 100); + * canvas.setAttribute("height", 100); + * // draw to canvas + * document.mozSetImageElement("canvasbg", canvas); + * </script> + * <div style="background-image: -moz-element(#canvasbg);"></div> + * + * @param aImageElementId an image element ID to associate with + * |aImageElement| + * @param aImageElement a DOM element to be used as the source image of + * |-moz-element(#aImageElementId)|. If this is null, the function will + * unregister the image element ID |aImageElementId|. + * + * @see <https://developer.mozilla.org/en/DOM/document.mozSetImageElement> + */ + [UseCounter] + undefined mozSetImageElement(DOMString aImageElementId, + Element? aImageElement); + + [ChromeOnly] + readonly attribute URI? documentURIObject; + + /** + * Current referrer policy - one of the referrer policy value from + * ReferrerPolicy.webidl. + */ + [ChromeOnly] + readonly attribute ReferrerPolicy referrerPolicy; + + /** + * Current referrer info, which holds all referrer related information + * including referrer policy and raw referrer of document. + */ + [ChromeOnly] + readonly attribute nsIReferrerInfo referrerInfo; + +}; + +// https://html.spec.whatwg.org/multipage/obsolete.html#other-elements%2C-attributes-and-apis +partial interface Document { + [CEReactions] attribute [LegacyNullToEmptyString] DOMString fgColor; + [CEReactions] attribute [LegacyNullToEmptyString] DOMString linkColor; + [CEReactions] attribute [LegacyNullToEmptyString] DOMString vlinkColor; + [CEReactions] attribute [LegacyNullToEmptyString] DOMString alinkColor; + [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor; + + [SameObject] readonly attribute HTMLCollection anchors; + [SameObject] readonly attribute HTMLCollection applets; + + undefined clear(); + // @deprecated These are old Netscape 4 methods. Do not use, + // the implementation is no-op. + // XXXbz do we actually need these anymore? + undefined captureEvents(); + undefined releaseEvents(); + + [SameObject] readonly attribute HTMLAllCollection all; +}; + +// https://fullscreen.spec.whatwg.org/#api +partial interface Document { + // Note: Per spec the 'S' in these two is lowercase, but the "Moz" + // versions have it uppercase. + [LegacyLenientSetter, Unscopable] + readonly attribute boolean fullscreen; + [BinaryName="fullscreen"] + readonly attribute boolean mozFullScreen; + [LegacyLenientSetter, NeedsCallerType] + readonly attribute boolean fullscreenEnabled; + [BinaryName="fullscreenEnabled", NeedsCallerType] + readonly attribute boolean mozFullScreenEnabled; + + [NewObject] + Promise<undefined> exitFullscreen(); + [NewObject, BinaryName="exitFullscreen"] + Promise<undefined> mozCancelFullScreen(); + + // Events handlers + attribute EventHandler onfullscreenchange; + attribute EventHandler onfullscreenerror; +}; + +// https://w3c.github.io/pointerlock/#extensions-to-the-document-interface +// https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin +partial interface Document { + undefined exitPointerLock(); + + // Event handlers + attribute EventHandler onpointerlockchange; + attribute EventHandler onpointerlockerror; +}; + +// Mozilla-internal document extensions specific to error pages. +partial interface Document { + [Func="Document::CallerIsTrustedAboutCertError", NewObject] + Promise<any> addCertException(boolean isTemporary); + + [Func="Document::CallerIsTrustedAboutHttpsOnlyError"] + undefined reloadWithHttpsOnlyException(); + + [Func="Document::CallerIsTrustedAboutCertError", Throws] + FailedCertSecurityInfo getFailedCertSecurityInfo(); + + [Func="Document::CallerIsTrustedAboutNetError", Throws] + NetErrorInfo getNetErrorInfo(); +}; + +// https://w3c.github.io/page-visibility/#extensions-to-the-document-interface +partial interface Document { + readonly attribute boolean hidden; + readonly attribute VisibilityState visibilityState; + attribute EventHandler onvisibilitychange; +}; + +// https://drafts.csswg.org/cssom/#extensions-to-the-document-interface +partial interface Document { + attribute DOMString? selectedStyleSheetSet; + readonly attribute DOMString? lastStyleSheetSet; + readonly attribute DOMString? preferredStyleSheetSet; + [Constant] + readonly attribute DOMStringList styleSheetSets; + undefined enableStyleSheetsForSet (DOMString? name); +}; + +// https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface +partial interface Document { + CaretPosition? caretPositionFromPoint (float x, float y); + + readonly attribute Element? scrollingElement; +}; + +// http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions +partial interface Document { + [Throws, Pure] + Element? querySelector(UTF8String selectors); + [Throws, Pure] + NodeList querySelectorAll(UTF8String selectors); + + //(Not implemented)Element? find(DOMString selectors, optional (Element or sequence<Node>)? refNodes); + //(Not implemented)NodeList findAll(DOMString selectors, optional (Element or sequence<Node>)? refNodes); +}; + +// https://drafts.csswg.org/web-animations/#extensions-to-the-document-interface +partial interface Document { + [Func="Document::AreWebAnimationsTimelinesEnabled"] + readonly attribute DocumentTimeline timeline; +}; + +// https://svgwg.org/svg2-draft/struct.html#InterfaceDocumentExtensions +partial interface Document { + [BinaryName="SVGRootElement"] + readonly attribute SVGSVGElement? rootElement; +}; + +// Mozilla extensions of various sorts +partial interface Document { + // Creates a new XUL element regardless of the document's default type. + [ChromeOnly, CEReactions, NewObject, Throws] + Element createXULElement(DOMString localName, optional (ElementCreationOptions or DOMString) options = {}); + // Wether the document was loaded using a nsXULPrototypeDocument. + [ChromeOnly] + readonly attribute boolean loadedFromPrototype; + + // The principal to use for the storage area of this document + [ChromeOnly] + readonly attribute Principal effectiveStoragePrincipal; + + // You should probably not be using this principal getter since it performs + // no checks to ensure that the partitioned principal should really be used + // here. It is only designed to be used in very specific circumstances, such + // as when inheriting the document/storage principal. + [ChromeOnly] + readonly attribute Principal partitionedPrincipal; + + // The cookieJarSettings of this document + [ChromeOnly] + readonly attribute nsICookieJarSettings cookieJarSettings; + + // Touch bits + // XXXbz I can't find the sane spec for this stuff, so just cribbing + // from our xpidl for now. + [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"] + Touch createTouch(optional Window? view = null, + optional EventTarget? target = null, + optional long identifier = 0, + optional long pageX = 0, + optional long pageY = 0, + optional long screenX = 0, + optional long screenY = 0, + optional long clientX = 0, + optional long clientY = 0, + optional long radiusX = 0, + optional long radiusY = 0, + optional float rotationAngle = 0, + optional float force = 0); + // XXXbz a hack to get around the fact that we don't support variadics as + // distinguishing arguments yet. Once this hack is removed. we can also + // remove the corresponding overload on Document, since Touch... and + // sequence<Touch> look the same in the C++. + [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"] + TouchList createTouchList(Touch touch, Touch... touches); + // XXXbz and another hack for the fact that we can't usefully have optional + // distinguishing arguments but need a working zero-arg form of + // createTouchList(). + [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"] + TouchList createTouchList(); + [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"] + TouchList createTouchList(sequence<Touch> touches); + + [ChromeOnly] + attribute boolean styleSheetChangeEventsEnabled; + + [ChromeOnly] + attribute boolean devToolsAnonymousAndShadowEventsEnabled; + + [ChromeOnly, BinaryName="contentLanguageForBindings"] readonly attribute DOMString contentLanguage; + + [ChromeOnly] readonly attribute nsILoadGroup? documentLoadGroup; + + // Blocks the initial document parser until the given promise is settled. + [ChromeOnly, NewObject] + Promise<any> blockParsing(Promise<any> promise, + optional BlockParsingOptions options = {}); + + [Func="nsContentUtils::IsSystemOrPDFJS", BinaryName="blockUnblockOnloadForSystemOrPDFJS"] + undefined blockUnblockOnload(boolean block); + + // like documentURI, except that for error pages, it returns the URI we were + // trying to load when we hit an error, rather than the error page's own URI. + [ChromeOnly] readonly attribute URI? mozDocumentURIIfNotForErrorPages; + + // A promise that is resolved when we have both fired DOMContentLoaded and + // are ready to start layout. + // This is used for the "document_idle" webextension script injection point. + [ChromeOnly, Throws] + readonly attribute Promise<undefined> documentReadyForIdle; + + // Lazily created command dispatcher, returns null if the document is not + // chrome privileged. + [ChromeOnly] + readonly attribute XULCommandDispatcher? commandDispatcher; + + [ChromeOnly] + attribute boolean devToolsWatchingDOMMutations; + + /** + * Returns all the shadow roots connected to the document, in no particular + * order, and without regard to open/closed-ness. Also returns UA widgets + * (like <video> controls), which can be checked using + * ShadowRoot.isUAWidget(). + */ + [ChromeOnly] + sequence<ShadowRoot> getConnectedShadowRoots(); +}; + +dictionary BlockParsingOptions { + /** + * If true, blocks script-created parsers (created via document.open()) in + * addition to network-created parsers. + */ + boolean blockScriptCreated = true; +}; + +// Extension to give chrome JS the ability to determine when a document was +// created to satisfy an iframe with srcdoc attribute. +partial interface Document { + [ChromeOnly] readonly attribute boolean isSrcdocDocument; +}; + + +// Extension to give chrome JS the ability to get the underlying +// sandbox flag attribute +partial interface Document { + [ChromeOnly] readonly attribute DOMString? sandboxFlagsAsString; +}; + + +/** + * Chrome document anonymous content management. + * This is a Chrome-only API that allows inserting fixed positioned anonymous + * content on top of the current page displayed in the document. + */ +partial interface Document { + /** + * If aForce is true, tries to update layout to be able to insert the element + * synchronously. + */ + [ChromeOnly, NewObject, Throws] + AnonymousContent insertAnonymousContent(optional boolean aForce = false); + + /** + * Removes the element inserted into the CanvasFrame given an AnonymousContent + * instance. + */ + [ChromeOnly] + undefined removeAnonymousContent(AnonymousContent aContent); +}; + +// http://w3c.github.io/selection-api/#extensions-to-document-interface +partial interface Document { + [Throws] + Selection? getSelection(); +}; + +// https://github.com/whatwg/html/issues/3338 +partial interface Document { + [Pref="dom.storage_access.enabled", NewObject] + Promise<boolean> hasStorageAccess(); + [Pref="dom.storage_access.enabled", NewObject] + Promise<undefined> requestStorageAccess(); + // https://github.com/privacycg/storage-access/pull/100 + [Pref="dom.storage_access.forward_declared.enabled", NewObject] + Promise<undefined> requestStorageAccessUnderSite(DOMString serializedSite); + [Pref="dom.storage_access.forward_declared.enabled", NewObject] + Promise<undefined> completeStorageAccessRequestFromSite(DOMString serializedSite); +}; + +// A privileged API to give chrome privileged code and the content script of the +// webcompat extension the ability to request the storage access for a given +// third party. +partial interface Document { + [Func="Document::CallerCanAccessPrivilegeSSA", NewObject] + Promise<undefined> requestStorageAccessForOrigin(DOMString thirdPartyOrigin, optional boolean requireUserInteraction = true); +}; + +// Extension to give chrome JS the ability to determine whether +// the user has interacted with the document or not. +partial interface Document { + [ChromeOnly] readonly attribute boolean userHasInteracted; +}; + +// Extension to give chrome JS the ability to simulate activate the document +// by user gesture. +partial interface Document { + [ChromeOnly] + undefined notifyUserGestureActivation(); + // For testing only. + [ChromeOnly] + undefined clearUserGestureActivation(); + [ChromeOnly] + readonly attribute boolean hasBeenUserGestureActivated; + [ChromeOnly] + readonly attribute boolean hasValidTransientUserGestureActivation; + [ChromeOnly] + readonly attribute DOMHighResTimeStamp lastUserGestureTimeStamp; + [ChromeOnly] + boolean consumeTransientUserGestureActivation(); +}; + +// Extension to give chrome JS the ability to set an event handler which is +// called with certain events that happened while events were suppressed in the +// document or one of its subdocuments. +partial interface Document { + [ChromeOnly] + undefined setSuppressedEventListener(EventListener? aListener); +}; + +// Allows frontend code to query a CSP which needs to be passed for a +// new load into docshell. Further, allows to query the CSP in JSON +// format for testing purposes. +partial interface Document { + [ChromeOnly] readonly attribute ContentSecurityPolicy? csp; + [ChromeOnly] readonly attribute DOMString cspJSON; +}; + +partial interface Document { + [Func="Document::DocumentSupportsL10n"] readonly attribute DocumentL10n? l10n; + [Func="Document::DocumentSupportsL10n"] readonly attribute boolean hasPendingL10nMutations; +}; + +Document includes XPathEvaluatorMixin; +Document includes GlobalEventHandlers; +Document includes TouchEventHandlers; +Document includes ParentNode; +Document includes OnErrorEventHandlerForNodes; +Document includes GeometryUtils; +Document includes FontFaceSource; +Document includes DocumentOrShadowRoot; + +// https://w3c.github.io/webappsec-feature-policy/#idl-index +partial interface Document { + [SameObject, Pref="dom.security.featurePolicy.webidl.enabled"] + readonly attribute FeaturePolicy featurePolicy; +}; + +// Extension to give chrome JS the ability to specify a non-default keypress +// event model. +partial interface Document { + /** + * setKeyPressEventModel() is called when we need to check whether the web + * app requires specific keypress event model or not. + * + * @param aKeyPressEventModel Proper keypress event model for the web app. + * KEYPRESS_EVENT_MODEL_DEFAULT: + * Use default keypress event model. I.e., depending on + * "dom.keyboardevent.keypress.set_keycode_and_charcode_to_same_value" + * pref. + * KEYPRESS_EVENT_MODEL_SPLIT: + * Use split model. I.e, if keypress event inputs a character, + * keyCode should be 0. Otherwise, charCode should be 0. + * KEYPRESS_EVENT_MODEL_CONFLATED: + * Use conflated model. I.e., keyCode and charCode values of each + * keypress event should be set to same value. + */ + [ChromeOnly] + const unsigned short KEYPRESS_EVENT_MODEL_DEFAULT = 0; + [ChromeOnly] + const unsigned short KEYPRESS_EVENT_MODEL_SPLIT = 1; + [ChromeOnly] + const unsigned short KEYPRESS_EVENT_MODEL_CONFLATED = 2; + [ChromeOnly] + undefined setKeyPressEventModel(unsigned short aKeyPressEventModel); +}; + +// Extensions to return information about about the nodes blocked by the +// Safebrowsing API inside a document. +partial interface Document { + /* + * Number of nodes that have been blocked by the Safebrowsing API to prevent + * tracking, cryptomining and so on. This method is for testing only. + */ + [ChromeOnly, Pure] + readonly attribute long blockedNodeByClassifierCount; + + /* + * List of nodes that have been blocked by the Safebrowsing API to prevent + * tracking, fingerprinting, cryptomining and so on. This method is for + * testing only. + */ + [ChromeOnly, Pure] + readonly attribute NodeList blockedNodesByClassifier; +}; + +// Extension to programmatically simulate a user interaction on a document, +// used for testing. +partial interface Document { + [ChromeOnly, BinaryName="setUserHasInteracted"] + undefined userInteractionForTesting(); +}; + +// Extension for permission delegation. +partial interface Document { + [ChromeOnly, Pure] + readonly attribute nsIPermissionDelegateHandler permDelegateHandler; +}; + +// Extension used by the password manager to infer form submissions. +partial interface Document { + /* + * Set whether the document notifies an event when a fetch or + * XHR completes successfully. + */ + [ChromeOnly] + undefined setNotifyFetchSuccess(boolean aShouldNotify); + + /* + * Set whether a form and a password field notify an event when it is + * removed from the DOM tree. + */ + [ChromeOnly] + undefined setNotifyFormOrPasswordRemoved(boolean aShouldNotify); +}; + +// Extension to allow chrome code to detect initial about:blank documents. +partial interface Document { + [ChromeOnly] + readonly attribute boolean isInitialDocument; +}; + +// Extension to allow chrome code to get some wireframe-like structure. +enum WireframeRectType { + "image", + "background", + "text", + "unknown", +}; +dictionary WireframeTaggedRect { + unrestricted double x = 0; + unrestricted double y = 0; + unrestricted double width = 0; + unrestricted double height = 0; + unsigned long color = 0; // in nscolor format + WireframeRectType type; + Node? node; +}; +[GenerateInit] +dictionary Wireframe { + unsigned long canvasBackground = 0; // in nscolor format + sequence<WireframeTaggedRect> rects; + unsigned long version = 1; // Increment when the wireframe structure changes in backwards-incompatible ways +}; +partial interface Document { + [ChromeOnly] + Wireframe? getWireframe(optional boolean aIncludeNodes = false); +}; + +partial interface Document { + // Returns true if the document is the current active document in a browsing + // context which isn't in bfcache. + [ChromeOnly] + boolean isActive(); +}; diff --git a/dom/webidl/DocumentFragment.webidl b/dom/webidl/DocumentFragment.webidl new file mode 100644 index 0000000000..0b760abd04 --- /dev/null +++ b/dom/webidl/DocumentFragment.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120405/#interface-documentfragment + * http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface DocumentFragment : Node { + [Throws] + constructor(); + + Element? getElementById(DOMString elementId); +}; + +// http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions +partial interface DocumentFragment { + [Throws] + Element? querySelector(UTF8String selectors); + [Throws] + NodeList querySelectorAll(UTF8String selectors); +}; + +DocumentFragment includes ParentNode; diff --git a/dom/webidl/DocumentOrShadowRoot.webidl b/dom/webidl/DocumentOrShadowRoot.webidl new file mode 100644 index 0000000000..598d60e5c8 --- /dev/null +++ b/dom/webidl/DocumentOrShadowRoot.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#documentorshadowroot + * http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin + * https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets + */ + +interface mixin DocumentOrShadowRoot { + // Not implemented yet: bug 1430308. + // Selection? getSelection(); + Element? elementFromPoint(float x, float y); + sequence<Element> elementsFromPoint(float x, float y); + + // TODO: Avoid making these ChromeOnly, see: + // https://github.com/w3c/csswg-drafts/issues/556 + [ChromeOnly] + Node? nodeFromPoint(float x, float y); + [ChromeOnly] + sequence<Node> nodesFromPoint(float x, float y); + + // Not implemented yet: bug 1430307. + // CaretPosition? caretPositionFromPoint (float x, float y); + + readonly attribute Element? activeElement; + readonly attribute StyleSheetList styleSheets; + + readonly attribute Element? pointerLockElement; + [LegacyLenientSetter] + readonly attribute Element? fullscreenElement; + [BinaryName="fullscreenElement"] + readonly attribute Element? mozFullScreenElement; +}; + +// https://drafts.csswg.org/web-animations-1/#extensions-to-the-documentorshadowroot-interface-mixin +partial interface mixin DocumentOrShadowRoot { + sequence<Animation> getAnimations(); +}; + +// https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets +partial interface mixin DocumentOrShadowRoot { + // We are using [Pure, Cached, Frozen] sequence until `FrozenArray` is implemented. + // See https://bugzilla.mozilla.org/show_bug.cgi?id=1236777 for more details. + attribute ObservableArray<CSSStyleSheet> adoptedStyleSheets; +}; diff --git a/dom/webidl/DocumentTimeline.webidl b/dom/webidl/DocumentTimeline.webidl new file mode 100644 index 0000000000..8e757addb3 --- /dev/null +++ b/dom/webidl/DocumentTimeline.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#documenttimeline + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary DocumentTimelineOptions { + DOMHighResTimeStamp originTime = 0; +}; + +[Func="Document::AreWebAnimationsTimelinesEnabled", + Exposed=Window] +interface DocumentTimeline : AnimationTimeline { + [Throws] + constructor(optional DocumentTimelineOptions options = {}); +}; diff --git a/dom/webidl/DocumentType.webidl b/dom/webidl/DocumentType.webidl new file mode 100644 index 0000000000..62a641e804 --- /dev/null +++ b/dom/webidl/DocumentType.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#documenttype + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface DocumentType : Node { + readonly attribute DOMString name; + readonly attribute DOMString publicId; + readonly attribute DOMString systemId; +}; + +DocumentType includes ChildNode; diff --git a/dom/webidl/DragEvent.webidl b/dom/webidl/DragEvent.webidl new file mode 100644 index 0000000000..4a54f4e55e --- /dev/null +++ b/dom/webidl/DragEvent.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/#dragevent + */ + +[Exposed=Window] +interface DragEvent : MouseEvent +{ + constructor(DOMString type, optional DragEventInit eventInitDict = {}); + + readonly attribute DataTransfer? dataTransfer; + + undefined initDragEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional Window? aView = null, + optional long aDetail = 0, + optional long aScreenX = 0, + optional long aScreenY = 0, + optional long aClientX = 0, + optional long aClientY = 0, + optional boolean aCtrlKey = false, + optional boolean aAltKey = false, + optional boolean aShiftKey = false, + optional boolean aMetaKey = false, + optional unsigned short aButton = 0, + optional EventTarget? aRelatedTarget = null, + optional DataTransfer? aDataTransfer = null); +}; + +dictionary DragEventInit : MouseEventInit +{ + DataTransfer? dataTransfer = null; +}; diff --git a/dom/webidl/DynamicsCompressorNode.webidl b/dom/webidl/DynamicsCompressorNode.webidl new file mode 100644 index 0000000000..853d3402d4 --- /dev/null +++ b/dom/webidl/DynamicsCompressorNode.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary DynamicsCompressorOptions : AudioNodeOptions { + float attack = 0.003; + float knee = 30; + float ratio = 12; + float release = 0.25; + float threshold = -24; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface DynamicsCompressorNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, + optional DynamicsCompressorOptions options = {}); + + readonly attribute AudioParam threshold; // in Decibels + readonly attribute AudioParam knee; // in Decibels + readonly attribute AudioParam ratio; // unit-less + readonly attribute float reduction; // in Decibels + readonly attribute AudioParam attack; // in Seconds + [BinaryName="getRelease"] + readonly attribute AudioParam release; // in Seconds + +}; + +// Mozilla extension +DynamicsCompressorNode includes AudioNodePassThrough; diff --git a/dom/webidl/Element.webidl b/dom/webidl/Element.webidl new file mode 100644 index 0000000000..75d07995fb --- /dev/null +++ b/dom/webidl/Element.webidl @@ -0,0 +1,418 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#element and + * http://domparsing.spec.whatwg.org/ and + * http://dev.w3.org/csswg/cssom-view/ and + * http://www.w3.org/TR/selectors-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface nsIScreen; + +[Exposed=Window, + InstrumentedProps=(computedStyleMap,onmousewheel,scrollIntoViewIfNeeded)] +interface Element : Node { + [Constant] + readonly attribute DOMString? namespaceURI; + [Constant] + readonly attribute DOMString? prefix; + [Constant] + readonly attribute DOMString localName; + + // Not [Constant] because it depends on which document we're in + [Pure] + readonly attribute DOMString tagName; + + [CEReactions, Pure] + attribute DOMString id; + [CEReactions, Pure] + attribute DOMString className; + [Constant, PutForwards=value] + readonly attribute DOMTokenList classList; + + // https://drafts.csswg.org/css-shadow-parts/#idl + [SameObject, PutForwards=value] + readonly attribute DOMTokenList part; + + [SameObject] + readonly attribute NamedNodeMap attributes; + [Pure] + sequence<DOMString> getAttributeNames(); + [Pure] + DOMString? getAttribute(DOMString name); + [Pure] + DOMString? getAttributeNS(DOMString? namespace, DOMString localName); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + boolean toggleAttribute(DOMString name, optional boolean force); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + undefined setAttribute(DOMString name, DOMString value); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + undefined setAttributeNS(DOMString? namespace, DOMString name, DOMString value); + [CEReactions, Throws] + undefined removeAttribute(DOMString name); + [CEReactions, Throws] + undefined removeAttributeNS(DOMString? namespace, DOMString localName); + [Pure] + boolean hasAttribute(DOMString name); + [Pure] + boolean hasAttributeNS(DOMString? namespace, DOMString localName); + [Pure] + boolean hasAttributes(); + + [Throws, Pure] + Element? closest(UTF8String selector); + + [Throws, Pure] + boolean matches(UTF8String selector); + [Throws, Pure, BinaryName="matches"] + boolean webkitMatchesSelector(UTF8String selector); + + [Pure] + HTMLCollection getElementsByTagName(DOMString localName); + [Throws, Pure] + HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); + [Pure] + HTMLCollection getElementsByClassName(DOMString classNames); + + [CEReactions, Throws] + Element? insertAdjacentElement(DOMString where, Element element); // historical + + [Throws] + undefined insertAdjacentText(DOMString where, DOMString data); // historical + + /** + * The ratio of font-size-inflated text font size to computed font + * size for this element. This will query the element for its primary frame, + * and then use this to get font size inflation information about the frame. + * This will be 1.0 if font size inflation is not enabled, and -1.0 if an + * error occurred during the retrieval of the font size inflation. + * + * @note The font size inflation ratio that is returned is actually the + * font size inflation data for the element's _primary frame_, not the + * element itself, but for most purposes, this should be sufficient. + */ + [ChromeOnly] + readonly attribute float fontSizeInflation; + + /** + * Returns the pseudo-element string if this element represents a + * pseudo-element, or null otherwise. + */ + [ChromeOnly] + readonly attribute DOMString? implementedPseudoElement; + + // Selectors API + /** + * Returns whether this element would be selected by the given selector + * string. + * + * See <http://dev.w3.org/2006/webapi/selectors-api2/#matchesselector> + */ + [Throws, Pure, BinaryName="matches"] + boolean mozMatchesSelector(UTF8String selector); + + // Pointer events methods. + [UseCounter, Throws] + undefined setPointerCapture(long pointerId); + [UseCounter, Throws] + undefined releasePointerCapture(long pointerId); + boolean hasPointerCapture(long pointerId); + + // Proprietary extensions + /** + * Set this during a mousedown event to grab and retarget all mouse events + * to this element until the mouse button is released or releaseCapture is + * called. If retargetToElement is true, then all events are targetted at + * this element. If false, events can also fire at descendants of this + * element. + * + */ + [Deprecated=ElementSetCapture, Pref="dom.mouse_capture.enabled"] + undefined setCapture(optional boolean retargetToElement = false); + + /** + * If this element has captured the mouse, release the capture. If another + * element has captured the mouse, this method has no effect. + */ + [Deprecated=ElementReleaseCapture, Pref="dom.mouse_capture.enabled"] + undefined releaseCapture(); + + /* + * Chrome-only version of setCapture that works outside of a mousedown event. + */ + [ChromeOnly] + undefined setCaptureAlways(optional boolean retargetToElement = false); + + // Mozilla extensions + + // Obsolete methods. + Attr? getAttributeNode(DOMString name); + [CEReactions, Throws] + Attr? setAttributeNode(Attr newAttr); + [CEReactions, Throws] + Attr? removeAttributeNode(Attr oldAttr); + Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName); + [CEReactions, Throws] + Attr? setAttributeNodeNS(Attr newAttr); + + [Func="nsContentUtils::IsCallerChromeOrElementTransformGettersEnabled"] + DOMMatrixReadOnly getTransformToAncestor(Element ancestor); + [Func="nsContentUtils::IsCallerChromeOrElementTransformGettersEnabled"] + DOMMatrixReadOnly getTransformToParent(); + [Func="nsContentUtils::IsCallerChromeOrElementTransformGettersEnabled"] + DOMMatrixReadOnly getTransformToViewport(); +}; + +// https://html.spec.whatwg.org/#focus-management-apis +dictionary FocusOptions { + boolean preventScroll = false; + boolean focusVisible; +}; + +interface mixin HTMLOrForeignElement { + [SameObject] readonly attribute DOMStringMap dataset; + // See bug 1389421 + // attribute DOMString nonce; // intentionally no [CEReactions] + + [CEReactions, SetterThrows, Pure] attribute boolean autofocus; + [CEReactions, SetterThrows, Pure] attribute long tabIndex; + [Throws, NeedsCallerType] undefined focus(optional FocusOptions options = {}); + [Throws] undefined blur(); +}; + +// https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-mixin +interface mixin ElementCSSInlineStyle { + [SameObject, PutForwards=cssText] + readonly attribute CSSStyleDeclaration style; +}; + +// http://dev.w3.org/csswg/cssom-view/ +enum ScrollLogicalPosition { "start", "center", "end", "nearest" }; +dictionary ScrollIntoViewOptions : ScrollOptions { + ScrollLogicalPosition block = "start"; + ScrollLogicalPosition inline = "nearest"; +}; + +dictionary CheckVisibilityOptions { + boolean checkOpacity = false; + boolean checkVisibilityCSS = false; + boolean contentVisibilityAuto = false; + boolean opacityProperty = false; + boolean visibilityProperty = false; + [ChromeOnly] boolean flush = true; +}; + +// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface +partial interface Element { + DOMRectList getClientRects(); + DOMRect getBoundingClientRect(); + + boolean checkVisibility(optional CheckVisibilityOptions options = {}); + + // scrolling + undefined scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg = {}); + // None of the CSSOM attributes are [Pure], because they flush + attribute long scrollTop; // scroll on setting + attribute long scrollLeft; // scroll on setting + readonly attribute long scrollWidth; + readonly attribute long scrollHeight; + + [BinaryName="scrollTo"] + undefined scroll(unrestricted double x, unrestricted double y); + [BinaryName="scrollTo"] + undefined scroll(optional ScrollToOptions options = {}); + undefined scrollTo(unrestricted double x, unrestricted double y); + undefined scrollTo(optional ScrollToOptions options = {}); + undefined scrollBy(unrestricted double x, unrestricted double y); + undefined scrollBy(optional ScrollToOptions options = {}); + // mozScrollSnap is used by chrome to perform scroll snapping after the + // user performs actions that may affect scroll position + // mozScrollSnap is deprecated, to be replaced by a web accessible API, such + // as an extension to the ScrollOptions dictionary. See bug 1137937. + [ChromeOnly] undefined mozScrollSnap(); + + readonly attribute long clientTop; + readonly attribute long clientLeft; + readonly attribute long clientWidth; + readonly attribute long clientHeight; + + // Return the screen coordinates of the element, in CSS pixels relative to + // the window's screen. + [ChromeOnly] readonly attribute long screenX; + [ChromeOnly] readonly attribute long screenY; + [ChromeOnly] readonly attribute nsIScreen? screen; + + // Mozilla specific stuff + /* The minimum/maximum offset that the element can be scrolled to + (i.e., the value that scrollLeft/scrollTop would be clamped to if they were + set to arbitrarily large values. */ + [ChromeOnly] readonly attribute long scrollTopMin; + readonly attribute long scrollTopMax; + [ChromeOnly] readonly attribute long scrollLeftMin; + readonly attribute long scrollLeftMax; +}; + +// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface +partial interface Element { + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, Pure, SetterThrows, GetterCanOOM] + attribute [LegacyNullToEmptyString] DOMString innerHTML; + [CEReactions, Pure, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString outerHTML; + [CEReactions, Throws] + undefined insertAdjacentHTML(DOMString position, DOMString text); +}; + +// http://www.w3.org/TR/selectors-api/#interface-definitions +partial interface Element { + [Throws, Pure] + Element? querySelector(UTF8String selectors); + [Throws, Pure] + NodeList querySelectorAll(UTF8String selectors); +}; + +// https://dom.spec.whatwg.org/#dictdef-shadowrootinit +dictionary ShadowRootInit { + required ShadowRootMode mode; + boolean delegatesFocus = false; + SlotAssignmentMode slotAssignment = "named"; + [Pref="dom.webcomponents.shadowdom.declarative.enabled"] + boolean clonable = false; +}; + +// https://dom.spec.whatwg.org/#element +partial interface Element { + // Shadow DOM v1 + [Throws, UseCounter] + ShadowRoot attachShadow(ShadowRootInit shadowRootInitDict); + [BinaryName="shadowRootByMode"] + readonly attribute ShadowRoot? shadowRoot; + + [Func="Document::IsCallerChromeOrAddon", BinaryName="shadowRoot"] + readonly attribute ShadowRoot? openOrClosedShadowRoot; + + [BinaryName="assignedSlotByMode"] + readonly attribute HTMLSlotElement? assignedSlot; + + [ChromeOnly, BinaryName="assignedSlot"] + readonly attribute HTMLSlotElement? openOrClosedAssignedSlot; + + [CEReactions, Unscopable, SetterThrows] + attribute DOMString slot; +}; + +Element includes ChildNode; +Element includes NonDocumentTypeChildNode; +Element includes ParentNode; +Element includes Animatable; +Element includes GeometryUtils; +Element includes AccessibilityRole; +Element includes AriaAttributes; + +// https://fullscreen.spec.whatwg.org/#api +partial interface Element { + [NewObject, NeedsCallerType] + Promise<undefined> requestFullscreen(); + [NewObject, BinaryName="requestFullscreen", NeedsCallerType, Deprecated="MozRequestFullScreenDeprecatedPrefix"] + Promise<undefined> mozRequestFullScreen(); + + // Events handlers + attribute EventHandler onfullscreenchange; + attribute EventHandler onfullscreenerror; +}; + +// https://w3c.github.io/pointerlock/#extensions-to-the-element-interface +partial interface Element { + [NeedsCallerType, Pref="dom.pointer-lock.enabled"] + undefined requestPointerLock(); +}; + +// Mozilla-specific additions to support devtools +partial interface Element { + // Support reporting of Flexbox properties + /** + * If this element has a display:flex or display:inline-flex style, + * this property returns an object with computed values for flex + * properties, as well as a property that exposes the flex lines + * in this container. + */ + [ChromeOnly, Pure] + Flex? getAsFlexContainer(); + + // Support reporting of Grid properties + /** + * If this element has a display:grid or display:inline-grid style, + * this property returns an object with computed values for grid + * tracks and lines. + */ + [ChromeOnly, Pure] + sequence<Grid> getGridFragments(); + + /** + * Returns whether there are any grid fragments on this element. + */ + [ChromeOnly, Pure] + boolean hasGridFragments(); + + /** + * Returns a sequence of all the descendent elements of this element + * that have display:grid or display:inline-grid style and generate + * a frame. + */ + [ChromeOnly, Pure] + sequence<Element> getElementsWithGrid(); + + /** + * Set attribute on the Element with a customized Content-Security-Policy + * appropriate to devtools, which includes: + * style-src 'unsafe-inline' + */ + [ChromeOnly, CEReactions, Throws] + undefined setAttributeDevtools(DOMString name, DOMString value); + [ChromeOnly, CEReactions, Throws] + undefined setAttributeDevtoolsNS(DOMString? namespace, DOMString name, DOMString value); + + /** + * Provide a direct way to determine if this Element has visible + * scrollbars. Flushes layout. + */ + [ChromeOnly] + readonly attribute boolean hasVisibleScrollbars; +}; + +// These variables are used in vtt.js, they are used for positioning vtt cues. +partial interface Element { + // These two attributes are a double version of the clientHeight and the + // clientWidth. + [ChromeOnly] + readonly attribute double clientHeightDouble; + [ChromeOnly] + readonly attribute double clientWidthDouble; + // This attribute returns the block size of the first line box under the different + // writing directions. If the direction is horizontal, it represents box's + // height. If the direction is vertical, it represents box's width. + [ChromeOnly] + readonly attribute double firstLineBoxBSize; +}; + + +// Sanitizer API, https://wicg.github.io/sanitizer-api/ +dictionary SetHTMLOptions { + SanitizerConfig sanitizer; +}; + +partial interface Element { + [SecureContext, UseCounter, Throws, Pref="dom.security.setHTML.enabled"] + undefined setHTML(DOMString aInnerHTML, optional SetHTMLOptions options = {}); +}; + +partial interface Element { + // https://html.spec.whatwg.org/#dom-element-sethtmlunsafe + [Pref="dom.webcomponents.shadowdom.declarative.enabled"] + undefined setHTMLUnsafe(DOMString html); +}; diff --git a/dom/webidl/ElementInternals.webidl b/dom/webidl/ElementInternals.webidl new file mode 100644 index 0000000000..175d0e4e1c --- /dev/null +++ b/dom/webidl/ElementInternals.webidl @@ -0,0 +1,80 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/#elementinternals + */ + +[Exposed=Window] +interface ElementInternals { + // Shadow root access + readonly attribute ShadowRoot? shadowRoot; + + // Form-associated custom elements + [Throws] + undefined setFormValue((File or USVString or FormData)? value, + optional (File or USVString or FormData)? state); + + [Throws] + readonly attribute HTMLFormElement? form; + + [Throws] + undefined setValidity(optional ValidityStateFlags flags = {}, + optional DOMString message, + optional HTMLElement anchor); + [Throws] + readonly attribute boolean willValidate; + [Throws] + readonly attribute ValidityState validity; + [Throws] + readonly attribute DOMString validationMessage; + [Throws] + boolean checkValidity(); + [Throws] + boolean reportValidity(); + + [Throws] + readonly attribute NodeList labels; + + [Pref="dom.element.customstateset.enabled", SameObject] readonly attribute CustomStateSet states; +}; + +[Pref="dom.element.customstateset.enabled", Exposed=Window] +interface CustomStateSet { + setlike<DOMString>; +}; + +partial interface CustomStateSet { + // Setlike methods need to be overriden. + [Throws] + undefined add(DOMString state); + + [Throws] + boolean delete(DOMString state); + + [Throws] + undefined clear(); +}; + +partial interface ElementInternals { + [ChromeOnly, Throws] + readonly attribute HTMLElement? validationAnchor; +}; + +ElementInternals includes AccessibilityRole; +ElementInternals includes AriaAttributes; + +dictionary ValidityStateFlags { + boolean valueMissing = false; + boolean typeMismatch = false; + boolean patternMismatch = false; + boolean tooLong = false; + boolean tooShort = false; + boolean rangeUnderflow = false; + boolean rangeOverflow = false; + boolean stepMismatch = false; + boolean badInput = false; + boolean customError = false; +}; diff --git a/dom/webidl/EncodedVideoChunk.webidl b/dom/webidl/EncodedVideoChunk.webidl new file mode 100644 index 0000000000..fa1c5599ab --- /dev/null +++ b/dom/webidl/EncodedVideoChunk.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/webcodecs/#encodedvideochunk + */ + +// [Serializable] is implemented without adding attribute here. +[Exposed=(Window,DedicatedWorker), Pref="dom.media.webcodecs.enabled"] +interface EncodedVideoChunk { + [Throws] + constructor(EncodedVideoChunkInit init); + readonly attribute EncodedVideoChunkType type; + readonly attribute long long timestamp; // microseconds + readonly attribute unsigned long long? duration; // microseconds + readonly attribute unsigned long byteLength; + + // bug 1696216: Should be `copyTo([AllowShared] BufferSource destination)` + [Throws] + undefined copyTo(([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) destination); +}; + +dictionary EncodedVideoChunkInit { + required EncodedVideoChunkType type; + required [EnforceRange] long long timestamp; // microseconds + [EnforceRange] unsigned long long duration; // microseconds + // bug 1696216: Should be `required BufferSource data` + required ([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) data; +}; + +enum EncodedVideoChunkType { + "key", + "delta", +}; diff --git a/dom/webidl/ErrorEvent.webidl b/dom/webidl/ErrorEvent.webidl new file mode 100644 index 0000000000..7ff6faf720 --- /dev/null +++ b/dom/webidl/ErrorEvent.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/#the-errorevent-interface + */ + +[Exposed=(Window,Worker)] +interface ErrorEvent : Event +{ + constructor(DOMString type, optional ErrorEventInit eventInitDict = {}); + + readonly attribute DOMString message; + readonly attribute DOMString filename; + readonly attribute unsigned long lineno; + readonly attribute unsigned long colno; + readonly attribute any error; +}; + +dictionary ErrorEventInit : EventInit +{ + DOMString message = ""; + DOMString filename = ""; + unsigned long lineno = 0; + unsigned long colno = 0; + any error; +}; diff --git a/dom/webidl/Event.webidl b/dom/webidl/Event.webidl new file mode 100644 index 0000000000..24eb456fa5 --- /dev/null +++ b/dom/webidl/Event.webidl @@ -0,0 +1,107 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker,AudioWorklet), ProbablyShortLivingWrapper] +interface Event { + constructor(DOMString type, optional EventInit eventInitDict = {}); + + [Pure] + readonly attribute DOMString type; + [Pure, BindingAlias="srcElement"] + readonly attribute EventTarget? target; + [Pure] + readonly attribute EventTarget? currentTarget; + + sequence<EventTarget> composedPath(); + + const unsigned short NONE = 0; + const unsigned short CAPTURING_PHASE = 1; + const unsigned short AT_TARGET = 2; + const unsigned short BUBBLING_PHASE = 3; + [Pure] + readonly attribute unsigned short eventPhase; + + undefined stopPropagation(); + undefined stopImmediatePropagation(); + + [Pure] + readonly attribute boolean bubbles; + [Pure] + readonly attribute boolean cancelable; + [NeedsCallerType] + attribute boolean returnValue; + [NeedsCallerType] + undefined preventDefault(); + [Pure, NeedsCallerType] + readonly attribute boolean defaultPrevented; + [ChromeOnly, Pure] + readonly attribute boolean defaultPreventedByChrome; + [ChromeOnly, Pure] + readonly attribute boolean defaultPreventedByContent; + [Pure] + readonly attribute boolean composed; + + [LegacyUnforgeable, Pure] + readonly attribute boolean isTrusted; + [Pure] + readonly attribute DOMHighResTimeStamp timeStamp; + + undefined initEvent(DOMString type, + optional boolean bubbles = false, + optional boolean cancelable = false); + attribute boolean cancelBubble; +}; + +// Mozilla specific legacy stuff. +partial interface Event { + const long ALT_MASK = 0x00000001; + const long CONTROL_MASK = 0x00000002; + const long SHIFT_MASK = 0x00000004; + const long META_MASK = 0x00000008; + + /** The original target of the event, before any retargetings. */ + readonly attribute EventTarget? originalTarget; + /** + * The explicit original target of the event. If the event was retargeted + * for some reason other than an anonymous boundary crossing, this will be set + * to the target before the retargeting occurs. For example, mouse events + * are retargeted to their parent node when they happen over text nodes (bug + * 185889), and in that case .target will show the parent and + * .explicitOriginalTarget will show the text node. + * .explicitOriginalTarget differs from .originalTarget in that it will never + * contain anonymous content. + */ + readonly attribute EventTarget? explicitOriginalTarget; + [ChromeOnly] readonly attribute EventTarget? composedTarget; + [ChromeOnly] undefined preventMultipleActions(); + [ChromeOnly] readonly attribute boolean multipleActionsPrevented; + [ChromeOnly] readonly attribute boolean isSynthesized; + /** + * When the event target is a remote browser, calling this will fire an + * reply event in the chrome process. + */ + [ChromeOnly] undefined requestReplyFromRemoteContent(); + /** + * Returns true when the event shouldn't be handled by chrome. + */ + [ChromeOnly] readonly attribute boolean isWaitingReplyFromRemoteContent; + /** + * Returns true when the event is a reply event from a remote process. + */ + [ChromeOnly] readonly attribute boolean isReplyEventFromRemoteContent; +}; + +dictionary EventInit { + boolean bubbles = false; + boolean cancelable = false; + boolean composed = false; +}; diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl new file mode 100644 index 0000000000..439ac79e5d --- /dev/null +++ b/dom/webidl/EventHandler.webidl @@ -0,0 +1,182 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#eventhandler + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ +[LegacyTreatNonObjectAsNull] +callback EventHandlerNonNull = any (Event event); +typedef EventHandlerNonNull? EventHandler; + +[LegacyTreatNonObjectAsNull] +callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event); +typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler; + +[LegacyTreatNonObjectAsNull] +callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error); +typedef OnErrorEventHandlerNonNull? OnErrorEventHandler; + +interface mixin GlobalEventHandlers { + attribute EventHandler onabort; + attribute EventHandler onblur; +// We think the spec is wrong here. See OnErrorEventHandlerForNodes/Window +// below. +// attribute OnErrorEventHandler onerror; + attribute EventHandler onfocus; + attribute EventHandler oncancel; + attribute EventHandler onauxclick; + attribute EventHandler onbeforeinput; + [Pref="dom.element.popover.enabled"] + attribute EventHandler onbeforetoggle; + attribute EventHandler oncanplay; + attribute EventHandler oncanplaythrough; + attribute EventHandler onchange; + attribute EventHandler onclick; + attribute EventHandler onclose; + attribute EventHandler oncontextmenu; + attribute EventHandler oncopy; + attribute EventHandler oncuechange; + attribute EventHandler oncut; + attribute EventHandler ondblclick; + attribute EventHandler ondrag; + attribute EventHandler ondragend; + attribute EventHandler ondragenter; + [Func="Event::IsDragExitEnabled"] + attribute EventHandler ondragexit; + attribute EventHandler ondragleave; + attribute EventHandler ondragover; + attribute EventHandler ondragstart; + attribute EventHandler ondrop; + attribute EventHandler ondurationchange; + attribute EventHandler onemptied; + attribute EventHandler onended; + attribute EventHandler onformdata; + attribute EventHandler oninput; + attribute EventHandler oninvalid; + attribute EventHandler onkeydown; + attribute EventHandler onkeypress; + attribute EventHandler onkeyup; + attribute EventHandler onload; + attribute EventHandler onloadeddata; + attribute EventHandler onloadedmetadata; + attribute EventHandler onloadstart; + attribute EventHandler onmousedown; + [LegacyLenientThis] attribute EventHandler onmouseenter; + [LegacyLenientThis] attribute EventHandler onmouseleave; + attribute EventHandler onmousemove; + attribute EventHandler onmouseout; + attribute EventHandler onmouseover; + attribute EventHandler onmouseup; + attribute EventHandler onwheel; + attribute EventHandler onpaste; + attribute EventHandler onpause; + attribute EventHandler onplay; + attribute EventHandler onplaying; + attribute EventHandler onprogress; + attribute EventHandler onratechange; + attribute EventHandler onreset; + attribute EventHandler onresize; + attribute EventHandler onscroll; + attribute EventHandler onscrollend; + attribute EventHandler onsecuritypolicyviolation; + attribute EventHandler onseeked; + attribute EventHandler onseeking; + attribute EventHandler onselect; + attribute EventHandler onslotchange; + //(Not implemented)attribute EventHandler onsort; + attribute EventHandler onstalled; + attribute EventHandler onsubmit; + attribute EventHandler onsuspend; + attribute EventHandler ontimeupdate; + attribute EventHandler onvolumechange; + attribute EventHandler onwaiting; + + attribute EventHandler onselectstart; + attribute EventHandler onselectionchange; + + attribute EventHandler ontoggle; + + // Pointer events handlers + attribute EventHandler onpointercancel; + attribute EventHandler onpointerdown; + attribute EventHandler onpointerup; + attribute EventHandler onpointermove; + attribute EventHandler onpointerout; + attribute EventHandler onpointerover; + attribute EventHandler onpointerenter; + attribute EventHandler onpointerleave; + attribute EventHandler ongotpointercapture; + attribute EventHandler onlostpointercapture; + + // Mozilla-specific handlers. Unprefixed handlers live in + // Document rather than here. + [Deprecated="MozfullscreenchangeDeprecatedPrefix"] + attribute EventHandler onmozfullscreenchange; + [Deprecated="MozfullscreenerrorDeprecatedPrefix"] + attribute EventHandler onmozfullscreenerror; + + // CSS-Animation and CSS-Transition handlers. + attribute EventHandler onanimationcancel; + attribute EventHandler onanimationend; + attribute EventHandler onanimationiteration; + attribute EventHandler onanimationstart; + attribute EventHandler ontransitioncancel; + attribute EventHandler ontransitionend; + attribute EventHandler ontransitionrun; + attribute EventHandler ontransitionstart; + + // CSS-Animation and CSS-Transition legacy handlers. + // This handler isn't standard. + [BinaryName="onwebkitAnimationEnd"] + attribute EventHandler onwebkitanimationend; + [BinaryName="onwebkitAnimationIteration"] + attribute EventHandler onwebkitanimationiteration; + [BinaryName="onwebkitAnimationStart"] + attribute EventHandler onwebkitanimationstart; + [BinaryName="onwebkitTransitionEnd"] + attribute EventHandler onwebkittransitionend; +}; + +interface mixin WindowEventHandlers { + attribute EventHandler onafterprint; + attribute EventHandler onbeforeprint; + attribute OnBeforeUnloadEventHandler onbeforeunload; + attribute EventHandler onhashchange; + attribute EventHandler onlanguagechange; + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; + attribute EventHandler onoffline; + attribute EventHandler ononline; + attribute EventHandler onpagehide; + attribute EventHandler onpageshow; + attribute EventHandler onpopstate; + attribute EventHandler onrejectionhandled; + attribute EventHandler onstorage; + attribute EventHandler onunhandledrejection; + attribute EventHandler onunload; +}; + +// https://w3c.github.io/gamepad/#extensions-to-the-windoweventhandlers-interface-mixin +partial interface mixin WindowEventHandlers { + attribute EventHandler ongamepadconnected; + attribute EventHandler ongamepaddisconnected; +}; + +// The spec has |attribute OnErrorEventHandler onerror;| on +// GlobalEventHandlers, and calls the handler differently depending on +// whether an ErrorEvent was fired. We don't do that, and until we do we'll +// need to distinguish between onerror on Window or on nodes. + +interface mixin OnErrorEventHandlerForNodes { + attribute EventHandler onerror; +}; + +interface mixin OnErrorEventHandlerForWindow { + attribute OnErrorEventHandler onerror; +}; diff --git a/dom/webidl/EventListener.webidl b/dom/webidl/EventListener.webidl new file mode 100644 index 0000000000..441be769fc --- /dev/null +++ b/dom/webidl/EventListener.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +callback interface EventListener { + undefined handleEvent(Event event); +}; diff --git a/dom/webidl/EventSource.webidl b/dom/webidl/EventSource.webidl new file mode 100644 index 0000000000..86c731dacb --- /dev/null +++ b/dom/webidl/EventSource.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/comms.html#the-eventsource-interface + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=(Window,DedicatedWorker,SharedWorker)] +interface EventSource : EventTarget { + [Throws] + constructor(USVString url, optional EventSourceInit eventSourceInitDict = {}); + + [Constant] + readonly attribute DOMString url; + [Constant] + readonly attribute boolean withCredentials; + + // ready state + const unsigned short CONNECTING = 0; + const unsigned short OPEN = 1; + const unsigned short CLOSED = 2; + readonly attribute unsigned short readyState; + + // networking + attribute EventHandler onopen; + attribute EventHandler onmessage; + attribute EventHandler onerror; + undefined close(); +}; + +dictionary EventSourceInit { + boolean withCredentials = false; +}; diff --git a/dom/webidl/EventTarget.webidl b/dom/webidl/EventTarget.webidl new file mode 100644 index 0000000000..5fe193a034 --- /dev/null +++ b/dom/webidl/EventTarget.webidl @@ -0,0 +1,73 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + + +dictionary EventListenerOptions { + boolean capture = false; + /* Setting to true make the listener be added to the system group. */ + [Func="ThreadSafeIsChromeOrUAWidget"] + boolean mozSystemGroup = false; +}; + +dictionary AddEventListenerOptions : EventListenerOptions { + boolean passive; + boolean once = false; + AbortSignal signal; + [ChromeOnly] + boolean wantUntrusted; +}; + +[Exposed=*] +interface EventTarget { + [Throws] + constructor(); + + /* Passing null for wantsUntrusted means "default behavior", which + differs in content and chrome. In content that default boolean + value is true, while in chrome the default boolean value is + false. */ + [Throws] + undefined addEventListener(DOMString type, + EventListener? listener, + optional (AddEventListenerOptions or boolean) options = {}, + optional boolean? wantsUntrusted = null); + [Throws] + undefined removeEventListener(DOMString type, + EventListener? listener, + optional (EventListenerOptions or boolean) options = {}); + [Throws, NeedsCallerType] + boolean dispatchEvent(Event event); +}; + +// Mozilla extensions for use by JS-implemented event targets to +// implement on* properties. +partial interface EventTarget { + // The use of [TreatNonCallableAsNull] here is a bit of a hack: it just makes + // the codegen check whether the type involved is either + // [TreatNonCallableAsNull] or [TreatNonObjectAsNull] and if it is handle it + // accordingly. In particular, it will NOT actually treat a non-null + // non-callable object as null here. + [ChromeOnly, Throws] + undefined setEventHandler(DOMString type, + [TreatNonCallableAsNull] EventHandler handler); + + [ChromeOnly] + EventHandler getEventHandler(DOMString type); +}; + +// Mozilla extension to make firing events on event targets from +// chrome easier. This returns the window which can be used to create +// events to fire at this EventTarget, or null if there isn't one. +partial interface EventTarget { + [ChromeOnly, Exposed=Window, BinaryName="ownerGlobalForBindings"] + readonly attribute WindowProxy? ownerGlobal; +}; diff --git a/dom/webidl/ExtendableEvent.webidl b/dom/webidl/ExtendableEvent.webidl new file mode 100644 index 0000000000..8bb8b665ac --- /dev/null +++ b/dom/webidl/ExtendableEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + */ + +[Exposed=ServiceWorker] +interface ExtendableEvent : Event { + constructor(DOMString type, optional ExtendableEventInit eventInitDict = {}); + + // https://github.com/slightlyoff/ServiceWorker/issues/261 + [Throws] + undefined waitUntil(Promise<any> p); +}; + +dictionary ExtendableEventInit : EventInit { + // Defined for the forward compatibility across the derived events +}; diff --git a/dom/webidl/ExtendableMessageEvent.webidl b/dom/webidl/ExtendableMessageEvent.webidl new file mode 100644 index 0000000000..cde11e8e75 --- /dev/null +++ b/dom/webidl/ExtendableMessageEvent.webidl @@ -0,0 +1,46 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://w3c.github.io/ServiceWorker/#extendablemessage-event-section + */ + +[Exposed=(ServiceWorker)] +interface ExtendableMessageEvent : ExtendableEvent { + constructor(DOMString type, + optional ExtendableMessageEventInit eventInitDict = {}); + + /** + * Custom data associated with this event. + */ + [GetterThrows] + readonly attribute any data; + + /** + * The origin of the site from which this event originated. + */ + readonly attribute DOMString origin; + + /** + * The last event ID string of the event source. + */ + readonly attribute DOMString lastEventId; + + /** + * The client, service worker or port which originated this event. + */ + readonly attribute (Client or ServiceWorker or MessagePort)? source; + + [Constant, Cached, Frozen] + readonly attribute sequence<MessagePort> ports; +}; + +dictionary ExtendableMessageEventInit : ExtendableEventInit { + any data = null; + DOMString origin = ""; + DOMString lastEventId = ""; + (Client or ServiceWorker or MessagePort)? source = null; + sequence<MessagePort> ports = []; +}; diff --git a/dom/webidl/ExtensionAlarms.webidl b/dom/webidl/ExtensionAlarms.webidl new file mode 100644 index 0000000000..eb51a3a94c --- /dev/null +++ b/dom/webidl/ExtensionAlarms.webidl @@ -0,0 +1,58 @@ +/* + * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT + * + * The content of this file has been generated based on the WebExtensions API + * JSONSchema using the following command: + * + * export SCRIPT_DIR="toolkit/components/extensions/webidl-api" + * mach python $SCRIPT_DIR/GenerateWebIDLBindings.py -- alarms + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +/* This Source Code Form is subject to the terms of 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +// WebIDL definition for the "alarms" WebExtensions API +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionAlarms { + // API methods. + + [Throws, WebExtensionStub="NoReturn"] + undefined create(DOMString name, any alarmInfo); + [Throws, WebExtensionStub="NoReturn"] + undefined create(any alarmInfo); + + [Throws, WebExtensionStub="Async"] + any get(DOMString name, optional Function callback); + [Throws, WebExtensionStub="Async"] + any get(optional Function callback); + + [Throws, WebExtensionStub="Async"] + any getAll(optional Function callback); + + [Throws, WebExtensionStub="Async"] + any clear(DOMString name, optional Function callback); + [Throws, WebExtensionStub="Async"] + any clear(optional Function callback); + + [Throws, WebExtensionStub="Async"] + any clearAll(optional Function callback); + + // API events. + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onAlarm; +}; diff --git a/dom/webidl/ExtensionBrowser.webidl b/dom/webidl/ExtensionBrowser.webidl new file mode 100644 index 0000000000..09e06053f8 --- /dev/null +++ b/dom/webidl/ExtensionBrowser.webidl @@ -0,0 +1,76 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + * + * This IDL file is related to interface mixin for the additional globals that should be + * available in windows and service workers allowed to access the WebExtensions API and + * the WebExtensions browser API namespace. + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +// WebExtensions API interface mixin (used to include ExtensionBrowser interface +// in the ServiceWorkerGlobalScope and Window). +[Exposed=(ServiceWorker)] +interface mixin ExtensionGlobalsMixin { + [Replaceable, SameObject, BinaryName="AcquireExtensionBrowser", + BindingAlias="chrome", Func="extensions::ExtensionAPIAllowed"] + readonly attribute ExtensionBrowser browser; +}; + +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionBrowser { + // A mock API only exposed in tests to unit test the internals + // meant to be reused by the real WebExtensions API bindings + // in xpcshell tests. + [Replaceable, SameObject, BinaryName="GetExtensionMockAPI", + Func="mozilla::extensions::ExtensionMockAPI::IsAllowed", + Pref="extensions.webidl-api.expose_mock_interface"] + readonly attribute ExtensionMockAPI mockExtensionAPI; + + // `browser.alarms` API namespace + [Replaceable, SameObject, BinaryName="GetExtensionAlarms", + Func="mozilla::extensions::ExtensionAlarms::IsAllowed"] + readonly attribute ExtensionAlarms alarms; + + // `browser.browserSettings` API namespace + [Replaceable, SameObject, BinaryName="GetExtensionBrowserSettings", + Func="mozilla::extensions::ExtensionBrowserSettings::IsAllowed"] + readonly attribute ExtensionBrowserSettings browserSettings; + + // `browser.dns` API namespace + [Replaceable, SameObject, BinaryName="GetExtensionDns", + Func="mozilla::extensions::ExtensionDns::IsAllowed"] + readonly attribute ExtensionDns dns; + + // `browser.proxy` API namespace + [Replaceable, SameObject, BinaryName="GetExtensionProxy", + Func="mozilla::extensions::ExtensionProxy::IsAllowed"] + readonly attribute ExtensionProxy proxy; + + // `browser.runtime` API namespace + [Replaceable, SameObject, BinaryName="GetExtensionRuntime", + Func="mozilla::extensions::ExtensionRuntime::IsAllowed"] + readonly attribute ExtensionRuntime runtime; + + // `browser.scripting` API namespace + [Replaceable, SameObject, BinaryName="GetExtensionScripting", + Func="mozilla::extensions::ExtensionScripting::IsAllowed"] + readonly attribute ExtensionScripting scripting; + + // `browser.test` API namespace, available in tests. + [Replaceable, SameObject, BinaryName="GetExtensionTest", + Func="mozilla::extensions::ExtensionTest::IsAllowed"] + readonly attribute ExtensionTest test; +}; diff --git a/dom/webidl/ExtensionBrowserSettings.webidl b/dom/webidl/ExtensionBrowserSettings.webidl new file mode 100644 index 0000000000..740537d6d5 --- /dev/null +++ b/dom/webidl/ExtensionBrowserSettings.webidl @@ -0,0 +1,93 @@ +/* + * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT + * + * The content of this file has been generated based on the WebExtensions API + * JSONSchema using the following command: + * + * export SCRIPT_DIR="toolkit/components/extensions/webidl-api" + * mach python $SCRIPT_DIR/GenerateWebIDLBindings.py -- browserSettings + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +/* This Source Code Form is subject to the terms of 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +// WebIDL definition for the "browserSettings" WebExtensions API +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionBrowserSettings { + // API properties. + + [Replaceable] + readonly attribute ExtensionSetting allowPopupsForUserEvents; + + [Replaceable] + readonly attribute ExtensionSetting cacheEnabled; + + [Replaceable] + readonly attribute ExtensionSetting closeTabsByDoubleClick; + + [Replaceable] + readonly attribute ExtensionSetting contextMenuShowEvent; + + [Replaceable] + readonly attribute ExtensionSetting ftpProtocolEnabled; + + [Replaceable] + readonly attribute ExtensionSetting homepageOverride; + + [Replaceable] + readonly attribute ExtensionSetting imageAnimationBehavior; + + [Replaceable] + readonly attribute ExtensionSetting newTabPageOverride; + + [Replaceable] + readonly attribute ExtensionSetting newTabPosition; + + [Replaceable] + readonly attribute ExtensionSetting openBookmarksInNewTabs; + + [Replaceable] + readonly attribute ExtensionSetting openSearchResultsInNewTabs; + + [Replaceable] + readonly attribute ExtensionSetting openUrlbarResultsInNewTabs; + + [Replaceable] + readonly attribute ExtensionSetting webNotificationsDisabled; + + [Replaceable] + readonly attribute ExtensionSetting overrideDocumentColors; + + [Replaceable] + readonly attribute ExtensionSetting overrideContentColorScheme; + + [Replaceable] + readonly attribute ExtensionSetting useDocumentFonts; + + [Replaceable] + readonly attribute ExtensionSetting zoomFullPage; + + [Replaceable] + readonly attribute ExtensionSetting zoomSiteSpecific; + + // API child namespaces. + + [Replaceable, SameObject, + BinaryName="GetExtensionBrowserSettingsColorManagement", + Func="mozilla::extensions::ExtensionBrowserSettingsColorManagement::IsAllowed"] + readonly attribute ExtensionBrowserSettingsColorManagement colorManagement; +}; diff --git a/dom/webidl/ExtensionBrowserSettingsColorManagement.webidl b/dom/webidl/ExtensionBrowserSettingsColorManagement.webidl new file mode 100644 index 0000000000..6409563058 --- /dev/null +++ b/dom/webidl/ExtensionBrowserSettingsColorManagement.webidl @@ -0,0 +1,41 @@ +/* + * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT + * + * The content of this file has been generated based on the WebExtensions API + * JSONSchema using the following command: + * + * export SCRIPT_DIR="toolkit/components/extensions/webidl-api" + * mach python $SCRIPT_DIR/GenerateWebIDLBindings.py -- browserSettings.colorManagement + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +/* This Source Code Form is subject to the terms of 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +// WebIDL definition for the "browserSettings.colorManagement" WebExtensions API +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionBrowserSettingsColorManagement { + // API properties. + + [Replaceable] + readonly attribute ExtensionSetting mode; + + [Replaceable] + readonly attribute ExtensionSetting useNativeSRGB; + + [Replaceable] + readonly attribute ExtensionSetting useWebRenderCompositor; +}; diff --git a/dom/webidl/ExtensionDns.webidl b/dom/webidl/ExtensionDns.webidl new file mode 100644 index 0000000000..f64a605664 --- /dev/null +++ b/dom/webidl/ExtensionDns.webidl @@ -0,0 +1,35 @@ +/* + * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT + * + * The content of this file has been generated based on the WebExtensions API + * JSONSchema using the following command: + * + * export SCRIPT_DIR="toolkit/components/extensions/webidl-api" + * mach python $SCRIPT_DIR/GenerateWebIDLBindings.py -- dns + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +/* This Source Code Form is subject to the terms of 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +// WebIDL definition for the "dns" WebExtensions API +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionDns { + // API methods. + + [Throws, WebExtensionStub="AsyncAmbiguous"] + any resolve(any... args); +}; diff --git a/dom/webidl/ExtensionEventManager.webidl b/dom/webidl/ExtensionEventManager.webidl new file mode 100644 index 0000000000..9514b2e357 --- /dev/null +++ b/dom/webidl/ExtensionEventManager.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + * + * This IDL file is related to the WebExtensions API object. + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionEventManager { + [Throws] + undefined addListener(Function callback, optional object listenerOptions); + + [Throws] + undefined removeListener(Function callback); + + [Throws] + boolean hasListener(Function callback); + + [Throws] + boolean hasListeners(); +}; diff --git a/dom/webidl/ExtensionMockAPI.webidl b/dom/webidl/ExtensionMockAPI.webidl new file mode 100644 index 0000000000..667fa9a772 --- /dev/null +++ b/dom/webidl/ExtensionMockAPI.webidl @@ -0,0 +1,55 @@ +/* This Source Code Form is subject to the terms of 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + * + * This IDL file is related to the WebExtensions API object only used in + * unit tests. + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +// WebIDL definition for the "mockExtensionAPI" WebExtensions API, +// only available in tests and locked behind an about:config preference +// ("extensions.webidl-api.expose_mock_interface"). +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionMockAPI { + // Test API methods scenarios. + + [Throws, WebExtensionStub] + any methodSyncWithReturn(any... args); + + [Throws, WebExtensionStub="NoReturn"] + undefined methodNoReturn(any... args); + + [Throws, WebExtensionStub="Async"] + any methodAsync(any arg0, optional Function cb); + + [Throws, WebExtensionStub="AsyncAmbiguous"] + any methodAmbiguousArgsAsync(any... args); + + [Throws, WebExtensionStub="ReturnsPort"] + ExtensionPort methodReturnsPort(DOMString testName); + + // Test API properties. + + [Replaceable] + readonly attribute any propertyAsErrorObject; + + [Replaceable] + readonly attribute DOMString propertyAsString; + + // Test API events. + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onTestEvent; +}; diff --git a/dom/webidl/ExtensionPort.webidl b/dom/webidl/ExtensionPort.webidl new file mode 100644 index 0000000000..35fb60dea7 --- /dev/null +++ b/dom/webidl/ExtensionPort.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + * + * This IDL file is related to the WebExtensions browser.runtime's Port. + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionPort { + [Replaceable] + readonly attribute DOMString name; + [Replaceable] + readonly attribute any sender; + [Replaceable] + readonly attribute any error; + + [Throws, WebExtensionStub="NoReturn"] + undefined disconnect(); + [Throws, WebExtensionStub="NoReturn"] + undefined postMessage(any message); + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onDisconnect; + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onMessage; +}; + +// Dictionary used by ExtensionAPIRequestForwarder and ExtensionCallabck to receive from the +// mozIExtensionAPIRequestHandler an internal description of a runtime.Port (and then used in +// the webidl implementation to create an ExtensionPort instance). +[GenerateInit] +dictionary ExtensionPortDescriptor { + required DOMString portId; + DOMString name = ""; +}; diff --git a/dom/webidl/ExtensionProxy.webidl b/dom/webidl/ExtensionProxy.webidl new file mode 100644 index 0000000000..fa8dfcf041 --- /dev/null +++ b/dom/webidl/ExtensionProxy.webidl @@ -0,0 +1,38 @@ +/* + * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT + * + * The content of this file has been generated based on the WebExtensions API + * JSONSchema using the following command: + * + * export SCRIPT_DIR="toolkit/components/extensions/webidl-api" + * mach python $SCRIPT_DIR/GenerateWebIDLBindings.py -- proxy + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + */ + +/* This Source Code Form is subject to the terms of 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +// WebIDL definition for the "proxy" WebExtensions API +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionProxy { + // API events. + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onRequest; + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onError; + + // API properties. + + [Replaceable] + readonly attribute ExtensionSetting settings; +}; diff --git a/dom/webidl/ExtensionRuntime.webidl b/dom/webidl/ExtensionRuntime.webidl new file mode 100644 index 0000000000..c60f45c8f2 --- /dev/null +++ b/dom/webidl/ExtensionRuntime.webidl @@ -0,0 +1,102 @@ +/* + * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT + * + * The content of this file has been generated based on the WebExtensions API + * JSONSchema using the following command: + * + * export SCRIPT_DIR="toolkit/components/extensions/webidl-api" + * mach python $SCRIPT_DIR/GenerateWebIDLBindings.py -- runtime + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +/* This Source Code Form is subject to the terms of 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +// WebIDL definition for the "runtime" WebExtensions API +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionRuntime { + // API methods. + + [Throws, WebExtensionStub="Async"] + any openOptionsPage(optional Function callback); + + [Throws, WebExtensionStub] + any getManifest(); + + [Throws, WebExtensionStub="ReturnsString"] + DOMString getURL(DOMString path); + + [Throws, WebExtensionStub="Async"] + any setUninstallURL(DOMString url, optional Function callback); + [Throws, WebExtensionStub="Async"] + any setUninstallURL(optional Function callback); + + [Throws, WebExtensionStub="NoReturn"] + undefined reload(); + + [Throws, WebExtensionStub="ReturnsPort"] + ExtensionPort connect(DOMString extensionId, any connectInfo); + [Throws, WebExtensionStub="ReturnsPort"] + ExtensionPort connect(any connectInfo); + [Throws, WebExtensionStub="ReturnsPort"] + ExtensionPort connect(); + + [Throws, WebExtensionStub="ReturnsPort"] + ExtensionPort connectNative(DOMString application); + + [Throws, WebExtensionStub="AsyncAmbiguous"] + any sendMessage(any... args); + + [Throws, WebExtensionStub="Async"] + any sendNativeMessage(DOMString application, any message, optional Function responseCallback); + + [Throws, WebExtensionStub="Async"] + any getBrowserInfo(optional Function callback); + + [Throws, WebExtensionStub="Async"] + any getPlatformInfo(optional Function callback); + + // API events. + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onStartup; + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onInstalled; + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onUpdateAvailable; + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onConnect; + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onConnectExternal; + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onMessage; + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onMessageExternal; + + // API properties. + + [Replaceable] + readonly attribute any lastError; + + [Replaceable] + readonly attribute DOMString id; +}; diff --git a/dom/webidl/ExtensionScripting.webidl b/dom/webidl/ExtensionScripting.webidl new file mode 100644 index 0000000000..0bd4ed8235 --- /dev/null +++ b/dom/webidl/ExtensionScripting.webidl @@ -0,0 +1,53 @@ +/* + * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT + * + * The content of this file has been generated based on the WebExtensions API + * JSONSchema using the following command: + * + * export SCRIPT_DIR="toolkit/components/extensions/webidl-api" + * mach python $SCRIPT_DIR/GenerateWebIDLBindings.py -- scripting + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +/* This Source Code Form is subject to the terms of 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +// WebIDL definition for the "scripting" WebExtensions API +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionScripting { + // API methods. + + [Throws, WebExtensionStub="NotImplementedAsync"] + any executeScript(any injection, optional Function callback); + + [Throws, WebExtensionStub="Async"] + any insertCSS(any injection, optional Function callback); + + [Throws, WebExtensionStub="Async"] + any removeCSS(any injection, optional Function callback); + + [Throws, WebExtensionStub="Async"] + any registerContentScripts(any scripts, optional Function callback); + + [Throws, WebExtensionStub="AsyncAmbiguous"] + any getRegisteredContentScripts(any... args); + + [Throws, WebExtensionStub="AsyncAmbiguous"] + any unregisterContentScripts(any... args); + + [Throws, WebExtensionStub="Async"] + any updateContentScripts(any scripts, optional Function callback); +}; diff --git a/dom/webidl/ExtensionSetting.webidl b/dom/webidl/ExtensionSetting.webidl new file mode 100644 index 0000000000..578feb17ff --- /dev/null +++ b/dom/webidl/ExtensionSetting.webidl @@ -0,0 +1,42 @@ +/* -*- 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + * + * This IDL file is related to the WebExtensions API object. + * + * The ExtensionSetting interface is used by the API namespace that expose + * settings API sub-namespaces (in particular browserSettings, proxy, + * captivePortal and privacy WebExtensions APIs). + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionSetting { + // API methods. + + [Throws, WebExtensionStub="Async"] + any get(object details, optional Function callback); + + [Throws, WebExtensionStub="Async"] + any set(object details, optional Function callback); + + [Throws, WebExtensionStub="Async"] + any clear(object details, optional Function callback); + + // API events. + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onChange; +}; diff --git a/dom/webidl/ExtensionTest.webidl b/dom/webidl/ExtensionTest.webidl new file mode 100644 index 0000000000..8d70ce52e1 --- /dev/null +++ b/dom/webidl/ExtensionTest.webidl @@ -0,0 +1,86 @@ +/* + * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT + * + * The content of this file has been generated based on the WebExtensions API + * JSONSchema using the following command: + * + * export SCRIPT_DIR="toolkit/components/extensions/webidl-api" + * mach python $SCRIPT_DIR/GenerateWebIDLBindings.py -- test + * + * More info about generating webidl API bindings for WebExtensions API at: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html + * + * A short summary of the special setup used by these WebIDL files (meant to aid + * webidl peers reviews and sign-offs) is available in the following section: + * + * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions + */ + +/* This Source Code Form is subject to the terms of 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/. + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +// WebIDL definition for the "test" WebExtensions API +[Exposed=(ServiceWorker), LegacyNoInterfaceObject] +interface ExtensionTest { + // API methods. + + [Throws, WebExtensionStub="NotImplementedNoReturn"] + undefined withHandlingUserInput(Function callback); + + [Throws, WebExtensionStub="NoReturn"] + undefined notifyFail(DOMString message); + + [Throws, WebExtensionStub="NoReturn"] + undefined notifyPass(DOMString message); + [Throws, WebExtensionStub="NoReturn"] + undefined notifyPass(); + + [Throws, WebExtensionStub="NoReturn"] + undefined log(DOMString message); + + [Throws, WebExtensionStub="NoReturn"] + undefined sendMessage(any... args); + + [Throws, WebExtensionStub="NoReturn"] + undefined fail(any message); + [Throws, WebExtensionStub="NoReturn"] + undefined fail(); + + [Throws, WebExtensionStub="NoReturn"] + undefined succeed(any message); + [Throws, WebExtensionStub="NoReturn"] + undefined succeed(); + + [Throws, WebExtensionStub="NoReturn"] + undefined assertTrue(any... args); + + [Throws, WebExtensionStub="NoReturn"] + undefined assertFalse(any... args); + + [Throws, WebExtensionStub="NoReturn"] + undefined assertDeepEq(any... args); + + [Throws, WebExtensionStub="AssertEq"] + undefined assertEq(any... args); + + [Throws] + any assertRejects(Promise<any> promise, any expectedError, DOMString message, optional Function callback); + [Throws] + any assertRejects(Promise<any> promise, any expectedError, optional Function callback); + + [Throws] + undefined assertThrows(Function func, any expectedError, DOMString message); + [Throws] + undefined assertThrows(Function func, any expectedError); + + // API events. + + [Replaceable, SameObject] + readonly attribute ExtensionEventManager onMessage; +}; diff --git a/dom/webidl/External.webidl b/dom/webidl/External.webidl new file mode 100644 index 0000000000..a1d2de82d8 --- /dev/null +++ b/dom/webidl/External.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[LegacyNoInterfaceObject, Exposed=Window] +interface External { + [Deprecated="External_AddSearchProvider"] + undefined AddSearchProvider(); + undefined IsSearchProviderInstalled(); +}; diff --git a/dom/webidl/FailedCertSecurityInfo.webidl b/dom/webidl/FailedCertSecurityInfo.webidl new file mode 100644 index 0000000000..cdd0425d6a --- /dev/null +++ b/dom/webidl/FailedCertSecurityInfo.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * This dictionary is used for exposing failed channel certificate information + * to about:certerror to display information. + */ + +enum OverridableErrorCategory { + "unset", + "trust-error", + "domain-mismatch", + "expired-or-not-yet-valid", +}; + +dictionary FailedCertSecurityInfo { + DOMString errorCodeString = ""; + OverridableErrorCategory overridableErrorCategory = "unset"; + DOMTimeStamp validNotBefore = 0; + DOMTimeStamp validNotAfter = 0; + DOMString issuerCommonName = ""; + DOMTimeStamp certValidityRangeNotAfter = 0; + DOMTimeStamp certValidityRangeNotBefore = 0; + DOMString errorMessage = ""; + boolean hasHSTS = true; + boolean hasHPKP = true; + sequence<DOMString> certChainStrings; +}; diff --git a/dom/webidl/FakePluginTagInit.webidl b/dom/webidl/FakePluginTagInit.webidl new file mode 100644 index 0000000000..aaa8ab617d --- /dev/null +++ b/dom/webidl/FakePluginTagInit.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * A fake plugin is fundamentally identified by its handlerURI. + * + * In addition to that, a fake plugin registration needs to provide at least one + * FakePluginMimeEntry so we'll know what types(s) the plugin is registered for. + * Other information is optional, though having usable niceName is highly + * recommended. + */ +[GenerateInit] +dictionary FakePluginTagInit { + required DOMString handlerURI; + required sequence<FakePluginMimeEntry> mimeEntries; + + // The niceName should really be provided, and be unique, if possible; it can + // be used as a key to persist state for this plug-in. + DOMString niceName = ""; + + // Other things can be provided but don't really matter that much. + DOMString fullPath = ""; + DOMString name = ""; + DOMString description = ""; + DOMString fileName = ""; + DOMString version = ""; + + /** + * Optional script to run in a sandbox when instantiating a plugin. The script + * runs in a sandbox with system principal in the process that contains the + * element that instantiates the plugin (ie the EMBED or OBJECT element). The + * sandbox global has a 'pluginElement' property that the script can use to + * access the element that instantiates the plugin. + */ + DOMString sandboxScript = ""; +}; + +/** + * A single MIME entry for the fake plugin. + */ +dictionary FakePluginMimeEntry { + required DOMString type; + DOMString description = ""; + DOMString extension = ""; +}; diff --git a/dom/webidl/FeaturePolicy.webidl b/dom/webidl/FeaturePolicy.webidl new file mode 100644 index 0000000000..18f683f202 --- /dev/null +++ b/dom/webidl/FeaturePolicy.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://w3c.github.io/webappsec-feature-policy/#idl-index + */ + +[LegacyNoInterfaceObject, + Exposed=Window] +interface FeaturePolicy { + boolean allowsFeature(DOMString feature, optional DOMString origin); + sequence<DOMString> features(); + sequence<DOMString> allowedFeatures(); + sequence<DOMString> getAllowlistForFeature(DOMString feature); +}; + +[Pref="dom.reporting.featurePolicy.enabled", + Exposed=Window] +interface FeaturePolicyViolationReportBody : ReportBody { + readonly attribute DOMString featureId; + readonly attribute DOMString? sourceFile; + readonly attribute long? lineNumber; + readonly attribute long? columnNumber; + readonly attribute DOMString disposition; +}; diff --git a/dom/webidl/Fetch.webidl b/dom/webidl/Fetch.webidl new file mode 100644 index 0000000000..1a6eb90823 --- /dev/null +++ b/dom/webidl/Fetch.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://fetch.spec.whatwg.org/ + */ + +typedef object JSON; +typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) XMLHttpRequestBodyInit; +/* no support for request body streams yet */ +typedef XMLHttpRequestBodyInit BodyInit; + +interface mixin Body { + readonly attribute boolean bodyUsed; + [NewObject] + Promise<ArrayBuffer> arrayBuffer(); + [NewObject] + Promise<Blob> blob(); + [NewObject] + Promise<FormData> formData(); + [NewObject] + Promise<JSON> json(); + [NewObject] + Promise<USVString> text(); +}; + +// These are helper dictionaries for the parsing of a +// getReader().read().then(data) parsing. +// See more about how these 2 helpers are used in +// dom/fetch/FetchStreamReader.cpp +[GenerateInit] +dictionary FetchReadableStreamReadDataDone { + boolean done = false; +}; + +[GenerateInit] +dictionary FetchReadableStreamReadDataArray { + Uint8Array value; +}; diff --git a/dom/webidl/FetchEvent.webidl b/dom/webidl/FetchEvent.webidl new file mode 100644 index 0000000000..9b8eee247f --- /dev/null +++ b/dom/webidl/FetchEvent.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + */ + +[Func="ServiceWorkerVisible", + Exposed=(ServiceWorker)] +interface FetchEvent : ExtendableEvent { + constructor(DOMString type, FetchEventInit eventInitDict); + + [SameObject, BinaryName="request_"] readonly attribute Request request; + [Pref="dom.serviceWorkers.navigationPreload.enabled"] + readonly attribute Promise<any> preloadResponse; + readonly attribute DOMString clientId; + readonly attribute DOMString resultingClientId; + readonly attribute Promise<undefined> handled; + + [Throws] + undefined respondWith(Promise<Response> r); +}; + +dictionary FetchEventInit : EventInit { + required Request request; + DOMString clientId = ""; + DOMString resultingClientId = ""; +}; diff --git a/dom/webidl/FetchObserver.webidl b/dom/webidl/FetchObserver.webidl new file mode 100644 index 0000000000..ccff51c789 --- /dev/null +++ b/dom/webidl/FetchObserver.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +callback interface ObserverCallback { + undefined handleEvent(FetchObserver observer); +}; + +enum FetchState { + // Pending states + "requesting", "responding", + // Final states + "aborted", "errored", "complete" +}; + +[Exposed=(Window,Worker), + Pref="dom.fetchObserver.enabled"] +interface FetchObserver : EventTarget { + readonly attribute FetchState state; + + // Events + attribute EventHandler onstatechange; + attribute EventHandler onrequestprogress; + attribute EventHandler onresponseprogress; +}; diff --git a/dom/webidl/File.webidl b/dom/webidl/File.webidl new file mode 100644 index 0000000000..32cc9b7713 --- /dev/null +++ b/dom/webidl/File.webidl @@ -0,0 +1,60 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/FileAPI/#file + * https://wicg.github.io/entries-api + */ + +interface nsIFile; + +[Exposed=(Window,Worker)] +interface File : Blob { + [Throws] + constructor(sequence<BlobPart> fileBits, + USVString fileName, optional FilePropertyBag options = {}); + + readonly attribute DOMString name; + + [GetterThrows] + readonly attribute long long lastModified; +}; + +dictionary FilePropertyBag : BlobPropertyBag { + long long lastModified; +}; + +dictionary ChromeFilePropertyBag : FilePropertyBag { + DOMString name = ""; + boolean existenceCheck = true; +}; + +// https://wicg.github.io/entries-api +partial interface File { + [BinaryName="relativePath", Pref="dom.webkitBlink.dirPicker.enabled"] + readonly attribute USVString webkitRelativePath; +}; + +// Mozilla extensions +partial interface File { + [GetterThrows, ChromeOnly, NeedsCallerType] + readonly attribute DOMString mozFullPath; +}; + +// Mozilla extensions +// These 2 methods can be used only in these conditions: +// - the main-thread +// - parent process OR file process OR, only for testing, with pref +// `dom.file.createInChild' set to true. +[Exposed=(Window)] +partial interface File { + [ChromeOnly, NewObject, NeedsCallerType] + static Promise<File> createFromNsIFile(nsIFile file, + optional ChromeFilePropertyBag options = {}); + + [ChromeOnly, NewObject, NeedsCallerType] + static Promise<File> createFromFileName(USVString fileName, + optional ChromeFilePropertyBag options = {}); +}; diff --git a/dom/webidl/FileList.webidl b/dom/webidl/FileList.webidl new file mode 100644 index 0000000000..5e4590347b --- /dev/null +++ b/dom/webidl/FileList.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2006/webapi/FileAPI/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker)] +interface FileList { + getter File? item(unsigned long index); + readonly attribute unsigned long length; +}; diff --git a/dom/webidl/FileMode.webidl b/dom/webidl/FileMode.webidl new file mode 100644 index 0000000000..788c2c9bf0 --- /dev/null +++ b/dom/webidl/FileMode.webidl @@ -0,0 +1,5 @@ +/* This Source Code Form is subject to the terms of 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 FileMode { "readonly", "readwrite" }; diff --git a/dom/webidl/FileReader.webidl b/dom/webidl/FileReader.webidl new file mode 100644 index 0000000000..f4dfeffb12 --- /dev/null +++ b/dom/webidl/FileReader.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/FileAPI/#APIASynch + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker)] +interface FileReader : EventTarget { + constructor(); + + // async read methods + [Throws] + undefined readAsArrayBuffer(Blob blob); + [Throws] + undefined readAsBinaryString(Blob filedata); + [Throws] + undefined readAsText(Blob blob, optional DOMString label); + [Throws] + undefined readAsDataURL(Blob blob); + + undefined abort(); + + // states + const unsigned short EMPTY = 0; + const unsigned short LOADING = 1; + const unsigned short DONE = 2; + + + readonly attribute unsigned short readyState; + + readonly attribute (DOMString or ArrayBuffer)? result; + + readonly attribute DOMException? error; + + // event handler attributes + attribute EventHandler onloadstart; + attribute EventHandler onprogress; + attribute EventHandler onload; + attribute EventHandler onabort; + attribute EventHandler onerror; + attribute EventHandler onloadend; +}; diff --git a/dom/webidl/FileReaderSync.webidl b/dom/webidl/FileReaderSync.webidl new file mode 100644 index 0000000000..67a831c990 --- /dev/null +++ b/dom/webidl/FileReaderSync.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2006/webapi/FileAPI/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(DedicatedWorker,SharedWorker)] +interface FileReaderSync { + constructor(); + + // Synchronously return strings + + [Throws] + ArrayBuffer readAsArrayBuffer(Blob blob); + [Throws] + DOMString readAsBinaryString(Blob blob); + [Throws] + DOMString readAsText(Blob blob, optional DOMString encoding); + [Throws] + DOMString readAsDataURL(Blob blob); +}; diff --git a/dom/webidl/FileSystem.webidl b/dom/webidl/FileSystem.webidl new file mode 100644 index 0000000000..ba62b1ce80 --- /dev/null +++ b/dom/webidl/FileSystem.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://wicg.github.io/entries-api/#idl-index + */ + +dictionary FileSystemFlags { + boolean create = false; + boolean exclusive = false; +}; + +callback FileSystemEntryCallback = undefined (FileSystemEntry entry); + +callback ErrorCallback = undefined (DOMException err); + +[Exposed=Window] +interface FileSystem { + readonly attribute USVString name; + readonly attribute FileSystemDirectoryEntry root; +}; diff --git a/dom/webidl/FileSystemDirectoryEntry.webidl b/dom/webidl/FileSystemDirectoryEntry.webidl new file mode 100644 index 0000000000..8168393cd6 --- /dev/null +++ b/dom/webidl/FileSystemDirectoryEntry.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://wicg.github.io/entries-api/#idl-index + */ + +[Exposed=Window] +interface FileSystemDirectoryEntry : FileSystemEntry { + FileSystemDirectoryReader createReader(); + + undefined getFile(optional USVString? path, + optional FileSystemFlags options = {}, + optional FileSystemEntryCallback successCallback, + optional ErrorCallback errorCallback); + + undefined getDirectory(optional USVString? path, + optional FileSystemFlags options = {}, + optional FileSystemEntryCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/dom/webidl/FileSystemDirectoryHandle.webidl b/dom/webidl/FileSystemDirectoryHandle.webidl new file mode 100644 index 0000000000..24a84db7d1 --- /dev/null +++ b/dom/webidl/FileSystemDirectoryHandle.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +dictionary FileSystemGetFileOptions { + boolean create = false; +}; + +dictionary FileSystemGetDirectoryOptions { + boolean create = false; +}; + +dictionary FileSystemRemoveOptions { + boolean recursive = false; +}; + +[Exposed=(Window,Worker), SecureContext, Serializable, Pref="dom.fs.enabled"] +interface FileSystemDirectoryHandle : FileSystemHandle { + + async iterable<USVString, FileSystemHandle>; + + [NewObject] + Promise<FileSystemFileHandle> getFileHandle(USVString name, optional FileSystemGetFileOptions options = {}); + + [NewObject] + Promise<FileSystemDirectoryHandle> getDirectoryHandle(USVString name, optional FileSystemGetDirectoryOptions options = {}); + + [NewObject] + Promise<undefined> removeEntry(USVString name, optional FileSystemRemoveOptions options = {}); + + [NewObject] + Promise<sequence<USVString>?> resolve(FileSystemHandle possibleDescendant); +}; diff --git a/dom/webidl/FileSystemDirectoryIterator.webidl b/dom/webidl/FileSystemDirectoryIterator.webidl new file mode 100644 index 0000000000..0b1b72b1aa --- /dev/null +++ b/dom/webidl/FileSystemDirectoryIterator.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// To implement FileSystemDirectoryHandle's async iteration until we can use +// a natively supported `async iterable`. +[Exposed=(Window,Worker), SecureContext, LegacyNoInterfaceObject] +interface FileSystemDirectoryIterator { + [NewObject] + Promise<any> next(); +}; diff --git a/dom/webidl/FileSystemDirectoryReader.webidl b/dom/webidl/FileSystemDirectoryReader.webidl new file mode 100644 index 0000000000..024b1294b5 --- /dev/null +++ b/dom/webidl/FileSystemDirectoryReader.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://wicg.github.io/entries-api/#idl-index + */ + +callback FileSystemEntriesCallback = undefined (sequence<FileSystemEntry> entries); + +[Exposed=Window] +interface FileSystemDirectoryReader { + + // readEntries can be called just once. The second time it returns no data. + + [Throws] + undefined readEntries(FileSystemEntriesCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/dom/webidl/FileSystemEntry.webidl b/dom/webidl/FileSystemEntry.webidl new file mode 100644 index 0000000000..edf29e3861 --- /dev/null +++ b/dom/webidl/FileSystemEntry.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://wicg.github.io/entries-api/#idl-index + */ + +[Exposed=Window] +interface FileSystemEntry { + readonly attribute boolean isFile; + readonly attribute boolean isDirectory; + + [GetterThrows] + readonly attribute USVString name; + + [GetterThrows] + readonly attribute USVString fullPath; + + readonly attribute FileSystem filesystem; + + undefined getParent(optional FileSystemEntryCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/dom/webidl/FileSystemFileEntry.webidl b/dom/webidl/FileSystemFileEntry.webidl new file mode 100644 index 0000000000..2d0069896a --- /dev/null +++ b/dom/webidl/FileSystemFileEntry.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://wicg.github.io/entries-api/#idl-index + */ + +callback FileCallback = undefined (File file); + +[Exposed=Window] +interface FileSystemFileEntry : FileSystemEntry { + [BinaryName="GetFile"] + undefined file (FileCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/dom/webidl/FileSystemFileHandle.webidl b/dom/webidl/FileSystemFileHandle.webidl new file mode 100644 index 0000000000..39598c7c42 --- /dev/null +++ b/dom/webidl/FileSystemFileHandle.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +dictionary FileSystemCreateWritableOptions { + boolean keepExistingData = false; +}; + +[Exposed=(Window,Worker), SecureContext, Serializable, Pref="dom.fs.enabled"] +interface FileSystemFileHandle : FileSystemHandle { + [NewObject] + Promise<File> getFile(); + + [NewObject] + Promise<FileSystemWritableFileStream> createWritable(optional FileSystemCreateWritableOptions options = {}); + + [Exposed=DedicatedWorker, NewObject] + Promise<FileSystemSyncAccessHandle> createSyncAccessHandle(); +}; diff --git a/dom/webidl/FileSystemHandle.webidl b/dom/webidl/FileSystemHandle.webidl new file mode 100644 index 0000000000..4dbbab983b --- /dev/null +++ b/dom/webidl/FileSystemHandle.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +enum FileSystemHandleKind { + "file", + "directory", +}; + +[Exposed=(Window,Worker), SecureContext, Serializable, Pref="dom.fs.enabled"] +interface FileSystemHandle { + readonly attribute FileSystemHandleKind kind; + readonly attribute USVString name; + + /* https://whatpr.org/fs/10.html#api-filesystemhandle */ + [NewObject] + Promise<undefined> move(USVString name); + [NewObject] + Promise<undefined> move(FileSystemDirectoryHandle parent); + [NewObject] + Promise<undefined> move(FileSystemDirectoryHandle parent, USVString name); + + [NewObject] + Promise<boolean> isSameEntry(FileSystemHandle other); +}; diff --git a/dom/webidl/FileSystemSyncAccessHandle.webidl b/dom/webidl/FileSystemSyncAccessHandle.webidl new file mode 100644 index 0000000000..343f0798bf --- /dev/null +++ b/dom/webidl/FileSystemSyncAccessHandle.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +dictionary FileSystemReadWriteOptions { + [EnforceRange] unsigned long long at; +}; + +[Exposed=(DedicatedWorker), SecureContext, Pref="dom.fs.enabled"] +interface FileSystemSyncAccessHandle { + // TODO: Use `[AllowShared] BufferSource data` once it works (bug 1696216) + [Throws] unsigned long long read(([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) buffer, optional FileSystemReadWriteOptions options = {}); + [Throws] unsigned long long write(([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) buffer, optional FileSystemReadWriteOptions options = {}); + + [Throws] undefined truncate([EnforceRange] unsigned long long size); + [Throws] unsigned long long getSize(); + [Throws] undefined flush(); + undefined close(); +}; diff --git a/dom/webidl/FileSystemWritableFileStream.webidl b/dom/webidl/FileSystemWritableFileStream.webidl new file mode 100644 index 0000000000..a6c2552cb6 --- /dev/null +++ b/dom/webidl/FileSystemWritableFileStream.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +enum WriteCommandType { + "write", + "seek", + "truncate" +}; + +[GenerateConversionToJS] +dictionary WriteParams { + required WriteCommandType type; + unsigned long long? size; + unsigned long long? position; + (BufferSource or Blob or UTF8String)? data; +}; + +typedef (BufferSource or Blob or UTF8String or WriteParams) FileSystemWriteChunkType; + +[Exposed=(Window,Worker), SecureContext, Pref="dom.fs.enabled"] +interface FileSystemWritableFileStream : WritableStream { + [NewObject, Throws] + Promise<undefined> write(FileSystemWriteChunkType data); + [NewObject] + Promise<undefined> seek(unsigned long long position); + [NewObject] + Promise<undefined> truncate(unsigned long long size); +}; diff --git a/dom/webidl/FinalizationRegistry.webidl b/dom/webidl/FinalizationRegistry.webidl new file mode 100644 index 0000000000..2331426c51 --- /dev/null +++ b/dom/webidl/FinalizationRegistry.webidl @@ -0,0 +1,10 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This IDL file contains a callback used to integrate JS FinalizationRegistry + * objects with the browser. + */ + +callback FinalizationRegistryCleanupCallback = undefined(); diff --git a/dom/webidl/FocusEvent.webidl b/dom/webidl/FocusEvent.webidl new file mode 100644 index 0000000000..00ae719d4d --- /dev/null +++ b/dom/webidl/FocusEvent.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface please see + * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface FocusEvent : UIEvent { + constructor(DOMString typeArg, + optional FocusEventInit focusEventInitDict = {}); + + // Introduced in DOM Level 3: + readonly attribute EventTarget? relatedTarget; +}; + +dictionary FocusEventInit : UIEventInit { + EventTarget? relatedTarget = null; +}; diff --git a/dom/webidl/FontFace.webidl b/dom/webidl/FontFace.webidl new file mode 100644 index 0000000000..864a562ba3 --- /dev/null +++ b/dom/webidl/FontFace.webidl @@ -0,0 +1,60 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-font-loading/#fontface-interface + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +typedef (ArrayBuffer or ArrayBufferView) BinaryData; + +dictionary FontFaceDescriptors { + UTF8String style = "normal"; + UTF8String weight = "normal"; + UTF8String stretch = "normal"; + UTF8String unicodeRange = "U+0-10FFFF"; + UTF8String variant = "normal"; + UTF8String featureSettings = "normal"; + [Pref="layout.css.font-variations.enabled"] UTF8String variationSettings = "normal"; + UTF8String display = "auto"; + UTF8String ascentOverride = "normal"; + UTF8String descentOverride = "normal"; + UTF8String lineGapOverride = "normal"; + [Pref="layout.css.size-adjust.enabled"] UTF8String sizeAdjust = "100%"; +}; + +enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" }; + +[Exposed=(Window,Worker)] +interface FontFace { + [Throws] + constructor(UTF8String family, + (UTF8String or BinaryData) source, + optional FontFaceDescriptors descriptors = {}); + + [SetterThrows] attribute UTF8String family; + [SetterThrows] attribute UTF8String style; + [SetterThrows] attribute UTF8String weight; + [SetterThrows] attribute UTF8String stretch; + [SetterThrows] attribute UTF8String unicodeRange; + [SetterThrows] attribute UTF8String variant; + [SetterThrows] attribute UTF8String featureSettings; + [SetterThrows, Pref="layout.css.font-variations.enabled"] attribute UTF8String variationSettings; + [SetterThrows] attribute UTF8String display; + [SetterThrows] attribute UTF8String ascentOverride; + [SetterThrows] attribute UTF8String descentOverride; + [SetterThrows] attribute UTF8String lineGapOverride; + [SetterThrows, Pref="layout.css.size-adjust.enabled"] attribute UTF8String sizeAdjust; + + readonly attribute FontFaceLoadStatus status; + + [Throws] + Promise<FontFace> load(); + + [Throws] + readonly attribute Promise<FontFace> loaded; +}; diff --git a/dom/webidl/FontFaceSet.webidl b/dom/webidl/FontFaceSet.webidl new file mode 100644 index 0000000000..c1a10c8df0 --- /dev/null +++ b/dom/webidl/FontFaceSet.webidl @@ -0,0 +1,65 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-font-loading/#FontFaceSet-interface + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +// To implement FontFaceSet's iterator until we can use setlike. +dictionary FontFaceSetIteratorResult +{ + required any value; + required boolean done; +}; + +// To implement FontFaceSet's iterator until we can use setlike. +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface FontFaceSetIterator { + [Throws] FontFaceSetIteratorResult next(); +}; + +callback FontFaceSetForEachCallback = undefined (FontFace value, FontFace key, FontFaceSet set); + +enum FontFaceSetLoadStatus { "loading", "loaded" }; + +[Exposed=(Window,Worker)] +interface FontFaceSet : EventTarget { + // Bug 1072762 is for the FontFaceSet constructor. + // constructor(sequence<FontFace> initialFaces); + + // Emulate setlike behavior until we can use that directly. + readonly attribute unsigned long size; + [Throws] undefined add(FontFace font); + boolean has(FontFace font); + boolean delete(FontFace font); + undefined clear(); + [NewObject] FontFaceSetIterator entries(); + // Iterator keys(); + [NewObject, Alias=keys, Alias="@@iterator"] FontFaceSetIterator values(); + [Throws] undefined forEach(FontFaceSetForEachCallback cb, optional any thisArg); + + // -- events for when loading state changes + attribute EventHandler onloading; + attribute EventHandler onloadingdone; + attribute EventHandler onloadingerror; + + // check and start loads if appropriate + // and fulfill promise when all loads complete + [NewObject] Promise<sequence<FontFace>> load(UTF8String font, optional DOMString text = " "); + + // return whether all fonts in the fontlist are loaded + // (does not initiate load if not available) + [Throws] boolean check(UTF8String font, optional DOMString text = " "); + + // async notification that font loading and layout operations are done + [Throws] readonly attribute Promise<undefined> ready; + + // loading state, "loading" while one or more fonts loading, "loaded" otherwise + readonly attribute FontFaceSetLoadStatus status; +}; diff --git a/dom/webidl/FontFaceSetLoadEvent.webidl b/dom/webidl/FontFaceSetLoadEvent.webidl new file mode 100644 index 0000000000..98e6eecc50 --- /dev/null +++ b/dom/webidl/FontFaceSetLoadEvent.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-font-loading/#FontFaceSet-interface + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary FontFaceSetLoadEventInit : EventInit { + sequence<FontFace> fontfaces = []; +}; + +[Exposed=(Window,Worker)] +interface FontFaceSetLoadEvent : Event { + constructor(DOMString type, + optional FontFaceSetLoadEventInit eventInitDict = {}); + + [Cached, Constant, Frozen] readonly attribute sequence<FontFace> fontfaces; +}; diff --git a/dom/webidl/FontFaceSource.webidl b/dom/webidl/FontFaceSource.webidl new file mode 100644 index 0000000000..3f0bd6000d --- /dev/null +++ b/dom/webidl/FontFaceSource.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-font-loading/#font-face-source + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin FontFaceSource { + [Throws] + readonly attribute FontFaceSet fonts; +}; diff --git a/dom/webidl/FormData.webidl b/dom/webidl/FormData.webidl new file mode 100644 index 0000000000..360b03aea4 --- /dev/null +++ b/dom/webidl/FormData.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://xhr.spec.whatwg.org + */ + +typedef (Blob or Directory or USVString) FormDataEntryValue; + +[Exposed=(Window,Worker)] +interface FormData { + [Throws] + constructor(optional HTMLFormElement form, optional HTMLElement? submitter = null); + + [Throws] + undefined append(USVString name, Blob value, optional USVString filename); + [Throws] + undefined append(USVString name, USVString value); + undefined delete(USVString name); + FormDataEntryValue? get(USVString name); + sequence<FormDataEntryValue> getAll(USVString name); + boolean has(USVString name); + [Throws] + undefined set(USVString name, Blob value, optional USVString filename); + [Throws] + undefined set(USVString name, USVString value); + iterable<USVString, FormDataEntryValue>; +}; diff --git a/dom/webidl/FormDataEvent.webidl b/dom/webidl/FormDataEvent.webidl new file mode 100644 index 0000000000..100e21c75e --- /dev/null +++ b/dom/webidl/FormDataEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#the-formdataevent-interface + */ + +[Exposed=Window] +interface FormDataEvent : Event { + constructor(DOMString type, optional FormDataEventInit eventInitDict = {}); + + // C++ can't deal with a method called FormData() in the generated code + [BinaryName="GetFormData"] + readonly attribute FormData formData; +}; + +dictionary FormDataEventInit : EventInit { + required FormData formData; +}; diff --git a/dom/webidl/FrameCrashedEvent.webidl b/dom/webidl/FrameCrashedEvent.webidl new file mode 100644 index 0000000000..b6d88f2757 --- /dev/null +++ b/dom/webidl/FrameCrashedEvent.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[ChromeOnly, + Exposed=Window] +interface FrameCrashedEvent : Event +{ + constructor(DOMString type, + optional FrameCrashedEventInit eventInitDict = {}); + + /** + * The browsingContextId of the frame that crashed. + */ + readonly attribute unsigned long long browsingContextId; + + /** + * True if the top-most frame crashed. + */ + readonly attribute boolean isTopFrame; + + /** + * Internal process identifier of the frame that crashed. This will be + * 0 if this identifier is not known, for example a process that failed + * to start. + */ + readonly attribute unsigned long long childID; +}; + +dictionary FrameCrashedEventInit : EventInit +{ + unsigned long long browsingContextId = 0; + boolean isTopFrame = true; + unsigned long long childID = 0; +}; diff --git a/dom/webidl/Function.webidl b/dom/webidl/Function.webidl new file mode 100644 index 0000000000..a27f3e6334 --- /dev/null +++ b/dom/webidl/Function.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#functiocn + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ +callback Function = any(any... arguments); + +callback VoidFunction = undefined (); diff --git a/dom/webidl/FuzzingFunctions.webidl b/dom/webidl/FuzzingFunctions.webidl new file mode 100644 index 0000000000..cd9a86771f --- /dev/null +++ b/dom/webidl/FuzzingFunctions.webidl @@ -0,0 +1,135 @@ +/* -*- 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/. + */ + +/* + * Various functions useful for automated fuzzing that are enabled + * only in --enable-fuzzing builds, because they may be dangerous to + * enable on untrusted pages. +*/ + +[Pref="fuzzing.enabled", + Exposed=Window] +namespace FuzzingFunctions { + /** + * Synchronously perform a garbage collection. + */ + undefined garbageCollect(); + + /** + * Synchronously perform a compacting garbage collection. + */ + undefined garbageCollectCompacting(); + + /** + * Trigger a forced crash. + */ + undefined crash(optional DOMString reason = ""); + + /** + * Synchronously perform a cycle collection. + */ + undefined cycleCollect(); + + /** + * Send a memory pressure event, causes shrinking GC, cycle collection and + * other actions. + */ + undefined memoryPressure(); + + /** + * Enable accessibility. + */ + [Throws] + undefined enableAccessibility(); + + /** + * Send IPC fuzzing ready event to parent. + */ + undefined signalIPCReady(); + + /** + * synthesizeKeyboardEvents() synthesizes a set of "keydown", + * "keypress" (only when it's necessary) and "keyup" events in top DOM window + * in current process (and the synthesized events will be retargeted to + * focused window/document/element). I.e, this is currently not dispatched + * via the main process if you call this in a content process. Therefore, in + * the case, some default action handlers which are only in the main process + * will never run. Note that this does not allow to synthesize keyboard + * events if this is called from a keyboard event or composition event + * listener. + * + * @param aKeyValue If you want to synthesize non-printable key + * events, you need to set one of key values + * defined by "UI Events KeyboardEvent key Values". + * You can check our current support values in + * dom/events/KeyNameList.h + * If you want to synthesize printable key events, + * you can set any string value including empty + * string. + * Note that |key| value in aDictionary is always + * ignored. + * @param aDictionary If you want to synthesize simple key press + * without any modifiers, you can omit this. + * Otherwise, specify this with proper values. + * If |code| is omitted or empty string, this + * guesses proper code value in US-English + * keyboard. Otherwise, the value must be empty + * string or known code value defined by "UI Events + * KeyboardEvent code Values". You can check our + * current support values in + * dom/events/PhysicalKeyCodeNameList.h. + * If |keyCode| is omitted or 0, this guesses + * proper keyCode value in US-English keyboard. + * If |location| is omitted or 0, this assumes + * that left modifier key is pressed if aKeyValue + * is one of such modifier keys. + * |key|, |isComposing|, |charCode| and |which| + * are always ignored. + * Modifier states like |shiftKey|, |altKey|, + * |modifierAltGraph|, |modifierCapsLock| and + * |modifierNumLock| are not adjusted for + * aKeyValue. Please specify them manually if + * necessary. + * Note that this API does not allow to dispatch + * known key events with empty |code| value and + * 0 |keyCode| value since it's unsual situation + * especially 0 |keyCode| value with known key. + * Note that when you specify only one of |code| + * and |keyCode| value, the other will be guessed + * from US-English keyboard layout. So, if you + * want to emulate key press with another keyboard + * layout, you should specify both values. + * + * For example: + * // Synthesize "Tab" key events. + * synthesizeKeyboardEvents("Tab"); + * // Synthesize Shift + Tab key events. + * synthesizeKeyboardEvents("Tab", { shiftKey: true }); + * // Synthesize Control + A key events. + * synthesizeKeyboardEvents("a", { controlKey: true }); + * // Synthesize Control + Shift + A key events. + * synthesizeKeyboardEvents("A", { controlKey: true, + * shitKey: true }); + * // Synthesize "Enter" key on numpad. + * synthesizeKeyboardEvents("Enter", { code: "NumpadEnter" }); + * // Synthesize right "Shift" key. + * synthesizeKeyboardEvents("Shift", { code: "ShiftRight" }); + * // Synthesize "1" on numpad. + * synthesizeKeyboardEvents("1", { code: "Numpad1", + * modifierNumLock: true }); + * // Synthesize "End" on numpad. + * synthesizeKeyboardEvents("End", { code: "Numpad1" }); + * // Synthesize "%" key of US-English keyboard layout. + * synthesizeKeyboardEvents("%", { shiftKey: true }); + * // Synthesize "*" key of Japanese keyboard layout. + * synthesizeKeyboardEvents("*", { code: "Quote", + * shiftKey: true, + * keyCode: KeyboardEvent.DOM_VK_COLON }); + */ + [Throws] + undefined synthesizeKeyboardEvents(DOMString aKeyValue, + optional KeyboardEventInit aDictionary = {}); +}; diff --git a/dom/webidl/GPUUncapturedErrorEvent.webidl b/dom/webidl/GPUUncapturedErrorEvent.webidl new file mode 100644 index 0000000000..ad31221427 --- /dev/null +++ b/dom/webidl/GPUUncapturedErrorEvent.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of 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://gpuweb.github.io/gpuweb/ + */ + +dictionary GPUUncapturedErrorEventInit : EventInit { + required GPUError error; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUUncapturedErrorEvent: Event { + constructor(DOMString type, GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict); + readonly attribute GPUError error; +}; diff --git a/dom/webidl/GainNode.webidl b/dom/webidl/GainNode.webidl new file mode 100644 index 0000000000..3f0e171a25 --- /dev/null +++ b/dom/webidl/GainNode.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary GainOptions : AudioNodeOptions { + float gain = 1.0; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface GainNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, optional GainOptions options = {}); + + readonly attribute AudioParam gain; + +}; + +// Mozilla extension +GainNode includes AudioNodePassThrough; diff --git a/dom/webidl/Gamepad.webidl b/dom/webidl/Gamepad.webidl new file mode 100644 index 0000000000..a8ec894441 --- /dev/null +++ b/dom/webidl/Gamepad.webidl @@ -0,0 +1,114 @@ +/* -*- 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/gamepad/ + * https://w3c.github.io/gamepad/extensions.html + * https://w3c.github.io/webvr/spec/1.1/#interface-gamepad + */ + +[Pref="dom.gamepad.enabled", + Exposed=Window, + SecureContext] +interface GamepadButton { + readonly attribute boolean pressed; + readonly attribute boolean touched; + readonly attribute double value; +}; + +enum GamepadHand { + "", + "left", + "right" +}; + +/** + * https://www.w3.org/TR/gamepad/#gamepadmappingtype-enum + * https://immersive-web.github.io/webxr-gamepads-module/#enumdef-gamepadmappingtype + */ +enum GamepadMappingType { + "", + "standard", + "xr-standard" +}; + +[Pref="dom.gamepad.enabled", + Exposed=Window, + SecureContext] +interface Gamepad { + /** + * An identifier, unique per type of device. + */ + readonly attribute DOMString id; + + /** + * The game port index for the device. Unique per device + * attached to this system. + */ + readonly attribute long index; + + /** + * The mapping in use for this device. The empty string + * indicates that no mapping is in use. + */ + readonly attribute GamepadMappingType mapping; + + /** + * The hand in use for this device. The empty string + * indicates that unknown, both hands, or not applicable + */ + [Pref="dom.gamepad.extensions.enabled"] + readonly attribute GamepadHand hand; + + /** + * The displayId in use for as an association point in the VRDisplay API + * to identify which VRDisplay that the gamepad is associated with. + */ + [Pref="dom.vr.enabled"] + readonly attribute unsigned long displayId; + + /** + * true if this gamepad is currently connected to the system. + */ + readonly attribute boolean connected; + + /** + * The current state of all buttons on the device, an + * array of GamepadButton. + */ + [Pure, Cached, Frozen] + readonly attribute sequence<GamepadButton> buttons; + + /** + * The current position of all axes on the device, an + * array of doubles. + */ + [Pure, Cached, Frozen] + readonly attribute sequence<double> axes; + + /** + * Timestamp from when the data of this device was last updated. + */ + readonly attribute DOMHighResTimeStamp timestamp; + + /** + * The current pose of the device, a GamepadPose. + */ + [Pref="dom.gamepad.extensions.enabled"] + readonly attribute GamepadPose? pose; + + /** + * The current haptic actuator of the device, an array of + * GamepadHapticActuator. + */ + [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled"] + readonly attribute sequence<GamepadHapticActuator> hapticActuators; + + [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.lightindicator"] + readonly attribute sequence<GamepadLightIndicator> lightIndicators; + + [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled", Pref="dom.gamepad.extensions.multitouch"] + readonly attribute sequence<GamepadTouch> touchEvents; +}; diff --git a/dom/webidl/GamepadAxisMoveEvent.webidl b/dom/webidl/GamepadAxisMoveEvent.webidl new file mode 100644 index 0000000000..6ccdeabf71 --- /dev/null +++ b/dom/webidl/GamepadAxisMoveEvent.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Pref="dom.gamepad.non_standard_events.enabled", + Exposed=Window, SecureContext] +interface GamepadAxisMoveEvent : GamepadEvent +{ + constructor(DOMString type, + optional GamepadAxisMoveEventInit eventInitDict = {}); + + readonly attribute unsigned long axis; + readonly attribute double value; +}; + +dictionary GamepadAxisMoveEventInit : GamepadEventInit +{ + unsigned long axis = 0; + double value = 0; +}; diff --git a/dom/webidl/GamepadButtonEvent.webidl b/dom/webidl/GamepadButtonEvent.webidl new file mode 100644 index 0000000000..02bc4fb010 --- /dev/null +++ b/dom/webidl/GamepadButtonEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Pref="dom.gamepad.non_standard_events.enabled", + Exposed=Window, + SecureContext] +interface GamepadButtonEvent : GamepadEvent +{ + constructor(DOMString type, + optional GamepadButtonEventInit eventInitDict = {}); + + readonly attribute unsigned long button; +}; + +dictionary GamepadButtonEventInit : GamepadEventInit +{ + unsigned long button = 0; +}; diff --git a/dom/webidl/GamepadEvent.webidl b/dom/webidl/GamepadEvent.webidl new file mode 100644 index 0000000000..be2ad9ec10 --- /dev/null +++ b/dom/webidl/GamepadEvent.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/gamepad/#gamepadevent-interface + */ + +[Pref="dom.gamepad.enabled", + Exposed=Window, + SecureContext] +interface GamepadEvent : Event +{ + constructor(DOMString type, optional GamepadEventInit eventInitDict = {}); + + readonly attribute Gamepad? gamepad; +}; + +dictionary GamepadEventInit : EventInit +{ + Gamepad? gamepad = null; +}; diff --git a/dom/webidl/GamepadHapticActuator.webidl b/dom/webidl/GamepadHapticActuator.webidl new file mode 100644 index 0000000000..9975b7ab85 --- /dev/null +++ b/dom/webidl/GamepadHapticActuator.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/gamepad/extensions.html#gamepadhapticactuator-interface + */ + +enum GamepadHapticActuatorType { + "vibration" +}; + +[Pref="dom.gamepad.extensions.enabled", + HeaderFile="mozilla/dom/GamepadHapticActuator.h", + Exposed=Window, + SecureContext] +interface GamepadHapticActuator +{ + readonly attribute GamepadHapticActuatorType type; + [Throws, NewObject] + Promise<boolean> pulse(double value, double duration); +}; diff --git a/dom/webidl/GamepadLightIndicator.webidl b/dom/webidl/GamepadLightIndicator.webidl new file mode 100644 index 0000000000..2c447439c8 --- /dev/null +++ b/dom/webidl/GamepadLightIndicator.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://github.com/knyg/gamepad/blob/lightindicator/extensions.html + */ + +enum GamepadLightIndicatorType { + "on-off", + "rgb" +}; + +dictionary GamepadLightColor { + required octet red; + required octet green; + required octet blue; +}; + +[SecureContext, Pref="dom.gamepad.extensions.lightindicator", + Exposed=Window] +interface GamepadLightIndicator +{ + readonly attribute GamepadLightIndicatorType type; + [Throws, NewObject] + Promise<boolean> setColor(GamepadLightColor color); +}; diff --git a/dom/webidl/GamepadPose.webidl b/dom/webidl/GamepadPose.webidl new file mode 100644 index 0000000000..4de822e7a7 --- /dev/null +++ b/dom/webidl/GamepadPose.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/gamepad/extensions.html#gamepadpose-interface + */ + +[Pref="dom.gamepad.extensions.enabled", + Exposed=Window, + SecureContext] +interface GamepadPose +{ + readonly attribute boolean hasOrientation; + readonly attribute boolean hasPosition; + + /** + * position, linearVelocity, and linearAcceleration are 3-component vectors. + * position is relative to a sitting space. Transforming this point with + * VRStageParameters.sittingToStandingTransform converts this to standing space. + */ + [Constant, Throws] readonly attribute Float32Array? position; + [Constant, Throws] readonly attribute Float32Array? linearVelocity; + [Constant, Throws] readonly attribute Float32Array? linearAcceleration; + + /* orientation is a 4-entry array representing the components of a quaternion. */ + [Constant, Throws] readonly attribute Float32Array? orientation; + /* angularVelocity and angularAcceleration are the components of 3-dimensional vectors. */ + [Constant, Throws] readonly attribute Float32Array? angularVelocity; + [Constant, Throws] readonly attribute Float32Array? angularAcceleration; +}; diff --git a/dom/webidl/GamepadServiceTest.webidl b/dom/webidl/GamepadServiceTest.webidl new file mode 100644 index 0000000000..dd8ae2144f --- /dev/null +++ b/dom/webidl/GamepadServiceTest.webidl @@ -0,0 +1,58 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +[Pref="dom.gamepad.test.enabled", + Exposed=Window] +interface GamepadServiceTest +{ + readonly attribute GamepadMappingType noMapping; + readonly attribute GamepadMappingType standardMapping; + readonly attribute GamepadHand noHand; + readonly attribute GamepadHand leftHand; + readonly attribute GamepadHand rightHand; + + [NewObject] + Promise<unsigned long> addGamepad(DOMString id, + GamepadMappingType mapping, + GamepadHand hand, + unsigned long numButtons, + unsigned long numAxes, + unsigned long numHaptics, + unsigned long numLightIndicator, + unsigned long numTouchEvents); + + [NewObject] + Promise<unsigned long> removeGamepad(unsigned long index); + + [NewObject] + Promise<unsigned long> newButtonEvent(unsigned long index, + unsigned long button, + boolean pressed, + boolean touched); + + [NewObject] + Promise<unsigned long> newButtonValueEvent(unsigned long index, + unsigned long button, + boolean pressed, + boolean touched, + double value); + + [NewObject] + Promise<unsigned long> newAxisMoveEvent(unsigned long index, + unsigned long axis, + double value); + [NewObject] + Promise<unsigned long> newPoseMove(unsigned long index, + Float32Array? orient, + Float32Array? pos, + Float32Array? angVelocity, + Float32Array? angAcceleration, + Float32Array? linVelocity, + Float32Array? linAcceleration); + + [NewObject] + Promise<unsigned long> newTouch(unsigned long index, unsigned long aTouchArrayIndex, + unsigned long touchId, octet surfaceId, + Float32Array position, Float32Array? surfaceDimension); +}; diff --git a/dom/webidl/GamepadTouch.webidl b/dom/webidl/GamepadTouch.webidl new file mode 100644 index 0000000000..a9c84edcbd --- /dev/null +++ b/dom/webidl/GamepadTouch.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://github.com/knyg/gamepad/blob/multitouch/extensions.html + */ + +[SecureContext, Pref="dom.gamepad.extensions.multitouch", + Exposed=Window] +interface GamepadTouch { + readonly attribute unsigned long touchId; + readonly attribute octet surfaceId; + [Constant, Throws] readonly attribute Float32Array position; + [Constant, Throws] readonly attribute Uint32Array? surfaceDimensions; +}; diff --git a/dom/webidl/GenericTransformStream.webidl b/dom/webidl/GenericTransformStream.webidl new file mode 100644 index 0000000000..cc54b361fc --- /dev/null +++ b/dom/webidl/GenericTransformStream.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#other-specs-ts-wrapping + */ + +interface mixin GenericTransformStream { + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; +}; diff --git a/dom/webidl/Geolocation.webidl b/dom/webidl/Geolocation.webidl new file mode 100644 index 0000000000..8b90a9a371 --- /dev/null +++ b/dom/webidl/Geolocation.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/geolocation-API + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary PositionOptions { + boolean enableHighAccuracy = false; + [Clamp] unsigned long timeout = 0x7fffffff; + [Clamp] unsigned long maximumAge = 0; +}; + +[Exposed=Window] +interface Geolocation { + [Throws, NeedsCallerType] + undefined getCurrentPosition(PositionCallback successCallback, + optional PositionErrorCallback? errorCallback = null, + optional PositionOptions options = {}); + + [Throws, NeedsCallerType] + long watchPosition(PositionCallback successCallback, + optional PositionErrorCallback? errorCallback = null, + optional PositionOptions options = {}); + + undefined clearWatch(long watchId); +}; + +callback PositionCallback = undefined (GeolocationPosition position); + +callback PositionErrorCallback = undefined (GeolocationPositionError positionError); diff --git a/dom/webidl/GeolocationCoordinates.webidl b/dom/webidl/GeolocationCoordinates.webidl new file mode 100644 index 0000000000..66c85ef8bc --- /dev/null +++ b/dom/webidl/GeolocationCoordinates.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/geolocation-API + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window, SecureContext] +interface GeolocationCoordinates { + readonly attribute double latitude; + readonly attribute double longitude; + readonly attribute double? altitude; + readonly attribute double accuracy; + readonly attribute double? altitudeAccuracy; + readonly attribute double? heading; + readonly attribute double? speed; +}; diff --git a/dom/webidl/GeolocationPosition.webidl b/dom/webidl/GeolocationPosition.webidl new file mode 100644 index 0000000000..3c3c8bcb55 --- /dev/null +++ b/dom/webidl/GeolocationPosition.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/geolocation-API + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window, SecureContext] +interface GeolocationPosition { + readonly attribute GeolocationCoordinates coords; + readonly attribute EpochTimeStamp timestamp; +}; diff --git a/dom/webidl/GeolocationPositionError.webidl b/dom/webidl/GeolocationPositionError.webidl new file mode 100644 index 0000000000..63bf6dd029 --- /dev/null +++ b/dom/webidl/GeolocationPositionError.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/geolocation-API + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface GeolocationPositionError { + const unsigned short PERMISSION_DENIED = 1; + const unsigned short POSITION_UNAVAILABLE = 2; + const unsigned short TIMEOUT = 3; + readonly attribute unsigned short code; + readonly attribute DOMString message; +}; diff --git a/dom/webidl/GeometryUtils.webidl b/dom/webidl/GeometryUtils.webidl new file mode 100644 index 0000000000..2f71b284ee --- /dev/null +++ b/dom/webidl/GeometryUtils.webidl @@ -0,0 +1,54 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/cssom-view/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum CSSBoxType { "margin", "border", "padding", "content" }; +dictionary BoxQuadOptions { + CSSBoxType box = "border"; + GeometryNode relativeTo; + [ChromeOnly] + boolean createFramesForSuppressedWhitespace = true; +}; + +dictionary ConvertCoordinateOptions { + CSSBoxType fromBox = "border"; + CSSBoxType toBox = "border"; +}; + +interface mixin GeometryUtils { + [Throws, Func="nsINode::HasBoxQuadsSupport", NeedsCallerType] + sequence<DOMQuad> getBoxQuads(optional BoxQuadOptions options = {}); + + /* getBoxQuadsFromWindowOrigin is similar to getBoxQuads, but the + * returned quads are further translated relative to the window + * origin -- which is not the layout origin. Further translation + * must be done to bring the quads into layout space. Typically, + * this will be done by performing another call from the top level + * browser process, requesting the quad of the top level content + * document itself. The position of this quad can then be used as + * the offset into layout space, and subtracted from the original + * returned quads. If options.relativeTo is supplied, this method + * will throw. + */ + [ChromeOnly, Throws, Func="nsINode::HasBoxQuadsSupport"] + sequence<DOMQuad> getBoxQuadsFromWindowOrigin(optional BoxQuadOptions options = {}); + + [Throws, Pref="layout.css.convertFromNode.enabled", NeedsCallerType] + DOMQuad convertQuadFromNode(DOMQuad quad, GeometryNode from, optional ConvertCoordinateOptions options = {}); + [Throws, Pref="layout.css.convertFromNode.enabled", NeedsCallerType] + DOMQuad convertRectFromNode(DOMRectReadOnly rect, GeometryNode from, optional ConvertCoordinateOptions options = {}); + [Throws, Pref="layout.css.convertFromNode.enabled", NeedsCallerType] + DOMPoint convertPointFromNode(DOMPointInit point, GeometryNode from, optional ConvertCoordinateOptions options = {}); +}; + +// PseudoElement includes GeometryUtils; + +typedef (Text or Element /* or PseudoElement */ or Document) GeometryNode; diff --git a/dom/webidl/GetUserMediaRequest.webidl b/dom/webidl/GetUserMediaRequest.webidl new file mode 100644 index 0000000000..791c8c49ae --- /dev/null +++ b/dom/webidl/GetUserMediaRequest.webidl @@ -0,0 +1,42 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This is an internal IDL file + */ + +interface nsIMediaDevice; + +// For gUM request start (getUserMedia:request) notification, +// rawID, mediaSource and audioOutputOptions won't be set. +// For selectAudioOutput request start (getUserMedia:request) notification, +// rawID, mediaSource and constraints won't be set. +// For gUM request stop (recording-device-stopped) notification due to page +// reload, only windowID will be set. +// For gUM request stop (recording-device-stopped) notification due to track +// stop, only type, windowID, rawID and mediaSource will be set + +enum GetUserMediaRequestType { + "getusermedia", + "selectaudiooutput", + "recording-device-stopped" +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface GetUserMediaRequest { + readonly attribute GetUserMediaRequestType type; + readonly attribute unsigned long long windowID; + readonly attribute unsigned long long innerWindowID; + readonly attribute DOMString callID; + readonly attribute DOMString rawID; + readonly attribute DOMString mediaSource; + // The set of devices to consider + [Constant, Cached, Frozen] + readonly attribute sequence<nsIMediaDevice> devices; + MediaStreamConstraints getConstraints(); + AudioOutputOptions getAudioOutputOptions(); + readonly attribute boolean isSecure; + readonly attribute boolean isHandlingUserInput; +}; diff --git a/dom/webidl/Glean.webidl b/dom/webidl/Glean.webidl new file mode 100644 index 0000000000..f6edb79484 --- /dev/null +++ b/dom/webidl/Glean.webidl @@ -0,0 +1,43 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanCategory { + /** + * Get a metric by name. + * + * Returns an object of the corresponding metric type, + * with only the allowed functions available. + */ + getter GleanMetric (DOMString identifier); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanImpl { + /** + * Get a metric category by name. + * + * Returns an object for further metric lookup. + */ + getter GleanCategory (DOMString identifier); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanLabeled { + /** + * Get a specific metric for a given label. + * + * If a set of acceptable labels were specified in the `metrics.yaml` file, + * and the given label is not in the set, it will be recorded under the + * special `OTHER_LABEL` label. + * + * If a set of acceptable labels was not specified in the `metrics.yaml` file, + * only the first 16 unique labels will be used. + * After that, any additional labels will be recorded under the special + * `OTHER_LABEL` label. + */ + getter GleanMetric (DOMString identifier); +}; diff --git a/dom/webidl/GleanMetrics.webidl b/dom/webidl/GleanMetrics.webidl new file mode 100644 index 0000000000..fc2697851d --- /dev/null +++ b/dom/webidl/GleanMetrics.webidl @@ -0,0 +1,644 @@ +/* -*- 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 definitions in this file are not sorted. +// Please add new ones to the bottom. + +/** + * Base interface for all metric types to make typing more expressive. + */ +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanMetric {}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanBoolean : GleanMetric { + /** + * Set to the specified boolean value. + * + * @param value the value to set. + */ + undefined set(boolean value); + + /** + * **Test-only API** + * + * Gets the currently stored value as a boolean. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + boolean? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanDatetime : GleanMetric { + /** + * Set the datetime to the provided value, or the local now. + * The internal value will store the local timezone. + * + * Note: The metric's time_unit affects the resolution of the value, not the + * unit of this function's parameter (which is always PRTime/nanos). + * + * @param aValue The (optional) time value as PRTime (nanoseconds since epoch). + * Defaults to local now. + */ + undefined set(optional long long aValue); + + /** + * **Test-only API** + * + * Gets the currently stored value as a Date. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric as a JS Date with timezone, + * or null if there is no value. + */ + [Throws, ChromeOnly] + any testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanCounter : GleanMetric { + /* + * Increases the counter by `amount`. + * + * @param aAmount The (optional) amount to increase by. Should be positive. Defaults to 1. + */ + undefined add(optional long aAmount = 1); + + /** + * **Test-only API** + * + * Gets the currently stored value as an integer. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + long? testGetValue(optional UTF8String aPingName = ""); +}; + +dictionary GleanDistributionData { + required unsigned long long sum; + required record<UTF8String, unsigned long long> values; +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanTimingDistribution : GleanMetric { + /** + * Starts tracking time for the provided metric. + * + * @returns A unique timer id for the new timer + */ + unsigned long long start(); + + /** + * Stops tracking time for the provided metric and timer id. + * + * Adds a count to the corresponding bucket in the timing distribution. + * This will record an error if no `start` was called for this TimerId or + * if this TimerId was used to call `cancel`. + * + * @param aId The TimerId associated with this timing. This allows for + * concurrent timing of events associated with different ids. + */ + undefined stopAndAccumulate(unsigned long long aId); + + /** + * Aborts a previous `start` call. No error is recorded if no `start` was + * called. (But then where did you get that id from?) + * + * @param aId The TimerID whose `start` you wish to abort. + */ + undefined cancel(unsigned long long aId); + + /** + * **Test-only API** + * + * Gets the currently stored value. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + GleanDistributionData? testGetValue(optional UTF8String aPingName = ""); + + /** + * **Test-only API** + * + * Accumulates a raw numeric sample of milliseconds. + * + * @param aSample The sample, in milliseconds, to add. + */ + [ChromeOnly] + undefined testAccumulateRawMillis(unsigned long long aSample); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanMemoryDistribution : GleanMetric { + /** + * Accumulates the provided signed sample in the metric. + * + * @param aSample The sample to be recorded by the metric. The sample is + * assumed to be in the confgured memory unit of the metric. + * + * Notes: Values bigger than 1 Terabyte (2^40 bytes) are truncated and an + * InvalidValue error is recorded. + */ + undefined accumulate(unsigned long long aSample); + + /** + * **Test-only API** + * + * Gets the currently stored value as a DistributionData. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + GleanDistributionData? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanCustomDistribution : GleanMetric { + /** + * Accumulates the provided signed samples in the metric. + * + * @param aSamples - The vector holding the samples to be recorded by the metric. + * + * Notes: Discards any negative value in `samples` + * and report an `ErrorType::InvalidValue` for each of them. + */ + undefined accumulateSamples(sequence<long long> aSamples); + + /** + * **Test-only API** + * + * Gets the currently stored value as a DistributionData. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + GleanDistributionData? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanString : GleanMetric { + /** + * Set the string to the provided value. + * + * @param aValue The string to set the metric to. + */ + undefined set(UTF8String? aValue); + + /** + * **Test-only API** + * + * Gets the currently stored value as a string. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + UTF8String? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanStringList : GleanMetric { + /** + * Adds a new string to the list. + * + * Truncates the value and logs an error if it is longer than 100 bytes. + * + * @param value The string to add. + */ + undefined add(UTF8String value); + + /** + * Sets the string_list to the provided list of strings. + * + * Truncates the list and logs an error if longer than 100 items. + * Truncates any item longer than 100 bytes and logs an error. + * + * @param aValue The list of strings to set the metric to. + */ + undefined set(sequence<UTF8String> aValue); + + /** + * **Test-only API** + * + * Gets the currently stored value. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + sequence<UTF8String>? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanTimespan : GleanMetric { + /** + * Start tracking time for the provided metric. + * + * This records an error if it’s already tracking time (i.e. start was already + * called with no corresponding [stop]): in that case the original + * start time will be preserved. + */ + undefined start(); + + /** + * Stop tracking time for the provided metric. + * + * Sets the metric to the elapsed time, but does not overwrite an already + * existing value. + * This will record an error if no [start] was called or there is an already + * existing value. + */ + undefined stop(); + + /** + * Aborts a previous start. + * + * Does not record an error if there was no previous call to start. + */ + undefined cancel(); + + /** + * Explicitly sets the timespan value. + * + * This API should only be used if you cannot make use of + * `start`/`stop`/`cancel`. + * + * @param aDuration The duration of this timespan, in units matching the + * `time_unit` of this metric's definition. + */ + undefined setRaw(unsigned long aDuration); + + /** + * **Test-only API** + * + * Gets the currently stored value. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + unsigned long long? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanUuid : GleanMetric { + /** + * Set to the specified value. + * + * @param aValue The UUID to set the metric to. + */ + undefined set(UTF8String aValue); + + /** + * Generate a new random UUID and set the metric to it. + */ + undefined generateAndSet(); + + /** + * **Test-only API** + * + * Gets the currently stored value. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + UTF8String? testGetValue(optional UTF8String aPingName = ""); +}; + +dictionary GleanEventRecord { + required unsigned long long timestamp; + required UTF8String category; + required UTF8String name; + record<UTF8String, UTF8String> extra; +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanEvent : GleanMetric { + + /* + * Record an event. + * + * @param aExtra An (optional) map of extra values. + */ + undefined _record(optional record<UTF8String, UTF8String?> aExtra); + + /** + * **Test-only API** + * + * Gets the currently stored value. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + * + * The difference between event timestamps is in milliseconds + * See https://mozilla.github.io/glean/book/user/metrics/event.html for further details. + * Due to limitations of numbers in JavaScript, the timestamp will only be accurate up until 2^53. + * (This is probably not an issue with the current clock implementation. Probably.) + */ + [Throws, ChromeOnly] + sequence<GleanEventRecord>? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanQuantity : GleanMetric { + /** + * Set to the specified value. + * + * @param aValue The value to set the metric to. + */ + undefined set(long long aValue); + + /** + * **Test-only API** + * + * Gets the currently stored value. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + long long? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanDenominator : GleanMetric { + /* + * Increases the counter by `aAmount`. + * + * @param aAmount The (optional) amount to increase by. Should be positive. Defaults to 1. + */ + undefined add(optional long aAmount = 1); + + /** + * **Test-only API** + * + * Gets the currently stored value as an integer. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + long? testGetValue(optional UTF8String aPingName = ""); +}; + +dictionary GleanRateData { + required long numerator; + required long denominator; +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanNumerator : GleanMetric { + /* + * Increases the numerator by `aAmount`. + * + * @param aAmount The (optional) amount to increase by. Should be positive. Defaults to 1. + */ + undefined addToNumerator(optional long aAmount = 1); + + /** + * **Test-only API** + * + * Gets the currently stored value in the form {numerator: n, denominator: d} + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + GleanRateData? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanRate : GleanMetric { + /* + * Increases the numerator by `amount`. + * + * @param aAmount The (optional) amount to increase by. Should be positive. Defaults to 1. + */ + undefined addToNumerator(optional long aAmount = 1); + + /* + * Increases the denominator by `amount`. + * + * @param aAmount The (optional) amount to increase by. Should be positive. Defaults to 1. + */ + undefined addToDenominator(optional long aAmount = 1); + + /** + * **Test-only API** + * + * Gets the currently stored value in the form {numerator: n, denominator: d} + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + GleanRateData? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanUrl : GleanMetric { + /** + * Set to the specified value. + * + * @param aValue The stringified URL to set the metric to. + */ + undefined set(UTF8String aValue); + + /** + * **Test-only API** + * + * Gets the currently stored value. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + UTF8String? testGetValue(optional UTF8String aPingName = ""); +}; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanText : GleanMetric { + /** + * Set to the provided value. + * + * @param aValue The text to set the metric to. + */ + undefined set(UTF8String aValue); + + /** + * **Test-only API** + * + * Gets the currently stored value as a string. + * + * This function will attempt to await the last parent-process task (if any) + * writing to the the metric's storage engine before returning a value. + * This function will not wait for data from child processes. + * + * This doesn't clear the stored value. + * Parent process only. Panics in child processes. + * + * @param aPingName The (optional) name of the ping to retrieve the metric + * for. Defaults to the first value in `send_in_pings`. + * + * @return value of the stored metric, or null if there is no value. + */ + [Throws, ChromeOnly] + UTF8String? testGetValue(optional UTF8String aPingName = ""); +}; diff --git a/dom/webidl/GleanPings.webidl b/dom/webidl/GleanPings.webidl new file mode 100644 index 0000000000..088a9f34e4 --- /dev/null +++ b/dom/webidl/GleanPings.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +interface nsIGleanPing; + +[Func="nsGlobalWindowInner::IsGleanNeeded", Exposed=Window] +interface GleanPingsImpl { + /** + * Get a ping by name. + */ + getter nsIGleanPing (DOMString identifier); +}; diff --git a/dom/webidl/HTMLAllCollection.webidl b/dom/webidl/HTMLAllCollection.webidl new file mode 100644 index 0000000000..43b989a68d --- /dev/null +++ b/dom/webidl/HTMLAllCollection.webidl @@ -0,0 +1,14 @@ +/* This Source Code Form is subject to the terms of 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/. */ + +/* Emulates undefined through Codegen.py. */ +[LegacyUnenumerableNamedProperties, + Exposed=Window] +interface HTMLAllCollection { + readonly attribute unsigned long length; + getter Element (unsigned long index); + getter (HTMLCollection or Element)? namedItem(DOMString name); + (HTMLCollection or Element)? item(optional DOMString nameOrIndex); + legacycaller (HTMLCollection or Element)? (optional DOMString nameOrIndex); +}; diff --git a/dom/webidl/HTMLAnchorElement.webidl b/dom/webidl/HTMLAnchorElement.webidl new file mode 100644 index 0000000000..3ca7455f4c --- /dev/null +++ b/dom/webidl/HTMLAnchorElement.webidl @@ -0,0 +1,54 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-a-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-a-element +[Exposed=Window] +interface HTMLAnchorElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute DOMString target; + [CEReactions, SetterThrows] + attribute DOMString download; + [CEReactions, SetterThrows] + attribute DOMString ping; + [CEReactions, SetterThrows] + attribute DOMString rel; + [CEReactions, SetterThrows] + attribute DOMString referrerPolicy; + [PutForwards=value] + readonly attribute DOMTokenList relList; + [CEReactions, SetterThrows] + attribute DOMString hreflang; + [CEReactions, SetterThrows] + attribute DOMString type; + + [CEReactions, Throws] + attribute DOMString text; +}; + +HTMLAnchorElement includes HTMLHyperlinkElementUtils; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLAnchorElement { + [CEReactions, SetterThrows] + attribute DOMString coords; + [CEReactions, SetterThrows] + attribute DOMString charset; + [CEReactions, SetterThrows] + attribute DOMString name; + [CEReactions, SetterThrows] + attribute DOMString rev; + [CEReactions, SetterThrows] + attribute DOMString shape; +}; diff --git a/dom/webidl/HTMLAreaElement.webidl b/dom/webidl/HTMLAreaElement.webidl new file mode 100644 index 0000000000..7bef4a316c --- /dev/null +++ b/dom/webidl/HTMLAreaElement.webidl @@ -0,0 +1,46 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-area-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + & + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-area-element +[Exposed=Window] +interface HTMLAreaElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute DOMString alt; + [CEReactions, SetterThrows] + attribute DOMString coords; + [CEReactions, SetterThrows] + attribute DOMString shape; + [CEReactions, SetterThrows] + attribute DOMString target; + [CEReactions, SetterThrows] + attribute DOMString download; + [CEReactions, SetterThrows] + attribute DOMString ping; + [CEReactions, SetterThrows] + attribute DOMString rel; + [CEReactions, SetterThrows] + attribute DOMString referrerPolicy; + [PutForwards=value] + readonly attribute DOMTokenList relList; +}; + +HTMLAreaElement includes HTMLHyperlinkElementUtils; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLAreaElement { + [CEReactions, SetterThrows] + attribute boolean noHref; +}; diff --git a/dom/webidl/HTMLAudioElement.webidl b/dom/webidl/HTMLAudioElement.webidl new file mode 100644 index 0000000000..a0d5eb8460 --- /dev/null +++ b/dom/webidl/HTMLAudioElement.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-audio-element + * + * © 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. + */ + +[LegacyFactoryFunction=Audio(optional DOMString src), + Exposed=Window] +interface HTMLAudioElement : HTMLMediaElement { + [HTMLConstructor] constructor(); +}; diff --git a/dom/webidl/HTMLBRElement.webidl b/dom/webidl/HTMLBRElement.webidl new file mode 100644 index 0000000000..9762fda019 --- /dev/null +++ b/dom/webidl/HTMLBRElement.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-br-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-br-element +[Exposed=Window] +interface HTMLBRElement : HTMLElement { + [HTMLConstructor] constructor(); +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLBRElement { + [CEReactions, SetterThrows] + attribute DOMString clear; +}; + +// Mozilla extensions + +partial interface HTMLBRElement { + // Set to true if the <br> element is created by editor for placing caret + // at proper position in empty editor. + [ChromeOnly] + readonly attribute boolean isPaddingForEmptyEditor; + // Set to true if the <br> element is created by editor for placing caret + // at proper position making last empty line in a block element in HTML + // editor or <textarea> element visible. + [ChromeOnly] + readonly attribute boolean isPaddingForEmptyLastLine; +}; diff --git a/dom/webidl/HTMLBaseElement.webidl b/dom/webidl/HTMLBaseElement.webidl new file mode 100644 index 0000000000..caa4b8dbd8 --- /dev/null +++ b/dom/webidl/HTMLBaseElement.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-base-element + * + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-base-element +[Exposed=Window] +interface HTMLBaseElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute DOMString href; + [CEReactions, SetterThrows, Pure] + attribute DOMString target; +}; diff --git a/dom/webidl/HTMLBodyElement.webidl b/dom/webidl/HTMLBodyElement.webidl new file mode 100644 index 0000000000..fdec58df6a --- /dev/null +++ b/dom/webidl/HTMLBodyElement.webidl @@ -0,0 +1,35 @@ +/* -*- 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. + */ + +[Exposed=Window] +interface HTMLBodyElement : HTMLElement { + [HTMLConstructor] constructor(); + +}; + +partial interface HTMLBodyElement { + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString text; + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString link; + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString vLink; + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString aLink; + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString bgColor; + [CEReactions, SetterThrows] + attribute DOMString background; +}; + +HTMLBodyElement includes WindowEventHandlers; diff --git a/dom/webidl/HTMLButtonElement.webidl b/dom/webidl/HTMLButtonElement.webidl new file mode 100644 index 0000000000..37ae3f645c --- /dev/null +++ b/dom/webidl/HTMLButtonElement.webidl @@ -0,0 +1,53 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-button-element + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-button-element +[Exposed=Window, + InstrumentedProps=(popoverTargetAction,popoverTargetElement)] +interface HTMLButtonElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute boolean disabled; + [Pure] + readonly attribute HTMLFormElement? form; + [CEReactions, SetterThrows, Pure] + attribute DOMString formAction; + [CEReactions, SetterThrows, Pure] + attribute DOMString formEnctype; + [CEReactions, SetterThrows, Pure] + attribute DOMString formMethod; + [CEReactions, SetterThrows, Pure] + attribute boolean formNoValidate; + [CEReactions, SetterThrows, Pure] + attribute DOMString formTarget; + [CEReactions, SetterThrows, Pure] + attribute DOMString name; + [CEReactions, SetterThrows, Pure] + attribute DOMString type; + [CEReactions, SetterThrows, Pure] + attribute DOMString value; + + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + [Throws] + readonly attribute DOMString validationMessage; + boolean checkValidity(); + boolean reportValidity(); + undefined setCustomValidity(DOMString error); + + readonly attribute NodeList labels; +}; + +HTMLButtonElement includes PopoverInvokerElement; + +HTMLButtonElement includes InvokerElement; diff --git a/dom/webidl/HTMLCanvasElement.webidl b/dom/webidl/HTMLCanvasElement.webidl new file mode 100644 index 0000000000..dff2ac2989 --- /dev/null +++ b/dom/webidl/HTMLCanvasElement.webidl @@ -0,0 +1,69 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-canvas-element + * © 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. + */ + +interface nsISupports; + +typedef (HTMLCanvasElement or OffscreenCanvas) CanvasSource; + +[Exposed=Window] +interface HTMLCanvasElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, Pure, SetterThrows] + attribute unsigned long width; + [CEReactions, Pure, SetterThrows] + attribute unsigned long height; + + [Throws] + nsISupports? getContext(DOMString contextId, optional any contextOptions = null); + + [Throws, NeedsSubjectPrincipal] + DOMString toDataURL(optional DOMString type = "", + optional any encoderOptions); + [Throws, NeedsSubjectPrincipal] + undefined toBlob(BlobCallback callback, + optional DOMString type = "", + optional any encoderOptions); +}; + +// Mozilla specific bits +partial interface HTMLCanvasElement { + [Pure, SetterThrows] + attribute boolean mozOpaque; + + attribute PrintCallback? mozPrintCallback; + + [Throws, NeedsSubjectPrincipal] + CanvasCaptureMediaStream captureStream(optional double frameRate); +}; + +// For OffscreenCanvas +// Reference: https://wiki.whatwg.org/wiki/OffscreenCanvas +partial interface HTMLCanvasElement { + [Pref="gfx.offscreencanvas.enabled", Throws] + OffscreenCanvas transferControlToOffscreen(); +}; + +[ChromeOnly, + Exposed=Window] +interface MozCanvasPrintState +{ + // A canvas rendering context. + readonly attribute nsISupports context; + + // To be called when rendering to the context is done. + undefined done(); +}; + +callback PrintCallback = undefined(MozCanvasPrintState ctx); + +callback BlobCallback = undefined(Blob? blob); diff --git a/dom/webidl/HTMLCollection.webidl b/dom/webidl/HTMLCollection.webidl new file mode 100644 index 0000000000..805788b572 --- /dev/null +++ b/dom/webidl/HTMLCollection.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[LegacyUnenumerableNamedProperties, + Exposed=Window] +interface HTMLCollection { + readonly attribute unsigned long length; + getter Element? item(unsigned long index); + getter Element? namedItem(DOMString name); +}; diff --git a/dom/webidl/HTMLDListElement.webidl b/dom/webidl/HTMLDListElement.webidl new file mode 100644 index 0000000000..00afe405b6 --- /dev/null +++ b/dom/webidl/HTMLDListElement.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-dl-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-dl-element +[Exposed=Window] +interface HTMLDListElement : HTMLElement { + [HTMLConstructor] constructor(); + +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLDListElement { + [CEReactions, SetterThrows] + attribute boolean compact; +}; diff --git a/dom/webidl/HTMLDataElement.webidl b/dom/webidl/HTMLDataElement.webidl new file mode 100644 index 0000000000..1a04747e75 --- /dev/null +++ b/dom/webidl/HTMLDataElement.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-data-element + */ + +[Exposed=Window] +interface HTMLDataElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute DOMString value; +}; diff --git a/dom/webidl/HTMLDataListElement.webidl b/dom/webidl/HTMLDataListElement.webidl new file mode 100644 index 0000000000..23c462a3b7 --- /dev/null +++ b/dom/webidl/HTMLDataListElement.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/ + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLDataListElement : HTMLElement { + [HTMLConstructor] constructor(); + + readonly attribute HTMLCollection options; +}; diff --git a/dom/webidl/HTMLDetailsElement.webidl b/dom/webidl/HTMLDetailsElement.webidl new file mode 100644 index 0000000000..7f293f8ed8 --- /dev/null +++ b/dom/webidl/HTMLDetailsElement.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/forms.html#the-details-element + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLDetailsElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute boolean open; +}; diff --git a/dom/webidl/HTMLDialogElement.webidl b/dom/webidl/HTMLDialogElement.webidl new file mode 100644 index 0000000000..22741b8ca5 --- /dev/null +++ b/dom/webidl/HTMLDialogElement.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/forms.html#the-dialog-element + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLDialogElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute boolean open; + attribute DOMString returnValue; + [CEReactions, Throws, UseCounter] + undefined show(); + [CEReactions, Throws] + undefined showModal(); + [CEReactions] + undefined close(optional DOMString returnValue); +}; diff --git a/dom/webidl/HTMLDirectoryElement.webidl b/dom/webidl/HTMLDirectoryElement.webidl new file mode 100644 index 0000000000..d4f9d570bc --- /dev/null +++ b/dom/webidl/HTMLDirectoryElement.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +[Exposed=Window] +interface HTMLDirectoryElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute boolean compact; +}; diff --git a/dom/webidl/HTMLDivElement.webidl b/dom/webidl/HTMLDivElement.webidl new file mode 100644 index 0000000000..44c810f9ea --- /dev/null +++ b/dom/webidl/HTMLDivElement.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.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. + */ + +[Exposed=Window, ProbablyShortLivingWrapper] +interface HTMLDivElement : HTMLElement { + [HTMLConstructor] constructor(); +}; + +partial interface HTMLDivElement { + [CEReactions, SetterThrows] + attribute DOMString align; +}; diff --git a/dom/webidl/HTMLDocument.webidl b/dom/webidl/HTMLDocument.webidl new file mode 100644 index 0000000000..fa0c22c55b --- /dev/null +++ b/dom/webidl/HTMLDocument.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[LegacyOverrideBuiltIns, + Exposed=Window] +interface HTMLDocument : Document { + // DOM tree accessors + [Throws] + getter object (DOMString name); +}; diff --git a/dom/webidl/HTMLElement.webidl b/dom/webidl/HTMLElement.webidl new file mode 100644 index 0000000000..2f467438ce --- /dev/null +++ b/dom/webidl/HTMLElement.webidl @@ -0,0 +1,122 @@ +/* -*- 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/ and + * http://dev.w3.org/csswg/cssom-view/ + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window, + InstrumentedProps=(attributeStyleMap,hidePopover,popover,showPopover,togglePopover)] +interface HTMLElement : Element { + [HTMLConstructor] constructor(); + + // metadata attributes + [CEReactions] + attribute DOMString title; + [CEReactions] + attribute DOMString lang; + [CEReactions, SetterThrows, Pure] + attribute boolean translate; + [CEReactions, SetterThrows, Pure] + attribute DOMString dir; + + [CEReactions, GetterThrows, Pure] + attribute [LegacyNullToEmptyString] DOMString innerText; + [CEReactions, GetterThrows, SetterThrows, Pure] + attribute [LegacyNullToEmptyString] DOMString outerText; + + // user interaction + [CEReactions, SetterThrows, Pure] + attribute boolean hidden; + [CEReactions, SetterThrows, Pure] + attribute boolean inert; + [NeedsCallerType] + undefined click(); + [CEReactions, SetterThrows, Pure] + attribute DOMString accessKey; + [Pure] + readonly attribute DOMString accessKeyLabel; + [CEReactions, SetterThrows, Pure] + attribute boolean draggable; + //[PutForwards=value] readonly attribute DOMTokenList dropzone; + [CEReactions, SetterThrows, Pure] + attribute DOMString contentEditable; + [Pure] + readonly attribute boolean isContentEditable; + [CEReactions, SetterThrows, Pure, Pref="dom.element.popover.enabled"] + attribute DOMString? popover; + [CEReactions, SetterThrows, Pure] + attribute boolean spellcheck; + [CEReactions, Pure, SetterThrows] + attribute DOMString inputMode; + [CEReactions, Pure, SetterThrows] + attribute DOMString enterKeyHint; + [CEReactions, Pure, SetterThrows] + attribute DOMString autocapitalize; + + attribute DOMString nonce; + + // command API + //readonly attribute DOMString? commandType; + //readonly attribute DOMString? commandLabel; + //readonly attribute DOMString? commandIcon; + //readonly attribute boolean? commandHidden; + //readonly attribute boolean? commandDisabled; + //readonly attribute boolean? commandChecked; + + // https://html.spec.whatwg.org/multipage/custom-elements.html#dom-attachinternals + [Throws] + ElementInternals attachInternals(); + + [Throws, Pref="dom.element.popover.enabled"] + undefined showPopover(); + [Throws, Pref="dom.element.popover.enabled"] + undefined hidePopover(); + [Throws, Pref="dom.element.popover.enabled"] + boolean togglePopover(optional boolean force); +}; + +// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interface +partial interface HTMLElement { + // CSSOM things are not [Pure] because they can flush + readonly attribute Element? offsetParent; + readonly attribute long offsetTop; + readonly attribute long offsetLeft; + readonly attribute long offsetWidth; + readonly attribute long offsetHeight; +}; + +partial interface HTMLElement { + [ChromeOnly] + readonly attribute ElementInternals? internals; + + [ChromeOnly] + readonly attribute boolean isFormAssociatedCustomElements; +}; + +interface mixin TouchEventHandlers { + [Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"] + attribute EventHandler ontouchstart; + [Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"] + attribute EventHandler ontouchend; + [Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"] + attribute EventHandler ontouchmove; + [Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"] + attribute EventHandler ontouchcancel; +}; + +HTMLElement includes GlobalEventHandlers; +HTMLElement includes HTMLOrForeignElement; +HTMLElement includes ElementCSSInlineStyle; +HTMLElement includes TouchEventHandlers; +HTMLElement includes OnErrorEventHandlerForNodes; + +[Exposed=Window] +interface HTMLUnknownElement : HTMLElement {}; diff --git a/dom/webidl/HTMLEmbedElement.webidl b/dom/webidl/HTMLEmbedElement.webidl new file mode 100644 index 0000000000..e02484b1fb --- /dev/null +++ b/dom/webidl/HTMLEmbedElement.webidl @@ -0,0 +1,45 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-embed-element + * http://www.whatwg.org/specs/web-apps/current-work/#HTMLEmbedElement-partial + * + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-embed-element +[Exposed=Window] +interface HTMLEmbedElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, Pure, SetterThrows] + attribute DOMString src; + [CEReactions, Pure, SetterThrows] + attribute DOMString type; + [CEReactions, Pure, SetterThrows] + attribute DOMString width; + [CEReactions, Pure, SetterThrows] + attribute DOMString height; +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#HTMLEmbedElement-partial +partial interface HTMLEmbedElement { + [CEReactions, Pure, SetterThrows] + attribute DOMString align; + [CEReactions, Pure, SetterThrows] + attribute DOMString name; +}; + +partial interface HTMLEmbedElement { + // GetSVGDocument + [NeedsSubjectPrincipal] + Document? getSVGDocument(); +}; + +HTMLEmbedElement includes MozFrameLoaderOwner; +HTMLEmbedElement includes MozObjectLoadingContent; diff --git a/dom/webidl/HTMLFieldSetElement.webidl b/dom/webidl/HTMLFieldSetElement.webidl new file mode 100644 index 0000000000..7af0b1e728 --- /dev/null +++ b/dom/webidl/HTMLFieldSetElement.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-fieldset-element + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLFieldSetElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute boolean disabled; + readonly attribute HTMLFormElement? form; + [CEReactions, SetterThrows] + attribute DOMString name; + + readonly attribute DOMString type; + + readonly attribute HTMLCollection elements; + + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + [Throws] + readonly attribute DOMString validationMessage; + + boolean checkValidity(); + boolean reportValidity(); + + undefined setCustomValidity(DOMString error); +}; diff --git a/dom/webidl/HTMLFontElement.webidl b/dom/webidl/HTMLFontElement.webidl new file mode 100644 index 0000000000..29d68811e1 --- /dev/null +++ b/dom/webidl/HTMLFontElement.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/ + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLFontElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] attribute [LegacyNullToEmptyString] DOMString color; + [CEReactions, SetterThrows] attribute DOMString face; + [CEReactions, SetterThrows] attribute DOMString size; +}; diff --git a/dom/webidl/HTMLFormControlsCollection.webidl b/dom/webidl/HTMLFormControlsCollection.webidl new file mode 100644 index 0000000000..c4024725aa --- /dev/null +++ b/dom/webidl/HTMLFormControlsCollection.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#htmlformcontrolscollection + * + * © Copyright 2004-2013 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLFormControlsCollection : HTMLCollection { + // inherits length and item() + /* legacycaller */ getter (RadioNodeList or Element)? namedItem(DOMString name); // shadows inherited namedItem() +}; diff --git a/dom/webidl/HTMLFormElement.webidl b/dom/webidl/HTMLFormElement.webidl new file mode 100644 index 0000000000..70a3f8eea6 --- /dev/null +++ b/dom/webidl/HTMLFormElement.webidl @@ -0,0 +1,59 @@ +/* -*- 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/#htmlformelement + * + * © 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. + */ + +[LegacyOverrideBuiltIns, LegacyUnenumerableNamedProperties, + Exposed=Window] +interface HTMLFormElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, Pure, SetterThrows] + attribute DOMString acceptCharset; + [CEReactions, Pure, SetterThrows] + attribute DOMString action; + [CEReactions, Pure, SetterThrows] + attribute DOMString autocomplete; + [CEReactions, Pure, SetterThrows] + attribute DOMString enctype; + [CEReactions, Pure, SetterThrows] + attribute DOMString encoding; + [CEReactions, Pure, SetterThrows] + attribute DOMString method; + [CEReactions, Pure, SetterThrows] + attribute DOMString name; + [CEReactions, Pure, SetterThrows] + attribute boolean noValidate; + [CEReactions, Pure, SetterThrows] + attribute DOMString target; + [CEReactions, Pure, SetterThrows] + attribute DOMString rel; + [PutForwards=value] + readonly attribute DOMTokenList relList; + + [SameObject] + readonly attribute HTMLFormControlsCollection elements; + [Pure] + readonly attribute long length; + + getter Element (unsigned long index); + // TODO this should be: getter (RadioNodeList or HTMLInputElement or HTMLImageElement) (DOMString name); + getter nsISupports (DOMString name); + + [Throws] + undefined submit(); + [Throws] + undefined requestSubmit(optional HTMLElement? submitter = null); + [CEReactions] + undefined reset(); + boolean checkValidity(); + boolean reportValidity(); +}; diff --git a/dom/webidl/HTMLFrameElement.webidl b/dom/webidl/HTMLFrameElement.webidl new file mode 100644 index 0000000000..5f83ba4f30 --- /dev/null +++ b/dom/webidl/HTMLFrameElement.webidl @@ -0,0 +1,40 @@ +/* -*- 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/#htmlframeelement + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#htmlframeelement +[Exposed=Window] +interface HTMLFrameElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute DOMString name; + [CEReactions, SetterThrows] + attribute DOMString scrolling; + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString src; + [CEReactions, SetterThrows] + attribute DOMString frameBorder; + [CEReactions, SetterThrows] + attribute DOMString longDesc; + [CEReactions, SetterThrows] + attribute boolean noResize; + [NeedsSubjectPrincipal] + readonly attribute Document? contentDocument; + readonly attribute WindowProxy? contentWindow; + + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString marginHeight; + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString marginWidth; +}; + +HTMLFrameElement includes MozFrameLoaderOwner; diff --git a/dom/webidl/HTMLFrameSetElement.webidl b/dom/webidl/HTMLFrameSetElement.webidl new file mode 100644 index 0000000000..49e6c54956 --- /dev/null +++ b/dom/webidl/HTMLFrameSetElement.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * 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. + */ + +[Exposed=Window] +interface HTMLFrameSetElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute DOMString cols; + [CEReactions, SetterThrows] + attribute DOMString rows; +}; + +HTMLFrameSetElement includes WindowEventHandlers; diff --git a/dom/webidl/HTMLHRElement.webidl b/dom/webidl/HTMLHRElement.webidl new file mode 100644 index 0000000000..b73c2589db --- /dev/null +++ b/dom/webidl/HTMLHRElement.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-hr-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-hr-element +[Exposed=Window] +interface HTMLHRElement : HTMLElement { + [HTMLConstructor] constructor(); + +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLHRElement { + [CEReactions, SetterThrows] + attribute DOMString align; + [CEReactions, SetterThrows] + attribute DOMString color; + [CEReactions, SetterThrows] + attribute boolean noShade; + [CEReactions, SetterThrows] + attribute DOMString size; + [CEReactions, SetterThrows] + attribute DOMString width; +}; diff --git a/dom/webidl/HTMLHeadElement.webidl b/dom/webidl/HTMLHeadElement.webidl new file mode 100644 index 0000000000..c296ded379 --- /dev/null +++ b/dom/webidl/HTMLHeadElement.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-head-element + * + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-head-element +[Exposed=Window] +interface HTMLHeadElement : HTMLElement { + [HTMLConstructor] constructor(); +}; diff --git a/dom/webidl/HTMLHeadingElement.webidl b/dom/webidl/HTMLHeadingElement.webidl new file mode 100644 index 0000000000..0092388e96 --- /dev/null +++ b/dom/webidl/HTMLHeadingElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements +[Exposed=Window] +interface HTMLHeadingElement : HTMLElement { + [HTMLConstructor] constructor(); + +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLHeadingElement { + [CEReactions, SetterThrows] + attribute DOMString align; +}; diff --git a/dom/webidl/HTMLHtmlElement.webidl b/dom/webidl/HTMLHtmlElement.webidl new file mode 100644 index 0000000000..38f1b3bc53 --- /dev/null +++ b/dom/webidl/HTMLHtmlElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-html-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-html-element +[Exposed=Window] +interface HTMLHtmlElement : HTMLElement { + [HTMLConstructor] constructor(); +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLHtmlElement { + [CEReactions, SetterThrows, Pure] + attribute DOMString version; +}; diff --git a/dom/webidl/HTMLHyperlinkElementUtils.webidl b/dom/webidl/HTMLHyperlinkElementUtils.webidl new file mode 100644 index 0000000000..652437c81b --- /dev/null +++ b/dom/webidl/HTMLHyperlinkElementUtils.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/semantics.html#htmlhyperlinkelementutils + * © 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. + */ + +interface mixin HTMLHyperlinkElementUtils { + [CEReactions, SetterThrows] + stringifier attribute USVString href; + + readonly attribute USVString origin; + [CEReactions] + attribute USVString protocol; + [CEReactions] + attribute USVString username; + [CEReactions] + attribute USVString password; + [CEReactions] + attribute USVString host; + [CEReactions] + attribute USVString hostname; + [CEReactions] + attribute USVString port; + [CEReactions] + attribute USVString pathname; + [CEReactions] + attribute USVString search; + [CEReactions] + attribute USVString hash; +}; diff --git a/dom/webidl/HTMLIFrameElement.webidl b/dom/webidl/HTMLIFrameElement.webidl new file mode 100644 index 0000000000..8a0b3bf93f --- /dev/null +++ b/dom/webidl/HTMLIFrameElement.webidl @@ -0,0 +1,75 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-iframe-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * https://wicg.github.io/feature-policy/#policy + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLIFrameElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows, Pure] + attribute DOMString src; + [CEReactions, SetterThrows, Pure] + attribute DOMString srcdoc; + [CEReactions, SetterThrows, Pure] + attribute DOMString name; + [PutForwards=value] readonly attribute DOMTokenList sandbox; + // attribute boolean seamless; + [CEReactions, SetterThrows, Pure] + attribute boolean allowFullscreen; + [CEReactions, SetterThrows, Pure] + attribute DOMString width; + [CEReactions, SetterThrows, Pure] + attribute DOMString height; + [CEReactions, SetterThrows, Pure] + attribute DOMString referrerPolicy; + [CEReactions, SetterThrows, Pure, Pref="dom.iframe-lazy-loading.enabled"] + attribute DOMString loading; + [NeedsSubjectPrincipal] + readonly attribute Document? contentDocument; + readonly attribute WindowProxy? contentWindow; +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLIFrameElement { + [CEReactions, SetterThrows, Pure] + attribute DOMString align; + [CEReactions, SetterThrows, Pure] + attribute DOMString scrolling; + [CEReactions, SetterThrows, Pure] + attribute DOMString frameBorder; + [CEReactions, SetterThrows, Pure] + attribute DOMString longDesc; + + [CEReactions, SetterThrows, Pure] + attribute [LegacyNullToEmptyString] DOMString marginHeight; + [CEReactions, SetterThrows, Pure] + attribute [LegacyNullToEmptyString] DOMString marginWidth; +}; + +partial interface HTMLIFrameElement { + // GetSVGDocument + [NeedsSubjectPrincipal] + Document? getSVGDocument(); +}; + +HTMLIFrameElement includes MozFrameLoaderOwner; + +// https://w3c.github.io/webappsec-feature-policy/#idl-index +partial interface HTMLIFrameElement { + [SameObject, Pref="dom.security.featurePolicy.webidl.enabled"] + readonly attribute FeaturePolicy featurePolicy; + + [CEReactions, SetterThrows, Pure] + attribute DOMString allow; +}; diff --git a/dom/webidl/HTMLImageElement.webidl b/dom/webidl/HTMLImageElement.webidl new file mode 100644 index 0000000000..1495d25f74 --- /dev/null +++ b/dom/webidl/HTMLImageElement.webidl @@ -0,0 +1,134 @@ +/* -*- 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/#htmlimageelement + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +interface imgINotificationObserver; +interface imgIRequest; +interface URI; +interface nsIStreamListener; + +[LegacyFactoryFunction=Image(optional unsigned long width, optional unsigned long height), + Exposed=Window] +interface HTMLImageElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute DOMString alt; + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString src; + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString srcset; + [CEReactions, SetterThrows] + attribute DOMString? crossOrigin; + [CEReactions, SetterThrows] + attribute DOMString useMap; + [CEReactions, SetterThrows] + attribute DOMString referrerPolicy; + [CEReactions, SetterThrows] + attribute boolean isMap; + [CEReactions, SetterThrows] + attribute unsigned long width; + [CEReactions, SetterThrows] + attribute unsigned long height; + [CEReactions, SetterThrows] + attribute DOMString decoding; + [CEReactions, SetterThrows] + attribute DOMString loading; + readonly attribute unsigned long naturalWidth; + readonly attribute unsigned long naturalHeight; + readonly attribute boolean complete; + [NewObject] + Promise<undefined> decode(); + [NewObject, ChromeOnly] + Promise<sequence<ImageText>> recognizeCurrentImageText(); +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLImageElement { + [CEReactions, SetterThrows] + attribute DOMString name; + [CEReactions, SetterThrows] + attribute DOMString align; + [CEReactions, SetterThrows] + attribute unsigned long hspace; + [CEReactions, SetterThrows] + attribute unsigned long vspace; + [CEReactions, SetterThrows] + attribute DOMString longDesc; + + [CEReactions, SetterThrows] attribute [LegacyNullToEmptyString] DOMString border; +}; + +// [Update me: not in whatwg spec yet] +// http://picture.responsiveimages.org/#the-img-element +partial interface HTMLImageElement { + [CEReactions, SetterThrows] + attribute DOMString sizes; + readonly attribute DOMString currentSrc; +}; + +// Mozilla extensions. +partial interface HTMLImageElement { + [CEReactions, SetterThrows] + attribute DOMString lowsrc; + + // These attributes are offsets from the closest view (to mimic + // NS4's "offset-from-layer" behavior). + readonly attribute long x; + readonly attribute long y; +}; + +interface mixin MozImageLoadingContent { + // Mirrored chrome-only nsIImageLoadingContent methods. Please make sure + // to update this list if nsIImageLoadingContent changes. + [ChromeOnly] + const long UNKNOWN_REQUEST = -1; + [ChromeOnly] + const long CURRENT_REQUEST = 0; + [ChromeOnly] + const long PENDING_REQUEST = 1; + + [ChromeOnly] + attribute boolean loadingEnabled; + /** + * Same as addNativeObserver but intended for scripted observers or observers + * from another or without a document. + */ + [ChromeOnly] + undefined addObserver(imgINotificationObserver aObserver); + /** + * Same as removeNativeObserver but intended for scripted observers or + * observers from another or without a document. + */ + [ChromeOnly] + undefined removeObserver(imgINotificationObserver aObserver); + [ChromeOnly,Throws] + imgIRequest? getRequest(long aRequestType); + [ChromeOnly,Throws] + long getRequestType(imgIRequest aRequest); + [ChromeOnly] + readonly attribute URI? currentURI; + // Gets the final URI of the current request, if available. + // Otherwise, returns null. + [ChromeOnly] + readonly attribute URI? currentRequestFinalURI; + /** + * forceReload forces reloading of the image pointed to by currentURI + * + * @param aNotify request should notify + * @throws NS_ERROR_NOT_AVAILABLE if there is no current URI to reload + */ + [ChromeOnly,Throws] + undefined forceReload(optional boolean aNotify = true); +}; + +HTMLImageElement includes MozImageLoadingContent; diff --git a/dom/webidl/HTMLInputElement.webidl b/dom/webidl/HTMLInputElement.webidl new file mode 100644 index 0000000000..594d80c30f --- /dev/null +++ b/dom/webidl/HTMLInputElement.webidl @@ -0,0 +1,293 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-input-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * https://wicg.github.io/entries-api/#idl-index + * + * © 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 SelectionMode { + "select", + "start", + "end", + "preserve", +}; + +interface XULControllers; + +[Exposed=Window, + InstrumentedProps=(capture, + incremental, + onsearch, + popoverTargetAction, + popoverTargetElement, + webkitEntries, + webkitdirectory)] +interface HTMLInputElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, Pure, SetterThrows] + attribute DOMString accept; + [CEReactions, Pure, SetterThrows] + attribute DOMString alt; + [CEReactions, Pure, SetterThrows] + attribute DOMString autocomplete; + [CEReactions, Pure, SetterThrows, Pref="dom.capture.enabled"] + attribute DOMString capture; + [CEReactions, Pure, SetterThrows] + attribute boolean defaultChecked; + [Pure] + attribute boolean checked; + [CEReactions, Pure, SetterThrows] + attribute DOMString dirName; + [CEReactions, Pure, SetterThrows] + attribute boolean disabled; + readonly attribute HTMLFormElement? form; + [Pure] + attribute FileList? files; + [CEReactions, Pure, SetterThrows] + attribute DOMString formAction; + [CEReactions, Pure, SetterThrows] + attribute DOMString formEnctype; + [CEReactions, Pure, SetterThrows] + attribute DOMString formMethod; + [CEReactions, Pure, SetterThrows] + attribute boolean formNoValidate; + [CEReactions, Pure, SetterThrows] + attribute DOMString formTarget; + [CEReactions, Pure, SetterThrows] + attribute unsigned long height; + [Pure] + attribute boolean indeterminate; + [Pure] + readonly attribute HTMLDataListElement? list; + [CEReactions, Pure, SetterThrows] + attribute DOMString max; + [CEReactions, Pure, SetterThrows] + attribute long maxLength; + [CEReactions, Pure, SetterThrows] + attribute DOMString min; + [CEReactions, Pure, SetterThrows] + attribute long minLength; + [CEReactions, Pure, SetterThrows] + attribute boolean multiple; + [CEReactions, Pure, SetterThrows] + attribute DOMString name; + [CEReactions, Pure, SetterThrows] + attribute DOMString pattern; + [CEReactions, Pure, SetterThrows] + attribute DOMString placeholder; + [CEReactions, Pure, SetterThrows] + attribute boolean readOnly; + [CEReactions, Pure, SetterThrows] + attribute boolean required; + [CEReactions, Pure, SetterThrows] + attribute unsigned long size; + [CEReactions, Pure, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString src; + [CEReactions, Pure, SetterThrows] + attribute DOMString step; + [CEReactions, Pure, SetterThrows] + attribute DOMString type; + [CEReactions, Pure, SetterThrows] + attribute DOMString defaultValue; + [CEReactions, Pure, SetterThrows, NeedsCallerType] + attribute [LegacyNullToEmptyString] DOMString value; + [Throws] + attribute object? valueAsDate; + [Pure, SetterThrows] + attribute unrestricted double valueAsNumber; + [CEReactions, SetterThrows] + attribute unsigned long width; + + [Throws] + undefined stepUp(optional long n = 1); + [Throws] + undefined stepDown(optional long n = 1); + + [Pure] + readonly attribute boolean willValidate; + [Pure] + readonly attribute ValidityState validity; + [Throws] + readonly attribute DOMString validationMessage; + boolean checkValidity(); + boolean reportValidity(); + undefined setCustomValidity(DOMString error); + + readonly attribute NodeList? labels; + + undefined select(); + + [Throws] + attribute unsigned long? selectionStart; + [Throws] + attribute unsigned long? selectionEnd; + [Throws] + attribute DOMString? selectionDirection; + [Throws] + undefined setRangeText(DOMString replacement); + [Throws] + undefined setRangeText(DOMString replacement, unsigned long start, + unsigned long end, optional SelectionMode selectionMode = "preserve"); + [Throws] + undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); + + [Throws] + undefined showPicker(); + + // also has obsolete members +}; + +partial interface HTMLInputElement { + [CEReactions, Pure, SetterThrows] + attribute DOMString align; + [CEReactions, Pure, SetterThrows] + attribute DOMString useMap; +}; + +// Mozilla extensions + +partial interface HTMLInputElement { + [GetterThrows, ChromeOnly] + readonly attribute XULControllers? controllers; + // Binaryname because we have a FragmentOrElement function named "TextLength()". + [NeedsCallerType, BinaryName="inputTextLength"] + readonly attribute long textLength; + + [Throws, ChromeOnly] + sequence<DOMString> mozGetFileNameArray(); + + [ChromeOnly, Throws] + undefined mozSetFileNameArray(sequence<DOMString> fileNames); + + [ChromeOnly] + undefined mozSetFileArray(sequence<File> files); + + // This method is meant to use for testing only. + [ChromeOnly, Throws] + undefined mozSetDirectory(DOMString directoryPath); + + // This method is meant to use for testing only. + [ChromeOnly] + undefined mozSetDndFilesAndDirectories(sequence<(File or Directory)> list); + + // This method is meant to use for testing only. + [ChromeOnly, NewObject] + Promise<sequence<(File or Directory)>> getFilesAndDirectories(); + + boolean mozIsTextField(boolean aExcludePassword); + + [ChromeOnly] + readonly attribute boolean hasBeenTypePassword; + + [ChromeOnly] + attribute DOMString previewValue; + + // Last value entered by the user, not by a script. + // NOTE(emilio): As of right now some execCommand triggered changes might be + // considered interactive. + [ChromeOnly] + readonly attribute DOMString lastInteractiveValue; + + [ChromeOnly] + // This function will return null if @autocomplete is not defined for the + // current @type + AutocompleteInfo? getAutocompleteInfo(); + + [ChromeOnly] + // The reveal password state for a type=password control. + attribute boolean revealPassword; +}; + +interface mixin MozEditableElement { + // Returns an nsIEditor instance which is associated with the element. + // If the element can be associated with an editor but not yet created, + // this creates new one automatically. + [Pure, ChromeOnly, BinaryName="editorForBindings"] + readonly attribute nsIEditor? editor; + + // Returns true if an nsIEditor instance has already been associated with + // the element. + [Pure, ChromeOnly] + readonly attribute boolean hasEditor; + + // This is set to true if "input" event should be fired with InputEvent on + // the element. Otherwise, i.e., if "input" event should be fired with + // Event, set to false. + [ChromeOnly] + readonly attribute boolean isInputEventTarget; + + // This is similar to set .value on nsIDOMInput/TextAreaElements, but handling + // of the value change is closer to the normal user input, so 'change' event + // for example will be dispatched when focusing out the element. + [Func="IsChromeOrUAWidget", NeedsSubjectPrincipal] + undefined setUserInput(DOMString input); +}; + +HTMLInputElement includes MozEditableElement; + +HTMLInputElement includes MozImageLoadingContent; + +HTMLInputElement includes PopoverInvokerElement; + +HTMLInputElement includes InvokerElement; + +// https://wicg.github.io/entries-api/#idl-index +partial interface HTMLInputElement { + [Pref="dom.webkitBlink.filesystem.enabled", Frozen, Cached, Pure] + readonly attribute sequence<FileSystemEntry> webkitEntries; + + [Pref="dom.webkitBlink.dirPicker.enabled", BinaryName="WebkitDirectoryAttr", SetterThrows] + attribute boolean webkitdirectory; +}; + +dictionary DateTimeValue { + long hour; + long minute; + long year; + long month; + long day; +}; + +partial interface HTMLInputElement { + [ChromeOnly] + DateTimeValue getDateTimeInputBoxValue(); + + [ChromeOnly] + readonly attribute Element? dateTimeBoxElement; + + [ChromeOnly, BinaryName="getMinimumAsDouble"] + double getMinimum(); + + [ChromeOnly, BinaryName="getMaximumAsDouble"] + double getMaximum(); + + [Func="IsChromeOrUAWidget"] + undefined openDateTimePicker(optional DateTimeValue initialValue = {}); + + [Func="IsChromeOrUAWidget"] + undefined updateDateTimePicker(optional DateTimeValue value = {}); + + [Func="IsChromeOrUAWidget"] + undefined closeDateTimePicker(); + + [Func="IsChromeOrUAWidget"] + undefined setFocusState(boolean aIsFocused); + + [Func="IsChromeOrUAWidget"] + undefined updateValidityState(); + + [Func="IsChromeOrUAWidget", BinaryName="getStepAsDouble"] + double getStep(); + + [Func="IsChromeOrUAWidget", BinaryName="getStepBaseAsDouble"] + double getStepBase(); +}; diff --git a/dom/webidl/HTMLLIElement.webidl b/dom/webidl/HTMLLIElement.webidl new file mode 100644 index 0000000000..f6a667102f --- /dev/null +++ b/dom/webidl/HTMLLIElement.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-li-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-li-element +[Exposed=Window] +interface HTMLLIElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute long value; +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLLIElement { + [CEReactions, SetterThrows, Pure] + attribute DOMString type; +}; diff --git a/dom/webidl/HTMLLabelElement.webidl b/dom/webidl/HTMLLabelElement.webidl new file mode 100644 index 0000000000..6f78a19339 --- /dev/null +++ b/dom/webidl/HTMLLabelElement.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.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. + */ + +[Exposed=Window] +interface HTMLLabelElement : HTMLElement { + [HTMLConstructor] constructor(); + + readonly attribute HTMLFormElement? form; + [CEReactions] + attribute DOMString htmlFor; + readonly attribute HTMLElement? control; +}; diff --git a/dom/webidl/HTMLLegendElement.webidl b/dom/webidl/HTMLLegendElement.webidl new file mode 100644 index 0000000000..075af8b1a9 --- /dev/null +++ b/dom/webidl/HTMLLegendElement.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-legend-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-legend-element +[Exposed=Window] +interface HTMLLegendElement : HTMLElement { + [HTMLConstructor] constructor(); + + readonly attribute HTMLFormElement? form; +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLLegendElement { + [CEReactions, SetterThrows] + attribute DOMString align; +}; diff --git a/dom/webidl/HTMLLinkElement.webidl b/dom/webidl/HTMLLinkElement.webidl new file mode 100644 index 0000000000..61b9ec7d5a --- /dev/null +++ b/dom/webidl/HTMLLinkElement.webidl @@ -0,0 +1,69 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-link-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// https://html.spec.whatwg.org/multipage/semantics.html#the-link-element +[Exposed=Window] +interface HTMLLinkElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute boolean disabled; + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows, Pure] + attribute DOMString href; + [CEReactions, SetterThrows, Pure] + attribute DOMString? crossOrigin; + [CEReactions, SetterThrows, Pure] + attribute DOMString rel; + [PutForwards=value] + readonly attribute DOMTokenList relList; + [CEReactions, SetterThrows, Pure] + attribute DOMString media; + [CEReactions, SetterThrows, Pure] + attribute DOMString hreflang; + [CEReactions, SetterThrows, Pure] + attribute DOMString type; + [CEReactions, SetterThrows, Pure] + attribute DOMString referrerPolicy; + [PutForwards=value] readonly attribute DOMTokenList sizes; + [CEReactions, SetterThrows, Pure] + attribute USVString imageSrcset; + [CEReactions, SetterThrows, Pure] + attribute USVString imageSizes; + [Pref="dom.element.blocking.enabled", SameObject, PutForwards=value] + readonly attribute DOMTokenList blocking; + [Pref="network.fetchpriority.enabled", CEReactions] + attribute DOMString fetchPriority; +}; +HTMLLinkElement includes LinkStyle; + +// https://html.spec.whatwg.org/multipage/obsolete.html#other-elements%2C-attributes-and-apis +partial interface HTMLLinkElement { + [CEReactions, SetterThrows, Pure] + attribute DOMString charset; + [CEReactions, SetterThrows, Pure] + attribute DOMString rev; + [CEReactions, SetterThrows, Pure] + attribute DOMString target; +}; + +// https://html.spec.whatwg.org/multipage/semantics.html#the-link-element +partial interface HTMLLinkElement { + [CEReactions, SetterThrows] + attribute DOMString integrity; +}; + +// https://html.spec.whatwg.org/multipage/links.html#link-type-preload +partial interface HTMLLinkElement { + [SetterThrows, Pure] + attribute DOMString as; +}; diff --git a/dom/webidl/HTMLMapElement.webidl b/dom/webidl/HTMLMapElement.webidl new file mode 100644 index 0000000000..038fd108e1 --- /dev/null +++ b/dom/webidl/HTMLMapElement.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-map-element + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-map-element +[Exposed=Window] +interface HTMLMapElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute DOMString name; + [Constant] + readonly attribute HTMLCollection areas; + // Not supported yet. + //readonly attribute HTMLCollection images; +}; diff --git a/dom/webidl/HTMLMarqueeElement.webidl b/dom/webidl/HTMLMarqueeElement.webidl new file mode 100644 index 0000000000..58bc8416f9 --- /dev/null +++ b/dom/webidl/HTMLMarqueeElement.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/obsolete.html#the-marquee-element + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// https://html.spec.whatwg.org/multipage/obsolete.html#the-marquee-element + +[Exposed=Window] +interface HTMLMarqueeElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] attribute DOMString behavior; + [CEReactions, SetterThrows] attribute DOMString bgColor; + [CEReactions, SetterThrows] attribute DOMString direction; + [CEReactions, SetterThrows] attribute DOMString height; + [CEReactions, SetterThrows] attribute unsigned long hspace; + [CEReactions, SetterThrows] attribute long loop; + [CEReactions, SetterThrows] attribute unsigned long scrollAmount; + [CEReactions, SetterThrows] attribute unsigned long scrollDelay; + [CEReactions, SetterThrows] attribute boolean trueSpeed; + [CEReactions, SetterThrows] attribute unsigned long vspace; + [CEReactions, SetterThrows] attribute DOMString width; + + attribute EventHandler onbounce; + attribute EventHandler onfinish; + attribute EventHandler onstart; + + undefined start(); + undefined stop(); +}; diff --git a/dom/webidl/HTMLMediaElement.webidl b/dom/webidl/HTMLMediaElement.webidl new file mode 100644 index 0000000000..93eddbb536 --- /dev/null +++ b/dom/webidl/HTMLMediaElement.webidl @@ -0,0 +1,289 @@ +/* -*- 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/#media-elements + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window, + InstrumentedProps=(disableRemotePlayback,remote)] +interface HTMLMediaElement : HTMLElement { + + // error state + readonly attribute MediaError? error; + + // network state + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString src; + readonly attribute DOMString currentSrc; + + [CEReactions, SetterThrows] + attribute DOMString? crossOrigin; + const unsigned short NETWORK_EMPTY = 0; + const unsigned short NETWORK_IDLE = 1; + const unsigned short NETWORK_LOADING = 2; + const unsigned short NETWORK_NO_SOURCE = 3; + readonly attribute unsigned short networkState; + [CEReactions, SetterThrows] + attribute DOMString preload; + [NewObject] + readonly attribute TimeRanges buffered; + undefined load(); + DOMString canPlayType(DOMString type); + + // ready state + const unsigned short HAVE_NOTHING = 0; + const unsigned short HAVE_METADATA = 1; + const unsigned short HAVE_CURRENT_DATA = 2; + const unsigned short HAVE_FUTURE_DATA = 3; + const unsigned short HAVE_ENOUGH_DATA = 4; + readonly attribute unsigned short readyState; + readonly attribute boolean seeking; + + // playback state + [SetterThrows] + attribute double currentTime; + [Throws] + undefined fastSeek(double time); + readonly attribute unrestricted double duration; + [ChromeOnly] + readonly attribute boolean isEncrypted; + // TODO: Bug 847376 - readonly attribute any startDate; + readonly attribute boolean paused; + [SetterThrows] + attribute double defaultPlaybackRate; + [SetterThrows] + attribute double playbackRate; + [NewObject] + readonly attribute TimeRanges played; + [NewObject] + readonly attribute TimeRanges seekable; + readonly attribute boolean ended; + [CEReactions, SetterThrows] + attribute boolean autoplay; + [CEReactions, SetterThrows] + attribute boolean loop; + [NewObject] + Promise<undefined> play(); + [Throws] + undefined pause(); + + // TODO: Bug 847377 - mediaGroup and MediaController + // media controller + // attribute DOMString mediaGroup; + // attribute MediaController? controller; + + // controls + [CEReactions, SetterThrows] + attribute boolean controls; + [SetterThrows] + attribute double volume; + attribute boolean muted; + [CEReactions, SetterThrows] + attribute boolean defaultMuted; + + // TODO: Bug 847379 + // tracks + [Pref="media.track.enabled"] + readonly attribute AudioTrackList audioTracks; + [Pref="media.track.enabled"] + readonly attribute VideoTrackList videoTracks; + readonly attribute TextTrackList? textTracks; + TextTrack addTextTrack(TextTrackKind kind, + optional DOMString label = "", + optional DOMString language = ""); +}; + +// Mozilla extensions: +partial interface HTMLMediaElement { + [Func="HasDebuggerOrTabsPrivilege"] + readonly attribute MediaSource? mozMediaSourceObject; + + [Func="HasDebuggerOrTabsPrivilege", NewObject] + Promise<HTMLMediaElementDebugInfo> mozRequestDebugInfo(); + + [Func="HasDebuggerOrTabsPrivilege", NewObject] + static undefined mozEnableDebugLog(); + [Func="HasDebuggerOrTabsPrivilege", NewObject] + Promise<DOMString> mozRequestDebugLog(); + + attribute MediaStream? srcObject; + + attribute boolean preservesPitch; + + // NB: for internal use with the video controls: + [Func="IsChromeOrUAWidget"] attribute boolean mozAllowCasting; + [Func="IsChromeOrUAWidget"] attribute boolean mozIsCasting; + + // Mozilla extension: stream capture + [Throws] + MediaStream mozCaptureStream(); + [Throws] + MediaStream mozCaptureStreamUntilEnded(); + readonly attribute boolean mozAudioCaptured; + + // Mozilla extension: return embedded metadata from the stream as a + // JSObject with key:value pairs for each tag. This can be used by + // player interfaces to display the song title, artist, etc. + [Throws] + object? mozGetMetadata(); + + // Mozilla extension: provides access to the fragment end time if + // the media element has a fragment URI for the currentSrc, otherwise + // it is equal to the media duration. + readonly attribute double mozFragmentEnd; +}; + +// Encrypted Media Extensions +partial interface HTMLMediaElement { + readonly attribute MediaKeys? mediaKeys; + + // undefined, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457 + [NewObject] + Promise<undefined> setMediaKeys(MediaKeys? mediaKeys); + + attribute EventHandler onencrypted; + + attribute EventHandler onwaitingforkey; +}; + +/** + * These attributes are general testing attributes and they should only be used + * in tests. + */ +partial interface HTMLMediaElement { + [Pref="media.useAudioChannelService.testing"] + readonly attribute double computedVolume; + + [Pref="media.useAudioChannelService.testing"] + readonly attribute boolean computedMuted; + + // Return true if the media is suspended because its document is inactive or + // the docshell is inactive and explicitly being set to prohibit all media + // from playing. + [ChromeOnly] + readonly attribute boolean isSuspendedByInactiveDocOrDocShell; +}; + +/* + * HTMLMediaElement::seekToNextFrame() is a Mozilla experimental feature. + * + * The SeekToNextFrame() method provides a way to access a video element's video + * frames one by one without going through the realtime playback. So, it lets + * authors use "frame" as unit to access the video element's underlying data, + * instead of "time". + * + * The SeekToNextFrame() is a kind of seek operation, so normally, once it is + * invoked, a "seeking" event is dispatched. However, if the media source has no + * video data or is not seekable, the operation is ignored without filing the + * "seeking" event. + * + * Once the SeekToNextFrame() is done, a "seeked" event should always be filed + * and a "ended" event might also be filed depends on where the media element's + * position before seeking was. There are two cases: + * Assume the media source has n+1 video frames where n is a non-negative + * integers and the frame sequence is indexed from zero. + * (1) If the currentTime is at anywhere smaller than the n-th frame's beginning + * time, say the currentTime is now pointing to a position which is smaller + * than the x-th frame's beginning time and larger or equal to the (x-1)-th + * frame's beginning time, where x belongs to [1, n], then the + * SeekToNextFrame() operation seeks the media to the x-th frame, sets the + * media's currentTime to the x-th frame's beginning time and dispatches a + * "seeked" event. + * (2) Otherwise, if the currentTime is larger or equal to the n-th frame's + * beginning time, then the SeekToNextFrame() operation sets the media's + * currentTime to the duration of the media source and dispatches a "seeked" + * event and an "ended" event. + */ +partial interface HTMLMediaElement { + [NewObject, Pref="media.seekToNextFrame.enabled"] + Promise<undefined> seekToNextFrame(); +}; + +/* Internal testing only API */ +partial interface HTMLMediaElement { + // These APIs are used to simulate visibility changes to help debug and write + // tests about suspend-video-decoding. + // - SetVisible() is for simulating visibility changes. + // - HasSuspendTaint() is for querying that the element's decoder cannot suspend + // video decoding because it has been tainted by an operation, such as + // drawImage(). + // - isInViewPort is a boolean value which indicate whether media element is + // in view port. + // - isVideoDecodingSuspended() is used to know whether video decoding has + // suspended. + [Pref="media.test.video-suspend"] + undefined setVisible(boolean aVisible); + + [Pref="media.test.video-suspend"] + boolean hasSuspendTaint(); + + [ChromeOnly] + readonly attribute boolean isInViewPort; + + [ChromeOnly] + readonly attribute boolean isVideoDecodingSuspended; + + [ChromeOnly] + readonly attribute double totalVideoPlayTime; + + [ChromeOnly] + readonly attribute double totalVideoHDRPlayTime; + + [ChromeOnly] + readonly attribute double visiblePlayTime; + + [ChromeOnly] + readonly attribute double invisiblePlayTime; + + [ChromeOnly] + readonly attribute double videoDecodeSuspendedTime; + + [ChromeOnly] + readonly attribute double totalAudioPlayTime; + + [ChromeOnly] + readonly attribute double audiblePlayTime; + + [ChromeOnly] + readonly attribute double inaudiblePlayTime; + + [ChromeOnly] + readonly attribute double mutedPlayTime; + + // These APIs are used for decoder doctor tests. + [ChromeOnly] + undefined setFormatDiagnosticsReportForMimeType(DOMString mimeType, DecoderDoctorReportType error); + + [Throws, ChromeOnly] + undefined setDecodeError(DOMString error); + + [ChromeOnly] + undefined setAudioSinkFailedStartup(); +}; + +/* Audio Output Devices API + * https://w3c.github.io/mediacapture-output/ + */ +partial interface HTMLMediaElement { + [SecureContext, Pref="media.setsinkid.enabled"] + readonly attribute DOMString sinkId; + [NewObject, SecureContext, Pref="media.setsinkid.enabled"] + Promise<undefined> setSinkId(DOMString sinkId); +}; + +/* + * API that exposes whether a call to HTMLMediaElement.play() would be + * blocked by autoplay policies; whether the promise returned by play() + * would be rejected with NotAllowedError. + */ +partial interface HTMLMediaElement { + [Pref="media.allowed-to-play.enabled"] + readonly attribute boolean allowedToPlay; +}; diff --git a/dom/webidl/HTMLMenuElement.webidl b/dom/webidl/HTMLMenuElement.webidl new file mode 100644 index 0000000000..6fdfd5a1b9 --- /dev/null +++ b/dom/webidl/HTMLMenuElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/grouping-content.html#the-menu-element + * https://html.spec.whatwg.org/multipage/obsolete.html#HTMLMenuElement-partial + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// https://html.spec.whatwg.org/multipage/grouping-content.html#the-menu-element +[Exposed=Window] +interface HTMLMenuElement : HTMLElement { + [HTMLConstructor] constructor(); +}; + +// https://html.spec.whatwg.org/multipage/obsolete.html#HTMLMenuElement-partial +partial interface HTMLMenuElement { + [CEReactions, SetterThrows] + attribute boolean compact; +}; diff --git a/dom/webidl/HTMLMetaElement.webidl b/dom/webidl/HTMLMetaElement.webidl new file mode 100644 index 0000000000..1598ea37f6 --- /dev/null +++ b/dom/webidl/HTMLMetaElement.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-meta-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// https://html.spec.whatwg.org/#the-meta-element +[Exposed=Window] +interface HTMLMetaElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute DOMString name; + [CEReactions, SetterThrows, Pure] + attribute DOMString httpEquiv; + [CEReactions, SetterThrows, Pure] + attribute DOMString content; + [CEReactions, SetterThrows, Pure] + attribute DOMString media; +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLMetaElement { + [CEReactions, SetterThrows, Pure] + attribute DOMString scheme; +}; diff --git a/dom/webidl/HTMLMeterElement.webidl b/dom/webidl/HTMLMeterElement.webidl new file mode 100644 index 0000000000..a9d3a18150 --- /dev/null +++ b/dom/webidl/HTMLMeterElement.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-meter-element + * + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-meter-element +[Exposed=Window] +interface HTMLMeterElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute double value; + [CEReactions, SetterThrows] + attribute double min; + [CEReactions, SetterThrows] + attribute double max; + [CEReactions, SetterThrows] + attribute double low; + [CEReactions, SetterThrows] + attribute double high; + [CEReactions, SetterThrows] + attribute double optimum; + readonly attribute NodeList labels; +}; diff --git a/dom/webidl/HTMLModElement.webidl b/dom/webidl/HTMLModElement.webidl new file mode 100644 index 0000000000..afc040123b --- /dev/null +++ b/dom/webidl/HTMLModElement.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#attributes-common-to-ins-and-del-elements + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#attributes-common-to-ins-and-del-elements +[Exposed=Window] +interface HTMLModElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute DOMString cite; + [CEReactions, SetterThrows, Pure] + attribute DOMString dateTime; +}; diff --git a/dom/webidl/HTMLOListElement.webidl b/dom/webidl/HTMLOListElement.webidl new file mode 100644 index 0000000000..269c4bfd1e --- /dev/null +++ b/dom/webidl/HTMLOListElement.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-ol-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-ol-element +[Exposed=Window] +interface HTMLOListElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute boolean reversed; + [CEReactions, SetterThrows] + attribute long start; + [CEReactions, SetterThrows] + attribute DOMString type; +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLOListElement { + [CEReactions, SetterThrows] + attribute boolean compact; +}; diff --git a/dom/webidl/HTMLObjectElement.webidl b/dom/webidl/HTMLObjectElement.webidl new file mode 100644 index 0000000000..ffea83e0da --- /dev/null +++ b/dom/webidl/HTMLObjectElement.webidl @@ -0,0 +1,115 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-object-element + * http://www.whatwg.org/specs/web-apps/current-work/#HTMLObjectElement-partial + * + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-object-element +[Exposed=Window] +interface HTMLObjectElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, Pure, SetterThrows] + attribute DOMString data; + [CEReactions, Pure, SetterThrows] + attribute DOMString type; + [CEReactions, Pure, SetterThrows] + attribute DOMString name; + [CEReactions, Pure, SetterThrows] + attribute DOMString useMap; + [Pure] + readonly attribute HTMLFormElement? form; + [CEReactions, Pure, SetterThrows] + attribute DOMString width; + [CEReactions, Pure, SetterThrows] + attribute DOMString height; + // Not pure: can trigger about:blank instantiation + [NeedsSubjectPrincipal] + readonly attribute Document? contentDocument; + // Not pure: can trigger about:blank instantiation + [NeedsSubjectPrincipal] + readonly attribute WindowProxy? contentWindow; + + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + [Throws] + readonly attribute DOMString validationMessage; + boolean checkValidity(); + boolean reportValidity(); + undefined setCustomValidity(DOMString error); +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#HTMLObjectElement-partial +partial interface HTMLObjectElement { + [CEReactions, Pure, SetterThrows] + attribute DOMString align; + [CEReactions, Pure, SetterThrows] + attribute DOMString archive; + [CEReactions, Pure, SetterThrows] + attribute DOMString code; + [CEReactions, Pure, SetterThrows] + attribute boolean declare; + [CEReactions, Pure, SetterThrows] + attribute unsigned long hspace; + [CEReactions, Pure, SetterThrows] + attribute DOMString standby; + [CEReactions, Pure, SetterThrows] + attribute unsigned long vspace; + [CEReactions, Pure, SetterThrows] + attribute DOMString codeBase; + [CEReactions, Pure, SetterThrows] + attribute DOMString codeType; + + [CEReactions, Pure, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString border; +}; + +partial interface HTMLObjectElement { + // GetSVGDocument + [NeedsSubjectPrincipal] + Document? getSVGDocument(); +}; + +interface mixin MozObjectLoadingContent { + // Mirrored chrome-only scriptable nsIObjectLoadingContent methods. Please + // make sure to update this list if nsIObjectLoadingContent changes. Also, + // make sure everything on here is [ChromeOnly]. + [ChromeOnly] + const unsigned long TYPE_LOADING = 0; + [ChromeOnly] + const unsigned long TYPE_DOCUMENT = 1; + [ChromeOnly] + const unsigned long TYPE_FALLBACK = 2; + + /** + * The actual mime type (the one we got back from the network + * request) for the element. + */ + [ChromeOnly] + readonly attribute DOMString actualType; + + /** + * Gets the type of the content that's currently loaded. See + * the constants above for the list of possible values. + */ + [ChromeOnly] + readonly attribute unsigned long displayedType; + + /** + * The URL of the data/src loaded in the object. This may be null (i.e. + * an <embed> with no src). + */ + [ChromeOnly] + readonly attribute URI? srcURI; +}; + +HTMLObjectElement includes MozFrameLoaderOwner; +HTMLObjectElement includes MozObjectLoadingContent; diff --git a/dom/webidl/HTMLOptGroupElement.webidl b/dom/webidl/HTMLOptGroupElement.webidl new file mode 100644 index 0000000000..926c59a31d --- /dev/null +++ b/dom/webidl/HTMLOptGroupElement.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-optgroup-element + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLOptGroupElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute boolean disabled; + [CEReactions, SetterThrows] + attribute DOMString label; +}; diff --git a/dom/webidl/HTMLOptionElement.webidl b/dom/webidl/HTMLOptionElement.webidl new file mode 100644 index 0000000000..277ff8ad10 --- /dev/null +++ b/dom/webidl/HTMLOptionElement.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-option-element + * + * © 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. + */ + +[LegacyFactoryFunction=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false), + Exposed=Window] +interface HTMLOptionElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute boolean disabled; + readonly attribute HTMLFormElement? form; + [CEReactions, SetterThrows] + attribute DOMString label; + [CEReactions, SetterThrows] + attribute boolean defaultSelected; + attribute boolean selected; + [CEReactions, SetterThrows] + attribute DOMString value; + + [CEReactions, SetterThrows] + attribute DOMString text; + readonly attribute long index; +}; diff --git a/dom/webidl/HTMLOptionsCollection.webidl b/dom/webidl/HTMLOptionsCollection.webidl new file mode 100644 index 0000000000..dc2302b641 --- /dev/null +++ b/dom/webidl/HTMLOptionsCollection.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-html5-20120329/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface HTMLOptionsCollection : HTMLCollection { + [CEReactions, SetterThrows] + attribute unsigned long length; + [CEReactions, Throws] + setter undefined (unsigned long index, HTMLOptionElement? option); + [CEReactions, Throws] + undefined add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null); + [CEReactions] + undefined remove(long index); + attribute long selectedIndex; +}; diff --git a/dom/webidl/HTMLOutputElement.webidl b/dom/webidl/HTMLOutputElement.webidl new file mode 100644 index 0000000000..a218242432 --- /dev/null +++ b/dom/webidl/HTMLOutputElement.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-output-element + * + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-output-element +[Exposed=Window] +interface HTMLOutputElement : HTMLElement { + [HTMLConstructor] constructor(); + + [PutForwards=value, Constant] + readonly attribute DOMTokenList htmlFor; + readonly attribute HTMLFormElement? form; + [CEReactions, SetterThrows, Pure] + attribute DOMString name; + + [Constant] + readonly attribute DOMString type; + [CEReactions, SetterThrows, Pure] + attribute DOMString defaultValue; + [CEReactions, SetterThrows, Pure] + attribute DOMString value; + + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + [Throws] + readonly attribute DOMString validationMessage; + boolean checkValidity(); + boolean reportValidity(); + undefined setCustomValidity(DOMString error); + + readonly attribute NodeList labels; +}; diff --git a/dom/webidl/HTMLParagraphElement.webidl b/dom/webidl/HTMLParagraphElement.webidl new file mode 100644 index 0000000000..f5d0bfd36a --- /dev/null +++ b/dom/webidl/HTMLParagraphElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-p-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-p-element +[Exposed=Window] +interface HTMLParagraphElement : HTMLElement { + [HTMLConstructor] constructor(); + +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLParagraphElement { + [CEReactions, SetterThrows] + attribute DOMString align; +}; diff --git a/dom/webidl/HTMLParamElement.webidl b/dom/webidl/HTMLParamElement.webidl new file mode 100644 index 0000000000..1fadfc6da6 --- /dev/null +++ b/dom/webidl/HTMLParamElement.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-param-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-param-element +[Exposed=Window] +interface HTMLParamElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute DOMString name; + [CEReactions, SetterThrows, Pure] + attribute DOMString value; +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLParamElement { + [CEReactions, SetterThrows, Pure] + attribute DOMString type; + [CEReactions, SetterThrows, Pure] + attribute DOMString valueType; +}; diff --git a/dom/webidl/HTMLPictureElement.webidl b/dom/webidl/HTMLPictureElement.webidl new file mode 100644 index 0000000000..520ff9e011 --- /dev/null +++ b/dom/webidl/HTMLPictureElement.webidl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface HTMLPictureElement : HTMLElement { + [HTMLConstructor] constructor(); + +}; diff --git a/dom/webidl/HTMLPreElement.webidl b/dom/webidl/HTMLPreElement.webidl new file mode 100644 index 0000000000..f13fc85195 --- /dev/null +++ b/dom/webidl/HTMLPreElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-pre-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-pre-element +[Exposed=Window] +interface HTMLPreElement : HTMLElement { + [HTMLConstructor] constructor(); + +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLPreElement { + [CEReactions, SetterThrows] + attribute long width; +}; diff --git a/dom/webidl/HTMLProgressElement.webidl b/dom/webidl/HTMLProgressElement.webidl new file mode 100644 index 0000000000..e5326375ff --- /dev/null +++ b/dom/webidl/HTMLProgressElement.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-progress-element + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLProgressElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute double value; + [CEReactions, SetterThrows] + attribute double max; + readonly attribute double position; + readonly attribute NodeList labels; +}; diff --git a/dom/webidl/HTMLQuoteElement.webidl b/dom/webidl/HTMLQuoteElement.webidl new file mode 100644 index 0000000000..08498e5174 --- /dev/null +++ b/dom/webidl/HTMLQuoteElement.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-blockquote-element + * + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-blockquote-element +[Exposed=Window] +interface HTMLQuoteElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute DOMString cite; +}; diff --git a/dom/webidl/HTMLScriptElement.webidl b/dom/webidl/HTMLScriptElement.webidl new file mode 100644 index 0000000000..aa23d920df --- /dev/null +++ b/dom/webidl/HTMLScriptElement.webidl @@ -0,0 +1,53 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-script-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + */ + +[Exposed=Window] +interface HTMLScriptElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString src; + [CEReactions, SetterThrows] + attribute DOMString type; + [CEReactions, SetterThrows] + attribute boolean noModule; + [CEReactions, SetterThrows] + attribute DOMString charset; + [CEReactions, SetterThrows] + attribute boolean async; + [CEReactions, SetterThrows] + attribute boolean defer; + [CEReactions, SetterThrows] + attribute DOMString? crossOrigin; + [CEReactions, SetterThrows] + attribute DOMString referrerPolicy; + [CEReactions, Throws] + attribute DOMString text; + [Pref="dom.element.blocking.enabled", SameObject, PutForwards=value] + readonly attribute DOMTokenList blocking; + [Pref="network.fetchpriority.enabled", CEReactions] + attribute DOMString fetchPriority; + + static boolean supports(DOMString type); +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLScriptElement { + [CEReactions, SetterThrows] + attribute DOMString event; + [CEReactions, SetterThrows] + attribute DOMString htmlFor; +}; + +// https://w3c.github.io/webappsec/specs/subresourceintegrity/#htmlscriptelement-1 +partial interface HTMLScriptElement { + [CEReactions, SetterThrows] + attribute DOMString integrity; +}; diff --git a/dom/webidl/HTMLSelectElement.webidl b/dom/webidl/HTMLSelectElement.webidl new file mode 100644 index 0000000000..88d7f5b830 --- /dev/null +++ b/dom/webidl/HTMLSelectElement.webidl @@ -0,0 +1,82 @@ +/* -*- 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/html/#the-select-element + */ + +[Exposed=Window] +interface HTMLSelectElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute DOMString autocomplete; + [CEReactions, SetterThrows, Pure] + attribute boolean disabled; + [Pure] + readonly attribute HTMLFormElement? form; + [CEReactions, SetterThrows, Pure] + attribute boolean multiple; + [CEReactions, SetterThrows, Pure] + attribute DOMString name; + [CEReactions, SetterThrows, Pure] + attribute boolean required; + [CEReactions, SetterThrows, Pure] + attribute unsigned long size; + + [Pure] + readonly attribute DOMString type; + + [Constant] + readonly attribute HTMLOptionsCollection options; + [CEReactions, SetterThrows, Pure] + attribute unsigned long length; + getter Element? item(unsigned long index); + HTMLOptionElement? namedItem(DOMString name); + [CEReactions, Throws] + undefined add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null); + [CEReactions] + undefined remove(long index); + [CEReactions, Throws] + setter undefined (unsigned long index, HTMLOptionElement? option); + + readonly attribute HTMLCollection selectedOptions; + [Pure] + attribute long selectedIndex; + [Pure] + attribute DOMString value; + + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + [Throws] + readonly attribute DOMString validationMessage; + boolean checkValidity(); + boolean reportValidity(); + undefined setCustomValidity(DOMString error); + + [Throws, Pref="dom.select.showPicker.enabled"] + undefined showPicker(); + + readonly attribute NodeList labels; + + // https://www.w3.org/Bugs/Public/show_bug.cgi?id=20720 + [CEReactions] + undefined remove(); +}; + +// Chrome only interface + +partial interface HTMLSelectElement { + [ChromeOnly] + undefined userFinishedInteracting(boolean changed); + [ChromeOnly, Pure] + readonly attribute boolean isCombobox; + [ChromeOnly] + attribute boolean openInParentProcess; + [ChromeOnly] + AutocompleteInfo getAutocompleteInfo(); + [ChromeOnly] + attribute DOMString previewValue; +}; diff --git a/dom/webidl/HTMLSlotElement.webidl b/dom/webidl/HTMLSlotElement.webidl new file mode 100644 index 0000000000..5a26ed7a5a --- /dev/null +++ b/dom/webidl/HTMLSlotElement.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/forms.html#the-dialog-element + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLSlotElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] attribute DOMString name; + sequence<Node> assignedNodes(optional AssignedNodesOptions options = {}); + sequence<Element> assignedElements(optional AssignedNodesOptions options = {}); + undefined assign((Element or Text)... nodes); +}; + +dictionary AssignedNodesOptions { + boolean flatten = false; +}; diff --git a/dom/webidl/HTMLSourceElement.webidl b/dom/webidl/HTMLSourceElement.webidl new file mode 100644 index 0000000000..4917e57c8e --- /dev/null +++ b/dom/webidl/HTMLSourceElement.webidl @@ -0,0 +1,35 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-source-element + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface HTMLSourceElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString src; + [CEReactions, SetterThrows] + attribute DOMString type; +}; + +partial interface HTMLSourceElement { + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows] + attribute DOMString srcset; + [CEReactions, SetterThrows] + attribute DOMString sizes; + [CEReactions, SetterThrows] + attribute DOMString media; + [CEReactions, SetterThrows] + attribute unsigned long width; + [CEReactions, SetterThrows] + attribute unsigned long height; +}; diff --git a/dom/webidl/HTMLSpanElement.webidl b/dom/webidl/HTMLSpanElement.webidl new file mode 100644 index 0000000000..e9215bc37a --- /dev/null +++ b/dom/webidl/HTMLSpanElement.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-span-element + * + * © 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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-span-element +[Exposed=Window, ProbablyShortLivingWrapper] +interface HTMLSpanElement : HTMLElement { + [HTMLConstructor] constructor(); +}; diff --git a/dom/webidl/HTMLStyleElement.webidl b/dom/webidl/HTMLStyleElement.webidl new file mode 100644 index 0000000000..2e0b8bed12 --- /dev/null +++ b/dom/webidl/HTMLStyleElement.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-style-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + */ + +[Exposed=Window] +interface HTMLStyleElement : HTMLElement { + [HTMLConstructor] constructor(); + + [Pure] + attribute boolean disabled; + [CEReactions, SetterThrows, Pure] + attribute DOMString media; + [CEReactions, SetterThrows, Pure] + attribute DOMString type; + [Pref="dom.element.blocking.enabled", SameObject, PutForwards=value] + readonly attribute DOMTokenList blocking; +}; +HTMLStyleElement includes LinkStyle; + +// Mozilla-specific additions to support devtools +partial interface HTMLStyleElement { + /** + * Mark this style element with a devtools-specific principal that + * skips Content Security Policy unsafe-inline checks. This triggering + * principal will be overwritten by any callers that set textContent + * or innerHTML on this element. + */ + [ChromeOnly] + undefined setDevtoolsAsTriggeringPrincipal(); +}; diff --git a/dom/webidl/HTMLTableCaptionElement.webidl b/dom/webidl/HTMLTableCaptionElement.webidl new file mode 100644 index 0000000000..6112fe6f31 --- /dev/null +++ b/dom/webidl/HTMLTableCaptionElement.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.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. + */ + +[Exposed=Window] +interface HTMLTableCaptionElement : HTMLElement { + [HTMLConstructor] constructor(); +}; + +partial interface HTMLTableCaptionElement { + [CEReactions, SetterThrows] + attribute DOMString align; +}; diff --git a/dom/webidl/HTMLTableCellElement.webidl b/dom/webidl/HTMLTableCellElement.webidl new file mode 100644 index 0000000000..29ac38a25e --- /dev/null +++ b/dom/webidl/HTMLTableCellElement.webidl @@ -0,0 +1,55 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * 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. + */ + +[Exposed=Window] +interface HTMLTableCellElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute unsigned long colSpan; + [CEReactions, SetterThrows] + attribute unsigned long rowSpan; + //[PutForwards=value] readonly attribute DOMTokenList headers; + [CEReactions, SetterThrows] + attribute DOMString headers; + readonly attribute long cellIndex; + + // Mozilla-specific extensions + [CEReactions, SetterThrows] + attribute DOMString abbr; + [CEReactions, SetterThrows] + attribute DOMString scope; +}; + +partial interface HTMLTableCellElement { + [CEReactions, SetterThrows] + attribute DOMString align; + [CEReactions, SetterThrows] + attribute DOMString axis; + [CEReactions, SetterThrows] + attribute DOMString height; + [CEReactions, SetterThrows] + attribute DOMString width; + + [CEReactions, SetterThrows] + attribute DOMString ch; + [CEReactions, SetterThrows] + attribute DOMString chOff; + [CEReactions, SetterThrows] + attribute boolean noWrap; + [CEReactions, SetterThrows] + attribute DOMString vAlign; + + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString bgColor; +}; diff --git a/dom/webidl/HTMLTableColElement.webidl b/dom/webidl/HTMLTableColElement.webidl new file mode 100644 index 0000000000..c17a78c925 --- /dev/null +++ b/dom/webidl/HTMLTableColElement.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.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. + */ + +[Exposed=Window] +interface HTMLTableColElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute unsigned long span; +}; + +partial interface HTMLTableColElement { + [CEReactions, SetterThrows] + attribute DOMString align; + [CEReactions, SetterThrows] + attribute DOMString ch; + [CEReactions, SetterThrows] + attribute DOMString chOff; + [CEReactions, SetterThrows] + attribute DOMString vAlign; + [CEReactions, SetterThrows] + attribute DOMString width; +}; diff --git a/dom/webidl/HTMLTableElement.webidl b/dom/webidl/HTMLTableElement.webidl new file mode 100644 index 0000000000..59f7e7bf41 --- /dev/null +++ b/dom/webidl/HTMLTableElement.webidl @@ -0,0 +1,64 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://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. + */ + +[Exposed=Window] +interface HTMLTableElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute HTMLTableCaptionElement? caption; + HTMLElement createCaption(); + [CEReactions] + undefined deleteCaption(); + [CEReactions, SetterThrows] + attribute HTMLTableSectionElement? tHead; + HTMLElement createTHead(); + [CEReactions] + undefined deleteTHead(); + [CEReactions, SetterThrows] + attribute HTMLTableSectionElement? tFoot; + HTMLElement createTFoot(); + [CEReactions] + undefined deleteTFoot(); + readonly attribute HTMLCollection tBodies; + HTMLElement createTBody(); + readonly attribute HTMLCollection rows; + [Throws] + HTMLElement insertRow(optional long index = -1); + [CEReactions, Throws] + undefined deleteRow(long index); + // attribute boolean sortable; + //undefined stopSorting(); +}; + +partial interface HTMLTableElement { + [CEReactions, SetterThrows] + attribute DOMString align; + [CEReactions, SetterThrows] + attribute DOMString border; + [CEReactions, SetterThrows] + attribute DOMString frame; + [CEReactions, SetterThrows] + attribute DOMString rules; + [CEReactions, SetterThrows] + attribute DOMString summary; + [CEReactions, SetterThrows] + attribute DOMString width; + + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString bgColor; + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString cellPadding; + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString cellSpacing; +}; diff --git a/dom/webidl/HTMLTableRowElement.webidl b/dom/webidl/HTMLTableRowElement.webidl new file mode 100644 index 0000000000..b1cc297b97 --- /dev/null +++ b/dom/webidl/HTMLTableRowElement.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * 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. + */ + +[Exposed=Window] +interface HTMLTableRowElement : HTMLElement { + [HTMLConstructor] constructor(); + + readonly attribute long rowIndex; + readonly attribute long sectionRowIndex; + readonly attribute HTMLCollection cells; + [Throws] + HTMLElement insertCell(optional long index = -1); + [CEReactions, Throws] + undefined deleteCell(long index); +}; + +partial interface HTMLTableRowElement { + [CEReactions, SetterThrows] + attribute DOMString align; + [CEReactions, SetterThrows] + attribute DOMString ch; + [CEReactions, SetterThrows] + attribute DOMString chOff; + [CEReactions, SetterThrows] + attribute DOMString vAlign; + + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString bgColor; +}; diff --git a/dom/webidl/HTMLTableSectionElement.webidl b/dom/webidl/HTMLTableSectionElement.webidl new file mode 100644 index 0000000000..476c908e07 --- /dev/null +++ b/dom/webidl/HTMLTableSectionElement.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://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. + */ + +[Exposed=Window] +interface HTMLTableSectionElement : HTMLElement { + [HTMLConstructor] constructor(); + + readonly attribute HTMLCollection rows; + [Throws] + HTMLElement insertRow(optional long index = -1); + [CEReactions, Throws] + undefined deleteRow(long index); +}; + +partial interface HTMLTableSectionElement { + [CEReactions, SetterThrows] + attribute DOMString align; + [CEReactions, SetterThrows] + attribute DOMString ch; + [CEReactions, SetterThrows] + attribute DOMString chOff; + [CEReactions, SetterThrows] + attribute DOMString vAlign; +}; diff --git a/dom/webidl/HTMLTemplateElement.webidl b/dom/webidl/HTMLTemplateElement.webidl new file mode 100644 index 0000000000..ce71a51fe5 --- /dev/null +++ b/dom/webidl/HTMLTemplateElement.webidl @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/scripting.html#the-template-element + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface HTMLTemplateElement : HTMLElement { + [HTMLConstructor] constructor(); + + readonly attribute DocumentFragment content; + [CEReactions, Pref="dom.webcomponents.shadowdom.declarative.enabled"] + attribute DOMString shadowRootMode; + [CEReactions, Pref="dom.webcomponents.shadowdom.declarative.enabled"] + attribute boolean shadowRootDelegatesFocus; +}; diff --git a/dom/webidl/HTMLTextAreaElement.webidl b/dom/webidl/HTMLTextAreaElement.webidl new file mode 100644 index 0000000000..bb9ed49d15 --- /dev/null +++ b/dom/webidl/HTMLTextAreaElement.webidl @@ -0,0 +1,95 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-textarea-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +interface nsIEditor; +interface XULControllers; + +[Exposed=Window] +interface HTMLTextAreaElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute DOMString autocomplete; + [CEReactions, SetterThrows, Pure] + attribute unsigned long cols; + [CEReactions, Pure, SetterThrows] + attribute DOMString dirName; + [CEReactions, SetterThrows, Pure] + attribute boolean disabled; + [Pure] + readonly attribute HTMLFormElement? form; + // attribute DOMString inputMode; + [CEReactions, SetterThrows, Pure] + attribute long maxLength; + [CEReactions, SetterThrows, Pure] + attribute long minLength; + [CEReactions, SetterThrows, Pure] + attribute DOMString name; + [CEReactions, SetterThrows, Pure] + attribute DOMString placeholder; + [CEReactions, SetterThrows, Pure] + attribute boolean readOnly; + [CEReactions, SetterThrows, Pure] + attribute boolean required; + [CEReactions, SetterThrows, Pure] + attribute unsigned long rows; + [CEReactions, SetterThrows, Pure] + attribute DOMString wrap; + + [Constant] + readonly attribute DOMString type; + [CEReactions, Throws, Pure] + attribute DOMString defaultValue; + [CEReactions, SetterThrows] attribute [LegacyNullToEmptyString] DOMString value; + [BinaryName="getTextLength"] + readonly attribute unsigned long textLength; + + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + [Throws] + readonly attribute DOMString validationMessage; + boolean checkValidity(); + boolean reportValidity(); + undefined setCustomValidity(DOMString error); + + readonly attribute NodeList labels; + + undefined select(); + [Throws] + attribute unsigned long? selectionStart; + [Throws] + attribute unsigned long? selectionEnd; + [Throws] + attribute DOMString? selectionDirection; + [Throws] + undefined setRangeText(DOMString replacement); + [Throws] + undefined setRangeText(DOMString replacement, unsigned long start, + unsigned long end, optional SelectionMode selectionMode = "preserve"); + [Throws] + undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); +}; + +partial interface HTMLTextAreaElement { + // Chrome-only Mozilla extensions + + [Throws, ChromeOnly] + readonly attribute XULControllers controllers; +}; + +HTMLTextAreaElement includes MozEditableElement; + +partial interface HTMLTextAreaElement { + [ChromeOnly] + attribute DOMString previewValue; +}; diff --git a/dom/webidl/HTMLTimeElement.webidl b/dom/webidl/HTMLTimeElement.webidl new file mode 100644 index 0000000000..3f0d8733eb --- /dev/null +++ b/dom/webidl/HTMLTimeElement.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-time-element + */ + +[Exposed=Window] +interface HTMLTimeElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute DOMString dateTime; +}; diff --git a/dom/webidl/HTMLTitleElement.webidl b/dom/webidl/HTMLTitleElement.webidl new file mode 100644 index 0000000000..25f4b9fbef --- /dev/null +++ b/dom/webidl/HTMLTitleElement.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-title-element + */ + +[Exposed=Window] +interface HTMLTitleElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, Throws] + attribute DOMString text; +}; diff --git a/dom/webidl/HTMLTrackElement.webidl b/dom/webidl/HTMLTrackElement.webidl new file mode 100644 index 0000000000..9c97e2092c --- /dev/null +++ b/dom/webidl/HTMLTrackElement.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-track-element + */ + +[Exposed=Window] +interface HTMLTrackElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute DOMString kind; + [CEReactions, SetterThrows, Pure] + attribute DOMString src; + [CEReactions, SetterThrows, Pure] + attribute DOMString srclang; + [CEReactions, SetterThrows, Pure] + attribute DOMString label; + [CEReactions, SetterThrows, Pure] + attribute boolean default; + + const unsigned short NONE = 0; + const unsigned short LOADING = 1; + const unsigned short LOADED = 2; + const unsigned short ERROR = 3; + + [BinaryName="readyStateForBindings"] + readonly attribute unsigned short readyState; + + readonly attribute TextTrack? track; +}; diff --git a/dom/webidl/HTMLUListElement.webidl b/dom/webidl/HTMLUListElement.webidl new file mode 100644 index 0000000000..447524c48c --- /dev/null +++ b/dom/webidl/HTMLUListElement.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-ul-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#the-ul-element +[Exposed=Window] +interface HTMLUListElement : HTMLElement { + [HTMLConstructor] constructor(); + +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLUListElement { + [CEReactions, SetterThrows] + attribute boolean compact; + [CEReactions, SetterThrows] + attribute DOMString type; +}; diff --git a/dom/webidl/HTMLVideoElement.webidl b/dom/webidl/HTMLVideoElement.webidl new file mode 100644 index 0000000000..a120d23e42 --- /dev/null +++ b/dom/webidl/HTMLVideoElement.webidl @@ -0,0 +1,87 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-video-element + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window, + InstrumentedProps=(cancelVideoFrameCallback, + onenterpictureinpicture, + onleavepictureinpicture, + playsInline, + requestPictureInPicture, + requestVideoFrameCallback)] +interface HTMLVideoElement : HTMLMediaElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute unsigned long width; + [CEReactions, SetterThrows] + attribute unsigned long height; + readonly attribute unsigned long videoWidth; + readonly attribute unsigned long videoHeight; + [CEReactions, SetterThrows] + attribute DOMString poster; +}; + +partial interface HTMLVideoElement { + // A count of the number of video frames that have demuxed from the media + // resource. If we were playing perfectly, we'd be able to paint this many + // frames. + readonly attribute unsigned long mozParsedFrames; + + // A count of the number of frames that have been decoded. We may drop + // frames if the decode is taking too much time. + readonly attribute unsigned long mozDecodedFrames; + + // A count of the number of frames that have been presented to the rendering + // pipeline. We may drop frames if they arrive late at the renderer. + readonly attribute unsigned long mozPresentedFrames; + + // Number of presented frames which were painted on screen. + readonly attribute unsigned long mozPaintedFrames; + + // Time which the last painted video frame was late by, in seconds. + readonly attribute double mozFrameDelay; + + // True if the video has an audio track available. + readonly attribute boolean mozHasAudio; + + // Clones the frames playing in this <video> to the target. Cloning ends + // when either node is removed from their DOM trees. Throws if one or + // both <video> elements are not attached to a DOM tree. + // Returns a promise that resolves when the target's ImageContainer has been + // installed in this <video>'s MediaDecoder, or selected video + // MediaStreamTrack, whichever is available first. Note that it might never + // resolve. + [NewObject, Func="IsChromeOrUAWidget"] + Promise<undefined> cloneElementVisually(HTMLVideoElement target); + + // Stops a <video> from cloning visually. Does nothing if the <video> + // wasn't cloning in the first place. + [Func="IsChromeOrUAWidget"] + undefined stopCloningElementVisually(); + + // Returns true if the <video> is being cloned visually to another + // <video> element (see cloneElementVisually). + [Func="IsChromeOrUAWidget"] + readonly attribute boolean isCloningElementVisually; +}; + +// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#idl-def-HTMLVideoElement +partial interface HTMLVideoElement { + [Pref="media.mediasource.enabled", NewObject] + VideoPlaybackQuality getVideoPlaybackQuality(); +}; + +// https://w3c.github.io/picture-in-picture/#htmlvideoelement-extensions +partial interface HTMLVideoElement { + [CEReactions, SetterThrows] attribute boolean disablePictureInPicture; +}; diff --git a/dom/webidl/HashChangeEvent.webidl b/dom/webidl/HashChangeEvent.webidl new file mode 100644 index 0000000000..0a99a41018 --- /dev/null +++ b/dom/webidl/HashChangeEvent.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/#the-hashchangeevent-interface + */ + +[LegacyEventInit, + Exposed=Window] +interface HashChangeEvent : Event +{ + constructor(DOMString type, optional HashChangeEventInit eventInitDict = {}); + + readonly attribute DOMString oldURL; + readonly attribute DOMString newURL; + + undefined initHashChangeEvent(DOMString typeArg, + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional DOMString oldURLArg = "", + optional DOMString newURLArg = ""); +}; + +dictionary HashChangeEventInit : EventInit +{ + DOMString oldURL = ""; + DOMString newURL = ""; +}; diff --git a/dom/webidl/Headers.webidl b/dom/webidl/Headers.webidl new file mode 100644 index 0000000000..1460dbb4ff --- /dev/null +++ b/dom/webidl/Headers.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://fetch.spec.whatwg.org/#headers-class + */ + +typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit; + +enum HeadersGuardEnum { + "none", + "request", + "request-no-cors", + "response", + "immutable" +}; + +[Exposed=(Window,Worker)] +interface Headers { + [Throws] + constructor(optional HeadersInit init); + + [Throws] undefined append(ByteString name, ByteString value); + [Throws] undefined delete(ByteString name); + [Throws] ByteString? get(ByteString name); + sequence<ByteString> getSetCookie(); + [Throws] boolean has(ByteString name); + [Throws] undefined set(ByteString name, ByteString value); + iterable<ByteString, ByteString>; + + // Used to test different guard states from mochitest. + // Note: Must be set prior to populating headers or will throw. + [ChromeOnly, SetterThrows] attribute HeadersGuardEnum guard; +}; diff --git a/dom/webidl/Highlight.webidl b/dom/webidl/Highlight.webidl new file mode 100644 index 0000000000..e09f0aed3f --- /dev/null +++ b/dom/webidl/Highlight.webidl @@ -0,0 +1,71 @@ +/* -*- 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-highlight-api-1/ + * + * Copyright © 2021 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +/** + * Enum defining the available highlight types. + * See https://drafts.csswg.org/css-highlight-api-1/#enumdef-highlighttype + */ +enum HighlightType { + "highlight", + "spelling-error", + "grammar-error" +}; + +/** + * Definition of a highlight object, consisting of a set of ranges, + * a priority and a highlight type. + * + * See https://drafts.csswg.org/css-highlight-api-1/#highlight + */ +[Pref="dom.customHighlightAPI.enabled", Exposed=Window] +interface Highlight { + + [Throws] + constructor(AbstractRange... initialRanges); + setlike<AbstractRange>; + attribute long priority; + attribute HighlightType type; +}; + +partial interface Highlight { + // Setlike methods need to be overridden. + // Iterating a setlike is not possible from C++ yet. + // Therefore a separate data structure must be held and kept in sync. + [Throws] + undefined add(AbstractRange range); + [Throws] + undefined clear(); + [Throws] + boolean delete(AbstractRange range); +}; + +/** + * Registry object that contains all Highlights associated with a Document. + * + * See https://drafts.csswg.org/css-highlight-api-1/#highlightregistry + */ +[Pref="dom.customHighlightAPI.enabled", Exposed=Window] +interface HighlightRegistry { + maplike<DOMString, Highlight>; +}; + +partial interface HighlightRegistry { + // Maplike interface methods need to be overridden. + // Iterating a maplike is not possible from C++ yet. + // Therefore, a separate data structure must be held and kept in sync. + [Throws] + undefined set(DOMString key, Highlight value); + [Throws] + undefined clear(); + [Throws] + boolean delete(DOMString key); +}; diff --git a/dom/webidl/History.webidl b/dom/webidl/History.webidl new file mode 100644 index 0000000000..934214965d --- /dev/null +++ b/dom/webidl/History.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#the-history-interface + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +enum ScrollRestoration { "auto", "manual" }; + +[Exposed=Window] +interface History { + [Throws] + readonly attribute unsigned long length; + [Throws] + attribute ScrollRestoration scrollRestoration; + [Throws] + readonly attribute any state; + [Throws, NeedsSubjectPrincipal] + undefined go(optional long delta = 0); + [Throws, NeedsCallerType] + undefined back(); + [Throws, NeedsCallerType] + undefined forward(); + [Throws, NeedsCallerType] + undefined pushState(any data, DOMString title, optional DOMString? url = null); + [Throws, NeedsCallerType] + undefined replaceState(any data, DOMString title, optional DOMString? url = null); +}; diff --git a/dom/webidl/IDBCursor.webidl b/dom/webidl/IDBCursor.webidl new file mode 100644 index 0000000000..fe69972311 --- /dev/null +++ b/dom/webidl/IDBCursor.webidl @@ -0,0 +1,44 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/IndexedDB/#cursor-interface + */ + +enum IDBCursorDirection { + "next", + "nextunique", + "prev", + "prevunique" +}; + +[Exposed=(Window,Worker)] +interface IDBCursor { + readonly attribute (IDBObjectStore or IDBIndex) source; + + [BinaryName="getDirection"] + readonly attribute IDBCursorDirection direction; + + [Pure, Throws] readonly attribute any key; + [Pure, Throws] readonly attribute any primaryKey; + [SameObject] readonly attribute IDBRequest request; + + [Throws] + undefined advance ([EnforceRange] unsigned long count); + + [Throws] + undefined continue (optional any key); + + [Throws] + undefined continuePrimaryKey(any key, any primaryKey); + + [NewObject, Throws] IDBRequest update(any value); + [NewObject, Throws] IDBRequest delete(); +}; + +[Exposed=(Window,Worker)] +interface IDBCursorWithValue : IDBCursor { + [Pure, Throws] readonly attribute any value; +}; diff --git a/dom/webidl/IDBDatabase.webidl b/dom/webidl/IDBDatabase.webidl new file mode 100644 index 0000000000..310c662c15 --- /dev/null +++ b/dom/webidl/IDBDatabase.webidl @@ -0,0 +1,35 @@ +/* -*- 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/IndexedDB/#database-interface + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker)] +interface IDBDatabase : EventTarget { + [Constant] readonly attribute DOMString name; + readonly attribute unsigned long long version; + + readonly attribute DOMStringList objectStoreNames; + + [NewObject, Throws] + IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames, + optional IDBTransactionMode mode = "readonly"); + [NewObject, Throws] + IDBObjectStore createObjectStore( + DOMString name, + optional IDBObjectStoreParameters options = {}); + [Throws] + undefined deleteObjectStore (DOMString name); + undefined close (); + + attribute EventHandler onabort; + attribute EventHandler onclose; + attribute EventHandler onerror; + attribute EventHandler onversionchange; +}; diff --git a/dom/webidl/IDBFactory.webidl b/dom/webidl/IDBFactory.webidl new file mode 100644 index 0000000000..37143bcbb5 --- /dev/null +++ b/dom/webidl/IDBFactory.webidl @@ -0,0 +1,64 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/IndexedDB/#factory-interface + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface Principal; + +dictionary IDBOpenDBOptions +{ + [EnforceRange] unsigned long long version; +}; + +/** + * Interface that defines the indexedDB property on a window. See + * https://w3c.github.io/IndexedDB/#idbfactory + * for more information. + */ +[Exposed=(Window,Worker)] +interface IDBFactory { + [NewObject, Throws, NeedsCallerType] + IDBOpenDBRequest + open(DOMString name, + [EnforceRange] unsigned long long version); + + [NewObject, Throws, NeedsCallerType] + IDBOpenDBRequest + open(DOMString name, + optional IDBOpenDBOptions options = {}); + + [NewObject, Throws, NeedsCallerType] + IDBOpenDBRequest + deleteDatabase(DOMString name, + optional IDBOpenDBOptions options = {}); + + [Throws] + short + cmp(any first, + any second); + + [NewObject, Throws, ChromeOnly, NeedsCallerType] + IDBOpenDBRequest + openForPrincipal(Principal principal, + DOMString name, + [EnforceRange] unsigned long long version); + + [NewObject, Throws, ChromeOnly, NeedsCallerType] + IDBOpenDBRequest + openForPrincipal(Principal principal, + DOMString name, + optional IDBOpenDBOptions options = {}); + + [NewObject, Throws, ChromeOnly, NeedsCallerType] + IDBOpenDBRequest + deleteForPrincipal(Principal principal, + DOMString name, + optional IDBOpenDBOptions options = {}); +}; diff --git a/dom/webidl/IDBIndex.webidl b/dom/webidl/IDBIndex.webidl new file mode 100644 index 0000000000..92b9842c20 --- /dev/null +++ b/dom/webidl/IDBIndex.webidl @@ -0,0 +1,63 @@ +/* -*- 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/IndexedDB/#index-interface + */ + +dictionary IDBIndexParameters { + boolean unique = false; + boolean multiEntry = false; + // <null>: Not locale-aware, uses normal JS sorting. + // <string>: Always sorted based on the rules of the specified + // locale (e.g. "en-US", etc.). + // "auto": Sorted by the platform default, may change based on + // user agent options. + DOMString? locale = null; +}; + +[Exposed=(Window,Worker)] +interface IDBIndex { + [SetterThrows] attribute DOMString name; + [SameObject] readonly attribute IDBObjectStore objectStore; + + [Throws] + readonly attribute any keyPath; + + readonly attribute boolean multiEntry; + readonly attribute boolean unique; + + // <null>: Not locale-aware, uses normal JS sorting. + // <string>: Sorted based on the rules of the specified locale. + // Note: never returns "auto", only the current locale. + [Pref="dom.indexedDB.experimental"] + readonly attribute DOMString? locale; + + [Pref="dom.indexedDB.experimental"] + readonly attribute boolean isAutoLocale; + + [NewObject, Throws] IDBRequest get(any query); + [NewObject, Throws] IDBRequest getKey(any query); + + // If we decide to add use counters for the mozGetAll/mozGetAllKeys + // functions, we'll need to pull them out into sepatate operations + // with a BinaryName mapping to the same underlying implementation. + // See also bug 1577227. + [NewObject, Throws, Alias="mozGetAll"] + IDBRequest getAll(optional any query, + optional [EnforceRange] unsigned long count); + [NewObject, Throws, Alias="mozGetAllKeys"] + IDBRequest getAllKeys(optional any query, + optional [EnforceRange] unsigned long count); + + [NewObject, Throws] IDBRequest count(optional any query); + + [NewObject, Throws] + IDBRequest openCursor(optional any query, + optional IDBCursorDirection direction = "next"); + [NewObject, Throws] + IDBRequest openKeyCursor(optional any query, + optional IDBCursorDirection direction = "next"); +}; diff --git a/dom/webidl/IDBKeyRange.webidl b/dom/webidl/IDBKeyRange.webidl new file mode 100644 index 0000000000..4b94b38cb9 --- /dev/null +++ b/dom/webidl/IDBKeyRange.webidl @@ -0,0 +1,34 @@ +/* This Source Code Form is subject to the terms of 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/IndexedDB/#keyrange + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker)] +interface IDBKeyRange { + [Throws] + readonly attribute any lower; + [Throws] + readonly attribute any upper; + [Constant] + readonly attribute boolean lowerOpen; + [Constant] + readonly attribute boolean upperOpen; + [Throws] + boolean _includes(any key); + + + [NewObject, Throws] + static IDBKeyRange only (any value); + [NewObject, Throws] + static IDBKeyRange lowerBound (any lower, optional boolean open = false); + [NewObject, Throws] + static IDBKeyRange upperBound (any upper, optional boolean open = false); + [NewObject, Throws] + static IDBKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false); +}; diff --git a/dom/webidl/IDBObjectStore.webidl b/dom/webidl/IDBObjectStore.webidl new file mode 100644 index 0000000000..fc19ab99e6 --- /dev/null +++ b/dom/webidl/IDBObjectStore.webidl @@ -0,0 +1,67 @@ +/* -*- 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/IndexedDB/#object-store-interface + */ + +dictionary IDBObjectStoreParameters { + (DOMString or sequence<DOMString>)? keyPath = null; + boolean autoIncrement = false; +}; + +[Exposed=(Window,Worker)] +interface IDBObjectStore { + [SetterThrows] + attribute DOMString name; + + [Throws] + readonly attribute any keyPath; + + readonly attribute DOMStringList indexNames; + [SameObject] readonly attribute IDBTransaction transaction; + readonly attribute boolean autoIncrement; + + [NewObject, Throws] + IDBRequest put (any value, optional any key); + [NewObject, Throws] + IDBRequest add (any value, optional any key); + [NewObject, Throws] + IDBRequest delete (any key); + [NewObject, Throws] + IDBRequest clear (); + [NewObject, Throws] + IDBRequest get (any key); + [NewObject, Throws] + IDBRequest getKey (any key); + + // Success fires IDBTransactionEvent, result == array of values for given keys + // If we decide to add use a counter for the mozGetAll function, we'll need + // to pull it out into a sepatate operation with a BinaryName mapping to the + // same underlying implementation. + [NewObject, Throws, Alias="mozGetAll"] + IDBRequest getAll(optional any query, + optional [EnforceRange] unsigned long count); + [NewObject, Throws] + IDBRequest getAllKeys(optional any query, + optional [EnforceRange] unsigned long count); + + [NewObject, Throws] + IDBRequest count(optional any key); + + [NewObject, Throws] + IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next"); + [NewObject, Throws] + IDBRequest openKeyCursor(optional any query, + optional IDBCursorDirection direction = "next"); + [NewObject, Throws] + IDBIndex createIndex (DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters optionalParameters = {}); + + [Throws] + IDBIndex index (DOMString name); + + [Throws] + undefined deleteIndex (DOMString indexName); +}; diff --git a/dom/webidl/IDBOpenDBRequest.webidl b/dom/webidl/IDBOpenDBRequest.webidl new file mode 100644 index 0000000000..16bb100d45 --- /dev/null +++ b/dom/webidl/IDBOpenDBRequest.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/IndexedDB/#idbopendbrequest + */ + +[Exposed=(Window,Worker)] +interface IDBOpenDBRequest : IDBRequest { + attribute EventHandler onblocked; + + attribute EventHandler onupgradeneeded; +}; diff --git a/dom/webidl/IDBRequest.webidl b/dom/webidl/IDBRequest.webidl new file mode 100644 index 0000000000..38d3f53acc --- /dev/null +++ b/dom/webidl/IDBRequest.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/IndexedDB/#idbrequest + * https://w3c.github.io/IndexedDB/#enumdef-idbrequestreadystate + */ + +enum IDBRequestReadyState { + "pending", + "done" +}; + +[Exposed=(Window,Worker)] +interface IDBRequest : EventTarget { + [Throws] + readonly attribute any result; + + [Throws] + readonly attribute DOMException? error; + + readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source; + readonly attribute IDBTransaction? transaction; + readonly attribute IDBRequestReadyState readyState; + + attribute EventHandler onsuccess; + + attribute EventHandler onerror; +}; diff --git a/dom/webidl/IDBTransaction.webidl b/dom/webidl/IDBTransaction.webidl new file mode 100644 index 0000000000..1bb52ff448 --- /dev/null +++ b/dom/webidl/IDBTransaction.webidl @@ -0,0 +1,47 @@ +/* -*- 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/IndexedDB/#idbtransaction + * https://w3c.github.io/IndexedDB/#enumdef-idbtransactionmode + */ + +enum IDBTransactionMode { + "readonly", + "readwrite", + // The "readwriteflush" mode is only available when the + // |dom.indexedDB.experimental| pref returns + // true. This mode is not yet part of the standard. + "readwriteflush", + "cleanup", + "versionchange" +}; + +[Exposed=(Window,Worker)] +interface IDBTransaction : EventTarget { + [Throws] + readonly attribute IDBTransactionMode mode; + [SameObject] readonly attribute IDBDatabase db; + + readonly attribute DOMException? error; + + [Throws] + IDBObjectStore objectStore (DOMString name); + + [Throws] + undefined commit(); + + [Throws] + undefined abort(); + + attribute EventHandler onabort; + attribute EventHandler oncomplete; + attribute EventHandler onerror; +}; + +// This seems to be custom +partial interface IDBTransaction { + readonly attribute DOMStringList objectStoreNames; +}; diff --git a/dom/webidl/IDBVersionChangeEvent.webidl b/dom/webidl/IDBVersionChangeEvent.webidl new file mode 100644 index 0000000000..cbb7e6fb0b --- /dev/null +++ b/dom/webidl/IDBVersionChangeEvent.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/IndexedDB/#idbversionchangeevent + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary IDBVersionChangeEventInit : EventInit { + unsigned long long oldVersion = 0; + unsigned long long? newVersion = null; +}; + +[Exposed=(Window,Worker)] +interface IDBVersionChangeEvent : Event { + constructor(DOMString type, + optional IDBVersionChangeEventInit eventInitDict = {}); + + [Constant] readonly attribute unsigned long long oldVersion; + [Constant] readonly attribute unsigned long long? newVersion; +}; diff --git a/dom/webidl/IIRFilterNode.webidl b/dom/webidl/IIRFilterNode.webidl new file mode 100644 index 0000000000..0dc56f01b1 --- /dev/null +++ b/dom/webidl/IIRFilterNode.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is https://www.w3.org/TR/webaudio + * + * Copyright © 2016 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary IIRFilterOptions : AudioNodeOptions { + required sequence<double> feedforward; + required sequence<double> feedback; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface IIRFilterNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, IIRFilterOptions options); + + undefined getFrequencyResponse(Float32Array frequencyHz, Float32Array magResponse, Float32Array phaseResponse); +}; + +// Mozilla extension +IIRFilterNode includes AudioNodePassThrough; diff --git a/dom/webidl/IdentityCredential.webidl b/dom/webidl/IdentityCredential.webidl new file mode 100644 index 0000000000..801b2dc0f8 --- /dev/null +++ b/dom/webidl/IdentityCredential.webidl @@ -0,0 +1,93 @@ +/* -*- 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://fedidcg.github.io/FedCM + */ + + +[Exposed=Window, SecureContext, + Pref="dom.security.credentialmanagement.identity.enabled"] +interface IdentityCredential : Credential { + readonly attribute USVString? token; + [Throws] + static Promise<undefined> logoutRPs(sequence<IdentityCredentialLogoutRPsRequest> logoutRequests); +}; + +dictionary IdentityCredentialRequestOptions { + sequence<IdentityProviderConfig> providers; +}; + +[GenerateConversionToJS] +dictionary IdentityProviderConfig { + required UTF8String configURL; + required USVString clientId; + USVString nonce; +}; + +// https://fedidcg.github.io/FedCM/#dictdef-identityproviderwellknown +[GenerateInit] +dictionary IdentityProviderWellKnown { + required sequence<UTF8String> provider_urls; +}; + +// https://fedidcg.github.io/FedCM/#dictdef-identityprovidericon +dictionary IdentityProviderIcon { + required USVString url; + unsigned long size; +}; + +// https://fedidcg.github.io/FedCM/#dictdef-identityproviderbranding +dictionary IdentityProviderBranding { + USVString background_color; + USVString color; + sequence<IdentityProviderIcon> icons; + USVString name; +}; + +// https://fedidcg.github.io/FedCM/#dictdef-identityproviderapiconfig +[GenerateInit, GenerateConversionToJS] +dictionary IdentityProviderAPIConfig { + required UTF8String accounts_endpoint; + required UTF8String client_metadata_endpoint; + required UTF8String id_assertion_endpoint; + IdentityProviderBranding branding; +}; + + +// https://fedidcg.github.io/FedCM/#dictdef-identityprovideraccount +dictionary IdentityProviderAccount { + required USVString id; + required USVString name; + required USVString email; + USVString given_name; + USVString picture; + sequence<USVString> approved_clients; +}; + +// https://fedidcg.github.io/FedCM/#dictdef-identityprovideraccountlist +[GenerateInit, GenerateConversionToJS] +dictionary IdentityProviderAccountList { + sequence<IdentityProviderAccount> accounts; +}; + +// https://fedidcg.github.io/FedCM/#dictdef-identityproviderclientmetadata +[GenerateInit, GenerateConversionToJS] +dictionary IdentityProviderClientMetadata { + USVString privacy_policy_url; + USVString terms_of_service_url; +}; + +// https://fedidcg.github.io/FedCM/#dictdef-identityprovidertoken +[GenerateInit] +dictionary IdentityProviderToken { + required USVString token; +}; + +// https://fedidcg.github.io/FedCM/#dictdef-identitycredentiallogoutrpsrequest +dictionary IdentityCredentialLogoutRPsRequest { + required UTF8String url; + required UTF8String accountId; +}; diff --git a/dom/webidl/IdleDeadline.webidl b/dom/webidl/IdleDeadline.webidl new file mode 100644 index 0000000000..13e45d9541 --- /dev/null +++ b/dom/webidl/IdleDeadline.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * https://w3c.github.io/requestidlecallback/ + */ + +[Exposed=Window] +interface IdleDeadline { + DOMHighResTimeStamp timeRemaining(); + readonly attribute boolean didTimeout; +}; diff --git a/dom/webidl/ImageBitmap.webidl b/dom/webidl/ImageBitmap.webidl new file mode 100644 index 0000000000..1ed738a741 --- /dev/null +++ b/dom/webidl/ImageBitmap.webidl @@ -0,0 +1,403 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/webappapis.html#images + * + * The origin of the extended IDL file is + * http://w3c.github.io/mediacapture-worker/#imagebitmap-extensions + */ + +typedef (CanvasImageSource or + Blob or + CanvasRenderingContext2D or // This is out of spec. + ImageData) ImageBitmapSource; + +[Exposed=(Window,Worker)] +interface ImageBitmap { + [Constant] + readonly attribute unsigned long width; + [Constant] + readonly attribute unsigned long height; +}; + +// It's crucial that there be a way to explicitly dispose of ImageBitmaps +// since they refer to potentially large graphics resources. Some uses +// of this API proposal will result in repeated allocations of ImageBitmaps, +// and garbage collection will not reliably reclaim them quickly enough. +// Here we reuse close(), which also exists on another Transferable type, +// MessagePort. Potentially, all Transferable types should inherit from a +// new interface type "Closeable". +partial interface ImageBitmap { + // Dispose of all graphical resources associated with this ImageBitmap. + undefined close(); +}; + +// ImageBitmap-extensions +// Bug 1141979 - [FoxEye] Extend ImageBitmap with interfaces to access its +// underlying image data + +/* + * An image or a video frame is conceptually a two-dimensional array of data and + * each element in the array is called a pixel. The pixels are usually stored in + * a one-dimensional array and could be arranged in a variety of image formats. + * Developers need to know how the pixels are formatted so that they are able to + * process them. + * + * The image format describes how pixels in an image are arranged. A single + * pixel has at least one, but usually multiple pixel values. The range of a + * pixel value varies, which means different image formats use different data + * types to store a single pixel value. + * + * The most frequently used data type is 8-bit unsigned integer whose range is + * from 0 to 255, others could be 16-bit integer or 32-bit floating points and + * so forth. The number of pixel values of a single pixel is called the number + * of channels of the image format. Multiple pixel values of a pixel are used + * together to describe the captured property which could be color or depth + * information. For example, if the data is a color image in RGB color space, + * then it is a three-channel image format and a pixel is described by R, G and + * B three pixel values with range from 0 to 255. As another example, if the + * data is a gray image, then it is a single-channel image format with 8-bit + * unsigned integer data type and the pixel value describes the gray scale. For + * depth data, it is a single channel image format too, but the data type is + * 16-bit unsigned integer and the pixel value is the depth level. + * + * For those image formats whose pixels contain multiple pixel values, the pixel + * values might be arranged in one of the following ways: + * 1) Planar pixel layout: + * each channel has its pixel values stored consecutively in separated + * buffers (a.k.a. planes) and then all channel buffers are stored + * consecutively in memory. + * (Ex: RRRRRR......GGGGGG......BBBBBB......) + * 2) Interleaving pixel layout: + * each pixel has its pixel values from all channels stored together and + * interleaves all channels. + * (Ex: RGBRGBRGBRGBRGB......) + */ + + +/* + * The ImageBitmap extensions use this enumeration to negotiate the image format + * while 1) accessing the underlying data of an ImageBitmap and + * 2) creating a new ImageBitmap. + * + * For each format in this enumeration, we use a 2x2 small image (4 pixels) as + * example to illustrate the pixel layout. + * + * 2x2 image: +--------+--------+ + * | pixel1 | pixel2 | + * +--------+--------+ + * | pixel3 | pixel4 | + * +--------+--------+ + * + */ +enum ImageBitmapFormat { + /* + * Channel order: R, G, B, A + * Channel size: full rgba-chennels + * Pixel layout: interleaving rgba-channels + * Pixel layout illustration: + * [Plane1]: R1 G1 B1 A1 R2 G2 B2 A2 R3 G3 B3 A3 R4 G4 B4 A4 + * Data type: 8-bit unsigned integer + */ + "RGBA32", + + /* + * Channel order: B, G, R, A + * Channel size: full bgra-channels + * Pixel layout: interleaving bgra-channels + * Pixel layout illustration: + * [Plane1]: B1 G1 R1 A1 B2 G2 R2 A2 B3 G3 R3 A3 B4 G4 R4 A4 + * Data type: 8-bit unsigned integer + */ + "BGRA32", + + /* + * Channel order: R, G, B + * Channel size: full rgb-channels + * Pixel layout: interleaving rgb-channels + * Pixel layout illustration: + * [Plane1]: R1 G1 B1 R2 G2 B2 R3 G3 B3 R4 G4 B4 + * Data type: 8-bit unsigned integer + */ + "RGB24", + + /* + * Channel order: B, G, R + * Channel size: full bgr-channels + * Pixel layout: interleaving bgr-channels + * Pixel layout illustration: + * [Plane1]: B1 G1 R1 B2 G2 R2 B3 G3 R3 B4 G4 R4 + * Data type: 8-bit unsigned integer + */ + "BGR24", + + /* + * Channel order: GRAY + * Channel size: full gray-channel + * Pixel layout: planar gray-channel + * Pixel layout illustration: + * [Plane1]: GRAY1 GRAY2 GRAY3 GRAY4 + * Data type: 8-bit unsigned integer + */ + "GRAY8", + + /* + * Channel order: Y, U, V + * Channel size: full yuv-channels + * Pixel layout: planar yuv-channels + * Pixel layout illustration: + * [Plane1]: Y1 Y2 Y3 Y4 + * [Plane2]: U1 U2 U3 U4 + * [Plane3]: V1 V2 V3 V4 + * Data type: 8-bit unsigned integer + */ + "YUV444P", + + /* + * Channel order: Y, U, V + * Channel size: full y-channel, half uv-channels + * Pixel layout: planar yuv-channels + * Pixel layout illustration: + * [Plane1]: Y1 Y2 Y3 Y4 + * [Plane2]: U1 U3 + * [Plane3]: V1 V3 + * Data type: 8-bit unsigned integer + */ + "YUV422P", + + /* + * Channel order: Y, U, V + * Channel size: full y-channel, quarter uv-channels + * Pixel layout: planar yuv-channels + * Pixel layout illustration: + * [Plane1]: Y1 Y2 Y3 Y4 + * [Plane2]: U1 + * [Plane3]: V1 + * Data type: 8-bit unsigned integer + */ + "YUV420P", + + /* + * Channel order: Y, U, V + * Channel size: full y-channel, quarter uv-channels + * Pixel layout: planar y-channel, interleaving uv-channels + * Pixel layout illustration: + * [Plane1]: Y1 Y2 Y3 Y4 + * [Plane2]: U1 V1 + * Data type: 8-bit unsigned integer + */ + "YUV420SP_NV12", + + /* + * Channel order: Y, V, U + * Channel size: full y-channel, quarter vu-channels + * Pixel layout: planar y-channel, interleaving vu-channels + * Pixel layout illustration: + * [Plane1]: Y1 Y2 Y3 Y4 + * [Plane2]: V1 U1 + * Data type: 8-bit unsigned integer + */ + "YUV420SP_NV21", + + /* + * Channel order: H, S, V + * Channel size: full hsv-channels + * Pixel layout: interleaving hsv-channels + * Pixel layout illustration: + * [Plane1]: H1 S1 V1 H2 S2 V2 H3 S3 V3 + * Data type: 32-bit floating point value + */ + "HSV", + + /* + * Channel order: l, a, b + * Channel size: full lab-channels + * Pixel layout: interleaving lab-channels + * Pixel layout illustration: + * [Plane1]: l1 a1 b1 l2 a2 b2 l3 a3 b3 + * Data type: 32-bit floating point value + */ + "Lab", + + /* + * Channel order: DEPTH + * Channel size: full depth-channel + * Pixel layout: planar depth-channel + * Pixel layout illustration: + * [Plane1]: DEPTH1 DEPTH2 DEPTH3 DEPTH4 + * Data type: 16-bit unsigned integer + */ + "DEPTH", +}; + +enum ChannelPixelLayoutDataType { + "uint8", + "int8", + "uint16", + "int16", + "uint32", + "int32", + "float32", + "float64" +}; + +/* + * Two concepts, ImagePixelLayout and ChannelPixelLayout, together generalize + * the variety of pixel layouts among image formats. + * + * The ChannelPixelLayout represents the pixel layout of a single channel in a + * certain image format and the ImagePixelLayout is just the collection of + * ChannelPixelLayouts. So, the ChannelPixelLayout is defined as a dictionary + * type with properties to describe the layout and the ImagePixelLayout is just + * an alias name to a sequence of ChannelPixelLayout objects. + * + * Since an image format is composed of at least one channel, an + * ImagePixelLayout object contains at least one ChannelPixelLayout object. + * + * Although an image or a video frame is a two-dimensional structure, its data + * is usually stored in a one-dimensional array in the row-major way and the + * ChannelPixelLayout objects use the following properties to describe the + * layout of pixel values in the buffer. + * + * 1) offset: + * denotes the beginning position of the channel's data relative to the + * beginning position of the one-dimensional array. + * 2) width & height: + * denote the width and height of the channel respectively. Each channel in + * an image format may have different height and width. + * 3) data type: + * denotes the format used to store one single pixel value. + * 4) stride: + * the number of bytes between the beginning two consecutive rows in memory. + * (The total bytes of each row plus the padding bytes of each raw.) + * 5) skip value: + * the value is zero for the planar pixel layout, and a positive integer for + * the interleaving pixel layout. (Describes how many bytes there are between + * two adjacent pixel values in this channel.) + */ + +/* + * Example1: RGBA image, width = 620, height = 480, stride = 2560 + * + * chanel_r: offset = 0, width = 620, height = 480, data type = uint8, stride = 2560, skip = 3 + * chanel_g: offset = 1, width = 620, height = 480, data type = uint8, stride = 2560, skip = 3 + * chanel_b: offset = 2, width = 620, height = 480, data type = uint8, stride = 2560, skip = 3 + * chanel_a: offset = 3, width = 620, height = 480, data type = uint8, stride = 2560, skip = 3 + * + * <---------------------------- stride ----------------------------> + * <---------------------- width x 4 ----------------------> + * [index] 01234 8 12 16 20 24 28 2479 2559 + * |||||---|---|---|---|---|---|----------------------------|-------| + * [data] RGBARGBARGBARGBARGBAR___R___R... A%%%%%%%% + * [data] RGBARGBARGBARGBARGBAR___R___R... A%%%%%%%% + * [data] RGBARGBARGBARGBARGBAR___R___R... A%%%%%%%% + * ^^^ + * r-skip + */ + +/* + * Example2: YUV420P image, width = 620, height = 480, stride = 640 + * + * chanel_y: offset = 0, width = 620, height = 480, stride = 640, skip = 0 + * chanel_u: offset = 307200, width = 310, height = 240, data type = uint8, stride = 320, skip = 0 + * chanel_v: offset = 384000, width = 310, height = 240, data type = uint8, stride = 320, skip = 0 + * + * <--------------------------- y-stride ---------------------------> + * <----------------------- y-width -----------------------> + * [index] 012345 619 639 + * ||||||--------------------------------------------------|--------| + * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% + * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% + * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% + * [data] ...... + * <-------- u-stride ----------> + * <----- u-width -----> + * [index] 307200 307509 307519 + * |-------------------|--------| + * [data] UUUUUUUUUU... U%%%%%%%%% + * [data] UUUUUUUUUU... U%%%%%%%%% + * [data] UUUUUUUUUU... U%%%%%%%%% + * [data] ...... + * <-------- v-stride ----------> + * <- --- v-width -----> + * [index] 384000 384309 384319 + * |-------------------|--------| + * [data] VVVVVVVVVV... V%%%%%%%%% + * [data] VVVVVVVVVV... V%%%%%%%%% + * [data] VVVVVVVVVV... V%%%%%%%%% + * [data] ...... + */ + +/* + * Example3: YUV420SP_NV12 image, width = 620, height = 480, stride = 640 + * + * chanel_y: offset = 0, width = 620, height = 480, stride = 640, skip = 0 + * chanel_u: offset = 307200, width = 310, height = 240, data type = uint8, stride = 640, skip = 1 + * chanel_v: offset = 307201, width = 310, height = 240, data type = uint8, stride = 640, skip = 1 + * + * <--------------------------- y-stride --------------------------> + * <----------------------- y-width ----------------------> + * [index] 012345 619 639 + * ||||||-------------------------------------------------|--------| + * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% + * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% + * [data] YYYYYYYYYYYYYYYYYYYYYYYYYYYYY... Y%%%%%%%%% + * [data] ...... + * <--------------------- u-stride / v-stride --------------------> + * <------------------ u-width + v-width -----------------> + * [index] 307200(u-offset) 307819 307839 + * |------------------------------------------------------|-------| + * [index] |307201(v-offset) |307820 | + * ||-----------------------------------------------------||------| + * [data] UVUVUVUVUVUVUVUVUVUVUVUVUVUVUV... UV%%%%%%% + * [data] UVUVUVUVUVUVUVUVUVUVUVUVUVUVUV... UV%%%%%%% + * [data] UVUVUVUVUVUVUVUVUVUVUVUVUVUVUV... UV%%%%%%% + * ^ ^ + * u-skip v-skip + */ + +/* + * Example4: DEPTH image, width = 640, height = 480, stride = 1280 + * + * chanel_d: offset = 0, width = 640, height = 480, data type = uint16, stride = 1280, skip = 0 + * + * note: each DEPTH value uses two bytes + * + * <----------------------- d-stride ----------------------> + * <----------------------- d-width -----------------------> + * [index] 02468 1278 + * |||||---------------------------------------------------| + * [data] DDDDDDDDDDDDDDDDDDDDDDDDDDDDD... D + * [data] DDDDDDDDDDDDDDDDDDDDDDDDDDDDD... D + * [data] DDDDDDDDDDDDDDDDDDDDDDDDDDDDD... D + * [data] ...... + */ + +dictionary ChannelPixelLayout { + required unsigned long offset; + required unsigned long width; + required unsigned long height; + required ChannelPixelLayoutDataType dataType; + required unsigned long stride; + required unsigned long skip; +}; + +typedef sequence<ChannelPixelLayout> ImagePixelLayout; + +enum ImageOrientation { "none", "flipY", "from-image" }; +enum PremultiplyAlpha { "none", "premultiply", "default" }; +enum ColorSpaceConversion { "none", "default" }; +//enum ResizeQuality { "pixelated", "low", "medium", "high" }; + +dictionary ImageBitmapOptions { + ImageOrientation imageOrientation = "none"; + PremultiplyAlpha premultiplyAlpha = "default"; + // options to be added bugs: 1363861 + ColorSpaceConversion colorSpaceConversion = "default"; + [EnforceRange] unsigned long resizeWidth; + [EnforceRange] unsigned long resizeHeight; + //ResizeQuality resizeQuality = "low"; +}; diff --git a/dom/webidl/ImageBitmapRenderingContext.webidl b/dom/webidl/ImageBitmapRenderingContext.webidl new file mode 100644 index 0000000000..83027c2826 --- /dev/null +++ b/dom/webidl/ImageBitmapRenderingContext.webidl @@ -0,0 +1,43 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://wiki.whatwg.org/wiki/OffscreenCanvas + * + * © 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. + */ + +// The new ImageBitmapRenderingContext is a canvas rendering context +// which only provides the functionality to replace the canvas's +// contents with the given ImageBitmap. Its context id (the first argument +// to getContext) is "bitmaprenderer". +[Exposed=(Window,Worker)] +interface ImageBitmapRenderingContext { + readonly attribute CanvasSource? canvas; + + // Displays the given ImageBitmap in the canvas associated with this + // rendering context. Ownership of the ImageBitmap is transferred to + // the canvas. The caller may not use its reference to the ImageBitmap + // after making this call. (This semantic is crucial to enable prompt + // reclamation of expensive graphics resources, rather than relying on + // garbage collection to do so.) + // + // The ImageBitmap conceptually replaces the canvas's bitmap, but + // it does not change the canvas's intrinsic width or height. + // + // The ImageBitmap, when displayed, is clipped to the rectangle + // defined by the canvas's instrinsic width and height. Pixels that + // would be covered by the canvas's bitmap which are not covered by + // the supplied ImageBitmap are rendered transparent black. Any CSS + // styles affecting the display of the canvas are applied as usual. + [Throws] + undefined transferFromImageBitmap(ImageBitmap? bitmap); + + // Deprecated version of transferFromImageBitmap + [Deprecated="ImageBitmapRenderingContext_TransferImageBitmap", Throws] + undefined transferImageBitmap(ImageBitmap bitmap); +}; diff --git a/dom/webidl/ImageCapture.webidl b/dom/webidl/ImageCapture.webidl new file mode 100644 index 0000000000..559a7dbfec --- /dev/null +++ b/dom/webidl/ImageCapture.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-capture/ImageCapture.html + * + * Copyright © 2012-2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Pref="dom.imagecapture.enabled", + Exposed=Window] +interface ImageCapture : EventTarget { + [Throws] + constructor(MediaStreamTrack track); + + // readonly attribute PhotoSettingsOptions photoSettingsOptions; + [BinaryName="GetVideoStreamTrack"] + readonly attribute MediaStreamTrack videoStreamTrack; + attribute EventHandler onphoto; + attribute EventHandler onerror; + // attribute EventHandler onphotosettingschange; + // attribute EventHandler onframegrab; + + // [Throws] + // undefined setOptions (PhotoSettings? photoSettings); + [Throws] + undefined takePhoto(); + // [Throws] + // undefined getFrame(); +}; diff --git a/dom/webidl/ImageCaptureErrorEvent.webidl b/dom/webidl/ImageCaptureErrorEvent.webidl new file mode 100644 index 0000000000..486154b861 --- /dev/null +++ b/dom/webidl/ImageCaptureErrorEvent.webidl @@ -0,0 +1,35 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-capture/ImageCapture.html + * + * Copyright © 2012-2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Pref="dom.imagecapture.enabled", + Exposed=Window] +interface ImageCaptureErrorEvent : Event { + constructor(DOMString type, + optional ImageCaptureErrorEventInit imageCaptureErrorInitDict = {}); + + readonly attribute ImageCaptureError? imageCaptureError; +}; + +dictionary ImageCaptureErrorEventInit : EventInit { + ImageCaptureError? imageCaptureError = null; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface ImageCaptureError { + const unsigned short FRAME_GRAB_ERROR = 1; + const unsigned short SETTINGS_ERROR = 2; + const unsigned short PHOTO_ERROR = 3; + const unsigned short ERROR_UNKNOWN = 4; + readonly attribute unsigned short code; + readonly attribute DOMString message; +}; diff --git a/dom/webidl/ImageData.webidl b/dom/webidl/ImageData.webidl new file mode 100644 index 0000000000..34a547f00d --- /dev/null +++ b/dom/webidl/ImageData.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#imagedata + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA. + * You are granted a license to use, reproduce and create derivative works of this document. + */ + +[Exposed=(Window,Worker), + Serializable, + InstrumentedProps=(colorSpace)] +interface ImageData { + [Throws] + constructor(unsigned long sw, unsigned long sh); + [Throws] + constructor(Uint8ClampedArray data, unsigned long sw, + optional unsigned long sh); + + [Constant] + readonly attribute unsigned long width; + [Constant] + readonly attribute unsigned long height; + [Constant, StoreInSlot] + readonly attribute Uint8ClampedArray data; +}; diff --git a/dom/webidl/ImageDocument.webidl b/dom/webidl/ImageDocument.webidl new file mode 100644 index 0000000000..e81af7da7b --- /dev/null +++ b/dom/webidl/ImageDocument.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[ChromeOnly, LegacyOverrideBuiltIns, + Exposed=Window] +interface ImageDocument : HTMLDocument { + /* Whether the image is overflowing visible area. */ + readonly attribute boolean imageIsOverflowing; + + /* Whether the image has been resized to fit visible area. */ + readonly attribute boolean imageIsResized; + + /* Resize the image to fit visible area. */ + undefined shrinkToFit(); + + /* Restore image original size. */ + undefined restoreImage(); +}; diff --git a/dom/webidl/InputEvent.webidl b/dom/webidl/InputEvent.webidl new file mode 100644 index 0000000000..1d00e3702c --- /dev/null +++ b/dom/webidl/InputEvent.webidl @@ -0,0 +1,51 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/input-events/#interface-InputEvent + */ + +[Exposed=Window] +interface InputEvent : UIEvent +{ + constructor(DOMString type, optional InputEventInit eventInitDict = {}); + + readonly attribute boolean isComposing; + + readonly attribute DOMString inputType; + + [NeedsCallerType] + readonly attribute DOMString? data; +}; + +dictionary InputEventInit : UIEventInit +{ + boolean isComposing = false; + DOMString inputType = ""; + // NOTE: Currently, default value of `data` attribute is declared as empty + // string by UI Events. However, both Chrome and Safari uses `null`, + // and there is a spec issue about this: + // https://github.com/w3c/uievents/issues/139 + // So, we take `null` for compatibility with them. + DOMString? data = null; +}; + +// https://w3c.github.io/input-events/#interface-InputEvent +// https://rawgit.com/w3c/input-events/v1/index.html#interface-InputEvent +partial interface InputEvent +{ + [NeedsCallerType] + readonly attribute DataTransfer? dataTransfer; + // Enable `getTargetRanges()` only when `beforeinput` event is enabled + // because this may be used for feature detection of `beforeinput` event + // support (due to Chrome not supporting `onbeforeinput` attribute). + sequence<StaticRange> getTargetRanges(); +}; + +partial dictionary InputEventInit +{ + DataTransfer? dataTransfer = null; + sequence<StaticRange> targetRanges = []; +}; diff --git a/dom/webidl/InstallTrigger.webidl b/dom/webidl/InstallTrigger.webidl new file mode 100644 index 0000000000..01fcb3a446 --- /dev/null +++ b/dom/webidl/InstallTrigger.webidl @@ -0,0 +1,94 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +/** + * A callback function that webpages can implement to be notified when triggered + * installs complete. + */ +callback InstallTriggerCallback = undefined(DOMString url, short status); + +dictionary InstallTriggerData { + DOMString URL; + DOMString? IconURL; + DOMString? Hash; +}; + +/** + * The interface for the InstallTrigger object available to all websites. + */ +[ChromeOnly, + JSImplementation="@mozilla.org/addons/installtrigger;1", + Exposed=Window] +interface InstallTriggerImpl { + /** + * Retained for backwards compatibility. + */ + const unsigned short SKIN = 1; + const unsigned short LOCALE = 2; + const unsigned short CONTENT = 4; + const unsigned short PACKAGE = 7; + + /** + * Tests if installation is enabled. + */ + boolean enabled(); + + /** + * Tests if installation is enabled. + * + * @deprecated Use "enabled" in the future. + */ + boolean updateEnabled(); + + /** + * Starts a new installation of a set of add-ons. + * + * @param aArgs + * The add-ons to install. This should be a JS object, each property + * is the name of an add-on to be installed. The value of the + * property should either be a string URL, or an object with the + * following properties: + * * URL for the add-on's URL + * * IconURL for an icon for the add-on + * * Hash for a hash of the add-on + * @param aCallback + * A callback to call as each installation succeeds or fails + * @return true if the installations were successfully started + */ + [Deprecated="InstallTriggerInstallDeprecated"] + boolean install(record<DOMString, (DOMString or InstallTriggerData)> installs, + optional InstallTriggerCallback callback); + + /** + * Starts installing a new add-on. + * + * @deprecated use "install" in the future. + * + * @param aType + * Unused, retained for backwards compatibility + * @param aUrl + * The URL of the add-on + * @param aSkin + * Unused, retained for backwards compatibility + * @return true if the installation was successfully started + */ + [Deprecated="InstallTriggerInstallDeprecated"] + boolean installChrome(unsigned short type, DOMString url, DOMString skin); + + /** + * Starts installing a new add-on. + * + * @deprecated use "install" in the future. + * + * @param aUrl + * The URL of the add-on + * @param aFlags + * Unused, retained for backwards compatibility + * @return true if the installation was successfully started + */ + [Deprecated="InstallTriggerInstallDeprecated"] + boolean startSoftwareUpdate(DOMString url, optional unsigned short flags); +}; diff --git a/dom/webidl/IntersectionObserver.webidl b/dom/webidl/IntersectionObserver.webidl new file mode 100644 index 0000000000..f28240df7d --- /dev/null +++ b/dom/webidl/IntersectionObserver.webidl @@ -0,0 +1,61 @@ +/* -*- 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/IntersectionObserver/ + */ + +[ProbablyShortLivingWrapper, Exposed=Window] +interface IntersectionObserverEntry { + [Constant] + readonly attribute DOMHighResTimeStamp time; + [Constant] + readonly attribute DOMRectReadOnly? rootBounds; + [Constant] + readonly attribute DOMRectReadOnly boundingClientRect; + [Constant] + readonly attribute DOMRectReadOnly intersectionRect; + [Constant] + readonly attribute boolean isIntersecting; + [Constant] + readonly attribute double intersectionRatio; + [Constant] + readonly attribute Element target; +}; + +[Exposed=Window] +interface IntersectionObserver { + [Throws] + constructor(IntersectionCallback intersectionCallback, + optional IntersectionObserverInit options = {}); + + [Constant] + readonly attribute Node? root; + [Constant] + readonly attribute UTF8String rootMargin; + [Constant,Cached] + readonly attribute sequence<double> thresholds; + undefined observe(Element target); + undefined unobserve(Element target); + undefined disconnect(); + sequence<IntersectionObserverEntry> takeRecords(); +}; + +callback IntersectionCallback = + undefined (sequence<IntersectionObserverEntry> entries, IntersectionObserver observer); + +dictionary IntersectionObserverEntryInit { + required DOMHighResTimeStamp time; + required DOMRectInit rootBounds; + required DOMRectInit boundingClientRect; + required DOMRectInit intersectionRect; + required Element target; +}; + +dictionary IntersectionObserverInit { + (Element or Document)? root = null; + UTF8String rootMargin = "0px"; + (double or sequence<double>) threshold = 0; +}; diff --git a/dom/webidl/IntlUtils.webidl b/dom/webidl/IntlUtils.webidl new file mode 100644 index 0000000000..1efa35c728 --- /dev/null +++ b/dom/webidl/IntlUtils.webidl @@ -0,0 +1,83 @@ +/* This Source Code Form is subject to the terms of 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/. */ + +[GenerateConversionToJS] +dictionary DisplayNameOptions { + DOMString type; + DOMString style; + DOMString calendar; + sequence<DOMString> keys; +}; + +[GenerateInit] +dictionary DisplayNameResult { + DOMString locale; + DOMString type; + DOMString style; + DOMString calendar; + sequence<DOMString> values; +}; + +[GenerateInit] +dictionary LocaleInfo { + DOMString locale; + DOMString direction; +}; + +/** + * The IntlUtils interface provides helper functions for localization. + */ +[LegacyNoInterfaceObject, + Exposed=Window] +interface IntlUtils { + /** + * Helper function to retrieve the localized values for a list of requested + * keys. + * + * The function takes two arguments - locales which is a list of locale + * strings and options which is an object with four optional properties: + * + * keys: + * an Array of string values to localize + * + * type: + * a String with a value "language", "region", "script", "currency", + * "weekday", "month", "quarter", "dayPeriod", or "dateTimeField" + * + * style: + * a String with a value "long", "abbreviated", "short", or "narrow" + * + * calendar: + * a String to select a specific calendar type, e.g. "gregory" + * + * It returns an object with properties: + * + * locale: + * a negotiated locale string + * + * type: + * negotiated type + * + * style: + * negotiated style + * + * calendar: + * negotiated calendar + * + * values: + * a list of translated values for the requested keys + * + */ + [Throws] + DisplayNameResult getDisplayNames(sequence<DOMString> locales, + optional DisplayNameOptions options = {}); + + /** + * Helper function to determine if the current application locale is RTL. + * + * The result of this function can be overriden by this pref: + * - `intl.l10n.pseudo` + */ + boolean isAppLocaleRTL(); +}; diff --git a/dom/webidl/InvokeEvent.webidl b/dom/webidl/InvokeEvent.webidl new file mode 100644 index 0000000000..f42eeb89fa --- /dev/null +++ b/dom/webidl/InvokeEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://github.com/whatwg/html/pull/9841 + */ + +[Pref="dom.element.invokers.enabled", + Exposed=Window] +interface InvokeEvent : Event { + constructor(DOMString type, optional InvokeEventInit eventInitDict = {}); + readonly attribute Element? invoker; + readonly attribute DOMString action; +}; + +dictionary InvokeEventInit : EventInit { + Element? invoker = null; + DOMString action = "auto"; +}; diff --git a/dom/webidl/InvokerElement.webidl b/dom/webidl/InvokerElement.webidl new file mode 100644 index 0000000000..0650d71400 --- /dev/null +++ b/dom/webidl/InvokerElement.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://github.com/whatwg/html/pull/9841 + */ + +interface mixin InvokerElement { + [Pref="dom.element.invokers.enabled", CEReactions] attribute Element? invokeTargetElement; + [Pref="dom.element.invokers.enabled", CEReactions] attribute DOMString invokeAction; +}; diff --git a/dom/webidl/IterableIterator.webidl b/dom/webidl/IterableIterator.webidl new file mode 100644 index 0000000000..378b7f12a9 --- /dev/null +++ b/dom/webidl/IterableIterator.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[GenerateConversionToJS] +dictionary IterableKeyOrValueResult { + any value; + boolean done = false; +}; + +[GenerateConversionToJS] +dictionary IterableKeyAndValueResult { + sequence<any> value = []; + boolean done = false; +}; diff --git a/dom/webidl/KeyAlgorithm.webidl b/dom/webidl/KeyAlgorithm.webidl new file mode 100644 index 0000000000..b1f3d79935 --- /dev/null +++ b/dom/webidl/KeyAlgorithm.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/WebCryptoAPI/ + */ + +dictionary KeyAlgorithm { + required DOMString name; +}; + +[GenerateConversionToJS] +dictionary AesKeyAlgorithm : KeyAlgorithm { + required unsigned short length; +}; + +[GenerateConversionToJS] +dictionary EcKeyAlgorithm : KeyAlgorithm { + required DOMString namedCurve; +}; + +[GenerateConversionToJS] +dictionary HmacKeyAlgorithm : KeyAlgorithm { + required KeyAlgorithm hash; + required unsigned long length; +}; + +[GenerateConversionToJS] +dictionary RsaHashedKeyAlgorithm : KeyAlgorithm { + required unsigned short modulusLength; + required Uint8Array publicExponent; + required KeyAlgorithm hash; +}; + +[GenerateConversionToJS] +dictionary DhKeyAlgorithm : KeyAlgorithm { + required Uint8Array prime; + required Uint8Array generator; +}; diff --git a/dom/webidl/KeyEvent.webidl b/dom/webidl/KeyEvent.webidl new file mode 100644 index 0000000000..16c417c9e3 --- /dev/null +++ b/dom/webidl/KeyEvent.webidl @@ -0,0 +1,250 @@ +/* -*- 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/. + */ + +// http://www.w3.org/TR/1999/WD-DOM-Level-2-19990923/events.html#Events-KeyEvent +[Exposed=Window] +interface KeyEvent +{ + // It's all mixed in. +}; +KeyEvent includes KeyEventMixin; + +interface mixin KeyEventMixin { + const unsigned long DOM_VK_CANCEL = 0x03; + const unsigned long DOM_VK_HELP = 0x06; + const unsigned long DOM_VK_BACK_SPACE = 0x08; + const unsigned long DOM_VK_TAB = 0x09; + const unsigned long DOM_VK_CLEAR = 0x0C; + const unsigned long DOM_VK_RETURN = 0x0D; + // DOM_VK_ENTER has been never used for representing native key events. + // Therefore, it's removed for preventing developers being confused. + // const unsigned long DOM_VK_ENTER = 0x0E; + const unsigned long DOM_VK_SHIFT = 0x10; + const unsigned long DOM_VK_CONTROL = 0x11; + const unsigned long DOM_VK_ALT = 0x12; + const unsigned long DOM_VK_PAUSE = 0x13; + const unsigned long DOM_VK_CAPS_LOCK = 0x14; + const unsigned long DOM_VK_KANA = 0x15; + const unsigned long DOM_VK_HANGUL = 0x15; + const unsigned long DOM_VK_EISU = 0x16; // Japanese Mac keyboard only + const unsigned long DOM_VK_JUNJA = 0x17; + const unsigned long DOM_VK_FINAL = 0x18; + const unsigned long DOM_VK_HANJA = 0x19; + const unsigned long DOM_VK_KANJI = 0x19; + const unsigned long DOM_VK_ESCAPE = 0x1B; + const unsigned long DOM_VK_CONVERT = 0x1C; + const unsigned long DOM_VK_NONCONVERT = 0x1D; + const unsigned long DOM_VK_ACCEPT = 0x1E; + const unsigned long DOM_VK_MODECHANGE = 0x1F; + const unsigned long DOM_VK_SPACE = 0x20; + const unsigned long DOM_VK_PAGE_UP = 0x21; + const unsigned long DOM_VK_PAGE_DOWN = 0x22; + const unsigned long DOM_VK_END = 0x23; + const unsigned long DOM_VK_HOME = 0x24; + const unsigned long DOM_VK_LEFT = 0x25; + const unsigned long DOM_VK_UP = 0x26; + const unsigned long DOM_VK_RIGHT = 0x27; + const unsigned long DOM_VK_DOWN = 0x28; + const unsigned long DOM_VK_SELECT = 0x29; + const unsigned long DOM_VK_PRINT = 0x2A; + const unsigned long DOM_VK_EXECUTE = 0x2B; + const unsigned long DOM_VK_PRINTSCREEN = 0x2C; + const unsigned long DOM_VK_INSERT = 0x2D; + const unsigned long DOM_VK_DELETE = 0x2E; + + // DOM_VK_0 - DOM_VK_9 match their ascii values + const unsigned long DOM_VK_0 = 0x30; + const unsigned long DOM_VK_1 = 0x31; + const unsigned long DOM_VK_2 = 0x32; + const unsigned long DOM_VK_3 = 0x33; + const unsigned long DOM_VK_4 = 0x34; + const unsigned long DOM_VK_5 = 0x35; + const unsigned long DOM_VK_6 = 0x36; + const unsigned long DOM_VK_7 = 0x37; + const unsigned long DOM_VK_8 = 0x38; + const unsigned long DOM_VK_9 = 0x39; + + const unsigned long DOM_VK_COLON = 0x3A; + const unsigned long DOM_VK_SEMICOLON = 0x3B; + const unsigned long DOM_VK_LESS_THAN = 0x3C; + const unsigned long DOM_VK_EQUALS = 0x3D; + const unsigned long DOM_VK_GREATER_THAN = 0x3E; + const unsigned long DOM_VK_QUESTION_MARK = 0x3F; + const unsigned long DOM_VK_AT = 0x40; + + // DOM_VK_A - DOM_VK_Z match their ascii values + const unsigned long DOM_VK_A = 0x41; + const unsigned long DOM_VK_B = 0x42; + const unsigned long DOM_VK_C = 0x43; + const unsigned long DOM_VK_D = 0x44; + const unsigned long DOM_VK_E = 0x45; + const unsigned long DOM_VK_F = 0x46; + const unsigned long DOM_VK_G = 0x47; + const unsigned long DOM_VK_H = 0x48; + const unsigned long DOM_VK_I = 0x49; + const unsigned long DOM_VK_J = 0x4A; + const unsigned long DOM_VK_K = 0x4B; + const unsigned long DOM_VK_L = 0x4C; + const unsigned long DOM_VK_M = 0x4D; + const unsigned long DOM_VK_N = 0x4E; + const unsigned long DOM_VK_O = 0x4F; + const unsigned long DOM_VK_P = 0x50; + const unsigned long DOM_VK_Q = 0x51; + const unsigned long DOM_VK_R = 0x52; + const unsigned long DOM_VK_S = 0x53; + const unsigned long DOM_VK_T = 0x54; + const unsigned long DOM_VK_U = 0x55; + const unsigned long DOM_VK_V = 0x56; + const unsigned long DOM_VK_W = 0x57; + const unsigned long DOM_VK_X = 0x58; + const unsigned long DOM_VK_Y = 0x59; + const unsigned long DOM_VK_Z = 0x5A; + + const unsigned long DOM_VK_WIN = 0x5B; + const unsigned long DOM_VK_CONTEXT_MENU = 0x5D; + const unsigned long DOM_VK_SLEEP = 0x5F; + + // Numpad keys + const unsigned long DOM_VK_NUMPAD0 = 0x60; + const unsigned long DOM_VK_NUMPAD1 = 0x61; + const unsigned long DOM_VK_NUMPAD2 = 0x62; + const unsigned long DOM_VK_NUMPAD3 = 0x63; + const unsigned long DOM_VK_NUMPAD4 = 0x64; + const unsigned long DOM_VK_NUMPAD5 = 0x65; + const unsigned long DOM_VK_NUMPAD6 = 0x66; + const unsigned long DOM_VK_NUMPAD7 = 0x67; + const unsigned long DOM_VK_NUMPAD8 = 0x68; + const unsigned long DOM_VK_NUMPAD9 = 0x69; + const unsigned long DOM_VK_MULTIPLY = 0x6A; + const unsigned long DOM_VK_ADD = 0x6B; + const unsigned long DOM_VK_SEPARATOR = 0x6C; + const unsigned long DOM_VK_SUBTRACT = 0x6D; + const unsigned long DOM_VK_DECIMAL = 0x6E; + const unsigned long DOM_VK_DIVIDE = 0x6F; + + const unsigned long DOM_VK_F1 = 0x70; + const unsigned long DOM_VK_F2 = 0x71; + const unsigned long DOM_VK_F3 = 0x72; + const unsigned long DOM_VK_F4 = 0x73; + const unsigned long DOM_VK_F5 = 0x74; + const unsigned long DOM_VK_F6 = 0x75; + const unsigned long DOM_VK_F7 = 0x76; + const unsigned long DOM_VK_F8 = 0x77; + const unsigned long DOM_VK_F9 = 0x78; + const unsigned long DOM_VK_F10 = 0x79; + const unsigned long DOM_VK_F11 = 0x7A; + const unsigned long DOM_VK_F12 = 0x7B; + const unsigned long DOM_VK_F13 = 0x7C; + const unsigned long DOM_VK_F14 = 0x7D; + const unsigned long DOM_VK_F15 = 0x7E; + const unsigned long DOM_VK_F16 = 0x7F; + const unsigned long DOM_VK_F17 = 0x80; + const unsigned long DOM_VK_F18 = 0x81; + const unsigned long DOM_VK_F19 = 0x82; + const unsigned long DOM_VK_F20 = 0x83; + const unsigned long DOM_VK_F21 = 0x84; + const unsigned long DOM_VK_F22 = 0x85; + const unsigned long DOM_VK_F23 = 0x86; + const unsigned long DOM_VK_F24 = 0x87; + + const unsigned long DOM_VK_NUM_LOCK = 0x90; + const unsigned long DOM_VK_SCROLL_LOCK = 0x91; + + // OEM specific virtual keyCode of Windows should pass through DOM keyCode + // for compatibility with the other web browsers on Windows. + const unsigned long DOM_VK_WIN_OEM_FJ_JISHO = 0x92; + const unsigned long DOM_VK_WIN_OEM_FJ_MASSHOU = 0x93; + const unsigned long DOM_VK_WIN_OEM_FJ_TOUROKU = 0x94; + const unsigned long DOM_VK_WIN_OEM_FJ_LOYA = 0x95; + const unsigned long DOM_VK_WIN_OEM_FJ_ROYA = 0x96; + + const unsigned long DOM_VK_CIRCUMFLEX = 0xA0; + const unsigned long DOM_VK_EXCLAMATION = 0xA1; + const unsigned long DOM_VK_DOUBLE_QUOTE = 0xA2; + const unsigned long DOM_VK_HASH = 0xA3; + const unsigned long DOM_VK_DOLLAR = 0xA4; + const unsigned long DOM_VK_PERCENT = 0xA5; + const unsigned long DOM_VK_AMPERSAND = 0xA6; + const unsigned long DOM_VK_UNDERSCORE = 0xA7; + const unsigned long DOM_VK_OPEN_PAREN = 0xA8; + const unsigned long DOM_VK_CLOSE_PAREN = 0xA9; + const unsigned long DOM_VK_ASTERISK = 0xAA; + const unsigned long DOM_VK_PLUS = 0xAB; + const unsigned long DOM_VK_PIPE = 0xAC; + const unsigned long DOM_VK_HYPHEN_MINUS = 0xAD; + + const unsigned long DOM_VK_OPEN_CURLY_BRACKET = 0xAE; + const unsigned long DOM_VK_CLOSE_CURLY_BRACKET = 0xAF; + + const unsigned long DOM_VK_TILDE = 0xB0; + + const unsigned long DOM_VK_VOLUME_MUTE = 0xB5; + const unsigned long DOM_VK_VOLUME_DOWN = 0xB6; + const unsigned long DOM_VK_VOLUME_UP = 0xB7; + + const unsigned long DOM_VK_COMMA = 0xBC; + const unsigned long DOM_VK_PERIOD = 0xBE; + const unsigned long DOM_VK_SLASH = 0xBF; + const unsigned long DOM_VK_BACK_QUOTE = 0xC0; + const unsigned long DOM_VK_OPEN_BRACKET = 0xDB; // square bracket + const unsigned long DOM_VK_BACK_SLASH = 0xDC; + const unsigned long DOM_VK_CLOSE_BRACKET = 0xDD; // square bracket + const unsigned long DOM_VK_QUOTE = 0xDE; // Apostrophe + + const unsigned long DOM_VK_META = 0xE0; + const unsigned long DOM_VK_ALTGR = 0xE1; + + // OEM specific virtual keyCode of Windows should pass through DOM keyCode + // for compatibility with the other web browsers on Windows. + const unsigned long DOM_VK_WIN_ICO_HELP = 0xE3; + const unsigned long DOM_VK_WIN_ICO_00 = 0xE4; + + // IME processed key. + const unsigned long DOM_VK_PROCESSKEY = 0xE5; + + // OEM specific virtual keyCode of Windows should pass through DOM keyCode + // for compatibility with the other web browsers on Windows. + const unsigned long DOM_VK_WIN_ICO_CLEAR = 0xE6; + const unsigned long DOM_VK_WIN_OEM_RESET = 0xE9; + const unsigned long DOM_VK_WIN_OEM_JUMP = 0xEA; + const unsigned long DOM_VK_WIN_OEM_PA1 = 0xEB; + const unsigned long DOM_VK_WIN_OEM_PA2 = 0xEC; + const unsigned long DOM_VK_WIN_OEM_PA3 = 0xED; + const unsigned long DOM_VK_WIN_OEM_WSCTRL = 0xEE; + const unsigned long DOM_VK_WIN_OEM_CUSEL = 0xEF; + const unsigned long DOM_VK_WIN_OEM_ATTN = 0xF0; + const unsigned long DOM_VK_WIN_OEM_FINISH = 0xF1; + const unsigned long DOM_VK_WIN_OEM_COPY = 0xF2; + const unsigned long DOM_VK_WIN_OEM_AUTO = 0xF3; + const unsigned long DOM_VK_WIN_OEM_ENLW = 0xF4; + const unsigned long DOM_VK_WIN_OEM_BACKTAB = 0xF5; + + // Following keys are not used on most keyboards. However, for compatibility + // with other browsers on Windows, we should define them. + const unsigned long DOM_VK_ATTN = 0xF6; + const unsigned long DOM_VK_CRSEL = 0xF7; + const unsigned long DOM_VK_EXSEL = 0xF8; + const unsigned long DOM_VK_EREOF = 0xF9; + const unsigned long DOM_VK_PLAY = 0xFA; + const unsigned long DOM_VK_ZOOM = 0xFB; + const unsigned long DOM_VK_PA1 = 0xFD; + + // OEM specific virtual keyCode of Windows should pass through DOM keyCode + // for compatibility with the other web browsers on Windows. + const unsigned long DOM_VK_WIN_OEM_CLEAR = 0xFE; + + [BinaryName="initKeyEventJS", Func="KeyboardEvent::IsInitKeyEventAvailable"] + undefined initKeyEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional Window? view = null, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false, + optional unsigned long keyCode = 0, + optional unsigned long charCode = 0); +}; diff --git a/dom/webidl/KeyIdsInitData.webidl b/dom/webidl/KeyIdsInitData.webidl new file mode 100644 index 0000000000..95f975dd45 --- /dev/null +++ b/dom/webidl/KeyIdsInitData.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// "KeyIds" EME init data format definition/parser, as defined by +// https://w3c.github.io/encrypted-media/format-registry/initdata/keyids.html +[GenerateInitFromJSON] +dictionary KeyIdsInitData { + required sequence<DOMString> kids; +}; diff --git a/dom/webidl/KeyboardEvent.webidl b/dom/webidl/KeyboardEvent.webidl new file mode 100644 index 0000000000..488c1ba5b1 --- /dev/null +++ b/dom/webidl/KeyboardEvent.webidl @@ -0,0 +1,78 @@ +/* -*- 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/. + */ + +[Exposed=Window] +interface KeyboardEvent : UIEvent +{ + [BinaryName="constructorJS"] + constructor(DOMString typeArg, + optional KeyboardEventInit keyboardEventInitDict= {}); + + [NeedsCallerType] + readonly attribute unsigned long charCode; + [NeedsCallerType] + readonly attribute unsigned long keyCode; + + [NeedsCallerType] + readonly attribute boolean altKey; + [NeedsCallerType] + readonly attribute boolean ctrlKey; + [NeedsCallerType] + readonly attribute boolean shiftKey; + readonly attribute boolean metaKey; + + [NeedsCallerType] + boolean getModifierState(DOMString key); + + const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00; + const unsigned long DOM_KEY_LOCATION_LEFT = 0x01; + const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02; + const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03; + + readonly attribute unsigned long location; + readonly attribute boolean repeat; + readonly attribute boolean isComposing; + + readonly attribute DOMString key; + [NeedsCallerType] + readonly attribute DOMString code; + + [BinaryName="initKeyboardEventJS"] + undefined initKeyboardEvent(DOMString typeArg, + optional boolean bubblesArg = false, + optional boolean cancelableArg = false, + optional Window? viewArg = null, + optional DOMString keyArg = "", + optional unsigned long locationArg = 0, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false); + + // This returns the initialized dictionary for generating a + // same-type keyboard event + [Cached, ChromeOnly, Constant] + readonly attribute KeyboardEventInit initDict; +}; + +dictionary KeyboardEventInit : EventModifierInit +{ + [BinaryType="nsAutoString"] + DOMString key = ""; + [BinaryType="nsAutoString"] + DOMString code = ""; + unsigned long location = 0; + boolean repeat = false; + boolean isComposing = false; + + // legacy attributes + unsigned long charCode = 0; + unsigned long keyCode = 0; + unsigned long which = 0; +}; + +// Mozilla extensions +KeyboardEvent includes KeyEventMixin; diff --git a/dom/webidl/KeyframeAnimationOptions.webidl b/dom/webidl/KeyframeAnimationOptions.webidl new file mode 100644 index 0000000000..047f46ed1a --- /dev/null +++ b/dom/webidl/KeyframeAnimationOptions.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/fxtf/web-animations/#the-animatable-interface + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +// This typedef is off in its own file, because of bug 995352. +typedef (unrestricted double or KeyframeAnimationOptions) UnrestrictedDoubleOrKeyframeAnimationOptions; diff --git a/dom/webidl/KeyframeEffect.webidl b/dom/webidl/KeyframeEffect.webidl new file mode 100644 index 0000000000..269c809000 --- /dev/null +++ b/dom/webidl/KeyframeEffect.webidl @@ -0,0 +1,64 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/web-animations/#the-keyframeeffect-interfaces + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum IterationCompositeOperation { + "replace", + "accumulate" +}; + +dictionary KeyframeEffectOptions : EffectTiming { + [Pref="dom.animations-api.compositing.enabled"] + IterationCompositeOperation iterationComposite = "replace"; + [Pref="dom.animations-api.compositing.enabled"] + CompositeOperation composite = "replace"; + DOMString? pseudoElement = null; +}; + +// KeyframeEffect should run in the caller's compartment to do custom +// processing on the `keyframes` object. +[RunConstructorInCallerCompartment, Exposed=Window] +interface KeyframeEffect : AnimationEffect { + [Throws] + constructor(Element? target, + object? keyframes, + optional (unrestricted double or KeyframeEffectOptions) options = {}); + [Throws] + constructor(KeyframeEffect source); + + attribute Element? target; + [SetterThrows] attribute DOMString? pseudoElement; + [Pref="dom.animations-api.compositing.enabled"] + attribute IterationCompositeOperation iterationComposite; + [Pref="dom.animations-api.compositing.enabled"] + attribute CompositeOperation composite; + [Throws] sequence<object> getKeyframes(); + [Throws] undefined setKeyframes(object? keyframes); +}; + +// Non-standard extensions +dictionary AnimationPropertyValueDetails { + required double offset; + UTF8String value; + UTF8String easing; + required CompositeOperation composite; +}; + +dictionary AnimationPropertyDetails { + required DOMString property; + required boolean runningOnCompositor; + DOMString warning; + required sequence<AnimationPropertyValueDetails> values; +}; + +partial interface KeyframeEffect { + [ChromeOnly, Throws] sequence<AnimationPropertyDetails> getProperties(); +}; diff --git a/dom/webidl/LinkStyle.webidl b/dom/webidl/LinkStyle.webidl new file mode 100644 index 0000000000..9559f2e958 --- /dev/null +++ b/dom/webidl/LinkStyle.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/cssom/#the-linkstyle-interface + */ + +interface mixin LinkStyle { + [BinaryName="sheetForBindings"] readonly attribute StyleSheet? sheet; +}; diff --git a/dom/webidl/Localization.webidl b/dom/webidl/Localization.webidl new file mode 100644 index 0000000000..8eceec433b --- /dev/null +++ b/dom/webidl/Localization.webidl @@ -0,0 +1,158 @@ +/* -*- Mode: C++; 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/. */ + +/** + * L10nIdArgs is an object used to carry localization tuple for message + * translation. + * + * Fields: + * id - identifier of a message. + * args - an optional record of arguments used to format the message. + * The argument will be converted to/from JSON, and the API + * will only handle strings and numbers. + */ +dictionary L10nIdArgs { + UTF8String? id = null; + L10nArgs? args = null; +}; + +/** + * When no arguments are required to format a message a simple string can be + * used instead. + */ +typedef (UTF8String or L10nIdArgs) L10nKey; + +/** + * L10nMessage is a compound translation unit from Fluent which + * encodes the value and (optionally) a list of attributes used + * to translate a given widget. + * + * Most simple imperative translations will only use the `value`, + * but when building a Message for a UI widget, a combination + * of a value and attributes will be used. + */ +dictionary AttributeNameValue { + required UTF8String name; + required UTF8String value; +}; + +dictionary L10nMessage { + UTF8String? value = null; + sequence<AttributeNameValue>? attributes = null; +}; + +/** + * Localization is an implementation of the Fluent Localization API. + * + * An instance of a Localization class stores a state of a mix + * of localization resources and provides the API to resolve + * translation value for localization identifiers from the + * resources. + * + * Methods: + * - addResourceIds - add resources + * - removeResourceIds - remove resources + * - formatValue - format a single value + * - formatValues - format multiple values + * - formatMessages - format multiple compound messages + * + */ +[Func="IsChromeOrUAWidget", Exposed=Window] +interface Localization { + /** + * Constructor arguments: + * - aResourceids - a list of localization resource URIs + * which will provide messages for this + * Localization instance. + * - aSync - Specifies if the initial state of the Localization API is synchronous. + * This enables a number of synchronous methods on the + * Localization API. + * - aRegistry - optional custom L10nRegistry to be used by this Localization instance. + * - aLocales - custom set of locales to be used for this Localization. + */ + [Throws] + constructor(sequence<L10nResourceId> aResourceIds, + optional boolean aSync = false, + optional L10nRegistry aRegistry, + optional sequence<UTF8String> aLocales); + + /** + * A method for adding resources to the localization context. + */ + undefined addResourceIds(sequence<L10nResourceId> aResourceIds); + + /** + * A method for removing resources from the localization context. + * + * Returns a new count of resources used by the context. + */ + unsigned long removeResourceIds(sequence<L10nResourceId> aResourceIds); + + /** + * Formats a value of a localization message with a given id. + * An optional dictionary of arguments can be passed to inform + * the message formatting logic. + * + * Example: + * let value = await document.l10n.formatValue("unread-emails", {count: 5}); + * assert.equal(value, "You have 5 unread emails"); + */ + [NewObject] Promise<UTF8String?> formatValue(UTF8String aId, optional L10nArgs aArgs); + + /** + * Formats values of a list of messages with given ids. + * + * Example: + * let values = await document.l10n.formatValues([ + * {id: "hello-world"}, + * {id: "unread-emails", args: {count: 5} + * ]); + * assert.deepEqual(values, [ + * "Hello World", + * "You have 5 unread emails" + * ]); + */ + [NewObject] Promise<sequence<UTF8String?>> formatValues(sequence<L10nKey> aKeys); + + /** + * Formats values and attributes of a list of messages with given ids. + * + * Example: + * let values = await document.l10n.formatMessages([ + * {id: "hello-world"}, + * {id: "unread-emails", args: {count: 5} + * ]); + * assert.deepEqual(values, [ + * { + * value: "Hello World", + * attributes: null + * }, + * { + * value: "You have 5 unread emails", + * attributes: { + * tooltip: "Click to select them all" + * } + * } + * ]); + */ + [NewObject] Promise<sequence<L10nMessage?>> formatMessages(sequence<L10nKey> aKeys); + + undefined setAsync(); + + [NewObject, Throws] + UTF8String? formatValueSync(UTF8String aId, optional L10nArgs aArgs); + [NewObject, Throws] + sequence<UTF8String?> formatValuesSync(sequence<L10nKey> aKeys); + [NewObject, Throws] + sequence<L10nMessage?> formatMessagesSync(sequence<L10nKey> aKeys); +}; + +/** + * A helper dict for converting between JS Value and L10nArgs. + */ +[GenerateInitFromJSON, GenerateConversionToJS] +dictionary L10nArgsHelperDict { + required L10nArgs args; +}; diff --git a/dom/webidl/Location.webidl b/dom/webidl/Location.webidl new file mode 100644 index 0000000000..cd4dbfe89f --- /dev/null +++ b/dom/webidl/Location.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/history.html#the-location-interface + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[LegacyUnforgeable, + Exposed=Window, + InstrumentedProps=(ancestorOrigins)] +interface Location { + [Throws, CrossOriginWritable, NeedsSubjectPrincipal] + stringifier attribute USVString href; + [Throws, NeedsSubjectPrincipal] + readonly attribute USVString origin; + [Throws, NeedsSubjectPrincipal] + attribute USVString protocol; + [Throws, NeedsSubjectPrincipal] + attribute USVString host; + [Throws, NeedsSubjectPrincipal] + attribute USVString hostname; + [Throws, NeedsSubjectPrincipal] + attribute USVString port; + [Throws, NeedsSubjectPrincipal] + attribute USVString pathname; + [Throws, NeedsSubjectPrincipal] + attribute USVString search; + [Throws, NeedsSubjectPrincipal] + attribute USVString hash; + + [Throws, NeedsSubjectPrincipal] + undefined assign(USVString url); + + [Throws, CrossOriginCallable, NeedsSubjectPrincipal] + undefined replace(USVString url); + + // XXXbz there is no forceget argument in the spec! See bug 1037721. + [Throws, NeedsSubjectPrincipal] + undefined reload(optional boolean forceget = false); + + // Bug 1085214 [SameObject] readonly attribute USVString[] ancestorOrigins; +}; diff --git a/dom/webidl/Lock.webidl b/dom/webidl/Lock.webidl new file mode 100644 index 0000000000..72449e111b --- /dev/null +++ b/dom/webidl/Lock.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/web-locks/ + */ + +[SecureContext, Exposed=(Window,Worker)] +interface Lock { + readonly attribute DOMString name; + readonly attribute LockMode mode; +}; diff --git a/dom/webidl/LockManager.webidl b/dom/webidl/LockManager.webidl new file mode 100644 index 0000000000..075ffbd94e --- /dev/null +++ b/dom/webidl/LockManager.webidl @@ -0,0 +1,44 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/web-locks/ + */ + +[SecureContext, Exposed=(Window,Worker)] +interface LockManager { + [NewObject] + Promise<any> request(DOMString name, + LockGrantedCallback callback); + [NewObject] + Promise<any> request(DOMString name, + LockOptions options, + LockGrantedCallback callback); + + [NewObject] + Promise<LockManagerSnapshot> query(); +}; + +callback LockGrantedCallback = Promise<any> (Lock? lock); + +enum LockMode { "shared", "exclusive" }; + +dictionary LockOptions { + LockMode mode = "exclusive"; + boolean ifAvailable = false; + boolean steal = false; + AbortSignal signal; +}; + +dictionary LockManagerSnapshot { + sequence<LockInfo> held; + sequence<LockInfo> pending; +}; + +dictionary LockInfo { + DOMString name; + LockMode mode; + DOMString clientId; +}; diff --git a/dom/webidl/MIDIAccess.webidl b/dom/webidl/MIDIAccess.webidl new file mode 100644 index 0000000000..4c7ca24920 --- /dev/null +++ b/dom/webidl/MIDIAccess.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-midi-api/ + */ + +[SecureContext, Pref="dom.webmidi.enabled", + Exposed=Window] +interface MIDIAccess : EventTarget { + readonly attribute MIDIInputMap inputs; + readonly attribute MIDIOutputMap outputs; + attribute EventHandler onstatechange; + readonly attribute boolean sysexEnabled; +}; diff --git a/dom/webidl/MIDIConnectionEvent.webidl b/dom/webidl/MIDIConnectionEvent.webidl new file mode 100644 index 0000000000..bb4b7adc22 --- /dev/null +++ b/dom/webidl/MIDIConnectionEvent.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-midi-api/ + */ + +[SecureContext, + Pref="dom.webmidi.enabled", + Exposed=Window] +interface MIDIConnectionEvent : Event +{ + constructor(DOMString type, + optional MIDIConnectionEventInit eventInitDict = {}); + + readonly attribute MIDIPort? port; +}; + +dictionary MIDIConnectionEventInit : EventInit +{ + MIDIPort? port = null; +}; diff --git a/dom/webidl/MIDIInput.webidl b/dom/webidl/MIDIInput.webidl new file mode 100644 index 0000000000..61b6cc2748 --- /dev/null +++ b/dom/webidl/MIDIInput.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-midi-api/ + */ + +[SecureContext, Pref="dom.webmidi.enabled", + Exposed=Window] +interface MIDIInput : MIDIPort { + attribute EventHandler onmidimessage; +}; diff --git a/dom/webidl/MIDIInputMap.webidl b/dom/webidl/MIDIInputMap.webidl new file mode 100644 index 0000000000..e3c3b0d5aa --- /dev/null +++ b/dom/webidl/MIDIInputMap.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-midi-api/ + */ + +[SecureContext, Pref="dom.webmidi.enabled", + Exposed=Window] +interface MIDIInputMap { + readonly maplike<DOMString, MIDIInput>; +}; diff --git a/dom/webidl/MIDIMessageEvent.webidl b/dom/webidl/MIDIMessageEvent.webidl new file mode 100644 index 0000000000..975ddae4c4 --- /dev/null +++ b/dom/webidl/MIDIMessageEvent.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-midi-api/ + */ + +[SecureContext, + Pref="dom.webmidi.enabled", + Exposed=Window] +interface MIDIMessageEvent : Event +{ + [Throws] + constructor(DOMString type, optional MIDIMessageEventInit eventInitDict = {}); + + [Throws] + readonly attribute Uint8Array data; +}; + +dictionary MIDIMessageEventInit : EventInit +{ + Uint8Array data; +}; diff --git a/dom/webidl/MIDIOptions.webidl b/dom/webidl/MIDIOptions.webidl new file mode 100644 index 0000000000..314ebec535 --- /dev/null +++ b/dom/webidl/MIDIOptions.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-midi-api/ + */ + +dictionary MIDIOptions { + boolean sysex = false; + boolean software = false; +}; diff --git a/dom/webidl/MIDIOutput.webidl b/dom/webidl/MIDIOutput.webidl new file mode 100644 index 0000000000..73c0a5bdb2 --- /dev/null +++ b/dom/webidl/MIDIOutput.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-midi-api/ + */ + +[SecureContext, Pref="dom.webmidi.enabled", + Exposed=Window] +interface MIDIOutput : MIDIPort { + [Throws] + undefined send(sequence<octet> data, optional DOMHighResTimeStamp timestamp); + undefined clear(); +}; diff --git a/dom/webidl/MIDIOutputMap.webidl b/dom/webidl/MIDIOutputMap.webidl new file mode 100644 index 0000000000..9070c55193 --- /dev/null +++ b/dom/webidl/MIDIOutputMap.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-midi-api/ + */ + +[SecureContext, Pref="dom.webmidi.enabled", + Exposed=Window] +interface MIDIOutputMap { + readonly maplike<DOMString, MIDIOutput>; +}; diff --git a/dom/webidl/MIDIPort.webidl b/dom/webidl/MIDIPort.webidl new file mode 100644 index 0000000000..97ee46bf00 --- /dev/null +++ b/dom/webidl/MIDIPort.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-midi-api/ + */ + +enum MIDIPortType { + "input", + "output" +}; + +enum MIDIPortDeviceState { + "disconnected", + "connected" +}; + +enum MIDIPortConnectionState { + "open", + "closed", + "pending" +}; + +[SecureContext, Pref="dom.webmidi.enabled", + Exposed=Window] +interface MIDIPort : EventTarget { + readonly attribute DOMString id; + readonly attribute DOMString? manufacturer; + readonly attribute DOMString? name; + readonly attribute DOMString? version; + readonly attribute MIDIPortType type; + readonly attribute MIDIPortDeviceState state; + readonly attribute MIDIPortConnectionState connection; + attribute EventHandler onstatechange; + [Throws] + Promise<MIDIPort> open(); + [Throws] + Promise<MIDIPort> close(); +}; diff --git a/dom/webidl/MathMLElement.webidl b/dom/webidl/MathMLElement.webidl new file mode 100644 index 0000000000..0283adfddc --- /dev/null +++ b/dom/webidl/MathMLElement.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://mathml-refresh.github.io/mathml-core/ + * + * Copyright © 2019 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark + * and permissive document license rules apply. + */ + +[Exposed=Window] +interface MathMLElement : Element { }; +MathMLElement includes GlobalEventHandlers; +MathMLElement includes HTMLOrForeignElement; +MathMLElement includes ElementCSSInlineStyle; +MathMLElement includes TouchEventHandlers; +MathMLElement includes OnErrorEventHandlerForNodes; diff --git a/dom/webidl/MediaCapabilities.webidl b/dom/webidl/MediaCapabilities.webidl new file mode 100644 index 0000000000..514a86285f --- /dev/null +++ b/dom/webidl/MediaCapabilities.webidl @@ -0,0 +1,87 @@ +/* -*- 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/media-capabilities/ + * + * Copyright © 2018 the Contributors to the Media Capabilities Specification + */ + +dictionary MediaConfiguration { + VideoConfiguration video; + AudioConfiguration audio; +}; + +dictionary MediaDecodingConfiguration : MediaConfiguration { + required MediaDecodingType type; +}; + +dictionary MediaEncodingConfiguration : MediaConfiguration { + required MediaEncodingType type; +}; + +enum MediaDecodingType { + "file", + "media-source", +}; + +enum MediaEncodingType { + "record", + "transmission" +}; + +dictionary VideoConfiguration { + required DOMString contentType; + required unsigned long width; + required unsigned long height; + required unsigned long long bitrate; + required double framerate; + boolean hasAlphaChannel; + HdrMetadataType hdrMetadataType; + ColorGamut colorGamut; + TransferFunction transferFunction; + DOMString scalabilityMode; +}; + +enum HdrMetadataType { + "smpteSt2086", + "smpteSt2094-10", + "smpteSt2094-40" +}; + +enum ColorGamut { + "srgb", + "p3", + "rec2020" +}; + +enum TransferFunction { + "srgb", + "pq", + "hlg" +}; + +dictionary AudioConfiguration { + required DOMString contentType; + DOMString channels; + unsigned long long bitrate; + unsigned long samplerate; +}; + +[Exposed=(Window, Worker), Func="mozilla::dom::MediaCapabilities::Enabled", + HeaderFile="mozilla/dom/MediaCapabilities.h"] +interface MediaCapabilitiesInfo { + readonly attribute boolean supported; + readonly attribute boolean smooth; + readonly attribute boolean powerEfficient; +}; + +[Exposed=(Window, Worker), Func="mozilla::dom::MediaCapabilities::Enabled"] +interface MediaCapabilities { + [NewObject] + Promise<MediaCapabilitiesInfo> decodingInfo(MediaDecodingConfiguration configuration); + [NewObject] + Promise<MediaCapabilitiesInfo> encodingInfo(MediaEncodingConfiguration configuration); +}; diff --git a/dom/webidl/MediaDebugInfo.webidl b/dom/webidl/MediaDebugInfo.webidl new file mode 100644 index 0000000000..46192d8e59 --- /dev/null +++ b/dom/webidl/MediaDebugInfo.webidl @@ -0,0 +1,235 @@ +/* -*- 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 module defines dictonaries that are filled with debug information + * through GetDebugInfo() calls in the media component. To get the information + * filled and returned, we have two methods that return promises, one in + * HTMLMediaElement and one in MediaSource. + * + * If you need to add some extra info, there's one dictionary per class, + * following the pattern <ClassName>DebugInfo, where you can add some fields + * and fill them in the corresponding GetDebugInfo() call. + * + * Below is the structures returned. + * + * Used by HTMLMediaElement.GetMozRequestDebugInfo(), see HTMLMediaElement.webidl: + * + * HTMLMediaElementDebugInfo + * EMEDebugInfo + * MediaDecoderDebugInfo + * MediaFormatReaderDebugInfo + * MediaStateDebugInfo + * MediaStateDebugInfo + * MediaFrameStats + * MediaDecoderStateMachineDebugInfo + * MediaDecoderStateMachineDecodingStateDebugInfo + * MediaSinkDebugInfo + * VideoSinkDebugInfo + * AudioSinkDebugInfo + * DecodedStreamDebugInfo + * DecodedStreamDataDebugInfo + * MediaResourceDebugInfo + * MediaCacheStreamDebugInfo + * + * Used by MediaSource.GetMozDebugReaderData(), see MediaSource.webidl: + * + * MediaSourceDecoderDebugInfo + * MediaFormatReaderDebugInfo + * MediaStateDebugInfo + * MediaStateDebugInfo + * MediaFrameStats + * MediaSourceDemuxerDebugInfo + * TrackBuffersManagerDebugInfo + * TrackBuffersManagerDebugInfo + */ +dictionary MediaCacheStreamDebugInfo { + long long streamLength = 0; + long long channelOffset = 0; + boolean cacheSuspended = false; + boolean channelEnded = false; + long loadID = 0; +}; + +dictionary MediaResourceDebugInfo { + MediaCacheStreamDebugInfo cacheStream = {}; +}; + +dictionary MediaDecoderDebugInfo { + DOMString instance = ""; + unsigned long channels = 0; + unsigned long rate = 0; + boolean hasAudio = false; + boolean hasVideo = false; + DOMString PlayState = ""; + DOMString containerType = ""; + MediaFormatReaderDebugInfo reader = {}; + MediaDecoderStateMachineDebugInfo stateMachine = {}; + MediaResourceDebugInfo resource = {}; +}; + +dictionary AudioSinkDebugInfo { + long long startTime = 0; + long long lastGoodPosition = 0; + boolean isPlaying = false; + boolean isStarted = false; + boolean audioEnded = false; + unsigned long outputRate = 0; + long long written = 0; + boolean hasErrored = false; + boolean playbackComplete = false; +}; + +dictionary AudioSinkWrapperDebugInfo { + boolean isPlaying = false; + boolean isStarted = false; + boolean audioEnded = false; + AudioSinkDebugInfo audioSink = {}; +}; + +dictionary VideoSinkDebugInfo { + boolean isStarted = false; + boolean isPlaying = false; + boolean finished = false; + long size = 0; + long long videoFrameEndTime = 0; + boolean hasVideo = false; + boolean videoSinkEndRequestExists = false; + boolean endPromiseHolderIsEmpty = false; +}; + +dictionary DecodedStreamDataDebugInfo { + DOMString instance = ""; + long long audioFramesWritten = 0; + long long streamAudioWritten = 0; + long long streamVideoWritten = 0; + long long nextAudioTime = 0; + long long lastVideoStartTime = 0; + long long lastVideoEndTime = 0; + boolean haveSentFinishAudio = false; + boolean haveSentFinishVideo = false; +}; + +dictionary DecodedStreamDebugInfo { + DOMString instance = ""; + long long startTime = 0; + long long lastOutputTime = 0; + long playing = 0; + long long lastAudio = 0; + boolean audioQueueFinished = false; + long audioQueueSize = 0; + DecodedStreamDataDebugInfo data = {}; +}; + +dictionary MediaSinkDebugInfo { + AudioSinkWrapperDebugInfo audioSinkWrapper = {}; + VideoSinkDebugInfo videoSink = {}; + DecodedStreamDebugInfo decodedStream = {}; +}; + +dictionary MediaDecoderStateMachineDecodingStateDebugInfo { + boolean isPrerolling = false; +}; + +dictionary MediaDecoderStateMachineDebugInfo { + long long duration = 0; + long long mediaTime = 0; + long long clock = 0; + DOMString state = ""; + long playState = 0; + boolean sentFirstFrameLoadedEvent = false; + boolean isPlaying = false; + DOMString audioRequestStatus = ""; + DOMString videoRequestStatus = ""; + long long decodedAudioEndTime = 0; + long long decodedVideoEndTime = 0; + boolean audioCompleted = false; + boolean videoCompleted = false; + MediaDecoderStateMachineDecodingStateDebugInfo stateObj = {}; + MediaSinkDebugInfo mediaSink = {}; +}; + +dictionary MediaStateDebugInfo { + boolean needInput = false; + boolean hasPromise = false; + boolean waitingPromise = false; + boolean hasDemuxRequest = false; + long demuxQueueSize = 0; + boolean hasDecoder = false; + double timeTreshold = 0.0; + boolean timeTresholdHasSeeked = false; + long long numSamplesInput = 0; + long long numSamplesOutput = 0; + long queueSize = 0; + long pending = 0; + boolean waitingForData = false; + long demuxEOS = 0; + long drainState = 0; + boolean waitingForKey = false; + long long lastStreamSourceID = 0; +}; + +dictionary MediaFrameStats { + long long droppedDecodedFrames = 0; + long long droppedSinkFrames = 0; + long long droppedCompositorFrames = 0; +}; + +dictionary MediaFormatReaderDebugInfo { + DOMString videoType = ""; + DOMString videoDecoderName = ""; + long videoWidth = 0; + long videoHeight = 0; + double videoRate = 0.0; + DOMString audioType = ""; + DOMString audioDecoderName = ""; + boolean videoHardwareAccelerated = false; + long long videoNumSamplesOutputTotal = 0; + long long videoNumSamplesSkippedTotal = 0; + long audioChannels = 0; + double audioRate = 0.0; + long long audioFramesDecoded = 0; + MediaStateDebugInfo audioState = {}; + MediaStateDebugInfo videoState = {}; + MediaFrameStats frameStats = {}; +}; + +dictionary BufferRange { + double start = 0; + double end = 0; +}; + +dictionary TrackBuffersManagerDebugInfo { + DOMString type = ""; + double nextSampleTime = 0.0; + long numSamples = 0; + long bufferSize = 0; + long evictable = 0; + long nextGetSampleIndex = 0; + long nextInsertionIndex = 0; + sequence<BufferRange> ranges = []; +}; + +dictionary MediaSourceDemuxerDebugInfo { + TrackBuffersManagerDebugInfo audioTrack = {}; + TrackBuffersManagerDebugInfo videoTrack = {}; +}; + +dictionary MediaSourceDecoderDebugInfo { + MediaFormatReaderDebugInfo reader = {}; + MediaSourceDemuxerDebugInfo demuxer = {}; +}; + +dictionary EMEDebugInfo { + DOMString keySystem = ""; + DOMString sessionsInfo = ""; +}; + +dictionary HTMLMediaElementDebugInfo { + unsigned long compositorDroppedFrames = 0; + EMEDebugInfo EMEInfo = {}; + MediaDecoderDebugInfo decoder = {}; +}; diff --git a/dom/webidl/MediaDeviceInfo.webidl b/dom/webidl/MediaDeviceInfo.webidl new file mode 100644 index 0000000000..7bceadc22e --- /dev/null +++ b/dom/webidl/MediaDeviceInfo.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/getusermedia.html + */ + +enum MediaDeviceKind { + "audioinput", + "audiooutput", + "videoinput" +}; + +[Func="Navigator::HasUserMediaSupport", + Exposed=Window] +interface MediaDeviceInfo { + readonly attribute DOMString deviceId; + readonly attribute MediaDeviceKind kind; + readonly attribute DOMString label; + readonly attribute DOMString groupId; + + [Default] object toJSON(); +}; diff --git a/dom/webidl/MediaDevices.webidl b/dom/webidl/MediaDevices.webidl new file mode 100644 index 0000000000..d291f722de --- /dev/null +++ b/dom/webidl/MediaDevices.webidl @@ -0,0 +1,40 @@ +/* -*- 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. + */ + +[Func="Navigator::HasUserMediaSupport", + Exposed=Window] +interface MediaDevices : EventTarget { + [Pref="media.ondevicechange.enabled"] + attribute EventHandler ondevicechange; + MediaTrackSupportedConstraints getSupportedConstraints(); + + [NewObject, UseCounter] + Promise<sequence<MediaDeviceInfo>> enumerateDevices(); + + [NewObject, NeedsCallerType, UseCounter] + Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints = {}); + + // We need [SecureContext] in case media.devices.insecure.enabled = true + // because we don't want that legacy pref to expose this newer method. + [SecureContext, Pref="media.getdisplaymedia.enabled", NewObject, NeedsCallerType, UseCounter] + Promise<MediaStream> getDisplayMedia(optional DisplayMediaStreamConstraints constraints = {}); +}; + +// https://w3c.github.io/mediacapture-output/#audiooutputoptions-dictionary +dictionary AudioOutputOptions { + DOMString deviceId = ""; +}; +// https://w3c.github.io/mediacapture-output/#mediadevices-extensions +partial interface MediaDevices { + [SecureContext, Pref="media.setsinkid.enabled", NewObject, NeedsCallerType] + Promise<MediaDeviceInfo> selectAudioOutput(optional AudioOutputOptions options = {}); +}; diff --git a/dom/webidl/MediaElementAudioSourceNode.webidl b/dom/webidl/MediaElementAudioSourceNode.webidl new file mode 100644 index 0000000000..7417b7c5be --- /dev/null +++ b/dom/webidl/MediaElementAudioSourceNode.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * 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 MediaElementAudioSourceOptions { + required HTMLMediaElement mediaElement; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface MediaElementAudioSourceNode : AudioNode { + [Throws] + constructor(AudioContext context, MediaElementAudioSourceOptions options); + + readonly attribute HTMLMediaElement mediaElement; +}; + +// Mozilla extensions +MediaElementAudioSourceNode includes AudioNodePassThrough; diff --git a/dom/webidl/MediaEncryptedEvent.webidl b/dom/webidl/MediaEncryptedEvent.webidl new file mode 100644 index 0000000000..864ed5d422 --- /dev/null +++ b/dom/webidl/MediaEncryptedEvent.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface MediaEncryptedEvent : Event { + [Throws] + constructor(DOMString type, + optional MediaKeyNeededEventInit eventInitDict = {}); + + readonly attribute DOMString initDataType; + [Throws] + readonly attribute ArrayBuffer? initData; +}; + +dictionary MediaKeyNeededEventInit : EventInit { + DOMString initDataType = ""; + ArrayBuffer? initData = null; +}; diff --git a/dom/webidl/MediaError.webidl b/dom/webidl/MediaError.webidl new file mode 100644 index 0000000000..f882e21386 --- /dev/null +++ b/dom/webidl/MediaError.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/html/#mediaerror + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface MediaError { + // Keep these constants in sync with the ones defined in HTMLMediaElement.h + const unsigned short MEDIA_ERR_ABORTED = 1; + const unsigned short MEDIA_ERR_NETWORK = 2; + const unsigned short MEDIA_ERR_DECODE = 3; + const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4; + + [Constant] + readonly attribute unsigned short code; + readonly attribute DOMString message; +}; diff --git a/dom/webidl/MediaKeyError.webidl b/dom/webidl/MediaKeyError.webidl new file mode 100644 index 0000000000..73e714e51f --- /dev/null +++ b/dom/webidl/MediaKeyError.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +// According to the spec, "The future of error events and MediaKeyError +// is uncertain." +// https://www.w3.org/Bugs/Public/show_bug.cgi?id=21798 +[Exposed=Window] +interface MediaKeyError : Event { + readonly attribute unsigned long systemCode; +}; diff --git a/dom/webidl/MediaKeyMessageEvent.webidl b/dom/webidl/MediaKeyMessageEvent.webidl new file mode 100644 index 0000000000..28f6ceabcb --- /dev/null +++ b/dom/webidl/MediaKeyMessageEvent.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +enum MediaKeyMessageType { + "license-request", + "license-renewal", + "license-release", + "individualization-request" +}; + +[Exposed=Window] +interface MediaKeyMessageEvent : Event { + [Throws] + constructor(DOMString type, MediaKeyMessageEventInit eventInitDict); + + readonly attribute MediaKeyMessageType messageType; + [Throws] + readonly attribute ArrayBuffer message; +}; + +dictionary MediaKeyMessageEventInit : EventInit { + required MediaKeyMessageType messageType; + required ArrayBuffer message; +}; diff --git a/dom/webidl/MediaKeySession.webidl b/dom/webidl/MediaKeySession.webidl new file mode 100644 index 0000000000..050923c546 --- /dev/null +++ b/dom/webidl/MediaKeySession.webidl @@ -0,0 +1,46 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface MediaKeySession : EventTarget { + // error state + readonly attribute MediaKeyError? error; + + // session properties + readonly attribute DOMString sessionId; + + readonly attribute unrestricted double expiration; + + readonly attribute Promise<undefined> closed; + + readonly attribute MediaKeyStatusMap keyStatuses; + + attribute EventHandler onkeystatuseschange; + + attribute EventHandler onmessage; + + [NewObject] + Promise<undefined> generateRequest(DOMString initDataType, BufferSource initData); + + [NewObject] + Promise<boolean> load(DOMString sessionId); + + // session operations + [NewObject] + Promise<undefined> update(BufferSource response); + + [NewObject] + Promise<undefined> close(); + + [NewObject] + Promise<undefined> remove(); +}; diff --git a/dom/webidl/MediaKeyStatusMap.webidl b/dom/webidl/MediaKeyStatusMap.webidl new file mode 100644 index 0000000000..8340a15769 --- /dev/null +++ b/dom/webidl/MediaKeyStatusMap.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +enum MediaKeyStatus { + "usable", + "expired", + "released", + "output-restricted", + "output-downscaled", + "status-pending", + "internal-error" +}; + +[Exposed=Window] +interface MediaKeyStatusMap { + iterable<ArrayBuffer,MediaKeyStatus>; + readonly attribute unsigned long size; + boolean has (BufferSource keyId); + [Throws] + (MediaKeyStatus or undefined) get (BufferSource keyId); +}; diff --git a/dom/webidl/MediaKeySystemAccess.webidl b/dom/webidl/MediaKeySystemAccess.webidl new file mode 100644 index 0000000000..21baadc159 --- /dev/null +++ b/dom/webidl/MediaKeySystemAccess.webidl @@ -0,0 +1,43 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +enum MediaKeysRequirement { + "required", + "optional", + "not-allowed" +}; + +dictionary MediaKeySystemMediaCapability { + DOMString contentType = ""; + DOMString robustness = ""; + [Pref="media.eme.encrypted-media-encryption-scheme.enabled"] + DOMString? encryptionScheme = null; +}; + +dictionary MediaKeySystemConfiguration { + DOMString label = ""; + sequence<DOMString> initDataTypes = []; + sequence<MediaKeySystemMediaCapability> audioCapabilities = []; + sequence<MediaKeySystemMediaCapability> videoCapabilities = []; + MediaKeysRequirement distinctiveIdentifier = "optional"; + MediaKeysRequirement persistentState = "optional"; + sequence<DOMString> sessionTypes; +}; + +[Exposed=Window] +interface MediaKeySystemAccess { + readonly attribute DOMString keySystem; + [NewObject] + MediaKeySystemConfiguration getConfiguration(); + [NewObject] + Promise<MediaKeys> createMediaKeys(); +}; diff --git a/dom/webidl/MediaKeys.webidl b/dom/webidl/MediaKeys.webidl new file mode 100644 index 0000000000..bfbe5bcfe6 --- /dev/null +++ b/dom/webidl/MediaKeys.webidl @@ -0,0 +1,51 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +// Note: "persistent-usage-record" session type is unsupported yet, as +// it's marked as "at risk" in the spec, and Chrome doesn't support it. +enum MediaKeySessionType { + "temporary", + "persistent-license", + // persistent-usage-record, +}; + +// https://w3c.github.io/encrypted-media/#idl-def-hdcpversion +enum HDCPVersion { + "1.0", + "1.1", + "1.2", + "1.3", + "1.4", + "2.0", + "2.1", + "2.2", + "2.3", +}; + +// https://w3c.github.io/encrypted-media/#idl-def-mediakeyspolicy +dictionary MediaKeysPolicy { + HDCPVersion minHdcpVersion; +}; + +[Exposed=Window] +interface MediaKeys { + readonly attribute DOMString keySystem; + + [NewObject, Throws] + MediaKeySession createSession(optional MediaKeySessionType sessionType = "temporary"); + + [NewObject] + Promise<undefined> setServerCertificate(BufferSource serverCertificate); + + [Pref="media.eme.hdcp-policy-check.enabled", NewObject] + Promise<MediaKeyStatus> getStatusForPolicy(optional MediaKeysPolicy policy = {}); +}; diff --git a/dom/webidl/MediaKeysRequestStatus.webidl b/dom/webidl/MediaKeysRequestStatus.webidl new file mode 100644 index 0000000000..3d9aa1e282 --- /dev/null +++ b/dom/webidl/MediaKeysRequestStatus.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +enum MediaKeySystemStatus { + "available", + "api-disabled", + "cdm-disabled", + "cdm-not-supported", + "cdm-not-installed", + "cdm-created", +}; + +/* Note: This dictionary and enum is only used by Gecko to convey messages + * to chrome JS code. It is not exposed to the web. + */ +[GenerateToJSON] +dictionary RequestMediaKeySystemAccessNotification { + required DOMString keySystem; + required MediaKeySystemStatus status; +}; diff --git a/dom/webidl/MediaList.webidl b/dom/webidl/MediaList.webidl new file mode 100644 index 0000000000..6b58a809fa --- /dev/null +++ b/dom/webidl/MediaList.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// https://drafts.csswg.org/cssom/#the-medialist-interface + +[Exposed=Window] +interface MediaList { + stringifier attribute [LegacyNullToEmptyString] UTF8String mediaText; + + readonly attribute unsigned long length; + getter UTF8String? item(unsigned long index); + [Throws] + undefined deleteMedium(UTF8String oldMedium); + [Throws] + undefined appendMedium(UTF8String newMedium); +}; diff --git a/dom/webidl/MediaQueryList.webidl b/dom/webidl/MediaQueryList.webidl new file mode 100644 index 0000000000..f1211c5713 --- /dev/null +++ b/dom/webidl/MediaQueryList.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/cssom-view/#mediaquerylist + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[ProbablyShortLivingWrapper, + Exposed=Window] +interface MediaQueryList : EventTarget { + readonly attribute UTF8String media; + readonly attribute boolean matches; + + [Throws] + undefined addListener(EventListener? listener); + + [Throws] + undefined removeListener(EventListener? listener); + + attribute EventHandler onchange; +}; diff --git a/dom/webidl/MediaQueryListEvent.webidl b/dom/webidl/MediaQueryListEvent.webidl new file mode 100644 index 0000000000..4f41ca480a --- /dev/null +++ b/dom/webidl/MediaQueryListEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * https://drafts.csswg.org/cssom-view/#mediaquerylistevent + */ + +[Exposed=Window] +interface MediaQueryListEvent : Event { + constructor(DOMString type, + optional MediaQueryListEventInit eventInitDict = {}); + + readonly attribute UTF8String media; + readonly attribute boolean matches; +}; + +dictionary MediaQueryListEventInit : EventInit { + UTF8String media = ""; + boolean matches = false; +}; diff --git a/dom/webidl/MediaRecorder.webidl b/dom/webidl/MediaRecorder.webidl new file mode 100644 index 0000000000..88dfe451db --- /dev/null +++ b/dom/webidl/MediaRecorder.webidl @@ -0,0 +1,57 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-capture/MediaRecorder.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + + +enum BitrateMode { "constant", "variable" }; + +enum RecordingState { "inactive", "recording", "paused" }; + +[Exposed=Window] +interface MediaRecorder : EventTarget { + [Throws] + constructor(MediaStream stream, optional MediaRecorderOptions options = {}); + [Throws] + constructor(AudioNode node, optional unsigned long output = 0, + optional MediaRecorderOptions options = {}); + readonly attribute MediaStream stream; + readonly attribute DOMString mimeType; + readonly attribute RecordingState state; + attribute EventHandler onstart; + attribute EventHandler onstop; + attribute EventHandler ondataavailable; + attribute EventHandler onpause; + attribute EventHandler onresume; + attribute EventHandler onerror; + readonly attribute unsigned long videoBitsPerSecond; + readonly attribute unsigned long audioBitsPerSecond; + + + [Throws] + undefined start(optional unsigned long timeslice); + [Throws] + undefined stop(); + [Throws] + undefined pause(); + [Throws] + undefined resume(); + [Throws] + undefined requestData(); + + static boolean isTypeSupported(DOMString type); +}; + +dictionary MediaRecorderOptions { + DOMString mimeType = ""; + unsigned long audioBitsPerSecond; + unsigned long videoBitsPerSecond; + unsigned long bitsPerSecond; +}; diff --git a/dom/webidl/MediaRecorderErrorEvent.webidl b/dom/webidl/MediaRecorderErrorEvent.webidl new file mode 100644 index 0000000000..0158d4b52a --- /dev/null +++ b/dom/webidl/MediaRecorderErrorEvent.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/mediacapture-record/ + * + * Copyright © 2017 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark + * and document use rules apply. + */ + +dictionary MediaRecorderErrorEventInit : EventInit { + required DOMException error; +}; + +[Exposed=Window] +interface MediaRecorderErrorEvent : Event { + constructor(DOMString type, MediaRecorderErrorEventInit eventInitDict); + + [SameObject] readonly attribute DOMException error; +}; diff --git a/dom/webidl/MediaSession.webidl b/dom/webidl/MediaSession.webidl new file mode 100644 index 0000000000..8a19998e05 --- /dev/null +++ b/dom/webidl/MediaSession.webidl @@ -0,0 +1,85 @@ +/* -*- 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/mediasession/#idl-index + */ + +enum MediaSessionPlaybackState { + "none", + "paused", + "playing" +}; + +enum MediaSessionAction { + "play", + "pause", + "seekbackward", + "seekforward", + "previoustrack", + "nexttrack", + "skipad", + "seekto", + "stop", +}; + +callback MediaSessionActionHandler = undefined(MediaSessionActionDetails details); + +[Exposed=Window] +interface MediaSession { + attribute MediaMetadata? metadata; + + attribute MediaSessionPlaybackState playbackState; + + undefined setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler); + + [Throws] + undefined setPositionState(optional MediaPositionState state = {}); + + // Fire the action handler. It's test-only for now. + [ChromeOnly] + undefined notifyHandler(MediaSessionActionDetails details); +}; + +[Exposed=Window] +interface MediaMetadata { + [Throws] + constructor(optional MediaMetadataInit init = {}); + + attribute DOMString title; + attribute DOMString artist; + attribute DOMString album; + // https://github.com/w3c/mediasession/issues/237 + // Take and return `MediaImage` on setter and getter. + [Frozen, Cached, Pure, Throws] + attribute sequence<object> artwork; +}; + +dictionary MediaMetadataInit { + DOMString title = ""; + DOMString artist = ""; + DOMString album = ""; + sequence<MediaImage> artwork = []; +}; + +dictionary MediaImage { + required USVString src; + DOMString sizes = ""; + DOMString type = ""; +}; + +// Spec issue https://github.com/w3c/mediasession/issues/254 +dictionary MediaSessionActionDetails { + required MediaSessionAction action; + double seekOffset; + double seekTime; + boolean fastSeek; +}; + +dictionary MediaPositionState { + double duration; + double playbackRate; + double position; +}; diff --git a/dom/webidl/MediaSource.webidl b/dom/webidl/MediaSource.webidl new file mode 100644 index 0000000000..278bf3a237 --- /dev/null +++ b/dom/webidl/MediaSource.webidl @@ -0,0 +1,51 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum MediaSourceReadyState { + "closed", + "open", + "ended" +}; + +enum MediaSourceEndOfStreamError { + "network", + "decode" +}; + +[Pref="media.mediasource.enabled", + Exposed=Window] +interface MediaSource : EventTarget { + [Throws] + constructor(); + + readonly attribute SourceBufferList sourceBuffers; + readonly attribute SourceBufferList activeSourceBuffers; + readonly attribute MediaSourceReadyState readyState; + [SetterThrows] + attribute unrestricted double duration; + attribute EventHandler onsourceopen; + attribute EventHandler onsourceended; + attribute EventHandler onsourceclose; + [NewObject, Throws] + SourceBuffer addSourceBuffer(DOMString type); + [Throws] + undefined removeSourceBuffer(SourceBuffer sourceBuffer); + [Throws] + undefined endOfStream(optional MediaSourceEndOfStreamError error); + [Throws] + undefined setLiveSeekableRange(double start, double end); + [Throws] + undefined clearLiveSeekableRange(); + static boolean isTypeSupported(DOMString type); + [NewObject, ChromeOnly] + Promise<MediaSourceDecoderDebugInfo> mozDebugReaderData(); +}; diff --git a/dom/webidl/MediaStream.webidl b/dom/webidl/MediaStream.webidl new file mode 100644 index 0000000000..3718e436ad --- /dev/null +++ b/dom/webidl/MediaStream.webidl @@ -0,0 +1,59 @@ +/* -*- 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 origins of this IDL file are + * 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. + */ + +// These dictionaries need to be in a separate file from their +// MediaTrackConstraints* counterparts due to a webidl compiler limitation. + +dictionary MediaStreamConstraints { + (boolean or MediaTrackConstraints) audio = false; + (boolean or MediaTrackConstraints) video = false; + boolean picture = false; // Mozilla legacy + boolean fake; // For testing purpose. Generates frames of solid + // colors if video is enabled, and sound of 1Khz sine + // wave if audio is enabled. + DOMString? peerIdentity = null; +}; + +dictionary DisplayMediaStreamConstraints { + (boolean or MediaTrackConstraints) video = true; + (boolean or MediaTrackConstraints) audio = false; +}; + +[Exposed=Window] +interface MediaStream : EventTarget { + [Throws] + constructor(); + [Throws] + constructor(MediaStream stream); + [Throws] + constructor(sequence<MediaStreamTrack> tracks); + + readonly attribute DOMString id; + sequence<MediaStreamTrack> getAudioTracks (); + sequence<MediaStreamTrack> getVideoTracks (); + sequence<MediaStreamTrack> getTracks (); + MediaStreamTrack? getTrackById (DOMString trackId); + undefined addTrack (MediaStreamTrack track); + undefined removeTrack (MediaStreamTrack track); + MediaStream clone (); + readonly attribute boolean active; + attribute EventHandler onaddtrack; + attribute EventHandler onremovetrack; + + [ChromeOnly, NewObject] + static Promise<long> countUnderlyingStreams(); + + // Webrtc allows the remote side to name a stream whatever it wants, and we + // need to surface this to content. + [ChromeOnly] + undefined assignId(DOMString id); +}; diff --git a/dom/webidl/MediaStreamAudioDestinationNode.webidl b/dom/webidl/MediaStreamAudioDestinationNode.webidl new file mode 100644 index 0000000000..2c60b9eaf0 --- /dev/null +++ b/dom/webidl/MediaStreamAudioDestinationNode.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface MediaStreamAudioDestinationNode : AudioNode { + [Throws] + constructor(AudioContext context, optional AudioNodeOptions options = {}); + + [BinaryName="DOMStream"] + readonly attribute MediaStream stream; +}; diff --git a/dom/webidl/MediaStreamAudioSourceNode.webidl b/dom/webidl/MediaStreamAudioSourceNode.webidl new file mode 100644 index 0000000000..5104fe3bf3 --- /dev/null +++ b/dom/webidl/MediaStreamAudioSourceNode.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary MediaStreamAudioSourceOptions { + required MediaStream mediaStream; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface MediaStreamAudioSourceNode : AudioNode { + [Throws] + constructor(AudioContext context, MediaStreamAudioSourceOptions options); + + [BinaryName="GetMediaStream"] + readonly attribute MediaStream mediaStream; +}; + +// Mozilla extensions +MediaStreamAudioSourceNode includes AudioNodePassThrough; diff --git a/dom/webidl/MediaStreamError.webidl b/dom/webidl/MediaStreamError.webidl new file mode 100644 index 0000000000..a1b76c5ea1 --- /dev/null +++ b/dom/webidl/MediaStreamError.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-MediaStreamError + */ + +// The future of MediaStreamError is uncertain. +// https://www.w3.org/Bugs/Public/show_bug.cgi?id=26776 + +// TODO: This is an 'exception', not an interface, by virtue of needing to be +// passed as a promise rejection-reason. Revisit if DOMException grows a customArg + +[ExceptionClass, LegacyNoInterfaceObject, + Exposed=Window] +interface MediaStreamError { + readonly attribute DOMString name; + readonly attribute DOMString? message; + readonly attribute DOMString? constraint; +}; diff --git a/dom/webidl/MediaStreamEvent.webidl b/dom/webidl/MediaStreamEvent.webidl new file mode 100644 index 0000000000..752e43c13b --- /dev/null +++ b/dom/webidl/MediaStreamEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/webrtc.html#mediastreamevent + */ + +dictionary MediaStreamEventInit : EventInit { + MediaStream? stream = null; +}; + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface MediaStreamEvent : Event { + constructor(DOMString type, optional MediaStreamEventInit eventInitDict = {}); + + readonly attribute MediaStream? stream; +}; diff --git a/dom/webidl/MediaStreamTrack.webidl b/dom/webidl/MediaStreamTrack.webidl new file mode 100644 index 0000000000..afd2f925f7 --- /dev/null +++ b/dom/webidl/MediaStreamTrack.webidl @@ -0,0 +1,120 @@ +/* -*- 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. + */ + +// These two enums are in the spec even though they're not used directly in the +// API due to https://www.w3.org/Bugs/Public/show_bug.cgi?id=19936 +// Their binding code is used in the implementation. + +enum VideoFacingModeEnum { + "user", + "environment", + "left", + "right" +}; + +enum MediaSourceEnum { + "camera", + "screen", + "application", + "window", + "browser", + "microphone", + "audioCapture", + "other" + // If values are added, adjust n_values in Histograms.json (2 places) +}; + +dictionary ConstrainLongRange { + long min; + long max; + long exact; + long ideal; +}; + +dictionary ConstrainDoubleRange { + double min; + double max; + double exact; + double ideal; +}; + +dictionary ConstrainBooleanParameters { + boolean exact; + boolean ideal; +}; + +dictionary ConstrainDOMStringParameters { + (DOMString or sequence<DOMString>) exact; + (DOMString or sequence<DOMString>) ideal; +}; + +typedef (long or ConstrainLongRange) ConstrainLong; +typedef (double or ConstrainDoubleRange) ConstrainDouble; +typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean; +typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString; + +// Note: When adding new constraints, remember to update the SelectSettings() +// function in MediaManager.cpp to make OverconstrainedError's constraint work! + +dictionary MediaTrackConstraintSet { + ConstrainLong width; + ConstrainLong height; + ConstrainDouble frameRate; + ConstrainDOMString facingMode; + DOMString mediaSource; + long long browserWindow; + boolean scrollWithPage; + ConstrainDOMString deviceId; + ConstrainDOMString groupId; + ConstrainLong viewportOffsetX; + ConstrainLong viewportOffsetY; + ConstrainLong viewportWidth; + ConstrainLong viewportHeight; + ConstrainBoolean echoCancellation; + ConstrainBoolean noiseSuppression; + ConstrainBoolean autoGainControl; + ConstrainLong channelCount; +}; + +[GenerateToJSON] +dictionary MediaTrackConstraints : MediaTrackConstraintSet { + sequence<MediaTrackConstraintSet> advanced; +}; + +enum MediaStreamTrackState { + "live", + "ended" +}; + +[Exposed=Window] +interface MediaStreamTrack : EventTarget { + readonly attribute DOMString kind; + readonly attribute DOMString id; + [NeedsCallerType] + readonly attribute DOMString label; + attribute boolean enabled; + readonly attribute boolean muted; + attribute EventHandler onmute; + attribute EventHandler onunmute; + readonly attribute MediaStreamTrackState readyState; + attribute EventHandler onended; + MediaStreamTrack clone (); + undefined stop (); +// MediaTrackCapabilities getCapabilities (); + MediaTrackConstraints getConstraints (); + [NeedsCallerType] + MediaTrackSettings getSettings (); + + [NewObject, NeedsCallerType] + Promise<undefined> applyConstraints (optional MediaTrackConstraints constraints = {}); +// attribute EventHandler onoverconstrained; +}; diff --git a/dom/webidl/MediaStreamTrackAudioSourceNode.webidl b/dom/webidl/MediaStreamTrackAudioSourceNode.webidl new file mode 100644 index 0000000000..abf66cb634 --- /dev/null +++ b/dom/webidl/MediaStreamTrackAudioSourceNode.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary MediaStreamTrackAudioSourceOptions { + required MediaStreamTrack mediaStreamTrack; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface MediaStreamTrackAudioSourceNode : AudioNode { + [Throws] + constructor(AudioContext context, MediaStreamTrackAudioSourceOptions options); +}; + +// Mozilla extensions +MediaStreamTrackAudioSourceNode includes AudioNodePassThrough; diff --git a/dom/webidl/MediaStreamTrackEvent.webidl b/dom/webidl/MediaStreamTrackEvent.webidl new file mode 100644 index 0000000000..8a202581e7 --- /dev/null +++ b/dom/webidl/MediaStreamTrackEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/webrtc.html#mediastreamevent + */ + +dictionary MediaStreamTrackEventInit : EventInit { + required MediaStreamTrack track; +}; + +[Exposed=Window] +interface MediaStreamTrackEvent : Event { + constructor(DOMString type, MediaStreamTrackEventInit eventInitDict); + + [SameObject] + readonly attribute MediaStreamTrack track; +}; diff --git a/dom/webidl/MediaTrackSettings.webidl b/dom/webidl/MediaTrackSettings.webidl new file mode 100644 index 0000000000..24642e063e --- /dev/null +++ b/dom/webidl/MediaTrackSettings.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://w3c.github.io/mediacapture-main/getusermedia.html + */ + +dictionary MediaTrackSettings { + long width; + long height; + double frameRate; + DOMString facingMode; + boolean echoCancellation; + boolean autoGainControl; + boolean noiseSuppression; + long channelCount; + DOMString deviceId; + DOMString groupId; + + // Mozilla-specific extensions: + + // http://fluffy.github.io/w3c-screen-share/#screen-based-video-constraints + // OBE by http://w3c.github.io/mediacapture-screen-share + + DOMString mediaSource; + + // Experimental https://bugzilla.mozilla.org/show_bug.cgi?id=1131568#c3 + // https://bugzilla.mozilla.org/show_bug.cgi?id=1193075 + + long long browserWindow; + boolean scrollWithPage; + long viewportOffsetX; + long viewportOffsetY; + long viewportWidth; + long viewportHeight; +}; diff --git a/dom/webidl/MediaTrackSupportedConstraints.webidl b/dom/webidl/MediaTrackSupportedConstraints.webidl new file mode 100644 index 0000000000..a242eae59a --- /dev/null +++ b/dom/webidl/MediaTrackSupportedConstraints.webidl @@ -0,0 +1,43 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/getusermedia.html + */ + +dictionary MediaTrackSupportedConstraints { + boolean width = true; + boolean height = true; + boolean aspectRatio; // to be supported + boolean frameRate = true; + boolean facingMode = true; + boolean volume; // to be supported + boolean sampleRate; // to be supported + boolean sampleSize; // to be supported + boolean echoCancellation = true; + boolean noiseSuppression = true; + boolean autoGainControl = true; + boolean latency; // to be supported + boolean channelCount = true; + boolean deviceId = true; + boolean groupId = true; + + // Mozilla-specific extensions: + + // http://fluffy.github.io/w3c-screen-share/#screen-based-video-constraints + // OBE by http://w3c.github.io/mediacapture-screen-share + + boolean mediaSource = true; + + // Experimental https://bugzilla.mozilla.org/show_bug.cgi?id=1131568#c3 + // https://bugzilla.mozilla.org/show_bug.cgi?id=1193075 + + boolean browserWindow = true; + boolean scrollWithPage = true; + boolean viewportOffsetX = true; + boolean viewportOffsetY = true; + boolean viewportWidth = true; + boolean viewportHeight = true; +}; diff --git a/dom/webidl/MerchantValidationEvent.webidl b/dom/webidl/MerchantValidationEvent.webidl new file mode 100644 index 0000000000..5f2145e979 --- /dev/null +++ b/dom/webidl/MerchantValidationEvent.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this WebIDL file is + * https://w3c.github.io/payment-request/#merchantvalidationevent-interface + * https://w3c.github.io/payment-request/#merchantvalidationeventinit-dictionary + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[SecureContext, +Exposed=Window, +Func="mozilla::dom::PaymentRequest::PrefEnabled"] +interface MerchantValidationEvent : Event { + [Throws] + constructor(DOMString type, + optional MerchantValidationEventInit eventInitDict = {}); + + readonly attribute DOMString methodName; + readonly attribute USVString validationURL; + [Throws] + undefined complete(Promise<any> merchantSessionPromise); +}; + +dictionary MerchantValidationEventInit : EventInit { + DOMString methodName = ""; + USVString validationURL = ""; +}; diff --git a/dom/webidl/MessageChannel.webidl b/dom/webidl/MessageChannel.webidl new file mode 100644 index 0000000000..57e5f99311 --- /dev/null +++ b/dom/webidl/MessageChannel.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * http://www.whatwg.org/specs/web-apps/current-work/#channel-messaging + */ + +[Exposed=(Window,Worker)] +interface MessageChannel { + [Throws] + constructor(); + + readonly attribute MessagePort port1; + readonly attribute MessagePort port2; +}; diff --git a/dom/webidl/MessageEvent.webidl b/dom/webidl/MessageEvent.webidl new file mode 100644 index 0000000000..e4f4ceac60 --- /dev/null +++ b/dom/webidl/MessageEvent.webidl @@ -0,0 +1,65 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://html.spec.whatwg.org/#messageevent + */ + +[Exposed=(Window,Worker,AudioWorklet), ProbablyShortLivingWrapper] +interface MessageEvent : Event { + constructor(DOMString type, optional MessageEventInit eventInitDict = {}); + + /** + * Custom data associated with this event. + */ + [GetterThrows] + readonly attribute any data; + + /** + * The origin of the site from which this event originated, which is the + * scheme, ":", and if the URI has a host, "//" followed by the + * host, and if the port is not the default for the given scheme, + * ":" followed by that port. This value does not have a trailing slash. + */ + readonly attribute USVString origin; + + /** + * The last event ID string of the event source, for server-sent DOM events; this + * value is the empty string for cross-origin messaging. + */ + readonly attribute DOMString lastEventId; + + /** + * The window or port which originated this event. + */ + readonly attribute MessageEventSource? source; + + [Pure, Cached, Frozen] + readonly attribute sequence<MessagePort> ports; + + /** + * Initializes this event with the given data, in a manner analogous to + * the similarly-named method on the Event interface, also setting the + * data, origin, source, and lastEventId attributes of this appropriately. + */ + undefined initMessageEvent(DOMString type, + optional boolean bubbles = false, + optional boolean cancelable = false, + optional any data = null, + optional DOMString origin = "", + optional DOMString lastEventId = "", + optional MessageEventSource? source = null, + optional sequence<MessagePort> ports = []); +}; + +dictionary MessageEventInit : EventInit { + any data = null; + DOMString origin = ""; + DOMString lastEventId = ""; + MessageEventSource? source = null; + sequence<MessagePort> ports = []; +}; + +typedef (WindowProxy or MessagePort or ServiceWorker) MessageEventSource; diff --git a/dom/webidl/MessagePort.webidl b/dom/webidl/MessagePort.webidl new file mode 100644 index 0000000000..349bf8fbee --- /dev/null +++ b/dom/webidl/MessagePort.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://html.spec.whatwg.org/#message-ports + */ + +[Exposed=(Window,Worker,AudioWorklet)] +interface MessagePort : EventTarget { + [Throws] + undefined postMessage(any message, sequence<object> transferable); + [Throws] + undefined postMessage(any message, optional StructuredSerializeOptions options = {}); + + undefined start(); + undefined close(); + + // event handlers + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; + +// Used to declare which objects should be transferred. +dictionary StructuredSerializeOptions { + sequence<object> transfer = []; +}; diff --git a/dom/webidl/MimeType.webidl b/dom/webidl/MimeType.webidl new file mode 100644 index 0000000000..86663bba12 --- /dev/null +++ b/dom/webidl/MimeType.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface MimeType { + readonly attribute DOMString type; + readonly attribute DOMString description; + readonly attribute DOMString suffixes; + readonly attribute Plugin enabledPlugin; +}; diff --git a/dom/webidl/MimeTypeArray.webidl b/dom/webidl/MimeTypeArray.webidl new file mode 100644 index 0000000000..830753ce31 --- /dev/null +++ b/dom/webidl/MimeTypeArray.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[LegacyUnenumerableNamedProperties, + Exposed=Window] +interface MimeTypeArray { + readonly attribute unsigned long length; + getter MimeType? item(unsigned long index); + getter MimeType? namedItem(DOMString name); +}; diff --git a/dom/webidl/MouseEvent.webidl b/dom/webidl/MouseEvent.webidl new file mode 100644 index 0000000000..979c05ca49 --- /dev/null +++ b/dom/webidl/MouseEvent.webidl @@ -0,0 +1,145 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface please see + * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html + * https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface nsIScreen; + +[Exposed=Window] +interface MouseEvent : UIEvent { + constructor(DOMString typeArg, + optional MouseEventInit mouseEventInitDict = {}); + + [NeedsCallerType] + readonly attribute long screenX; + [NeedsCallerType] + readonly attribute long screenY; + + [ChromeOnly] + readonly attribute nsIScreen? screen; + + readonly attribute long pageX; + readonly attribute long pageY; + readonly attribute long clientX; + readonly attribute long clientY; + [BinaryName="clientX"] + readonly attribute long x; + [BinaryName="clientY"] + readonly attribute long y; + readonly attribute long offsetX; + readonly attribute long offsetY; + readonly attribute boolean ctrlKey; + readonly attribute boolean shiftKey; + readonly attribute boolean altKey; + readonly attribute boolean metaKey; + readonly attribute short button; + readonly attribute unsigned short buttons; + readonly attribute EventTarget? relatedTarget; + + // Pointer Lock + readonly attribute long movementX; + readonly attribute long movementY; + + // Deprecated in DOM Level 3: + [Deprecated="InitMouseEvent"] + undefined initMouseEvent(DOMString typeArg, + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional Window? viewArg = null, + optional long detailArg = 0, + optional long screenXArg = 0, + optional long screenYArg = 0, + optional long clientXArg = 0, + optional long clientYArg = 0, + optional boolean ctrlKeyArg = false, + optional boolean altKeyArg = false, + optional boolean shiftKeyArg = false, + optional boolean metaKeyArg = false, + optional short buttonArg = 0, + optional EventTarget? relatedTargetArg = null); + // Introduced in DOM Level 3: + boolean getModifierState(DOMString keyArg); +}; + +// Suggested initMouseEvent replacement initializer: +dictionary MouseEventInit : EventModifierInit { + // Attributes for MouseEvent: + long screenX = 0; + long screenY = 0; + long clientX = 0; + long clientY = 0; + short button = 0; + // Note: "buttons" was not previously initializable through initMouseEvent! + unsigned short buttons = 0; + EventTarget? relatedTarget = null; + + // Pointer Lock + long movementX = 0; + long movementY = 0; +}; + +// Mozilla extensions +partial interface MouseEvent +{ + // Finger or touch pressure event value + // ranges between 0.0 and 1.0 + // TODO: Remove mozPressure. (bug 1534199) + [Deprecated="MouseEvent_MozPressure"] + readonly attribute float mozPressure; + + const unsigned short MOZ_SOURCE_UNKNOWN = 0; + const unsigned short MOZ_SOURCE_MOUSE = 1; + const unsigned short MOZ_SOURCE_PEN = 2; + const unsigned short MOZ_SOURCE_ERASER = 3; + const unsigned short MOZ_SOURCE_CURSOR = 4; + const unsigned short MOZ_SOURCE_TOUCH = 5; + const unsigned short MOZ_SOURCE_KEYBOARD = 6; + + [ChromeOnly] + readonly attribute unsigned short inputSource; + + [Deprecated="MozInputSource", BinaryName="inputSource"] + readonly attribute unsigned short mozInputSource; + + // TODO: Remove initNSMouseEvent. (bug 1165213) + [Deprecated="InitNSMouseEvent"] + undefined initNSMouseEvent(DOMString typeArg, + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional Window? viewArg = null, + optional long detailArg = 0, + optional long screenXArg = 0, + optional long screenYArg = 0, + optional long clientXArg = 0, + optional long clientYArg = 0, + optional boolean ctrlKeyArg = false, + optional boolean altKeyArg = false, + optional boolean shiftKeyArg = false, + optional boolean metaKeyArg = false, + optional short buttonArg = 0, + optional EventTarget? relatedTargetArg = null, + optional float pressure = 0, + optional unsigned short inputSourceArg = 0); + + /** + * preventClickEvent() prevents the following "click", "auxclick" and + * "dblclick" events of "mousedown" and "mouseup" events. + */ + [ChromeOnly] + undefined preventClickEvent(); + + /** + * Returns true if the following "click", "auxclick" and "dblclick" + * events of "mousedown" and "mouseup" events are prevented. + */ + [ChromeOnly] + boolean clickEventPrevented(); +}; diff --git a/dom/webidl/MouseScrollEvent.webidl b/dom/webidl/MouseScrollEvent.webidl new file mode 100644 index 0000000000..8bc7af3a64 --- /dev/null +++ b/dom/webidl/MouseScrollEvent.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface MouseScrollEvent : MouseEvent +{ + const long HORIZONTAL_AXIS = 1; + const long VERTICAL_AXIS = 2; + + readonly attribute long axis; + + undefined initMouseScrollEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional Window? view = null, + optional long detail = 0, + optional long screenX = 0, + optional long screenY = 0, + optional long clientX = 0, + optional long clientY = 0, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false, + optional short button = 0, + optional EventTarget? relatedTarget = null, + optional long axis = 0); +}; diff --git a/dom/webidl/MozApplicationEvent.webidl b/dom/webidl/MozApplicationEvent.webidl new file mode 100644 index 0000000000..97a4cdd1f3 --- /dev/null +++ b/dom/webidl/MozApplicationEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[ChromeOnly, + Exposed=Window] +interface MozApplicationEvent : Event +{ + constructor(DOMString type, + optional MozApplicationEventInit eventInitDict = {}); + + readonly attribute DOMApplication? application; +}; + +dictionary MozApplicationEventInit : EventInit +{ + DOMApplication? application = null; +}; diff --git a/dom/webidl/MozFrameLoaderOwner.webidl b/dom/webidl/MozFrameLoaderOwner.webidl new file mode 100644 index 0000000000..6caee18ee2 --- /dev/null +++ b/dom/webidl/MozFrameLoaderOwner.webidl @@ -0,0 +1,45 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +dictionary RemotenessOptions { + required UTF8String? remoteType; + + // Used to resume a given channel load within the target process. If present, + // it will be used rather than the `src` & `srcdoc` attributes on the + // frameloader to control the load behaviour. + unsigned long long pendingSwitchID; + + // True if we have an existing channel that we will resume in the + // target process, either via pendingSwitchID or using messageManager. + boolean switchingInProgressLoad = false; +}; + +/** + * A mixin included by elements that are 'browsing context containers' + * in HTML5 terms (that is, elements such as iframe that creates a new + * browsing context): + * + * https://html.spec.whatwg.org/#browsing-context-container + * + * Objects including this mixin must implement nsFrameLoaderOwner in + * native C++ code. + */ +interface mixin MozFrameLoaderOwner { + [ChromeOnly] + readonly attribute FrameLoader? frameLoader; + + [ChromeOnly] + readonly attribute BrowsingContext? browsingContext; + + [ChromeOnly, Throws] + undefined swapFrameLoaders(XULFrameElement aOtherLoaderOwner); + + [ChromeOnly, Throws] + undefined swapFrameLoaders(HTMLIFrameElement aOtherLoaderOwner); + + [ChromeOnly, Throws] + undefined changeRemoteness(RemotenessOptions aOptions); +}; diff --git a/dom/webidl/MutationEvent.webidl b/dom/webidl/MutationEvent.webidl new file mode 100644 index 0000000000..1fca8d1c07 --- /dev/null +++ b/dom/webidl/MutationEvent.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ +[Exposed=Window] +interface MutationEvent : Event +{ + const unsigned short MODIFICATION = 1; + const unsigned short ADDITION = 2; + const unsigned short REMOVAL = 3; + [ChromeOnly] + const unsigned short SMIL = 4; + + readonly attribute Node? relatedNode; + readonly attribute DOMString prevValue; + readonly attribute DOMString newValue; + readonly attribute DOMString attrName; + readonly attribute unsigned short attrChange; + + [Throws] + undefined initMutationEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional Node? relatedNode = null, + optional DOMString prevValue = "", + optional DOMString newValue = "", + optional DOMString attrName = "", + optional unsigned short attrChange = 0); +}; diff --git a/dom/webidl/MutationObserver.webidl b/dom/webidl/MutationObserver.webidl new file mode 100644 index 0000000000..ae43e1b48a --- /dev/null +++ b/dom/webidl/MutationObserver.webidl @@ -0,0 +1,78 @@ +/* -*- 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 + */ + +[ProbablyShortLivingWrapper, + Exposed=Window] +interface MutationRecord { + [Constant] + readonly attribute DOMString type; + // .target is not nullable per the spec, but in order to prevent crashes, + // if there are GC/CC bugs in Gecko, we let the property to be null. + [Constant] + readonly attribute Node? target; + [Constant] + readonly attribute NodeList addedNodes; + [Constant] + readonly attribute NodeList removedNodes; + [Constant] + readonly attribute Node? previousSibling; + [Constant] + readonly attribute Node? nextSibling; + [Constant] + readonly attribute DOMString? attributeName; + [Constant] + readonly attribute DOMString? attributeNamespace; + [Constant] + readonly attribute DOMString? oldValue; + [Constant, Cached, ChromeOnly] + readonly attribute sequence<Animation> addedAnimations; + [Constant, Cached, ChromeOnly] + readonly attribute sequence<Animation> changedAnimations; + [Constant, Cached, ChromeOnly] + readonly attribute sequence<Animation> removedAnimations; +}; + +[Exposed=Window] +interface MutationObserver { + [Throws] + constructor(MutationCallback mutationCallback); + + [Throws, NeedsSubjectPrincipal] + undefined observe(Node target, optional MutationObserverInit options = {}); + undefined disconnect(); + sequence<MutationRecord> takeRecords(); + + [ChromeOnly, Throws] + sequence<MutationObservingInfo?> getObservingInfo(); + [ChromeOnly] + readonly attribute MutationCallback mutationCallback; + [ChromeOnly] + attribute boolean mergeAttributeRecords; +}; + +callback MutationCallback = undefined (sequence<MutationRecord> mutations, MutationObserver observer); + +dictionary MutationObserverInit { + boolean childList = false; + boolean attributes; + boolean characterData; + boolean subtree = false; + boolean attributeOldValue; + boolean characterDataOldValue; + [ChromeOnly] + boolean chromeOnlyNodes = false; + [ChromeOnly] + boolean animations = false; + sequence<DOMString> attributeFilter; +}; + +dictionary MutationObservingInfo : MutationObserverInit +{ + Node? observedNode = null; +}; diff --git a/dom/webidl/NamedNodeMap.webidl b/dom/webidl/NamedNodeMap.webidl new file mode 100644 index 0000000000..2f0b649f59 --- /dev/null +++ b/dom/webidl/NamedNodeMap.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +[LegacyUnenumerableNamedProperties, + Exposed=Window] +interface NamedNodeMap { + getter Attr? getNamedItem(DOMString name); + [CEReactions, Throws, BinaryName="setNamedItemNS"] + Attr? setNamedItem(Attr arg); + [CEReactions, Throws] + Attr removeNamedItem(DOMString name); + + getter Attr? item(unsigned long index); + readonly attribute unsigned long length; + + Attr? getNamedItemNS(DOMString? namespaceURI, DOMString localName); + [CEReactions, Throws] + Attr? setNamedItemNS(Attr arg); + [CEReactions, Throws] + Attr removeNamedItemNS(DOMString? namespaceURI, DOMString localName); +}; diff --git a/dom/webidl/NavigationPreloadManager.webidl b/dom/webidl/NavigationPreloadManager.webidl new file mode 100644 index 0000000000..f1715d3c8f --- /dev/null +++ b/dom/webidl/NavigationPreloadManager.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/ServiceWorker/#navigation-preload-manager + */ + +[Func="NavigationPreloadManager::IsEnabled", SecureContext, + Exposed=(Window,Worker)] +interface NavigationPreloadManager { + [NewObject] + Promise<undefined> enable(); + [NewObject] + Promise<undefined> disable(); + [NewObject] + Promise<undefined> setHeaderValue(ByteString value); + [NewObject] + Promise<NavigationPreloadState> getState(); +}; + +dictionary NavigationPreloadState { + boolean enabled = false; + ByteString headerValue; +}; diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl new file mode 100644 index 0000000000..935ffdabec --- /dev/null +++ b/dom/webidl/Navigator.webidl @@ -0,0 +1,387 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/#the-navigator-object + * http://www.w3.org/TR/tracking-dnt/ + * http://www.w3.org/TR/geolocation-API/#geolocation_interface + * http://www.w3.org/TR/battery-status/#navigatorbattery-interface + * http://www.w3.org/TR/vibration/#vibration-interface + * http://www.w3.org/2012/sysapps/runtime/#extension-to-the-navigator-interface-1 + * https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension + * http://www.w3.org/TR/beacon/#sec-beacon-method + * https://html.spec.whatwg.org/#navigatorconcurrenthardware + * http://wicg.github.io/netinfo/#extensions-to-the-navigator-interface + * https://w3c.github.io/webappsec-credential-management/#framework-credential-management + * https://w3c.github.io/webdriver/webdriver-spec.html#interface + * https://wicg.github.io/media-capabilities/#idl-index + * https://w3c.github.io/mediasession/#idl-index + * + * © 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. + */ + +interface URI; + +// https://html.spec.whatwg.org/#the-navigator-object +[HeaderFile="Navigator.h", + Exposed=Window, + InstrumentedProps=(canShare, + clearAppBadge, + setAppBadge, + share, + userActivation, + wakeLock)] +interface Navigator { + // objects implementing this interface also implement the interfaces given below +}; +Navigator includes NavigatorID; +Navigator includes NavigatorLanguage; +Navigator includes NavigatorOnLine; +Navigator includes NavigatorContentUtils; +Navigator includes NavigatorStorageUtils; +Navigator includes NavigatorConcurrentHardware; +Navigator includes NavigatorStorage; +Navigator includes NavigatorAutomationInformation; +Navigator includes NavigatorGPU; +Navigator includes GlobalPrivacyControl; + +interface mixin NavigatorID { + // WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla"). + [Constant, Cached, Throws] + readonly attribute DOMString appCodeName; // constant "Mozilla" + [Constant, Cached] + readonly attribute DOMString appName; // constant "Netscape" + [Constant, Cached, Throws, NeedsCallerType] + readonly attribute DOMString appVersion; + [Pure, Cached, Throws, NeedsCallerType] + readonly attribute DOMString platform; + [Pure, Cached, Throws, NeedsCallerType] + readonly attribute DOMString userAgent; + [Constant, Cached] + readonly attribute DOMString product; // constant "Gecko" + + // Everyone but WebKit/Blink supports this. See bug 679971. + [Exposed=Window] + boolean taintEnabled(); // constant false +}; + +interface mixin NavigatorLanguage { + + // These two attributes are cached because this interface is also implemented + // by Workernavigator and this way we don't have to go back to the + // main-thread from the worker thread anytime we need to retrieve them. They + // are updated when pref intl.accept_languages is changed. + + [Pure, Cached] + readonly attribute DOMString? language; + [Pure, Cached, Frozen] + readonly attribute sequence<DOMString> languages; +}; + +interface mixin NavigatorOnLine { + readonly attribute boolean onLine; +}; + +interface mixin NavigatorContentUtils { + // content handler registration + [Throws, ChromeOnly] + undefined checkProtocolHandlerAllowed(DOMString scheme, URI handlerURI, URI documentURI); + [Throws, SecureContext] + undefined registerProtocolHandler(DOMString scheme, DOMString url); + // NOT IMPLEMENTED + //undefined unregisterProtocolHandler(DOMString scheme, DOMString url); +}; + +[SecureContext] +interface mixin NavigatorStorage { + readonly attribute StorageManager storage; +}; + +interface mixin NavigatorStorageUtils { + // NOT IMPLEMENTED + //undefined yieldForStorageUpdates(); +}; + +partial interface Navigator { + [Throws] + readonly attribute Permissions permissions; +}; + +partial interface Navigator { + [Throws, SameObject] + readonly attribute MimeTypeArray mimeTypes; + [Throws, SameObject] + readonly attribute PluginArray plugins; + readonly attribute boolean pdfViewerEnabled; +}; + +// http://www.w3.org/TR/tracking-dnt/ sort of +partial interface Navigator { + readonly attribute DOMString doNotTrack; +}; + +// https://globalprivacycontrol.github.io/gpc-spec/ +interface mixin GlobalPrivacyControl { + [Pref="privacy.globalprivacycontrol.functionality.enabled"] + readonly attribute boolean globalPrivacyControl; +}; + +// http://www.w3.org/TR/geolocation-API/#geolocation_interface +interface mixin NavigatorGeolocation { + [Throws, Pref="geo.enabled"] + readonly attribute Geolocation geolocation; +}; +Navigator includes NavigatorGeolocation; + +// http://www.w3.org/TR/battery-status/#navigatorbattery-interface +partial interface Navigator { + // ChromeOnly to prevent web content from fingerprinting users' batteries. + [Throws, ChromeOnly, Pref="dom.battery.enabled"] + Promise<BatteryManager> getBattery(); +}; + +// http://www.w3.org/TR/vibration/#vibration-interface +partial interface Navigator { + // We don't support sequences in unions yet + //boolean vibrate ((unsigned long or sequence<unsigned long>) pattern); + boolean vibrate(unsigned long duration); + boolean vibrate(sequence<unsigned long> pattern); +}; + +// http://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface +partial interface Navigator { + [NeedsCallerType] + readonly attribute long maxTouchPoints; +}; + +// https://wicg.github.io/media-capabilities/#idl-index +[Exposed=Window] +partial interface Navigator { + [SameObject, Func="mozilla::dom::MediaCapabilities::Enabled"] + readonly attribute MediaCapabilities mediaCapabilities; +}; + +// Mozilla-specific extensions + +// Chrome-only interface for Vibration API permission handling. +partial interface Navigator { + /* Set permission state to device vibration. + * @param permitted permission state (true for allowing vibration) + * @param persistent make the permission session-persistent + */ + [ChromeOnly] + undefined setVibrationPermission(boolean permitted, + optional boolean persistent = true); +}; + +partial interface Navigator { + [Throws, Constant, Cached, NeedsCallerType] + readonly attribute DOMString oscpu; + // WebKit/Blink support this; Trident/Presto do not. + readonly attribute DOMString vendor; + // WebKit/Blink supports this (hardcoded ""); Trident/Presto do not. + readonly attribute DOMString vendorSub; + // WebKit/Blink supports this (hardcoded "20030107"); Trident/Presto don't + readonly attribute DOMString productSub; + // WebKit/Blink/Trident/Presto support this. + readonly attribute boolean cookieEnabled; + [Throws, Constant, Cached, NeedsCallerType] + readonly attribute DOMString buildID; + + // WebKit/Blink/Trident/Presto support this. + [Affects=Nothing, DependsOn=Nothing] + boolean javaEnabled(); +}; + +// Addon manager bits +partial interface Navigator { + [Throws, Func="mozilla::AddonManagerWebAPI::IsAPIEnabled"] + readonly attribute AddonManager mozAddonManager; +}; + +// NetworkInformation +partial interface Navigator { + [Throws, Pref="dom.netinfo.enabled"] + readonly attribute NetworkInformation connection; +}; + +// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension +partial interface Navigator { + [Throws, Pref="dom.gamepad.enabled", SecureContext] + sequence<Gamepad?> getGamepads(); +}; +partial interface Navigator { + [Throws, Pref="dom.gamepad.test.enabled"] + GamepadServiceTest requestGamepadServiceTest(); +}; + +// https://immersive-web.github.io/webvr/spec/1.1/#interface-navigator +partial interface Navigator { + [NewObject, SecureContext, Pref="dom.vr.enabled"] + Promise<sequence<VRDisplay>> getVRDisplays(); + // TODO: Use FrozenArray once available. (Bug 1236777) + [SecureContext, Frozen, Cached, Pure, Pref="dom.vr.enabled"] + readonly attribute sequence<VRDisplay> activeVRDisplays; + [ChromeOnly, Pref="dom.vr.enabled"] + readonly attribute boolean isWebVRContentDetected; + [ChromeOnly, Pref="dom.vr.enabled"] + readonly attribute boolean isWebVRContentPresenting; + [ChromeOnly, Pref="dom.vr.enabled"] + undefined requestVRPresentation(VRDisplay display); +}; +partial interface Navigator { + [Throws, Pref="dom.vr.puppet.enabled"] + VRServiceTest requestVRServiceTest(); +}; + +// https://immersive-web.github.io/webxr/#dom-navigator-xr +partial interface Navigator { + [SecureContext, SameObject, Throws, Pref="dom.vr.webxr.enabled"] + readonly attribute XRSystem xr; +}; + +// http://webaudio.github.io/web-midi-api/#requestmidiaccess +partial interface Navigator { + [NewObject, Func="Navigator::HasMidiSupport"] + Promise<MIDIAccess> requestMIDIAccess(optional MIDIOptions options = {}); +}; + +callback NavigatorUserMediaSuccessCallback = undefined (MediaStream stream); +callback NavigatorUserMediaErrorCallback = undefined (MediaStreamError error); + +partial interface Navigator { + [Throws, Func="Navigator::HasUserMediaSupport"] + readonly attribute MediaDevices mediaDevices; + + // Deprecated. Use mediaDevices.getUserMedia instead. + [Deprecated="NavigatorGetUserMedia", Throws, + Func="Navigator::HasUserMediaSupport", + NeedsCallerType, + UseCounter] + undefined mozGetUserMedia(MediaStreamConstraints constraints, + NavigatorUserMediaSuccessCallback successCallback, + NavigatorUserMediaErrorCallback errorCallback); +}; + +// Service Workers/Navigation Controllers +partial interface Navigator { + [Func="ServiceWorkersEnabled", SameObject, BinaryName="serviceWorkerJS"] + readonly attribute ServiceWorkerContainer serviceWorker; +}; + +partial interface Navigator { + [Throws, Pref="beacon.enabled"] + boolean sendBeacon(DOMString url, + optional BodyInit? data = null); +}; + +partial interface Navigator { + [NewObject, Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist"] + readonly attribute LegacyMozTCPSocket mozTCPSocket; +}; + +partial interface Navigator { + [NewObject] + Promise<MediaKeySystemAccess> + requestMediaKeySystemAccess(DOMString keySystem, + sequence<MediaKeySystemConfiguration> supportedConfigurations); +}; + +interface mixin NavigatorConcurrentHardware { + readonly attribute unsigned long long hardwareConcurrency; +}; + +// https://w3c.github.io/webappsec-credential-management/#framework-credential-management +partial interface Navigator { + [Pref="security.webauth.webauthn", SecureContext, SameObject] + readonly attribute CredentialsContainer credentials; +}; + +// https://w3c.github.io/webdriver/webdriver-spec.html#interface +interface mixin NavigatorAutomationInformation { + [Constant, Cached] + readonly attribute boolean webdriver; +}; + +// https://www.w3.org/TR/clipboard-apis/#navigator-interface +partial interface Navigator { + [SecureContext, SameObject] + readonly attribute Clipboard clipboard; +}; + +// Used for testing of origin trials. +partial interface Navigator { + [Trial="TestTrial"] + readonly attribute boolean testTrialGatedAttribute; +}; + +// https://wicg.github.io/web-share/#navigator-interface +partial interface Navigator { + [SecureContext, NewObject, Func="Navigator::HasShareSupport"] + Promise<undefined> share(optional ShareData data = {}); + [SecureContext, Func="Navigator::HasShareSupport"] + boolean canShare(optional ShareData data = {}); +}; +// https://wicg.github.io/web-share/#sharedata-dictionary +dictionary ShareData { + USVString title; + USVString text; + USVString url; + // Note: we don't actually support files yet + // we have it here for the .canShare() checks. + sequence<File> files; +}; + +// https://w3c.github.io/mediasession/#idl-index +[Exposed=Window] +partial interface Navigator { + [SameObject] + readonly attribute MediaSession mediaSession; +}; + +// https://w3c.github.io/web-locks/#navigator-mixins +[SecureContext] +interface mixin NavigatorLocks { + readonly attribute LockManager locks; +}; +Navigator includes NavigatorLocks; + +// https://w3c.github.io/autoplay/#autoplay-policy +enum AutoplayPolicy { + "allowed", + "allowed-muted", + "disallowed" +}; + +enum AutoplayPolicyMediaType { + "mediaelement", + "audiocontext" +}; + +// https://w3c.github.io/autoplay/#autoplay-detection-methods +partial interface Navigator { + [Pref="dom.media.autoplay-policy-detection.enabled"] + AutoplayPolicy getAutoplayPolicy(AutoplayPolicyMediaType type); + + [Pref="dom.media.autoplay-policy-detection.enabled"] + AutoplayPolicy getAutoplayPolicy(HTMLMediaElement element); + + [Pref="dom.media.autoplay-policy-detection.enabled"] + AutoplayPolicy getAutoplayPolicy(AudioContext context); +}; + +// https://html.spec.whatwg.org/multipage/interaction.html#the-useractivation-interface +partial interface Navigator { + [SameObject] readonly attribute UserActivation userActivation; +}; + +// https://w3c.github.io/screen-wake-lock/#extensions-to-the-navigator-interface +[SecureContext] +partial interface Navigator { + [SameObject, Pref="dom.screenwakelock.enabled"] + readonly attribute WakeLock wakeLock; +}; diff --git a/dom/webidl/NetErrorInfo.webidl b/dom/webidl/NetErrorInfo.webidl new file mode 100644 index 0000000000..46f5fa64d6 --- /dev/null +++ b/dom/webidl/NetErrorInfo.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * This dictionary is used for exposing failed channel info + * to about:neterror to built UI. + */ + +dictionary NetErrorInfo { + DOMString errorCodeString = ""; +}; diff --git a/dom/webidl/NetworkInformation.webidl b/dom/webidl/NetworkInformation.webidl new file mode 100644 index 0000000000..2020044d2e --- /dev/null +++ b/dom/webidl/NetworkInformation.webidl @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of 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/netinfo/ + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum ConnectionType { + "cellular", + "bluetooth", + "ethernet", + "wifi", + "other", + "none", + "unknown" +}; + +[Pref="dom.netinfo.enabled", + Exposed=(Window,Worker)] +interface NetworkInformation : EventTarget { + readonly attribute ConnectionType type; + attribute EventHandler ontypechange; +}; diff --git a/dom/webidl/NetworkOptions.webidl b/dom/webidl/NetworkOptions.webidl new file mode 100644 index 0000000000..b313c932dd --- /dev/null +++ b/dom/webidl/NetworkOptions.webidl @@ -0,0 +1,109 @@ +/* This Source Code Form is subject to the terms of 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 sent to the network worker. +*/ +dictionary NetworkCommandOptions +{ + long id = 0; // opaque id. + DOMString cmd = ""; // the command name. + DOMString ifname; // for "removeNetworkRoute", "setDNS", + // "setDefaultRouteAndDNS", "removeDefaultRoute" + // "addHostRoute", "removeHostRoute" + // "removeHostRoutes". + DOMString ip; // for "removeNetworkRoute", "setWifiTethering". + unsigned long prefixLength; // for "removeNetworkRoute". + DOMString domain; // for "setDNS" + sequence<DOMString> dnses; // for "setDNS", "setDefaultRouteAndDNS". + DOMString gateway; // for "addSecondaryRoute", "removeSecondaryRoute". + sequence<DOMString> gateways; // for "setDefaultRouteAndDNS", "removeDefaultRoute". + DOMString mode; // for "setWifiOperationMode". + boolean report; // for "setWifiOperationMode". + boolean enabled; // for "setDhcpServer". + DOMString wifictrlinterfacename; // for "setWifiTethering". + DOMString internalIfname; // for "setWifiTethering". + DOMString externalIfname; // for "setWifiTethering". + boolean enable; // for "setWifiTethering". + DOMString ssid; // for "setWifiTethering". + DOMString security; // for "setWifiTethering". + DOMString key; // for "setWifiTethering". + DOMString prefix; // for "setWifiTethering", "setDhcpServer". + DOMString link; // for "setWifiTethering", "setDhcpServer". + sequence<DOMString> interfaceList; // for "setWifiTethering". + DOMString wifiStartIp; // for "setWifiTethering". + DOMString wifiEndIp; // for "setWifiTethering". + DOMString usbStartIp; // for "setWifiTethering". + DOMString usbEndIp; // for "setWifiTethering". + DOMString dns1; // for "setWifiTethering". + DOMString dns2; // for "setWifiTethering". + long long threshold; // for "setNetworkInterfaceAlarm", + // "enableNetworkInterfaceAlarm". + DOMString startIp; // for "setDhcpServer". + DOMString endIp; // for "setDhcpServer". + DOMString serverIp; // for "setDhcpServer". + DOMString maskLength; // for "setDhcpServer". + DOMString preInternalIfname; // for "updateUpStream". + DOMString preExternalIfname; // for "updateUpStream". + DOMString curInternalIfname; // for "updateUpStream". + DOMString curExternalIfname; // for "updateUpStream". + + long ipaddr; // for "ifc_configure". + long mask; // for "ifc_configure". + long gateway_long; // for "ifc_configure". + long dns1_long; // for "ifc_configure". + long dns2_long; // for "ifc_configure". + + long mtu; // for "setMtu". +}; + +/** +* This dictionary holds the parameters sent back to NetworkService.js. +*/ +dictionary NetworkResultOptions +{ + long id = 0; // opaque id. + boolean ret = false; // for sync command. + boolean broadcast = false; // for netd broadcast message. + DOMString topic = ""; // for netd broadcast message. + DOMString reason = ""; // for netd broadcast message. + + long resultCode = 0; // for all commands. + DOMString resultReason = ""; // for all commands. + boolean error = false; // for all commands. + + boolean enable = false; // for "setWifiTethering", "setUSBTethering" + // "enableUsbRndis". + boolean result = false; // for "enableUsbRndis". + boolean success = false; // for "setDhcpServer". + DOMString curExternalIfname = ""; // for "updateUpStream". + DOMString curInternalIfname = ""; // for "updateUpStream". + + DOMString reply = ""; // for "command". + DOMString route = ""; // for "ifc_get_default_route". + DOMString ipaddr_str = ""; // The following are for the result of + // dhcp_do_request. + DOMString gateway_str = ""; + DOMString dns1_str = ""; + DOMString dns2_str = ""; + DOMString mask_str = ""; + DOMString server_str = ""; + DOMString vendor_str = ""; + long lease = 0; + long prefixLength = 0; + long mask = 0; + long ipaddr = 0; + long gateway = 0; + long dns1 = 0; + long dns2 = 0; + long server = 0; + + DOMString netId = ""; // for "getNetId". + + sequence<DOMString> interfaceList; // for "getInterfaceList". + + DOMString flag = "down"; // for "getInterfaceConfig". + DOMString macAddr = ""; // for "getInterfaceConfig". + DOMString ipAddr = ""; // for "getInterfaceConfig". +}; diff --git a/dom/webidl/Node.webidl b/dom/webidl/Node.webidl new file mode 100644 index 0000000000..f0604d406e --- /dev/null +++ b/dom/webidl/Node.webidl @@ -0,0 +1,139 @@ +/* -*- 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 Principal; +interface URI; + +[Exposed=Window] +interface Node : EventTarget { + const unsigned short ELEMENT_NODE = 1; + const unsigned short ATTRIBUTE_NODE = 2; // historical + const unsigned short TEXT_NODE = 3; + const unsigned short CDATA_SECTION_NODE = 4; // historical + const unsigned short ENTITY_REFERENCE_NODE = 5; // historical + const unsigned short ENTITY_NODE = 6; // historical + const unsigned short PROCESSING_INSTRUCTION_NODE = 7; + const unsigned short COMMENT_NODE = 8; + const unsigned short DOCUMENT_NODE = 9; + const unsigned short DOCUMENT_TYPE_NODE = 10; + const unsigned short DOCUMENT_FRAGMENT_NODE = 11; + const unsigned short NOTATION_NODE = 12; // historical + [Constant] + readonly attribute unsigned short nodeType; + [Pure] + readonly attribute DOMString nodeName; + + [Pure, Throws, NeedsCallerType, BinaryName="baseURIFromJS"] + readonly attribute DOMString? baseURI; + + [Pure, BinaryName=isInComposedDoc] + readonly attribute boolean isConnected; + [Pure] + readonly attribute Document? ownerDocument; + [Pure] + Node getRootNode(optional GetRootNodeOptions options = {}); + [Pure] + readonly attribute Node? parentNode; + [Pure] + readonly attribute Element? parentElement; + [Pure] + boolean hasChildNodes(); + [SameObject] + readonly attribute NodeList childNodes; + [Pure] + readonly attribute Node? firstChild; + [Pure] + readonly attribute Node? lastChild; + [Pure] + readonly attribute Node? previousSibling; + [Pure] + readonly attribute Node? nextSibling; + + [CEReactions, SetterThrows, Pure] + attribute DOMString? nodeValue; + [CEReactions, SetterThrows, GetterCanOOM, + SetterNeedsSubjectPrincipal=NonSystem, Pure] + attribute DOMString? textContent; + // These DOM methods cannot be accessed by UA Widget scripts + // because the DOM element reflectors will be in the content scope, + // instead of the desired UA Widget scope. + [CEReactions, Throws, Func="IsNotUAWidget"] + Node insertBefore(Node node, Node? child); + [CEReactions, Throws, Func="IsNotUAWidget"] + Node appendChild(Node node); + [CEReactions, Throws, Func="IsNotUAWidget"] + Node replaceChild(Node node, Node child); + [CEReactions, Throws] + Node removeChild(Node child); + [CEReactions] + undefined normalize(); + + [CEReactions, Throws, Func="IsNotUAWidget"] + Node cloneNode(optional boolean deep = false); + [Pure] + boolean isSameNode(Node? node); + [Pure] + boolean isEqualNode(Node? node); + + const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; + const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; + const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; + const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; + const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; + const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; // historical + [Pure] + unsigned short compareDocumentPosition(Node other); + [Pure] + boolean contains(Node? other); + + [Pure] + DOMString? lookupPrefix(DOMString? namespace); + [Pure] + DOMString? lookupNamespaceURI(DOMString? prefix); + [Pure] + boolean isDefaultNamespace(DOMString? namespace); + + // Mozilla-specific stuff + [ChromeOnly] + readonly attribute Principal nodePrincipal; + [ChromeOnly] + readonly attribute URI? baseURIObject; + [ChromeOnly] + DOMString generateXPath(); + [ChromeOnly, Pure, BinaryName="flattenedTreeParentNodeNonInline"] + readonly attribute Node? flattenedTreeParentNode; + [ChromeOnly, Pure, BinaryName="isInNativeAnonymousSubtree"] + readonly attribute boolean isNativeAnonymous; + + // Maybe this would be useful to authors? https://github.com/whatwg/dom/issues/826 + [Func="IsChromeOrUAWidget", Pure, BinaryName="containingShadow"] + readonly attribute ShadowRoot? containingShadowRoot; + + // Mozilla devtools-specific stuff + /** + * If this element is a flex item (or has one or more anonymous box ancestors + * that chain up to an anonymous flex item), then this method returns the + * flex container that the flex item participates in. Otherwise, this method + * returns null. + */ + [ChromeOnly] + readonly attribute Element? parentFlexElement; + +#ifdef ACCESSIBILITY + [Func="mozilla::dom::AccessibleNode::IsAOMEnabled", SameObject] + readonly attribute AccessibleNode? accessibleNode; +#endif +}; + +dictionary GetRootNodeOptions { + boolean composed = false; +}; diff --git a/dom/webidl/NodeFilter.webidl b/dom/webidl/NodeFilter.webidl new file mode 100644 index 0000000000..b2f3207286 --- /dev/null +++ b/dom/webidl/NodeFilter.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#interface-nodefilter + */ + +[Exposed=Window] +callback interface NodeFilter { + // Constants for acceptNode() + const unsigned short FILTER_ACCEPT = 1; + const unsigned short FILTER_REJECT = 2; + const unsigned short FILTER_SKIP = 3; + + // Constants for whatToShow + const unsigned long SHOW_ALL = 0xFFFFFFFF; + const unsigned long SHOW_ELEMENT = 0x1; + const unsigned long SHOW_ATTRIBUTE = 0x2; // historical + const unsigned long SHOW_TEXT = 0x4; + const unsigned long SHOW_CDATA_SECTION = 0x8; // historical + const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical + const unsigned long SHOW_ENTITY = 0x20; // historical + const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40; + const unsigned long SHOW_COMMENT = 0x80; + const unsigned long SHOW_DOCUMENT = 0x100; + const unsigned long SHOW_DOCUMENT_TYPE = 0x200; + const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400; + const unsigned long SHOW_NOTATION = 0x800; // historical + + unsigned short acceptNode(Node node); +}; diff --git a/dom/webidl/NodeIterator.webidl b/dom/webidl/NodeIterator.webidl new file mode 100644 index 0000000000..f9cc89c795 --- /dev/null +++ b/dom/webidl/NodeIterator.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface NodeIterator { + [Constant] + readonly attribute Node root; + [Pure] + readonly attribute Node? referenceNode; + [Pure] + readonly attribute boolean pointerBeforeReferenceNode; + [Constant] + readonly attribute unsigned long whatToShow; + [Constant] + readonly attribute NodeFilter? filter; + + [Throws] + Node? nextNode(); + [Throws] + Node? previousNode(); + + undefined detach(); +}; diff --git a/dom/webidl/NodeList.webidl b/dom/webidl/NodeList.webidl new file mode 100644 index 0000000000..c881665de2 --- /dev/null +++ b/dom/webidl/NodeList.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[ProbablyShortLivingWrapper, + Exposed=Window] +interface NodeList { + getter Node? item(unsigned long index); + readonly attribute unsigned long length; + iterable<Node?>; +}; diff --git a/dom/webidl/Notification.webidl b/dom/webidl/Notification.webidl new file mode 100644 index 0000000000..8c96a81713 --- /dev/null +++ b/dom/webidl/Notification.webidl @@ -0,0 +1,107 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://notifications.spec.whatwg.org/ + * + * Copyright: + * To the extent possible under law, the editors have waived all copyright and + * related or neighboring rights to this work. + */ + +[Exposed=(Window,Worker), + Func="mozilla::dom::Notification::PrefEnabled"] +interface Notification : EventTarget { + [Throws] + constructor(DOMString title, optional NotificationOptions options = {}); + + [GetterThrows] + static readonly attribute NotificationPermission permission; + + [NewObject, Func="mozilla::dom::Notification::RequestPermissionEnabledForScope"] + static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback permissionCallback); + + attribute EventHandler onclick; + + attribute EventHandler onshow; + + attribute EventHandler onerror; + + attribute EventHandler onclose; + + [Pure] + readonly attribute DOMString title; + + [Pure] + readonly attribute NotificationDirection dir; + + [Pure] + readonly attribute DOMString? lang; + + [Pure] + readonly attribute DOMString? body; + + [Constant] + readonly attribute DOMString? tag; + + [Pure] + readonly attribute DOMString? icon; + + [Constant, Pref="dom.webnotifications.requireinteraction.enabled"] + readonly attribute boolean requireInteraction; + + [Constant, Pref="dom.webnotifications.silent.enabled"] + readonly attribute boolean silent; + + [Cached, Frozen, Pure, Pref="dom.webnotifications.vibrate.enabled"] + readonly attribute sequence<unsigned long> vibrate; + + [Constant] + readonly attribute any data; + + undefined close(); +}; + +typedef (unsigned long or sequence<unsigned long>) VibratePattern; + +dictionary NotificationOptions { + NotificationDirection dir = "auto"; + DOMString lang = ""; + DOMString body = ""; + DOMString tag = ""; + DOMString icon = ""; + boolean requireInteraction = false; + boolean silent = false; + VibratePattern vibrate; + any data = null; + NotificationBehavior mozbehavior = {}; +}; + +dictionary GetNotificationOptions { + DOMString tag = ""; +}; + +[GenerateToJSON] +dictionary NotificationBehavior { + boolean noscreen = false; + boolean noclear = false; + boolean showOnlyOnce = false; + DOMString soundFile = ""; + sequence<unsigned long> vibrationPattern; +}; + +enum NotificationPermission { + "default", + "denied", + "granted" +}; + +callback NotificationPermissionCallback = undefined (NotificationPermission permission); + +enum NotificationDirection { + "auto", + "ltr", + "rtl" +}; diff --git a/dom/webidl/NotificationEvent.webidl b/dom/webidl/NotificationEvent.webidl new file mode 100644 index 0000000000..9e77eb3434 --- /dev/null +++ b/dom/webidl/NotificationEvent.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://notifications.spec.whatwg.org/ + * + * Copyright: + * To the extent possible under law, the editors have waived all copyright and + * related or neighboring rights to this work. + */ + +[Exposed=ServiceWorker,Func="mozilla::dom::Notification::PrefEnabled"] +interface NotificationEvent : ExtendableEvent { + constructor(DOMString type, NotificationEventInit eventInitDict); + + [BinaryName="notification_"] + readonly attribute Notification notification; +}; + +dictionary NotificationEventInit : ExtendableEventInit { + required Notification notification; +}; diff --git a/dom/webidl/NotifyPaintEvent.webidl b/dom/webidl/NotifyPaintEvent.webidl new file mode 100644 index 0000000000..70252524e7 --- /dev/null +++ b/dom/webidl/NotifyPaintEvent.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * The NotifyPaintEvent interface is used for the MozDOMAfterPaint + * event, which fires at a window when painting has happened in + * that window. + */ +[ChromeOnly, + Exposed=Window] +interface NotifyPaintEvent : Event +{ + /** + * Get a list of rectangles which are affected. The rectangles are + * in CSS pixels relative to the viewport origin. + */ + [ChromeOnly, NeedsCallerType] + readonly attribute DOMRectList clientRects; + + /** + * Get the bounding box of the rectangles which are affected. The rectangle + * is in CSS pixels relative to the viewport origin. + */ + [ChromeOnly, NeedsCallerType] + readonly attribute DOMRect boundingClientRect; + + [ChromeOnly, NeedsCallerType] + readonly attribute PaintRequestList paintRequests; + + [ChromeOnly, NeedsCallerType] + readonly attribute unsigned long long transactionId; + + [ChromeOnly, NeedsCallerType] + readonly attribute DOMHighResTimeStamp paintTimeStamp; +}; diff --git a/dom/webidl/OfflineAudioCompletionEvent.webidl b/dom/webidl/OfflineAudioCompletionEvent.webidl new file mode 100644 index 0000000000..749aa5d889 --- /dev/null +++ b/dom/webidl/OfflineAudioCompletionEvent.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary OfflineAudioCompletionEventInit : EventInit { + required AudioBuffer renderedBuffer; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface OfflineAudioCompletionEvent : Event { + constructor(DOMString type, OfflineAudioCompletionEventInit eventInitDict); + + readonly attribute AudioBuffer renderedBuffer; +}; diff --git a/dom/webidl/OfflineAudioContext.webidl b/dom/webidl/OfflineAudioContext.webidl new file mode 100644 index 0000000000..a9f36f70c6 --- /dev/null +++ b/dom/webidl/OfflineAudioContext.webidl @@ -0,0 +1,35 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of 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 OfflineAudioContextOptions { + unsigned long numberOfChannels = 1; + required unsigned long length; + required float sampleRate; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface OfflineAudioContext : BaseAudioContext { + [Throws] + constructor(OfflineAudioContextOptions contextOptions); + [Throws] + constructor(unsigned long numberOfChannels, unsigned long length, + float sampleRate); + + [NewObject] + Promise<AudioBuffer> startRendering(); + + // TODO: Promise<undefined> suspend (double suspendTime); + + readonly attribute unsigned long length; + attribute EventHandler oncomplete; +}; diff --git a/dom/webidl/OffscreenCanvas.webidl b/dom/webidl/OffscreenCanvas.webidl new file mode 100644 index 0000000000..408bee600d --- /dev/null +++ b/dom/webidl/OffscreenCanvas.webidl @@ -0,0 +1,45 @@ +/* -*- 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/#the-offscreencanvas-interface + */ + +typedef (OffscreenCanvasRenderingContext2D or ImageBitmapRenderingContext or WebGLRenderingContext or WebGL2RenderingContext or GPUCanvasContext) OffscreenRenderingContext; + +dictionary ImageEncodeOptions { + DOMString type = "image/png"; + unrestricted double quality; +}; + +enum OffscreenRenderingContextId { "2d", "bitmaprenderer", "webgl", "webgl2", "webgpu" }; + +[Exposed=(Window,Worker), Pref="gfx.offscreencanvas.enabled"] +interface OffscreenCanvas : EventTarget { + [Throws] + constructor([EnforceRange] unsigned long width, [EnforceRange] unsigned long height); + + [Pure, SetterThrows] + attribute [EnforceRange] unsigned long width; + [Pure, SetterThrows] + attribute [EnforceRange] unsigned long height; + + [Throws] + OffscreenRenderingContext? getContext(OffscreenRenderingContextId contextId, + optional any contextOptions = null); + + [Throws] + ImageBitmap transferToImageBitmap(); + [NewObject] + Promise<Blob> convertToBlob(optional ImageEncodeOptions options = {}); + + attribute EventHandler oncontextlost; + attribute EventHandler oncontextrestored; + + // Deprecated by convertToBlob + [Deprecated="OffscreenCanvasToBlob", NewObject] + Promise<Blob> toBlob(optional DOMString type = "", + optional any encoderOptions); +}; diff --git a/dom/webidl/OffscreenCanvasRenderingContext2D.webidl b/dom/webidl/OffscreenCanvasRenderingContext2D.webidl new file mode 100644 index 0000000000..0929730ba9 --- /dev/null +++ b/dom/webidl/OffscreenCanvasRenderingContext2D.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * https://html.spec.whatwg.org/#the-offscreen-2d-rendering-context + */ + +[Exposed=(Window,Worker), Pref="gfx.offscreencanvas.enabled"] +interface OffscreenCanvasRenderingContext2D { + [Throws] + undefined commit(); + + readonly attribute OffscreenCanvas canvas; +}; + +OffscreenCanvasRenderingContext2D includes CanvasState; +OffscreenCanvasRenderingContext2D includes CanvasTransform; +OffscreenCanvasRenderingContext2D includes CanvasCompositing; +OffscreenCanvasRenderingContext2D includes CanvasImageSmoothing; +OffscreenCanvasRenderingContext2D includes CanvasFillStrokeStyles; +OffscreenCanvasRenderingContext2D includes CanvasShadowStyles; +OffscreenCanvasRenderingContext2D includes CanvasFilters; +OffscreenCanvasRenderingContext2D includes CanvasRect; +OffscreenCanvasRenderingContext2D includes CanvasDrawPath; +OffscreenCanvasRenderingContext2D includes CanvasText; +OffscreenCanvasRenderingContext2D includes CanvasDrawImage; +OffscreenCanvasRenderingContext2D includes CanvasImageData; +OffscreenCanvasRenderingContext2D includes CanvasPathDrawingStyles; +OffscreenCanvasRenderingContext2D includes CanvasTextDrawingStyles; +OffscreenCanvasRenderingContext2D includes CanvasPathMethods; diff --git a/dom/webidl/OscillatorNode.webidl b/dom/webidl/OscillatorNode.webidl new file mode 100644 index 0000000000..7b5b407670 --- /dev/null +++ b/dom/webidl/OscillatorNode.webidl @@ -0,0 +1,45 @@ +/* -*- 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 OscillatorType { + "sine", + "square", + "sawtooth", + "triangle", + "custom" +}; + +dictionary OscillatorOptions : AudioNodeOptions { + OscillatorType type = "sine"; + float frequency = 440; + float detune = 0; + PeriodicWave periodicWave; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface OscillatorNode : AudioScheduledSourceNode { + [Throws] + constructor(BaseAudioContext context, + optional OscillatorOptions options = {}); + + [SetterThrows] + attribute OscillatorType type; + + readonly attribute AudioParam frequency; // in Hertz + readonly attribute AudioParam detune; // in Cents + + undefined setPeriodicWave(PeriodicWave periodicWave); +}; + +// Mozilla extensions +OscillatorNode includes AudioNodePassThrough; diff --git a/dom/webidl/PageTransitionEvent.webidl b/dom/webidl/PageTransitionEvent.webidl new file mode 100644 index 0000000000..20bcd6f3f2 --- /dev/null +++ b/dom/webidl/PageTransitionEvent.webidl @@ -0,0 +1,35 @@ +/* -*- 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 PageTransitionEvent interface is used for the pageshow and + * pagehide events, which are generic events that apply to both page + * load/unload and saving/restoring a document from session history. + */ + +[Exposed=Window] +interface PageTransitionEvent : Event +{ + constructor(DOMString type, + optional PageTransitionEventInit eventInitDict = {}); + + /** + * Set to true if the document has been or will be persisted across + * firing of the event. For example, if a document is being cached in + * session history, |persisted| is true for the PageHide event. + */ + readonly attribute boolean persisted; + + // Whether the document is in the middle of a frame swap. + [ChromeOnly] + readonly attribute boolean inFrameSwap; +}; + +dictionary PageTransitionEventInit : EventInit +{ + boolean persisted = false; + boolean inFrameSwap = false; +}; diff --git a/dom/webidl/PaintRequest.webidl b/dom/webidl/PaintRequest.webidl new file mode 100644 index 0000000000..ffe9e8ae74 --- /dev/null +++ b/dom/webidl/PaintRequest.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * These objects are exposed by the MozDOMAfterPaint event. Each one represents + * a request to repaint a rectangle that was generated by the browser. + */ +[Exposed=Window] +interface PaintRequest { + /** + * The client rect where invalidation was triggered. + */ + readonly attribute DOMRect clientRect; + + /** + * The reason for the request, as a string. If an empty string, then we don't know + * the reason (this is common). Reasons include "scroll repaint", meaning that we + * needed to repaint the rectangle due to scrolling, and "scroll copy", meaning + * that we updated the rectangle due to scrolling but instead of painting + * manually, we were able to do a copy from another area of the screen. + */ + readonly attribute DOMString reason; +}; diff --git a/dom/webidl/PaintRequestList.webidl b/dom/webidl/PaintRequestList.webidl new file mode 100644 index 0000000000..b5f59e1ccf --- /dev/null +++ b/dom/webidl/PaintRequestList.webidl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface PaintRequestList { + readonly attribute unsigned long length; + getter PaintRequest? item(unsigned long index); +}; diff --git a/dom/webidl/PaintWorkletGlobalScope.webidl b/dom/webidl/PaintWorkletGlobalScope.webidl new file mode 100644 index 0000000000..1393db272f --- /dev/null +++ b/dom/webidl/PaintWorkletGlobalScope.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.css-houdini.org/css-paint-api-1/#paintworkletglobalscope + */ + +[Global=(Worklet,PaintWorklet),Exposed=PaintWorklet] +interface PaintWorkletGlobalScope : WorkletGlobalScope { + undefined registerPaint(DOMString name, VoidFunction paintCtor); +}; diff --git a/dom/webidl/PannerNode.webidl b/dom/webidl/PannerNode.webidl new file mode 100644 index 0000000000..c50e575d73 --- /dev/null +++ b/dom/webidl/PannerNode.webidl @@ -0,0 +1,84 @@ +/* -*- 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 PanningModelType { + "equalpower", + "HRTF" +}; + +enum DistanceModelType { + "linear", + "inverse", + "exponential" +}; + +dictionary PannerOptions : AudioNodeOptions { + PanningModelType panningModel = "equalpower"; + DistanceModelType distanceModel = "inverse"; + float positionX = 0; + float positionY = 0; + float positionZ = 0; + float orientationX = 1; + float orientationY = 0; + float orientationZ = 0; + double refDistance = 1; + double maxDistance = 10000; + double rolloffFactor = 1; + double coneInnerAngle = 360; + double coneOuterAngle = 360; + double coneOuterGain = 0; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface PannerNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, optional PannerOptions options = {}); + + // Default for stereo is equalpower + attribute PanningModelType panningModel; + + // Uses a 3D cartesian coordinate system + [Throws] + undefined setPosition(double x, double y, double z); + [Throws] + undefined setOrientation(double x, double y, double z); + + // Cartesian coordinate for position + readonly attribute AudioParam positionX; + readonly attribute AudioParam positionY; + readonly attribute AudioParam positionZ; + + // Cartesian coordinate for orientation + readonly attribute AudioParam orientationX; + readonly attribute AudioParam orientationY; + readonly attribute AudioParam orientationZ; + + // Distance model and attributes + attribute DistanceModelType distanceModel; + [SetterThrows] + attribute double refDistance; + [SetterThrows] + attribute double maxDistance; + [SetterThrows] + attribute double rolloffFactor; + + // Directional sound cone + attribute double coneInnerAngle; + attribute double coneOuterAngle; + [SetterThrows] + attribute double coneOuterGain; + +}; + +// Mozilla extension +PannerNode includes AudioNodePassThrough; diff --git a/dom/webidl/ParentNode.webidl b/dom/webidl/ParentNode.webidl new file mode 100644 index 0000000000..4350fb8a05 --- /dev/null +++ b/dom/webidl/ParentNode.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#interface-parentnode + */ + +interface mixin ParentNode { + [Constant] + readonly attribute HTMLCollection children; + [Pure] + readonly attribute Element? firstElementChild; + [Pure] + readonly attribute Element? lastElementChild; + [Pure] + readonly attribute unsigned long childElementCount; + + [ChromeOnly] + HTMLCollection getElementsByAttribute(DOMString name, + [LegacyNullToEmptyString] DOMString value); + [ChromeOnly, Throws] + HTMLCollection getElementsByAttributeNS(DOMString? namespaceURI, DOMString name, + [LegacyNullToEmptyString] DOMString value); + + [CEReactions, Throws, Unscopable] + undefined prepend((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + undefined append((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + undefined replaceChildren((Node or DOMString)... nodes); +}; diff --git a/dom/webidl/PaymentAddress.webidl b/dom/webidl/PaymentAddress.webidl new file mode 100644 index 0000000000..c678c6ef97 --- /dev/null +++ b/dom/webidl/PaymentAddress.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this WebIDL file is + * https://www.w3.org/TR/payment-request/#paymentaddress-interface + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[SecureContext, + Func="mozilla::dom::PaymentRequest::PrefEnabled", + Exposed=Window] +interface PaymentAddress { + [Default] object toJSON(); + + readonly attribute DOMString country; + // TODO: Use FrozenArray once available. (Bug 1236777) + // readonly attribute FrozenArray<DOMString> addressLine; + [Frozen, Cached, Pure] + readonly attribute sequence<DOMString> addressLine; + readonly attribute DOMString region; + readonly attribute DOMString regionCode; + readonly attribute DOMString city; + readonly attribute DOMString dependentLocality; + readonly attribute DOMString postalCode; + readonly attribute DOMString sortingCode; + readonly attribute DOMString organization; + readonly attribute DOMString recipient; + readonly attribute DOMString phone; +}; diff --git a/dom/webidl/PaymentMethodChangeEvent.webidl b/dom/webidl/PaymentMethodChangeEvent.webidl new file mode 100644 index 0000000000..525ca1cc3d --- /dev/null +++ b/dom/webidl/PaymentMethodChangeEvent.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this WebIDL file is + * https://w3c.github.io/payment-request/#paymentmethodchangeevent-interface + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[SecureContext, + Exposed=Window, + Func="mozilla::dom::PaymentRequest::PrefEnabled"] +interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent { + constructor(DOMString type, + optional PaymentMethodChangeEventInit eventInitDict = {}); + + readonly attribute DOMString methodName; + readonly attribute object? methodDetails; +}; + +dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit { + DOMString methodName = ""; + object? methodDetails = null; +}; diff --git a/dom/webidl/PaymentRequest.webidl b/dom/webidl/PaymentRequest.webidl new file mode 100644 index 0000000000..b9021e0b06 --- /dev/null +++ b/dom/webidl/PaymentRequest.webidl @@ -0,0 +1,132 @@ +/* -*- 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://w3c.github.io/payment-request/#paymentrequest-interface + * https://w3c.github.io/payment-request/#idl-index + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary PaymentMethodData { + required DOMString supportedMethods; + object data; +}; + +dictionary PaymentCurrencyAmount { + required DOMString currency; + required DOMString value; +}; + +dictionary PaymentItem { + required DOMString label; + required PaymentCurrencyAmount amount; + boolean pending = false; +}; + +dictionary PaymentShippingOption { + required DOMString id; + required DOMString label; + required PaymentCurrencyAmount amount; + boolean selected = false; +}; + +dictionary PaymentDetailsModifier { + required DOMString supportedMethods; + PaymentItem total; + sequence<PaymentItem> additionalDisplayItems; + object data; +}; + +dictionary PaymentDetailsBase { + sequence<PaymentItem> displayItems; + sequence<PaymentShippingOption> shippingOptions; + sequence<PaymentDetailsModifier> modifiers; +}; + +dictionary PaymentDetailsInit : PaymentDetailsBase { + DOMString id; + required PaymentItem total; +}; + +[GenerateInitFromJSON, GenerateToJSON] +dictionary AddressErrors { + DOMString addressLine; + DOMString city; + DOMString country; + DOMString dependentLocality; + DOMString organization; + DOMString phone; + DOMString postalCode; + DOMString recipient; + DOMString region; + DOMString regionCode; + DOMString sortingCode; +}; + +dictionary PaymentValidationErrors { + PayerErrors payer; + AddressErrors shippingAddress; + DOMString error; + object paymentMethod; +}; + +[GenerateInitFromJSON, GenerateToJSON] +dictionary PayerErrors { + DOMString email; + DOMString name; + DOMString phone; +}; + +dictionary PaymentDetailsUpdate : PaymentDetailsBase { + DOMString error; + AddressErrors shippingAddressErrors; + PayerErrors payerErrors; + object paymentMethodErrors; + PaymentItem total; +}; + +enum PaymentShippingType { + "shipping", + "delivery", + "pickup" +}; + +dictionary PaymentOptions { + boolean requestPayerName = false; + boolean requestPayerEmail = false; + boolean requestPayerPhone = false; + boolean requestShipping = false; + boolean requestBillingAddress = false; + PaymentShippingType shippingType = "shipping"; +}; + +[SecureContext, + Func="mozilla::dom::PaymentRequest::PrefEnabled", + Exposed=Window] +interface PaymentRequest : EventTarget { + [Throws] + constructor(sequence<PaymentMethodData> methodData, + PaymentDetailsInit details, + optional PaymentOptions options = {}); + + [NewObject] + Promise<PaymentResponse> show(optional Promise<PaymentDetailsUpdate> detailsPromise); + [NewObject] + Promise<undefined> abort(); + [NewObject] + Promise<boolean> canMakePayment(); + + readonly attribute DOMString id; + readonly attribute PaymentAddress? shippingAddress; + readonly attribute DOMString? shippingOption; + readonly attribute PaymentShippingType? shippingType; + + attribute EventHandler onmerchantvalidation; + attribute EventHandler onshippingaddresschange; + attribute EventHandler onshippingoptionchange; + attribute EventHandler onpaymentmethodchange; +}; diff --git a/dom/webidl/PaymentRequestUpdateEvent.webidl b/dom/webidl/PaymentRequestUpdateEvent.webidl new file mode 100644 index 0000000000..a1428fecd7 --- /dev/null +++ b/dom/webidl/PaymentRequestUpdateEvent.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this WebIDL file is + * https://w3c.github.io/payment-request/#paymentrequestupdateevent-interface + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[SecureContext, + Func="mozilla::dom::PaymentRequest::PrefEnabled", + Exposed=Window] +interface PaymentRequestUpdateEvent : Event { + constructor(DOMString type, + optional PaymentRequestUpdateEventInit eventInitDict = {}); + + [Throws] + undefined updateWith(Promise<PaymentDetailsUpdate> detailsPromise); +}; + +dictionary PaymentRequestUpdateEventInit : EventInit { +}; diff --git a/dom/webidl/PaymentResponse.webidl b/dom/webidl/PaymentResponse.webidl new file mode 100644 index 0000000000..581fabcb6a --- /dev/null +++ b/dom/webidl/PaymentResponse.webidl @@ -0,0 +1,42 @@ +/* -*- 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:/w3c.github.io/payment-request/#paymentresponse-interface + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum PaymentComplete { + "success", + "fail", + "unknown" +}; + +[SecureContext, + Func="mozilla::dom::PaymentRequest::PrefEnabled", + Exposed=Window] +interface PaymentResponse : EventTarget { + [Default] object toJSON(); + + readonly attribute DOMString requestId; + readonly attribute DOMString methodName; + readonly attribute object details; + readonly attribute PaymentAddress? shippingAddress; + readonly attribute DOMString? shippingOption; + readonly attribute DOMString? payerName; + readonly attribute DOMString? payerEmail; + readonly attribute DOMString? payerPhone; + + [NewObject] + Promise<undefined> complete(optional PaymentComplete result = "unknown"); + + // If the dictionary argument has no required members, it must be optional. + [NewObject] + Promise<undefined> retry(optional PaymentValidationErrors errorFields = {}); + + attribute EventHandler onpayerdetailchange; +}; diff --git a/dom/webidl/PeerConnectionImpl.webidl b/dom/webidl/PeerConnectionImpl.webidl new file mode 100644 index 0000000000..5b59b629e5 --- /dev/null +++ b/dom/webidl/PeerConnectionImpl.webidl @@ -0,0 +1,134 @@ +/* -*- 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/. + * + * PeerConnection.js' interface to the C++ PeerConnectionImpl. + * + * Do not confuse with RTCPeerConnection. This interface is purely for + * communication between the PeerConnection JS DOM binding and the C++ + * implementation. + * + * See media/webrtc/signaling/include/PeerConnectionImpl.h + * + */ + +interface nsISupports; + +callback ChainedOperation = Promise<any> (); + +/* Must be created first. Observer events will be dispatched on the thread provided */ +[ChromeOnly, + Exposed=Window] +interface PeerConnectionImpl { + constructor(); + + /* Must be called first. Observer events dispatched on the thread provided */ + [Throws] + undefined initialize(PeerConnectionObserver observer, Window window); + + /* JSEP calls */ + [Throws] + undefined createOffer(optional RTCOfferOptions options = {}); + [Throws] + undefined createAnswer(); + [Throws] + undefined setLocalDescription(long action, DOMString sdp); + [Throws] + undefined setRemoteDescription(long action, DOMString sdp); + + Promise<RTCStatsReport> getStats(MediaStreamTrack? selector); + + sequence<MediaStream> getRemoteStreams(); + + /* Adds the tracks created by GetUserMedia */ + [Throws] + RTCRtpTransceiver addTransceiver(RTCRtpTransceiverInit init, + DOMString kind, + MediaStreamTrack? sendTrack, + boolean addTrackMagic); + sequence<RTCRtpTransceiver> getTransceivers(); + + [Throws] + undefined closeStreams(); + + [Throws] + undefined enablePacketDump(unsigned long level, + mozPacketDumpType type, + boolean sending); + + [Throws] + undefined disablePacketDump(unsigned long level, + mozPacketDumpType type, + boolean sending); + + /* As the ICE candidates roll in this one should be called each time + * in order to keep the candidate list up-to-date for the next SDP-related + * call PeerConnectionImpl does not parse ICE candidates, just sticks them + * into the SDP. + */ + [Throws] + undefined addIceCandidate(DOMString candidate, + DOMString mid, + DOMString ufrag, + unsigned short? level); + + /* Shuts down threads, deletes state */ + [Throws] + undefined close(); + + [Throws] + undefined setConfiguration(optional RTCConfiguration config = {}); + + undefined restartIce(); + undefined restartIceNoRenegotiationNeeded(); + + /* Notify DOM window if this plugin crash is ours. */ + boolean pluginCrash(unsigned long long pluginId, DOMString name); + + // Only throws if promise creation fails + [Throws] + Promise<undefined> onSetDescriptionSuccess(RTCSdpType type, boolean remote); + + undefined onSetDescriptionError(); + + /* Attributes */ + /* This provides the implementation with the certificate it uses to + * authenticate itself. The JS side must set this before calling + * createOffer/createAnswer or retrieving the value of fingerprint. This has + * to be delayed because generating the certificate takes some time. */ + attribute RTCCertificate certificate; + [Constant] + readonly attribute DOMString fingerprint; + readonly attribute DOMString currentLocalDescription; + readonly attribute DOMString pendingLocalDescription; + readonly attribute DOMString currentRemoteDescription; + readonly attribute DOMString pendingRemoteDescription; + readonly attribute boolean? currentOfferer; + readonly attribute boolean? pendingOfferer; + + readonly attribute RTCIceConnectionState iceConnectionState; + readonly attribute RTCIceGatheringState iceGatheringState; + readonly attribute RTCPeerConnectionState connectionState; + readonly attribute RTCSignalingState signalingState; + attribute DOMString id; + + [SetterThrows] + attribute DOMString peerIdentity; + readonly attribute boolean privacyRequested; + + readonly attribute RTCSctpTransport? sctp; + + /* Data channels */ + [Throws] + RTCDataChannel createDataChannel(DOMString label, DOMString protocol, + unsigned short type, boolean ordered, + unsigned short maxTime, unsigned short maxNum, + boolean externalNegotiated, unsigned short stream); + + [Throws] + Promise<any> chain(ChainedOperation op); + undefined updateNegotiationNeeded(); + + boolean createdSender(RTCRtpSender sender); +}; diff --git a/dom/webidl/PeerConnectionObserver.webidl b/dom/webidl/PeerConnectionObserver.webidl new file mode 100644 index 0000000000..5f190303b4 --- /dev/null +++ b/dom/webidl/PeerConnectionObserver.webidl @@ -0,0 +1,56 @@ +/* -*- 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 nsISupports; + +dictionary PCErrorData +{ + required PCError name; + required DOMString message; + // Will need to add more stuff (optional) for RTCError +}; + +[ChromeOnly, + JSImplementation="@mozilla.org/dom/peerconnectionobserver;1", + Exposed=Window] +interface PeerConnectionObserver +{ + [Throws] + constructor(RTCPeerConnection domPC); + + /* JSEP callbacks */ + undefined onCreateOfferSuccess(DOMString offer); + undefined onCreateOfferError(PCErrorData error); + undefined onCreateAnswerSuccess(DOMString answer); + undefined onCreateAnswerError(PCErrorData error); + undefined onSetDescriptionSuccess(); + undefined onSetDescriptionError(PCErrorData error); + undefined onAddIceCandidateSuccess(); + undefined onAddIceCandidateError(PCErrorData error); + undefined onIceCandidate(unsigned short level, DOMString mid, DOMString candidate, DOMString ufrag); + + /* Data channel callbacks */ + undefined notifyDataChannel(RTCDataChannel channel); + + /* Notification of one of several types of state changed */ + undefined onStateChange(PCObserverStateType state); + + /* + Lets PeerConnectionImpl fire track events on the RTCPeerConnection + */ + undefined fireTrackEvent(RTCRtpReceiver receiver, sequence<MediaStream> streams); + + /* + Lets PeerConnectionImpl fire addstream events on the RTCPeerConnection + */ + undefined fireStreamEvent(MediaStream stream); + + undefined fireNegotiationNeededEvent(); + + /* Packet dump callback */ + undefined onPacket(unsigned long level, mozPacketDumpType type, boolean sending, + ArrayBuffer packet); +}; diff --git a/dom/webidl/PeerConnectionObserverEnums.webidl b/dom/webidl/PeerConnectionObserverEnums.webidl new file mode 100644 index 0000000000..e0f517ad82 --- /dev/null +++ b/dom/webidl/PeerConnectionObserverEnums.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This is in a separate file so it can be shared with unittests. + */ + +enum PCObserverStateType { + "None", + "IceConnectionState", + "IceGatheringState", + "SignalingState", + "ConnectionState", +}; + +enum PCError { + "UnknownError", + "InvalidAccessError", + "InvalidStateError", + "InvalidModificationError", + "OperationError", + "NotSupportedError", + "SyntaxError", + "NotReadableError", + "TypeError", + "RangeError", + "InvalidCharacterError" +}; diff --git a/dom/webidl/Performance.webidl b/dom/webidl/Performance.webidl new file mode 100644 index 0000000000..f8ea8dfdc9 --- /dev/null +++ b/dom/webidl/Performance.webidl @@ -0,0 +1,97 @@ +/* -*- 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/hr-time/#sec-performance + * https://w3c.github.io/navigation-timing/#extensions-to-the-performance-interface + * https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface + * https://w3c.github.io/resource-timing/#sec-extensions-performance-interface + * https://w3c.github.io/user-timing/#extensions-performance-interface + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). + * W3C liability, trademark and document use rules apply. + */ + +// DOMTimeStamp is deprecated, use EpochTimeStamp instead. +typedef unsigned long long DOMTimeStamp; +typedef unsigned long long EpochTimeStamp; +typedef double DOMHighResTimeStamp; +typedef sequence <PerformanceEntry> PerformanceEntryList; + +// https://w3c.github.io/hr-time/#sec-performance +[Exposed=(Window,Worker)] +interface Performance : EventTarget { + [DependsOn=DeviceState, Affects=Nothing] + DOMHighResTimeStamp now(); + + [Constant] + readonly attribute DOMHighResTimeStamp timeOrigin; + + [Default] object toJSON(); +}; + +// https://w3c.github.io/navigation-timing/#extensions-to-the-performance-interface +[Exposed=Window] +partial interface Performance { + [Constant] + readonly attribute PerformanceTiming timing; + [Constant] + readonly attribute PerformanceNavigation navigation; +}; + +// https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface +[Exposed=(Window,Worker)] +partial interface Performance { + PerformanceEntryList getEntries(); + PerformanceEntryList getEntriesByType(DOMString entryType); + PerformanceEntryList getEntriesByName(DOMString name, optional DOMString + entryType); +}; + +// https://w3c.github.io/resource-timing/#sec-extensions-performance-interface +[Exposed=(Window,Worker)] +partial interface Performance { + undefined clearResourceTimings(); + undefined setResourceTimingBufferSize(unsigned long maxSize); + attribute EventHandler onresourcetimingbufferfull; +}; + +// GC microbenchmarks, pref-guarded, not for general use (bug 1125412) +[Exposed=Window] +partial interface Performance { + [Pref="dom.enable_memory_stats"] + readonly attribute object mozMemory; +}; + +// https://w3c.github.io/user-timing/#extensions-performance-interface +dictionary PerformanceMarkOptions { + any detail; + DOMHighResTimeStamp startTime; +}; + +// https://w3c.github.io/user-timing/#extensions-performance-interface +dictionary PerformanceMeasureOptions { + any detail; + (DOMString or DOMHighResTimeStamp) start; + DOMHighResTimeStamp duration; + (DOMString or DOMHighResTimeStamp) end; +}; + +// https://w3c.github.io/user-timing/#extensions-performance-interface +[Exposed=(Window,Worker)] +partial interface Performance { + [Throws] + PerformanceMark mark(DOMString markName, optional PerformanceMarkOptions markOptions = {}); + undefined clearMarks(optional DOMString markName); + [Throws] + PerformanceMeasure measure(DOMString measureName, optional (DOMString or PerformanceMeasureOptions) startOrMeasureOptions = {}, optional DOMString endMark); + undefined clearMeasures(optional DOMString measureName); +}; + +[Exposed=Window] +partial interface Performance { + [Pref="dom.enable_event_timing", SameObject] + readonly attribute EventCounts eventCounts; +}; diff --git a/dom/webidl/PerformanceEntry.webidl b/dom/webidl/PerformanceEntry.webidl new file mode 100644 index 0000000000..ddd094bbb9 --- /dev/null +++ b/dom/webidl/PerformanceEntry.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/performance-timeline/#dom-performanceentry + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker)] +interface PerformanceEntry +{ + readonly attribute DOMString name; + readonly attribute DOMString entryType; + readonly attribute DOMHighResTimeStamp startTime; + readonly attribute DOMHighResTimeStamp duration; + + [Default] object toJSON(); +}; diff --git a/dom/webidl/PerformanceEntryEvent.webidl b/dom/webidl/PerformanceEntryEvent.webidl new file mode 100644 index 0000000000..4ddbc8049a --- /dev/null +++ b/dom/webidl/PerformanceEntryEvent.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +dictionary PerformanceEntryEventInit : EventInit +{ + DOMString name = ""; + DOMString entryType = ""; + DOMHighResTimeStamp startTime = 0; + DOMHighResTimeStamp duration = 0; + double epoch = 0; + DOMString origin = ""; +}; + +[ChromeOnly, + Exposed=Window] +interface PerformanceEntryEvent : Event +{ + constructor(DOMString type, + optional PerformanceEntryEventInit eventInitDict = {}); + + readonly attribute DOMString name; + readonly attribute DOMString entryType; + readonly attribute DOMHighResTimeStamp startTime; + readonly attribute DOMHighResTimeStamp duration; + readonly attribute double epoch; + readonly attribute DOMString origin; +}; diff --git a/dom/webidl/PerformanceEventTiming.webidl b/dom/webidl/PerformanceEventTiming.webidl new file mode 100644 index 0000000000..08edad1da1 --- /dev/null +++ b/dom/webidl/PerformanceEventTiming.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/navigation-timing/#the-performancenavigation-interface + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.enable_event_timing", + Exposed=Window] +interface EventCounts { + readonly maplike<DOMString, unsigned long long>; +}; + +[Pref="dom.enable_event_timing", + Exposed=Window] +interface PerformanceEventTiming : PerformanceEntry { + readonly attribute DOMHighResTimeStamp processingStart; + readonly attribute DOMHighResTimeStamp processingEnd; + readonly attribute boolean cancelable; + readonly attribute Node? target; + + [Default] object toJSON(); +}; diff --git a/dom/webidl/PerformanceLargestContentfulPaint.webidl b/dom/webidl/PerformanceLargestContentfulPaint.webidl new file mode 100644 index 0000000000..11f29a1147 --- /dev/null +++ b/dom/webidl/PerformanceLargestContentfulPaint.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/largest-contentful-paint/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.enable_largest_contentful_paint", + Exposed=Window] +interface LargestContentfulPaint : PerformanceEntry { + readonly attribute DOMHighResTimeStamp renderTime; + readonly attribute DOMHighResTimeStamp loadTime; + readonly attribute unsigned long size; + readonly attribute DOMString id; + readonly attribute DOMString url; + readonly attribute Element? element; + [Default] object toJSON(); +}; diff --git a/dom/webidl/PerformanceMark.webidl b/dom/webidl/PerformanceMark.webidl new file mode 100644 index 0000000000..8b2bdd689e --- /dev/null +++ b/dom/webidl/PerformanceMark.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/user-timing/#performancemark + */ + +[Exposed=(Window,Worker)] +interface PerformanceMark : PerformanceEntry +{ + [Throws] + constructor(DOMString markName, optional PerformanceMarkOptions markOptions = {}); + readonly attribute any detail; +}; diff --git a/dom/webidl/PerformanceMeasure.webidl b/dom/webidl/PerformanceMeasure.webidl new file mode 100644 index 0000000000..a520778b88 --- /dev/null +++ b/dom/webidl/PerformanceMeasure.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/user-timing/#performancemeasure + */ + +[Exposed=(Window,Worker)] +interface PerformanceMeasure : PerformanceEntry +{ + readonly attribute any detail; +}; diff --git a/dom/webidl/PerformanceNavigation.webidl b/dom/webidl/PerformanceNavigation.webidl new file mode 100644 index 0000000000..ff3dbb4944 --- /dev/null +++ b/dom/webidl/PerformanceNavigation.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/navigation-timing/#the-performancenavigation-interface + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface PerformanceNavigation { + const unsigned short TYPE_NAVIGATE = 0; + const unsigned short TYPE_RELOAD = 1; + const unsigned short TYPE_BACK_FORWARD = 2; + const unsigned short TYPE_RESERVED = 255; + + readonly attribute unsigned short type; + readonly attribute unsigned short redirectCount; + + [Default] object toJSON(); +}; diff --git a/dom/webidl/PerformanceNavigationTiming.webidl b/dom/webidl/PerformanceNavigationTiming.webidl new file mode 100644 index 0000000000..cf02997230 --- /dev/null +++ b/dom/webidl/PerformanceNavigationTiming.webidl @@ -0,0 +1,35 @@ +/* -*- 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/navigation-timing/#sec-PerformanceNavigationTiming + * + * Copyright © 2016 W3C® (MIT, ERCIM, Keio, Beihang). + * W3C liability, trademark and document use rules apply. + */ + +enum NavigationType { + "navigate", + "reload", + "back_forward", + "prerender" +}; + +[Exposed=Window, + Func="mozilla::dom::PerformanceNavigationTiming::Enabled"] +interface PerformanceNavigationTiming : PerformanceResourceTiming { + readonly attribute DOMHighResTimeStamp unloadEventStart; + readonly attribute DOMHighResTimeStamp unloadEventEnd; + readonly attribute DOMHighResTimeStamp domInteractive; + readonly attribute DOMHighResTimeStamp domContentLoadedEventStart; + readonly attribute DOMHighResTimeStamp domContentLoadedEventEnd; + readonly attribute DOMHighResTimeStamp domComplete; + readonly attribute DOMHighResTimeStamp loadEventStart; + readonly attribute DOMHighResTimeStamp loadEventEnd; + readonly attribute NavigationType type; + readonly attribute unsigned short redirectCount; + + [Default] object toJSON(); +}; diff --git a/dom/webidl/PerformanceObserver.webidl b/dom/webidl/PerformanceObserver.webidl new file mode 100644 index 0000000000..041490e9d8 --- /dev/null +++ b/dom/webidl/PerformanceObserver.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/performance-timeline/#the-performanceobserver-interface + */ + +dictionary PerformanceObserverInit { + sequence<DOMString> entryTypes; + DOMString type; + boolean buffered; + [Pref="dom.enable_event_timing"] + DOMHighResTimeStamp durationThreshold; +}; + +callback PerformanceObserverCallback = undefined (PerformanceObserverEntryList entries, + PerformanceObserver observer); + +[Pref="dom.enable_performance_observer", + Exposed=(Window,Worker)] +interface PerformanceObserver { + [Throws] + constructor(PerformanceObserverCallback callback); + + [Throws] undefined observe(optional PerformanceObserverInit options = {}); + undefined disconnect(); + PerformanceEntryList takeRecords(); + static readonly attribute object supportedEntryTypes; +}; diff --git a/dom/webidl/PerformanceObserverEntryList.webidl b/dom/webidl/PerformanceObserverEntryList.webidl new file mode 100644 index 0000000000..6e31d3164e --- /dev/null +++ b/dom/webidl/PerformanceObserverEntryList.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/performance-timeline/#the-performanceobserverentrylist-interface + */ + +// XXX should be moved into Performance.webidl. +dictionary PerformanceEntryFilterOptions { + DOMString name; + DOMString entryType; + DOMString initiatorType; +}; + +[Pref="dom.enable_performance_observer", + Exposed=(Window,Worker)] +interface PerformanceObserverEntryList { + PerformanceEntryList getEntries(optional PerformanceEntryFilterOptions filter = {}); + PerformanceEntryList getEntriesByType(DOMString entryType); + PerformanceEntryList getEntriesByName(DOMString name, + optional DOMString entryType); +}; diff --git a/dom/webidl/PerformancePaintTiming.webidl b/dom/webidl/PerformancePaintTiming.webidl new file mode 100644 index 0000000000..6551bdfd8d --- /dev/null +++ b/dom/webidl/PerformancePaintTiming.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/paint-timing/#sec-PerformancePaintTiming + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window)] +interface PerformancePaintTiming : PerformanceEntry +{ +}; diff --git a/dom/webidl/PerformanceResourceTiming.webidl b/dom/webidl/PerformanceResourceTiming.webidl new file mode 100644 index 0000000000..83c7737148 --- /dev/null +++ b/dom/webidl/PerformanceResourceTiming.webidl @@ -0,0 +1,58 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/resource-timing/#sec-performanceresourcetiming + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker)] +interface PerformanceResourceTiming : PerformanceEntry +{ + readonly attribute DOMString initiatorType; + readonly attribute DOMString nextHopProtocol; + + readonly attribute DOMHighResTimeStamp workerStart; + + [NeedsSubjectPrincipal] + readonly attribute DOMHighResTimeStamp redirectStart; + [NeedsSubjectPrincipal] + readonly attribute DOMHighResTimeStamp redirectEnd; + + readonly attribute DOMHighResTimeStamp fetchStart; + + [NeedsSubjectPrincipal] + readonly attribute DOMHighResTimeStamp domainLookupStart; + [NeedsSubjectPrincipal] + readonly attribute DOMHighResTimeStamp domainLookupEnd; + [NeedsSubjectPrincipal] + readonly attribute DOMHighResTimeStamp connectStart; + [NeedsSubjectPrincipal] + readonly attribute DOMHighResTimeStamp connectEnd; + [NeedsSubjectPrincipal] + readonly attribute DOMHighResTimeStamp secureConnectionStart; + [NeedsSubjectPrincipal] + readonly attribute DOMHighResTimeStamp requestStart; + [NeedsSubjectPrincipal] + readonly attribute DOMHighResTimeStamp responseStart; + + readonly attribute DOMHighResTimeStamp responseEnd; + + [NeedsSubjectPrincipal] + readonly attribute unsigned long long transferSize; + [NeedsSubjectPrincipal] + readonly attribute unsigned long long encodedBodySize; + [NeedsSubjectPrincipal] + readonly attribute unsigned long long decodedBodySize; + + // TODO: Use FrozenArray once available. (Bug 1236777) + // readonly attribute FrozenArray<PerformanceServerTiming> serverTiming; + [SecureContext, Frozen, Cached, Pure, NeedsSubjectPrincipal] + readonly attribute sequence<PerformanceServerTiming> serverTiming; + + [Default] object toJSON(); +}; diff --git a/dom/webidl/PerformanceServerTiming.webidl b/dom/webidl/PerformanceServerTiming.webidl new file mode 100644 index 0000000000..0fd7a54fc2 --- /dev/null +++ b/dom/webidl/PerformanceServerTiming.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/server-timing/#the-performanceservertiming-interface + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[SecureContext,Exposed=(Window,Worker)] +interface PerformanceServerTiming { + readonly attribute DOMString name; + readonly attribute DOMHighResTimeStamp duration; + readonly attribute DOMString description; + + [Default] object toJSON(); +}; diff --git a/dom/webidl/PerformanceTiming.webidl b/dom/webidl/PerformanceTiming.webidl new file mode 100644 index 0000000000..f1ea315c7b --- /dev/null +++ b/dom/webidl/PerformanceTiming.webidl @@ -0,0 +1,60 @@ +/* -*- 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/navigation-timing/#the-performancetiming-interface + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface PerformanceTiming { + readonly attribute unsigned long long navigationStart; + readonly attribute unsigned long long unloadEventStart; + readonly attribute unsigned long long unloadEventEnd; + readonly attribute unsigned long long redirectStart; + readonly attribute unsigned long long redirectEnd; + readonly attribute unsigned long long fetchStart; + readonly attribute unsigned long long domainLookupStart; + readonly attribute unsigned long long domainLookupEnd; + readonly attribute unsigned long long connectStart; + readonly attribute unsigned long long connectEnd; + readonly attribute unsigned long long secureConnectionStart; + readonly attribute unsigned long long requestStart; + readonly attribute unsigned long long responseStart; + readonly attribute unsigned long long responseEnd; + readonly attribute unsigned long long domLoading; + readonly attribute unsigned long long domInteractive; + readonly attribute unsigned long long domContentLoadedEventStart; + readonly attribute unsigned long long domContentLoadedEventEnd; + readonly attribute unsigned long long domComplete; + readonly attribute unsigned long long loadEventStart; + readonly attribute unsigned long long loadEventEnd; + + // This is a Chrome proprietary extension and not part of the + // performance/navigation timing specification. + // Returns 0 if a non-blank paint has not happened. + [Pref="dom.performance.time_to_non_blank_paint.enabled"] + readonly attribute unsigned long long timeToNonBlankPaint; + + // Returns 0 if a contentful paint has not happened. + [Pref="dom.performance.time_to_contentful_paint.enabled"] + readonly attribute unsigned long long timeToContentfulPaint; + + // This is a Mozilla proprietary extension and not part of the + // performance/navigation timing specification. It marks the + // completion of the first presentation flush after DOMContentLoaded. + [Pref="dom.performance.time_to_dom_content_flushed.enabled"] + readonly attribute unsigned long long timeToDOMContentFlushed; + + // This is a Chrome proprietary extension and not part of the + // performance/navigation timing specification. + // Returns 0 if a time-to-interactive measurement has not happened. + [Pref="dom.performance.time_to_first_interactive.enabled"] + readonly attribute unsigned long long timeToFirstInteractive; + + [Default] object toJSON(); +}; diff --git a/dom/webidl/PeriodicWave.webidl b/dom/webidl/PeriodicWave.webidl new file mode 100644 index 0000000000..e1a14b4d36 --- /dev/null +++ b/dom/webidl/PeriodicWave.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary PeriodicWaveConstraints { + boolean disableNormalization = false; +}; + +dictionary PeriodicWaveOptions : PeriodicWaveConstraints { + sequence<float> real; + sequence<float> imag; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface PeriodicWave { + [Throws] + constructor(BaseAudioContext context, + optional PeriodicWaveOptions options = {}); +}; diff --git a/dom/webidl/PermissionStatus.webidl b/dom/webidl/PermissionStatus.webidl new file mode 100644 index 0000000000..fa29f2de53 --- /dev/null +++ b/dom/webidl/PermissionStatus.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/permissions/#status-of-a-permission + */ + +enum PermissionState { + "granted", + "denied", + "prompt" +}; + +[Exposed=Window] +interface PermissionStatus : EventTarget { + readonly attribute PermissionName name; + readonly attribute PermissionState state; + attribute EventHandler onchange; + + [ChromeOnly] + readonly attribute UTF8String type; +}; diff --git a/dom/webidl/Permissions.webidl b/dom/webidl/Permissions.webidl new file mode 100644 index 0000000000..c4804e79cb --- /dev/null +++ b/dom/webidl/Permissions.webidl @@ -0,0 +1,42 @@ +/* -*- 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/permissions/#permissions-interface + */ + +enum PermissionName { + "geolocation", + "notifications", + "push", + "persistent-storage", + "midi", + "storage-access", // Defined in https://privacycg.github.io/storage-access/#permissions-integration + "screen-wake-lock" // Defined in https://w3c.github.io/screen-wake-lock/ +}; + +[GenerateInit] +dictionary PermissionDescriptor { + required PermissionName name; +}; + +// https://webaudio.github.io/web-midi-api/#permissions-integration +[GenerateInit] +dictionary MidiPermissionDescriptor : PermissionDescriptor { + boolean sysex = false; +}; + +// We don't implement `PushPermissionDescriptor` because we use a background +// message quota instead of `userVisibleOnly`. + +[Exposed=Window] +interface Permissions { + [NewObject] + Promise<PermissionStatus> query(object permission); + + // http://w3c.github.io/permissions/#webdriver-command-set-permission + [ChromeOnly, Throws] + PermissionStatus parseSetParameters(PermissionSetParameters parameters); +}; diff --git a/dom/webidl/Plugin.webidl b/dom/webidl/Plugin.webidl new file mode 100644 index 0000000000..8e66858d77 --- /dev/null +++ b/dom/webidl/Plugin.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[LegacyUnenumerableNamedProperties, + Exposed=Window] +interface Plugin { + readonly attribute DOMString description; + readonly attribute DOMString filename; + readonly attribute DOMString name; + + readonly attribute unsigned long length; + getter MimeType? item(unsigned long index); + getter MimeType? namedItem(DOMString name); +}; diff --git a/dom/webidl/PluginArray.webidl b/dom/webidl/PluginArray.webidl new file mode 100644 index 0000000000..06dbc5e59f --- /dev/null +++ b/dom/webidl/PluginArray.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[LegacyUnenumerableNamedProperties, + Exposed=Window] +interface PluginArray { + undefined refresh(); + readonly attribute unsigned long length; + getter Plugin? item(unsigned long index); + getter Plugin? namedItem(DOMString name); +}; diff --git a/dom/webidl/PointerEvent.webidl b/dom/webidl/PointerEvent.webidl new file mode 100644 index 0000000000..4aef14c219 --- /dev/null +++ b/dom/webidl/PointerEvent.webidl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information see nsIPointerEvent.idl. + * + * Portions Copyright 2013 Microsoft Open Technologies, Inc. */ + +interface WindowProxy; + +[Exposed=Window] +interface PointerEvent : MouseEvent +{ + constructor(DOMString type, optional PointerEventInit eventInitDict = {}); + + readonly attribute long pointerId; + + readonly attribute long width; + readonly attribute long height; + readonly attribute float pressure; + readonly attribute float tangentialPressure; + readonly attribute long tiltX; + readonly attribute long tiltY; + readonly attribute long twist; + + readonly attribute DOMString pointerType; + readonly attribute boolean isPrimary; + + [Func="mozilla::dom::PointerEvent::EnableGetCoalescedEvents"] + sequence<PointerEvent> getCoalescedEvents(); + sequence<PointerEvent> getPredictedEvents(); +}; + +dictionary PointerEventInit : MouseEventInit +{ + long pointerId = 0; + long width = 1; + long height = 1; + float pressure = 0; + float tangentialPressure = 0; + long tiltX = 0; + long tiltY = 0; + long twist = 0; + DOMString pointerType = ""; + boolean isPrimary = false; + sequence<PointerEvent> coalescedEvents = []; + sequence<PointerEvent> predictedEvents = []; +}; diff --git a/dom/webidl/PopStateEvent.webidl b/dom/webidl/PopStateEvent.webidl new file mode 100644 index 0000000000..738a7dc14a --- /dev/null +++ b/dom/webidl/PopStateEvent.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface PopStateEvent : Event +{ + constructor(DOMString type, optional PopStateEventInit eventInitDict = {}); + + readonly attribute any state; +}; + +dictionary PopStateEventInit : EventInit +{ + any state = null; +}; diff --git a/dom/webidl/PopoverInvokerElement.webidl b/dom/webidl/PopoverInvokerElement.webidl new file mode 100644 index 0000000000..b5d98856b7 --- /dev/null +++ b/dom/webidl/PopoverInvokerElement.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/popover.html#popoverinvokerelement + */ + +interface mixin PopoverInvokerElement { + [Pref="dom.element.popover.enabled", CEReactions] attribute Element? popoverTargetElement; + [Pref="dom.element.popover.enabled", CEReactions] attribute DOMString popoverTargetAction; +}; diff --git a/dom/webidl/PopupBlockedEvent.webidl b/dom/webidl/PopupBlockedEvent.webidl new file mode 100644 index 0000000000..888dc3899d --- /dev/null +++ b/dom/webidl/PopupBlockedEvent.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +interface URI; + +[Exposed=Window] +interface PopupBlockedEvent : Event +{ + constructor(DOMString type, + optional PopupBlockedEventInit eventInitDict = {}); + + readonly attribute Window? requestingWindow; + readonly attribute URI? popupWindowURI; + readonly attribute DOMString? popupWindowName; + readonly attribute DOMString? popupWindowFeatures; +}; + +dictionary PopupBlockedEventInit : EventInit +{ + Window? requestingWindow = null; + URI? popupWindowURI = null; + DOMString popupWindowName = ""; + DOMString popupWindowFeatures = ""; +}; diff --git a/dom/webidl/PositionStateEvent.webidl b/dom/webidl/PositionStateEvent.webidl new file mode 100644 index 0000000000..a393172991 --- /dev/null +++ b/dom/webidl/PositionStateEvent.webidl @@ -0,0 +1,19 @@ +/** + * This Source Code Form is subject to the terms of 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 PositionStateEventInit : EventInit { + required double duration; + required double playbackRate; + required double position; +}; + +[Exposed=Window, ChromeOnly] +interface PositionStateEvent : Event { + constructor(DOMString type, optional PositionStateEventInit eventInitDict = {}); + readonly attribute double duration; + readonly attribute double playbackRate; + readonly attribute double position; +}; diff --git a/dom/webidl/ProcessingInstruction.webidl b/dom/webidl/ProcessingInstruction.webidl new file mode 100644 index 0000000000..59f8228b83 --- /dev/null +++ b/dom/webidl/ProcessingInstruction.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#interface-processinginstruction + * https://drafts.csswg.org/cssom/#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +// https://dom.spec.whatwg.org/#interface-processinginstruction +[Exposed=Window] +interface ProcessingInstruction : CharacterData { + readonly attribute DOMString target; +}; + +// https://drafts.csswg.org/cssom/#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction +ProcessingInstruction includes LinkStyle; diff --git a/dom/webidl/ProgressEvent.webidl b/dom/webidl/ProgressEvent.webidl new file mode 100644 index 0000000000..56b1e72b13 --- /dev/null +++ b/dom/webidl/ProgressEvent.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=(Window,Worker)] +interface ProgressEvent : Event +{ + constructor(DOMString type, optional ProgressEventInit eventInitDict = {}); + + readonly attribute boolean lengthComputable; + readonly attribute unsigned long long loaded; + readonly attribute unsigned long long total; +}; + +dictionary ProgressEventInit : EventInit +{ + boolean lengthComputable = false; + unsigned long long loaded = 0; + unsigned long long total = 0; +}; diff --git a/dom/webidl/Promise.webidl b/dom/webidl/Promise.webidl new file mode 100644 index 0000000000..0fc9dc0950 --- /dev/null +++ b/dom/webidl/Promise.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This IDL file contains utilities to help connect JS promises to our + * Web IDL infrastructure. + */ + +callback PromiseJobCallback = undefined(); + +[TreatNonCallableAsNull] +callback AnyCallback = any (any value); + +// Hack to allow us to have JS owning and properly tracing/CCing/etc a +// PromiseNativeHandler. +[LegacyNoInterfaceObject, Exposed=(Window,Worker)] +interface PromiseNativeHandler { +}; diff --git a/dom/webidl/PromiseRejectionEvent.webidl b/dom/webidl/PromiseRejectionEvent.webidl new file mode 100644 index 0000000000..df027e909e --- /dev/null +++ b/dom/webidl/PromiseRejectionEvent.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/webappapis.html#the-promiserejectionevent-interface + */ + +[Exposed=(Window,Worker)] +interface PromiseRejectionEvent : Event +{ + constructor(DOMString type, PromiseRejectionEventInit eventInitDict); + + [BinaryName="rejectedPromise"] + readonly attribute Promise<any> promise; + readonly attribute any reason; +}; + +dictionary PromiseRejectionEventInit : EventInit { + required Promise<any> promise; + any reason; +}; diff --git a/dom/webidl/PushEvent.webidl b/dom/webidl/PushEvent.webidl new file mode 100644 index 0000000000..6a47e8a62b --- /dev/null +++ b/dom/webidl/PushEvent.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/push-api/ + */ + +[Pref="dom.push.enabled", + Exposed=ServiceWorker] +interface PushEvent : ExtendableEvent { + [Throws] + constructor(DOMString type, optional PushEventInit eventInitDict = {}); + + readonly attribute PushMessageData? data; +}; + +typedef (BufferSource or USVString) PushMessageDataInit; + +dictionary PushEventInit : ExtendableEventInit { + PushMessageDataInit data; +}; diff --git a/dom/webidl/PushManager.webidl b/dom/webidl/PushManager.webidl new file mode 100644 index 0000000000..ff99e294b5 --- /dev/null +++ b/dom/webidl/PushManager.webidl @@ -0,0 +1,40 @@ +/* -*- 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/push-api/ +*/ + +dictionary PushSubscriptionOptionsInit { + // boolean userVisibleOnly = false; + (BufferSource or DOMString)? applicationServerKey = null; +}; + +// The main thread JS implementation. Please see comments in +// dom/push/PushManager.h for the split between PushManagerImpl and PushManager. +[JSImplementation="@mozilla.org/push/PushManager;1", + ChromeOnly, + Exposed=Window] +interface PushManagerImpl { + [Throws] + constructor(DOMString scope); + + Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {}); + Promise<PushSubscription?> getSubscription(); + Promise<PermissionState> permissionState(optional PushSubscriptionOptionsInit options = {}); +}; + +[Exposed=(Window,Worker), Func="PushManager::IsEnabled"] +interface PushManager { + [Throws, ChromeOnly] + constructor(DOMString scope); + + [Throws, UseCounter] + Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {}); + [Throws] + Promise<PushSubscription?> getSubscription(); + [Throws] + Promise<PermissionState> permissionState(optional PushSubscriptionOptionsInit options = {}); +}; diff --git a/dom/webidl/PushMessageData.webidl b/dom/webidl/PushMessageData.webidl new file mode 100644 index 0000000000..95ff374cad --- /dev/null +++ b/dom/webidl/PushMessageData.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/push-api/ + */ + +[Pref="dom.push.enabled", + Exposed=ServiceWorker] +interface PushMessageData +{ + [Throws] + ArrayBuffer arrayBuffer(); + [Throws] + Blob blob(); + [Throws] + any json(); + USVString text(); +}; diff --git a/dom/webidl/PushSubscription.webidl b/dom/webidl/PushSubscription.webidl new file mode 100644 index 0000000000..6acb13d10a --- /dev/null +++ b/dom/webidl/PushSubscription.webidl @@ -0,0 +1,61 @@ +/* -*- 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/push-api/ +*/ + +interface Principal; + +enum PushEncryptionKeyName +{ + "p256dh", + "auth" +}; + +dictionary PushSubscriptionKeys +{ + ByteString p256dh; + ByteString auth; +}; + +dictionary PushSubscriptionJSON +{ + USVString endpoint; + // FIXME: bug 1493860: should this "= {}" be here? For that matter, this + // PushSubscriptionKeys thing is not even in the spec; "keys" is a record + // there. + PushSubscriptionKeys keys = {}; + EpochTimeStamp? expirationTime; +}; + +dictionary PushSubscriptionInit +{ + required USVString endpoint; + required USVString scope; + ArrayBuffer? p256dhKey; + ArrayBuffer? authSecret; + BufferSource? appServerKey; + EpochTimeStamp? expirationTime = null; +}; + +[Exposed=(Window,Worker), Func="ServiceWorkerVisible"] +interface PushSubscription +{ + [Throws, ChromeOnly] + constructor(PushSubscriptionInit initDict); + + readonly attribute USVString endpoint; + readonly attribute PushSubscriptionOptions options; + readonly attribute EpochTimeStamp? expirationTime; + [Throws] + ArrayBuffer? getKey(PushEncryptionKeyName name); + [NewObject, UseCounter] + Promise<boolean> unsubscribe(); + + // Implements the custom serializer specified in Push API, section 9. + [Throws] + PushSubscriptionJSON toJSON(); +}; diff --git a/dom/webidl/PushSubscriptionOptions.webidl b/dom/webidl/PushSubscriptionOptions.webidl new file mode 100644 index 0000000000..b0a421008f --- /dev/null +++ b/dom/webidl/PushSubscriptionOptions.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* The origin of this IDL file is +* https://w3c.github.io/push-api/ +*/ + +[Exposed=(Window,Worker), Func="ServiceWorkerVisible"] +interface PushSubscriptionOptions +{ + [SameObject, Throws] + readonly attribute ArrayBuffer? applicationServerKey; +}; diff --git a/dom/webidl/QueuingStrategy.webidl b/dom/webidl/QueuingStrategy.webidl new file mode 100644 index 0000000000..1ef2c30d2c --- /dev/null +++ b/dom/webidl/QueuingStrategy.webidl @@ -0,0 +1,40 @@ +/* -*- 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://streams.spec.whatwg.org/#qs + */ + +dictionary QueuingStrategy { + unrestricted double highWaterMark; + QueuingStrategySize size; +}; + +callback QueuingStrategySize = unrestricted double (optional any chunk); + +dictionary QueuingStrategyInit { + required unrestricted double highWaterMark; +}; + + +[Exposed=*] +interface CountQueuingStrategy { + constructor(QueuingStrategyInit init); + + readonly attribute unrestricted double highWaterMark; + + [Throws] + readonly attribute Function size; +}; + +[Exposed=*] +interface ByteLengthQueuingStrategy { + constructor(QueuingStrategyInit init); + + readonly attribute unrestricted double highWaterMark; + + [Throws] + readonly attribute Function size; +}; diff --git a/dom/webidl/RTCCertificate.webidl b/dom/webidl/RTCCertificate.webidl new file mode 100644 index 0000000000..ff4f0ce669 --- /dev/null +++ b/dom/webidl/RTCCertificate.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Specification: http://w3c.github.io/webrtc-pc/#certificate-management + */ + +[GenerateInit] +dictionary RTCCertificateExpiration { + [EnforceRange] + DOMTimeStamp expires; +}; + +[Pref="media.peerconnection.enabled", Serializable, + Exposed=Window] +interface RTCCertificate { + readonly attribute DOMTimeStamp expires; +}; diff --git a/dom/webidl/RTCConfiguration.webidl b/dom/webidl/RTCConfiguration.webidl new file mode 100644 index 0000000000..e7f08ad16a --- /dev/null +++ b/dom/webidl/RTCConfiguration.webidl @@ -0,0 +1,44 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCConfiguration + */ + +enum RTCIceCredentialType { + "password", +}; + +dictionary RTCIceServer { + (DOMString or sequence<DOMString>) urls; + DOMString url; //deprecated + DOMString username; + DOMString credential; + RTCIceCredentialType credentialType = "password"; +}; + +enum RTCIceTransportPolicy { + "relay", + "all" +}; + +enum RTCBundlePolicy { + "balanced", + "max-compat", + "max-bundle" +}; + +dictionary RTCConfiguration { + sequence<RTCIceServer> iceServers = []; + RTCIceTransportPolicy iceTransportPolicy = "all"; + RTCBundlePolicy bundlePolicy = "balanced"; + DOMString? peerIdentity = null; + sequence<RTCCertificate> certificates = []; + + // Non-standard. Only here to be able to detect and warn in web console. + // Uses DOMString over enum as a trade-off between type errors and safety. + // TODO: Remove once sdpSemantics usage drops to zero (bug 1632243). + DOMString sdpSemantics; +}; diff --git a/dom/webidl/RTCDTMFSender.webidl b/dom/webidl/RTCDTMFSender.webidl new file mode 100644 index 0000000000..284ebba222 --- /dev/null +++ b/dom/webidl/RTCDTMFSender.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.w3.org/TR/webrtc/#rtcdtmfsender + */ + +[Exposed=Window] +interface RTCDTMFSender : EventTarget { + [Throws] + undefined insertDTMF(DOMString tones, + optional unsigned long duration = 100, + optional unsigned long interToneGap = 70); + attribute EventHandler ontonechange; + readonly attribute DOMString toneBuffer; +}; diff --git a/dom/webidl/RTCDTMFToneChangeEvent.webidl b/dom/webidl/RTCDTMFToneChangeEvent.webidl new file mode 100644 index 0000000000..e962820938 --- /dev/null +++ b/dom/webidl/RTCDTMFToneChangeEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.w3.org/TR/webrtc/#rtcdtmftonechangeevent + */ + +[Exposed=Window] +interface RTCDTMFToneChangeEvent : Event { + constructor(DOMString type, + optional RTCDTMFToneChangeEventInit eventInitDict = {}); + + readonly attribute DOMString tone; +}; + +dictionary RTCDTMFToneChangeEventInit : EventInit { + DOMString tone = ""; +}; diff --git a/dom/webidl/RTCDataChannel.webidl b/dom/webidl/RTCDataChannel.webidl new file mode 100644 index 0000000000..956458bd32 --- /dev/null +++ b/dom/webidl/RTCDataChannel.webidl @@ -0,0 +1,46 @@ +/* This Source Code Form is subject to the terms of 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 RTCDataChannelState { + "connecting", + "open", + "closing", + "closed" +}; + +enum RTCDataChannelType { + "arraybuffer", + "blob" +}; + +[Exposed=Window] +interface RTCDataChannel : EventTarget +{ + readonly attribute DOMString label; + readonly attribute boolean negotiated; + readonly attribute boolean ordered; + readonly attribute boolean reliable; + readonly attribute unsigned short? maxPacketLifeTime; + readonly attribute unsigned short? maxRetransmits; + readonly attribute USVString protocol; + readonly attribute unsigned short? id; + readonly attribute RTCDataChannelState readyState; + readonly attribute unsigned long bufferedAmount; + attribute unsigned long bufferedAmountLowThreshold; + attribute EventHandler onopen; + attribute EventHandler onerror; + attribute EventHandler onclose; + undefined close(); + attribute EventHandler onmessage; + attribute EventHandler onbufferedamountlow; + attribute RTCDataChannelType binaryType; + [Throws] + undefined send(DOMString data); + [Throws] + undefined send(Blob data); + [Throws] + undefined send(ArrayBuffer data); + [Throws] + undefined send(ArrayBufferView data); +}; diff --git a/dom/webidl/RTCDataChannelEvent.webidl b/dom/webidl/RTCDataChannelEvent.webidl new file mode 100644 index 0000000000..1ad7b5fdae --- /dev/null +++ b/dom/webidl/RTCDataChannelEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCDataChannelEvent + */ + +dictionary RTCDataChannelEventInit : EventInit { + required RTCDataChannel channel; +}; + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface RTCDataChannelEvent : Event { + constructor(DOMString type, RTCDataChannelEventInit eventInitDict); + + readonly attribute RTCDataChannel channel; +}; diff --git a/dom/webidl/RTCDtlsTransport.webidl b/dom/webidl/RTCDtlsTransport.webidl new file mode 100644 index 0000000000..0b2f095ab6 --- /dev/null +++ b/dom/webidl/RTCDtlsTransport.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/webrtc-pc/#rtcdtlstransport-interface + */ + +enum RTCDtlsTransportState { + "new", + "connecting", + "connected", + "closed", + "failed" +}; + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface RTCDtlsTransport : EventTarget { + readonly attribute RTCDtlsTransportState state; + attribute EventHandler onstatechange; +}; diff --git a/dom/webidl/RTCEncodedAudioFrame.webidl b/dom/webidl/RTCEncodedAudioFrame.webidl new file mode 100644 index 0000000000..a2a25f0f28 --- /dev/null +++ b/dom/webidl/RTCEncodedAudioFrame.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/webrtc-encoded-transform + */ + +dictionary RTCEncodedAudioFrameMetadata { + unsigned long synchronizationSource; + octet payloadType; + sequence<unsigned long> contributingSources; + short sequenceNumber; +}; + +[Pref="media.peerconnection.enabled", + Pref="media.peerconnection.scripttransform.enabled", + Exposed=(Window,DedicatedWorker)] +interface RTCEncodedAudioFrame { + readonly attribute unsigned long timestamp; + attribute ArrayBuffer data; + RTCEncodedAudioFrameMetadata getMetadata(); +}; diff --git a/dom/webidl/RTCEncodedVideoFrame.webidl b/dom/webidl/RTCEncodedVideoFrame.webidl new file mode 100644 index 0000000000..564252fd6e --- /dev/null +++ b/dom/webidl/RTCEncodedVideoFrame.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.w3.org/TR/webrtc-encoded-transform + */ + +// New enum for video frame types. Will eventually re-use the equivalent defined +// by WebCodecs. +enum RTCEncodedVideoFrameType { + "empty", + "key", + "delta", +}; + +dictionary RTCEncodedVideoFrameMetadata { + unsigned long long frameId; + sequence<unsigned long long> dependencies; + unsigned short width; + unsigned short height; + unsigned long spatialIndex; + unsigned long temporalIndex; + unsigned long synchronizationSource; + octet payloadType; + sequence<unsigned long> contributingSources; + long long timestamp; // microseconds +}; + +// New interfaces to define encoded video and audio frames. Will eventually +// re-use or extend the equivalent defined in WebCodecs. +[Pref="media.peerconnection.enabled", + Pref="media.peerconnection.scripttransform.enabled", + Exposed=(Window,DedicatedWorker)] +interface RTCEncodedVideoFrame { + readonly attribute RTCEncodedVideoFrameType type; + readonly attribute unsigned long timestamp; + attribute ArrayBuffer data; + RTCEncodedVideoFrameMetadata getMetadata(); +}; diff --git a/dom/webidl/RTCIceCandidate.webidl b/dom/webidl/RTCIceCandidate.webidl new file mode 100644 index 0000000000..865b029ab9 --- /dev/null +++ b/dom/webidl/RTCIceCandidate.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCIceCandidate + */ + +dictionary RTCIceCandidateInit { + DOMString candidate = ""; + DOMString? sdpMid = null; + unsigned short? sdpMLineIndex = null; + DOMString? usernameFragment = null; +}; + +[Pref="media.peerconnection.enabled", + JSImplementation="@mozilla.org/dom/rtcicecandidate;1", + Exposed=Window] +interface RTCIceCandidate { + [Throws] + constructor(optional RTCIceCandidateInit candidateInitDict = {}); + + attribute DOMString candidate; + attribute DOMString? sdpMid; + attribute unsigned short? sdpMLineIndex; + attribute DOMString? usernameFragment; + [Default] object toJSON(); +}; diff --git a/dom/webidl/RTCIdentityAssertion.webidl b/dom/webidl/RTCIdentityAssertion.webidl new file mode 100644 index 0000000000..621b21fed9 --- /dev/null +++ b/dom/webidl/RTCIdentityAssertion.webidl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://w3c.github.io/webrtc-pc/#idl-def-RTCIdentityAssertion + */ + +dictionary RTCIdentityAssertion { + DOMString idp; + DOMString name; +}; diff --git a/dom/webidl/RTCIdentityProvider.webidl b/dom/webidl/RTCIdentityProvider.webidl new file mode 100644 index 0000000000..4755503276 --- /dev/null +++ b/dom/webidl/RTCIdentityProvider.webidl @@ -0,0 +1,65 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * http://w3c.github.io/webrtc-pc/ (with https://github.com/w3c/webrtc-pc/pull/178) + */ + +[LegacyNoInterfaceObject, + Exposed=Window] +interface RTCIdentityProviderRegistrar { + undefined register(RTCIdentityProvider idp); + + /* Whether an IdP was passed to register() to chrome code. */ + [ChromeOnly] + readonly attribute boolean hasIdp; + /* The following two chrome-only functions forward to the corresponding + * function on the registered IdP. This is necessary because the + * JS-implemented WebIDL can't see these functions on `idp` above, chrome JS + * gets an Xray onto the content code that suppresses functions, see + * https://developer.mozilla.org/en-US/docs/Xray_vision#Xrays_for_JavaScript_objects + */ + /* Forward to idp.generateAssertion() */ + [ChromeOnly, Throws] + Promise<RTCIdentityAssertionResult> + generateAssertion(DOMString contents, DOMString origin, + optional RTCIdentityProviderOptions options = {}); + /* Forward to idp.validateAssertion() */ + [ChromeOnly, Throws] + Promise<RTCIdentityValidationResult> + validateAssertion(DOMString assertion, DOMString origin); +}; + +dictionary RTCIdentityProvider { + required GenerateAssertionCallback generateAssertion; + required ValidateAssertionCallback validateAssertion; +}; + +callback GenerateAssertionCallback = + Promise<RTCIdentityAssertionResult> + (DOMString contents, DOMString origin, + RTCIdentityProviderOptions options); +callback ValidateAssertionCallback = + Promise<RTCIdentityValidationResult> (DOMString assertion, DOMString origin); + +dictionary RTCIdentityAssertionResult { + required RTCIdentityProviderDetails idp; + required DOMString assertion; +}; + +dictionary RTCIdentityProviderDetails { + required DOMString domain; + DOMString protocol = "default"; +}; + +dictionary RTCIdentityValidationResult { + required DOMString identity; + required DOMString contents; +}; + +dictionary RTCIdentityProviderOptions { + DOMString protocol = "default"; + DOMString usernameHint; + DOMString peerIdentity; +}; diff --git a/dom/webidl/RTCPeerConnection.webidl b/dom/webidl/RTCPeerConnection.webidl new file mode 100644 index 0000000000..8fb908788e --- /dev/null +++ b/dom/webidl/RTCPeerConnection.webidl @@ -0,0 +1,201 @@ +/* -*- 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://w3c.github.io/webrtc-pc/#interface-definition + */ + +callback RTCSessionDescriptionCallback = undefined (RTCSessionDescriptionInit description); +callback RTCPeerConnectionErrorCallback = undefined (DOMException error); +callback RTCStatsCallback = undefined (RTCStatsReport report); + +enum RTCSignalingState { + "stable", + "have-local-offer", + "have-remote-offer", + "have-local-pranswer", + "have-remote-pranswer", + "closed" +}; + +enum RTCIceGatheringState { + "new", + "gathering", + "complete" +}; + +enum RTCIceConnectionState { + "new", + "checking", + "connected", + "completed", + "failed", + "disconnected", + "closed" +}; + +enum RTCPeerConnectionState { + "closed", + "failed", + "disconnected", + "new", + "connecting", + "connected" +}; + +enum mozPacketDumpType { + "rtp", // dump unencrypted rtp as the MediaPipeline sees it + "srtp", // dump encrypted rtp as the MediaPipeline sees it + "rtcp", // dump unencrypted rtcp as the MediaPipeline sees it + "srtcp" // dump encrypted rtcp as the MediaPipeline sees it +}; + +callback mozPacketCallback = undefined (unsigned long level, + mozPacketDumpType type, + boolean sending, + ArrayBuffer packet); + +dictionary RTCDataChannelInit { + boolean ordered = true; + [EnforceRange] + unsigned short maxPacketLifeTime; + [EnforceRange] + unsigned short maxRetransmits; + DOMString protocol = ""; + boolean negotiated = false; + [EnforceRange] + unsigned short id; + + // These are deprecated due to renaming in the spec, but still supported for Fx53 + unsigned short maxRetransmitTime; +}; + +dictionary RTCOfferAnswerOptions { +// boolean voiceActivityDetection = true; // TODO: support this (Bug 1184712) +}; + +dictionary RTCAnswerOptions : RTCOfferAnswerOptions { +}; + +dictionary RTCOfferOptions : RTCOfferAnswerOptions { + boolean offerToReceiveVideo; + boolean offerToReceiveAudio; + boolean iceRestart = false; +}; + +[Pref="media.peerconnection.enabled", + JSImplementation="@mozilla.org/dom/peerconnection;1", + Exposed=Window] +interface RTCPeerConnection : EventTarget { + [Throws] + constructor(optional RTCConfiguration configuration = {}, + optional object? constraints); + + [Throws, StaticClassOverride="mozilla::dom::RTCCertificate"] + static Promise<RTCCertificate> generateCertificate (AlgorithmIdentifier keygenAlgorithm); + + undefined setIdentityProvider (DOMString provider, + optional RTCIdentityProviderOptions options = {}); + Promise<DOMString> getIdentityAssertion(); + Promise<RTCSessionDescriptionInit> createOffer (optional RTCOfferOptions options = {}); + Promise<RTCSessionDescriptionInit> createAnswer (optional RTCAnswerOptions options = {}); + Promise<undefined> setLocalDescription (optional RTCSessionDescriptionInit description = {}); + Promise<undefined> setRemoteDescription (optional RTCSessionDescriptionInit description = {}); + readonly attribute RTCSessionDescription? localDescription; + readonly attribute RTCSessionDescription? currentLocalDescription; + readonly attribute RTCSessionDescription? pendingLocalDescription; + readonly attribute RTCSessionDescription? remoteDescription; + readonly attribute RTCSessionDescription? currentRemoteDescription; + readonly attribute RTCSessionDescription? pendingRemoteDescription; + readonly attribute RTCSignalingState signalingState; + Promise<undefined> addIceCandidate (optional (RTCIceCandidateInit or RTCIceCandidate) candidate = {}); + readonly attribute boolean? canTrickleIceCandidates; + readonly attribute RTCIceGatheringState iceGatheringState; + readonly attribute RTCIceConnectionState iceConnectionState; + readonly attribute RTCPeerConnectionState connectionState; + undefined restartIce (); + readonly attribute Promise<RTCIdentityAssertion> peerIdentity; + readonly attribute DOMString? idpLoginUrl; + + [ChromeOnly] + attribute DOMString id; + + RTCConfiguration getConfiguration (); + undefined setConfiguration(optional RTCConfiguration configuration = {}); + [Deprecated="RTCPeerConnectionGetStreams"] + sequence<MediaStream> getLocalStreams (); + [Deprecated="RTCPeerConnectionGetStreams"] + sequence<MediaStream> getRemoteStreams (); + undefined addStream (MediaStream stream); + + // replaces addStream; fails if already added + // because a track can be part of multiple streams, stream parameters + // indicate which particular streams should be referenced in signaling + + RTCRtpSender addTrack(MediaStreamTrack track, + MediaStream... streams); + undefined removeTrack(RTCRtpSender sender); + + [Throws] + RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind, + optional RTCRtpTransceiverInit init = {}); + + sequence<RTCRtpSender> getSenders(); + sequence<RTCRtpReceiver> getReceivers(); + sequence<RTCRtpTransceiver> getTransceivers(); + + [ChromeOnly] + undefined mozSetPacketCallback(mozPacketCallback callback); + [ChromeOnly] + undefined mozEnablePacketDump(unsigned long level, + mozPacketDumpType type, + boolean sending); + [ChromeOnly] + undefined mozDisablePacketDump(unsigned long level, + mozPacketDumpType type, + boolean sending); + + undefined close (); + attribute EventHandler onnegotiationneeded; + attribute EventHandler onicecandidate; + attribute EventHandler onsignalingstatechange; + attribute EventHandler onaddstream; // obsolete + attribute EventHandler onaddtrack; // obsolete + attribute EventHandler ontrack; // replaces onaddtrack and onaddstream. + attribute EventHandler oniceconnectionstatechange; + attribute EventHandler onicegatheringstatechange; + attribute EventHandler onconnectionstatechange; + + Promise<RTCStatsReport> getStats (optional MediaStreamTrack? selector = null); + + readonly attribute RTCSctpTransport? sctp; + // Data channel. + RTCDataChannel createDataChannel (DOMString label, + optional RTCDataChannelInit dataChannelDict = {}); + attribute EventHandler ondatachannel; +}; + +// Legacy callback API + +partial interface RTCPeerConnection { + + // Dummy Promise<undefined> return values avoid "WebIDL.WebIDLError: error: + // We have overloads with both Promise and non-Promise return types" + + Promise<undefined> createOffer (RTCSessionDescriptionCallback successCallback, + RTCPeerConnectionErrorCallback failureCallback, + optional RTCOfferOptions options = {}); + Promise<undefined> createAnswer (RTCSessionDescriptionCallback successCallback, + RTCPeerConnectionErrorCallback failureCallback); + Promise<undefined> setLocalDescription (RTCSessionDescriptionInit description, + VoidFunction successCallback, + RTCPeerConnectionErrorCallback failureCallback); + Promise<undefined> setRemoteDescription (RTCSessionDescriptionInit description, + VoidFunction successCallback, + RTCPeerConnectionErrorCallback failureCallback); + Promise<undefined> addIceCandidate (RTCIceCandidate candidate, + VoidFunction successCallback, + RTCPeerConnectionErrorCallback failureCallback); +}; diff --git a/dom/webidl/RTCPeerConnectionIceEvent.webidl b/dom/webidl/RTCPeerConnectionIceEvent.webidl new file mode 100644 index 0000000000..ed43643b93 --- /dev/null +++ b/dom/webidl/RTCPeerConnectionIceEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnectionIceEvent + */ + +dictionary RTCPeerConnectionIceEventInit : EventInit { + RTCIceCandidate? candidate = null; +}; + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface RTCPeerConnectionIceEvent : Event { + constructor(DOMString type, + optional RTCPeerConnectionIceEventInit eventInitDict = {}); + + readonly attribute RTCIceCandidate? candidate; +}; diff --git a/dom/webidl/RTCPeerConnectionStatic.webidl b/dom/webidl/RTCPeerConnectionStatic.webidl new file mode 100644 index 0000000000..e34ca52ea6 --- /dev/null +++ b/dom/webidl/RTCPeerConnectionStatic.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + Right now, it is not possible to add static functions to a JS implemented + interface (see bug 863952), so we need to create a simple interface with a + trivial constructor and no data to hold these functions that really ought to + be static in RTCPeerConnection. + TODO(bcampen@mozilla.com) Merge this code into RTCPeerConnection once this + limitation is gone. (Bug 1017082) +*/ + +enum RTCLifecycleEvent { + "initialized", + "icegatheringstatechange", + "iceconnectionstatechange", + "connectionstatechange", +}; + +callback PeerConnectionLifecycleCallback = undefined (RTCPeerConnection pc, + unsigned long long windowId, + RTCLifecycleEvent eventType); + +[ChromeOnly, + Pref="media.peerconnection.enabled", + JSImplementation="@mozilla.org/dom/peerconnectionstatic;1", + Exposed=Window] +interface RTCPeerConnectionStatic { + [Throws] + constructor(); + + /* One slot per window (the window in which the register call is made), + automatically unregistered when window goes away. + Fires when a PC is created, and whenever the ICE connection state or + gathering state changes. */ + undefined registerPeerConnectionLifecycleCallback( + PeerConnectionLifecycleCallback cb); +}; diff --git a/dom/webidl/RTCRtpCapabilities.webidl b/dom/webidl/RTCRtpCapabilities.webidl new file mode 100644 index 0000000000..c88cd5b8aa --- /dev/null +++ b/dom/webidl/RTCRtpCapabilities.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/webrtc-pc/#dom-rtcrtpcapabilities + */ + +dictionary RTCRtpCapabilities { + required sequence<RTCRtpCodecCapability> codecs; + required sequence<RTCRtpHeaderExtensionCapability> headerExtensions; +}; + +dictionary RTCRtpCodecCapability : RTCRtpCodec { +}; + +dictionary RTCRtpCodec { + required DOMString mimeType; + required unsigned long clockRate; + unsigned short channels; + DOMString sdpFmtpLine; +}; + +dictionary RTCRtpHeaderExtensionCapability { + required DOMString uri; +}; diff --git a/dom/webidl/RTCRtpParameters.webidl b/dom/webidl/RTCRtpParameters.webidl new file mode 100644 index 0000000000..d9671f21c2 --- /dev/null +++ b/dom/webidl/RTCRtpParameters.webidl @@ -0,0 +1,65 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface + */ + +enum RTCPriorityType { + "very-low", + "low", + "medium", + "high" +}; + +enum RTCDegradationPreference { + "maintain-framerate", + "maintain-resolution", + "balanced" +}; + +dictionary RTCRtpEncodingParameters { + boolean active = true; + // From https://www.w3.org/TR/webrtc-priority/ + RTCPriorityType priority = "low"; + unsigned long maxBitrate; + DOMString rid; + double scaleResolutionDownBy; + // From https://w3c.github.io/webrtc-extensions/#rtcrtpencodingparameters-dictionary + double maxFramerate; +}; + +dictionary RTCRtpHeaderExtensionParameters { + DOMString uri; + unsigned short id; + boolean encrypted; +}; + +dictionary RTCRtcpParameters { + DOMString cname; + boolean reducedSize; +}; + +dictionary RTCRtpCodecParameters { + unsigned short payloadType; + DOMString mimeType; + unsigned long clockRate; + unsigned short channels = 1; + DOMString sdpFmtpLine; +}; + +dictionary RTCRtpParameters { + // We do not support these, but every wpt test involving parameters insists + // that these be present, regardless of whether the test-case has anything to + // do with these in particular (see validateRtpParameters). + sequence<RTCRtpHeaderExtensionParameters> headerExtensions; + RTCRtcpParameters rtcp; + sequence<RTCRtpCodecParameters> codecs; +}; + +dictionary RTCRtpSendParameters : RTCRtpParameters { + DOMString transactionId; + required sequence<RTCRtpEncodingParameters> encodings; +}; diff --git a/dom/webidl/RTCRtpReceiver.webidl b/dom/webidl/RTCRtpReceiver.webidl new file mode 100644 index 0000000000..d8002e6511 --- /dev/null +++ b/dom/webidl/RTCRtpReceiver.webidl @@ -0,0 +1,40 @@ +/* -*- 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://lists.w3.org/Archives/Public/public-webrtc/2014May/0067.html + */ + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface RTCRtpReceiver { + readonly attribute MediaStreamTrack track; + readonly attribute RTCDtlsTransport? transport; + static RTCRtpCapabilities? getCapabilities(DOMString kind); + sequence<RTCRtpContributingSource> getContributingSources(); + sequence<RTCRtpSynchronizationSource> getSynchronizationSources(); + [NewObject] + Promise<RTCStatsReport> getStats(); + + // test-only: for testing getContributingSources + [ChromeOnly] + undefined mozInsertAudioLevelForContributingSource(unsigned long source, + DOMHighResTimeStamp timestamp, + unsigned long rtpTimestamp, + boolean hasLevel, + byte level); +}; + +//https://w3c.github.io/webrtc-extensions/#rtcrtpreceiver-jitterbuffertarget-rtcrtpreceiver-interface +partial interface RTCRtpReceiver { + [Throws] + attribute DOMHighResTimeStamp? jitterBufferTarget; +}; + +// https://w3c.github.io/webrtc-encoded-transform/#specification +partial interface RTCRtpReceiver { + [SetterThrows, + Pref="media.peerconnection.scripttransform.enabled"] attribute RTCRtpTransform? transform; +}; diff --git a/dom/webidl/RTCRtpScriptTransform.webidl b/dom/webidl/RTCRtpScriptTransform.webidl new file mode 100644 index 0000000000..91fe7b39ed --- /dev/null +++ b/dom/webidl/RTCRtpScriptTransform.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.w3.org/TR/webrtc-encoded-transform + */ + +// Spec version is commented out (uncomment if SFrameTransform is implemented) +// typedef (SFrameTransform or RTCRtpScriptTransform) RTCRtpTransform; +typedef RTCRtpScriptTransform RTCRtpTransform; + +[Pref="media.peerconnection.enabled", + Pref="media.peerconnection.scripttransform.enabled", + Exposed=Window] +interface RTCRtpScriptTransform { + [Throws] + constructor(Worker worker, optional any options, optional sequence<object> transfer); +}; diff --git a/dom/webidl/RTCRtpScriptTransformer.webidl b/dom/webidl/RTCRtpScriptTransformer.webidl new file mode 100644 index 0000000000..3a047ac9a0 --- /dev/null +++ b/dom/webidl/RTCRtpScriptTransformer.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.w3.org/TR/webrtc-encoded-transform + */ + +[Pref="media.peerconnection.enabled", + Pref="media.peerconnection.scripttransform.enabled", + Exposed=DedicatedWorker] +interface RTCRtpScriptTransformer { + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; + [Throws] readonly attribute any options; + Promise<unsigned long long> generateKeyFrame(optional DOMString rid); + Promise<undefined> sendKeyFrameRequest(); +}; diff --git a/dom/webidl/RTCRtpSender.webidl b/dom/webidl/RTCRtpSender.webidl new file mode 100644 index 0000000000..c6e70a376f --- /dev/null +++ b/dom/webidl/RTCRtpSender.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface + */ + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface RTCRtpSender { + readonly attribute MediaStreamTrack? track; + readonly attribute RTCDtlsTransport? transport; + static RTCRtpCapabilities? getCapabilities(DOMString kind); + [NewObject] + Promise<undefined> setParameters (RTCRtpSendParameters parameters); + RTCRtpSendParameters getParameters(); + [Throws] + Promise<undefined> replaceTrack(MediaStreamTrack? withTrack); + [Throws] + undefined setStreams(MediaStream... streams); + [NewObject] + Promise<RTCStatsReport> getStats(); + readonly attribute RTCDTMFSender? dtmf; + [ChromeOnly] + sequence<MediaStream> getStreams(); + [ChromeOnly] + undefined setStreamsImpl(MediaStream... streams); + [ChromeOnly] + undefined setTrack(MediaStreamTrack? track); +}; + +// https://w3c.github.io/webrtc-encoded-transform/#specification +partial interface RTCRtpSender { + [SetterThrows, + Pref="media.peerconnection.scripttransform.enabled"] attribute RTCRtpTransform? transform; +}; diff --git a/dom/webidl/RTCRtpSources.webidl b/dom/webidl/RTCRtpSources.webidl new file mode 100644 index 0000000000..ec47b9df23 --- /dev/null +++ b/dom/webidl/RTCRtpSources.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/webrtc-pc/ Editor's Draft 18 January 2018 + */ + +dictionary RTCRtpContributingSource { + required DOMHighResTimeStamp timestamp; + required unsigned long source; + double audioLevel; + required unsigned long rtpTimestamp; +}; + +dictionary RTCRtpSynchronizationSource : RTCRtpContributingSource { + boolean? voiceActivityFlag; +}; + +/* Internal enum of types used by RTCRtpSourceEntry */ +enum RTCRtpSourceEntryType { + "contributing", + "synchronization", +}; +/* Internal shared representation of Contributing and Synchronization sources */ +dictionary RTCRtpSourceEntry : RTCRtpSynchronizationSource { + required RTCRtpSourceEntryType sourceType; +}; diff --git a/dom/webidl/RTCRtpTransceiver.webidl b/dom/webidl/RTCRtpTransceiver.webidl new file mode 100644 index 0000000000..d6dae19a10 --- /dev/null +++ b/dom/webidl/RTCRtpTransceiver.webidl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://w3c.github.io/webrtc-pc/#rtcrtptransceiver-interface + */ + +enum RTCRtpTransceiverDirection { + "sendrecv", + "sendonly", + "recvonly", + "inactive", + "stopped" +}; + +dictionary RTCRtpTransceiverInit { + RTCRtpTransceiverDirection direction = "sendrecv"; + sequence<MediaStream> streams = []; + sequence<RTCRtpEncodingParameters> sendEncodings = []; +}; + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface RTCRtpTransceiver { + readonly attribute DOMString? mid; + [SameObject] + readonly attribute RTCRtpSender sender; + [SameObject] + readonly attribute RTCRtpReceiver receiver; + readonly attribute boolean stopped; + [SetterThrows] + attribute RTCRtpTransceiverDirection direction; + readonly attribute RTCRtpTransceiverDirection? currentDirection; + + [Throws] + undefined stop(); + // TODO: bug 1396922 + // undefined setCodecPreferences(sequence<RTCRtpCodecCapability> codecs); + + [ChromeOnly] + undefined setDirectionInternal(RTCRtpTransceiverDirection direction); + + [ChromeOnly] + DOMString getKind(); + [ChromeOnly] + boolean hasBeenUsedToSend(); +}; diff --git a/dom/webidl/RTCSctpTransport.webidl b/dom/webidl/RTCSctpTransport.webidl new file mode 100644 index 0000000000..882967294a --- /dev/null +++ b/dom/webidl/RTCSctpTransport.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/webrtc-pc/#dom-rtcsctptransport + */ + +enum RTCSctpTransportState { + "connecting", + "connected", + "closed" +}; + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface RTCSctpTransport : EventTarget { + readonly attribute RTCDtlsTransport transport; + readonly attribute RTCSctpTransportState state; + readonly attribute unrestricted double maxMessageSize; + readonly attribute unsigned short? maxChannels; + attribute EventHandler onstatechange; +}; diff --git a/dom/webidl/RTCSessionDescription.webidl b/dom/webidl/RTCSessionDescription.webidl new file mode 100644 index 0000000000..6cf116ff6e --- /dev/null +++ b/dom/webidl/RTCSessionDescription.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCSessionDescription + */ + +enum RTCSdpType { + "offer", + "pranswer", + "answer", + "rollback" +}; + +dictionary RTCSessionDescriptionInit { + RTCSdpType type; + DOMString sdp = ""; +}; + +[Pref="media.peerconnection.enabled", + JSImplementation="@mozilla.org/dom/rtcsessiondescription;1", + Exposed=Window] +interface RTCSessionDescription { + [Throws] + constructor(optional RTCSessionDescriptionInit descriptionInitDict = {}); + + // These should be readonly, but writing causes deprecation warnings for a bit + attribute RTCSdpType type; + attribute DOMString sdp; + + [Default] object toJSON(); +}; diff --git a/dom/webidl/RTCStatsReport.webidl b/dom/webidl/RTCStatsReport.webidl new file mode 100644 index 0000000000..8f61dceeb9 --- /dev/null +++ b/dom/webidl/RTCStatsReport.webidl @@ -0,0 +1,343 @@ +/* -*- 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/webrtc.html#rtcstatsreport-object + * http://www.w3.org/2011/04/webrtc/wiki/Stats + * https://www.w3.org/TR/webrtc-stats/ + */ + +enum RTCStatsType { + "codec", + "inbound-rtp", + "outbound-rtp", + "remote-inbound-rtp", + "remote-outbound-rtp", + "media-source", + "peer-connection", + "csrc", + "data-channel", + "session", + "track", + "transport", + "candidate-pair", + "local-candidate", + "remote-candidate" +}; + +dictionary RTCStats { + DOMHighResTimeStamp timestamp; + RTCStatsType type; + DOMString id; +}; + +dictionary RTCRtpStreamStats : RTCStats { + required unsigned long ssrc; + required DOMString kind; + DOMString mediaType; + DOMString transportId; + DOMString codecId; +}; + +dictionary RTCCodecStats : RTCStats { + required unsigned long payloadType; + RTCCodecType codecType; + required DOMString transportId; + required DOMString mimeType; + unsigned long clockRate; + unsigned long channels; + DOMString sdpFmtpLine; +}; + +enum RTCCodecType { + "encode", + "decode", +}; + +dictionary RTCReceivedRtpStreamStats: RTCRtpStreamStats { + unsigned long long packetsReceived; + long long packetsLost; + double jitter; + unsigned long discardedPackets; // non-standard alias for packetsDiscarded + unsigned long packetsDiscarded; +}; + +dictionary RTCInboundRtpStreamStats : RTCReceivedRtpStreamStats { + required DOMString trackIdentifier; + DOMString remoteId; + unsigned long framesDecoded; + unsigned long framesDropped; + unsigned long frameWidth; + unsigned long frameHeight; + double framesPerSecond; + unsigned long long qpSum; + double totalDecodeTime; + double totalInterFrameDelay; + double totalSquaredInterFrameDelay; + DOMHighResTimeStamp lastPacketReceivedTimestamp; + unsigned long long headerBytesReceived; + unsigned long long fecPacketsReceived; + unsigned long long fecPacketsDiscarded; + unsigned long long bytesReceived; + unsigned long nackCount; + unsigned long firCount; + unsigned long pliCount; + double totalProcessingDelay; + // Always missing from libwebrtc + // DOMHighResTimeStamp estimatedPlayoutTimestamp; + double jitterBufferDelay; + unsigned long long jitterBufferEmittedCount; + unsigned long long totalSamplesReceived; + unsigned long long concealedSamples; + unsigned long long silentConcealedSamples; + unsigned long long concealmentEvents; + unsigned long long insertedSamplesForDeceleration; + unsigned long long removedSamplesForAcceleration; + double audioLevel; + double totalAudioEnergy; + double totalSamplesDuration; + unsigned long framesReceived; +}; + +dictionary RTCRemoteInboundRtpStreamStats : RTCReceivedRtpStreamStats { + DOMString localId; + double roundTripTime; + double totalRoundTripTime; + double fractionLost; + unsigned long long roundTripTimeMeasurements; +}; + +dictionary RTCSentRtpStreamStats : RTCRtpStreamStats { + unsigned long packetsSent; + unsigned long long bytesSent; +}; + +dictionary RTCOutboundRtpStreamStats : RTCSentRtpStreamStats { + DOMString remoteId; + unsigned long framesEncoded; + unsigned long long qpSum; + unsigned long nackCount; + unsigned long firCount; + unsigned long pliCount; + unsigned long long headerBytesSent; + unsigned long long retransmittedPacketsSent; + unsigned long long retransmittedBytesSent; + unsigned long long totalEncodedBytesTarget; + unsigned long frameWidth; + unsigned long frameHeight; + double framesPerSecond; + unsigned long framesSent; + unsigned long hugeFramesSent; + double totalEncodeTime; +}; + +dictionary RTCRemoteOutboundRtpStreamStats : RTCSentRtpStreamStats { + DOMString localId; + DOMHighResTimeStamp remoteTimestamp; +}; + +dictionary RTCMediaSourceStats : RTCStats { + required DOMString trackIdentifier; + required DOMString kind; +}; + +dictionary RTCVideoSourceStats : RTCMediaSourceStats { + unsigned long width; + unsigned long height; + unsigned long frames; + double framesPerSecond; +}; + +dictionary RTCPeerConnectionStats : RTCStats { + unsigned long dataChannelsOpened; + unsigned long dataChannelsClosed; +}; + +dictionary RTCRTPContributingSourceStats : RTCStats { + unsigned long contributorSsrc; + DOMString inboundRtpStreamId; +}; + +dictionary RTCDataChannelStats : RTCStats { + DOMString label; + DOMString protocol; + long dataChannelIdentifier; + // RTCTransportId is not yet implemented - Bug 1225723 + // DOMString transportId; + RTCDataChannelState state; + unsigned long messagesSent; + unsigned long long bytesSent; + unsigned long messagesReceived; + unsigned long long bytesReceived; +}; + +enum RTCStatsIceCandidatePairState { + "frozen", + "waiting", + "inprogress", + "failed", + "succeeded", + "cancelled" +}; + +dictionary RTCIceCandidatePairStats : RTCStats { + DOMString transportId; + DOMString localCandidateId; + DOMString remoteCandidateId; + RTCStatsIceCandidatePairState state; + unsigned long long priority; + boolean nominated; + boolean writable; + boolean readable; + unsigned long long bytesSent; + unsigned long long bytesReceived; + DOMHighResTimeStamp lastPacketSentTimestamp; + DOMHighResTimeStamp lastPacketReceivedTimestamp; + boolean selected; + [ChromeOnly] + unsigned long componentId; // moz +}; + +enum RTCIceCandidateType { + "host", + "srflx", + "prflx", + "relay" +}; + +dictionary RTCIceCandidateStats : RTCStats { + DOMString address; + long port; + DOMString protocol; + RTCIceCandidateType candidateType; + long priority; + DOMString relayProtocol; + // Because we use this internally but don't support RTCIceCandidateStats, + // we need to keep the field as ChromeOnly. Bug 1225723 + [ChromeOnly] + DOMString transportId; + [ChromeOnly] + DOMString proxied; +}; + +// This is for tracking the frame rate in about:webrtc +dictionary RTCVideoFrameHistoryEntryInternal { + required unsigned long width; + required unsigned long height; + required unsigned long rotationAngle; + required DOMHighResTimeStamp firstFrameTimestamp; + required DOMHighResTimeStamp lastFrameTimestamp; + required unsigned long long consecutiveFrames; + required unsigned long localSsrc; + required unsigned long remoteSsrc; +}; + +// Collection over the entries for a single track for about:webrtc +dictionary RTCVideoFrameHistoryInternal { + required DOMString trackIdentifier; + sequence<RTCVideoFrameHistoryEntryInternal> entries = []; +}; + +// Collection over the libwebrtc bandwidth estimation stats +dictionary RTCBandwidthEstimationInternal { + required DOMString trackIdentifier; + long sendBandwidthBps; // Estimated available send bandwidth + long maxPaddingBps; // Cumulative configured max padding + long receiveBandwidthBps; // Estimated available receive bandwidth + long pacerDelayMs; + long rttMs; +}; + +// This is used by about:webrtc to report SDP parsing errors +dictionary RTCSdpParsingErrorInternal { + required unsigned long lineNumber; + required DOMString error; +}; + +// This is for tracking the flow of SDP for about:webrtc +dictionary RTCSdpHistoryEntryInternal { + required DOMHighResTimeStamp timestamp; + required boolean isLocal; + required DOMString sdp; + sequence<RTCSdpParsingErrorInternal> errors = []; +}; + +// This is intended to be a list of dictionaries that inherit from RTCStats +// (with some raw ICE candidates thrown in). Unfortunately, we cannot simply +// store a sequence<RTCStats> because of slicing. So, we have to have a +// separate list for each type. Used in c++ gecko code. +dictionary RTCStatsCollection { + sequence<RTCInboundRtpStreamStats> inboundRtpStreamStats = []; + sequence<RTCOutboundRtpStreamStats> outboundRtpStreamStats = []; + sequence<RTCRemoteInboundRtpStreamStats> remoteInboundRtpStreamStats = []; + sequence<RTCRemoteOutboundRtpStreamStats> remoteOutboundRtpStreamStats = []; + sequence<RTCMediaSourceStats> mediaSourceStats = []; + sequence<RTCVideoSourceStats> videoSourceStats = []; + sequence<RTCPeerConnectionStats> peerConnectionStats = []; + sequence<RTCRTPContributingSourceStats> rtpContributingSourceStats = []; + sequence<RTCIceCandidatePairStats> iceCandidatePairStats = []; + sequence<RTCIceCandidateStats> iceCandidateStats = []; + sequence<RTCIceCandidateStats> trickledIceCandidateStats = []; + sequence<RTCDataChannelStats> dataChannelStats = []; + sequence<RTCCodecStats> codecStats = []; + + // For internal use only + sequence<DOMString> rawLocalCandidates = []; + sequence<DOMString> rawRemoteCandidates = []; + sequence<RTCVideoFrameHistoryInternal> videoFrameHistories = []; + sequence<RTCBandwidthEstimationInternal> bandwidthEstimations = []; +}; + +// Details that about:webrtc can display about configured ICE servers +dictionary RTCIceServerInternal { + sequence<DOMString> urls = []; + required boolean credentialProvided; + required boolean userNameProvided; +}; + +// Details that about:webrtc can display about the RTCConfiguration +// Chrome only +dictionary RTCConfigurationInternal { + RTCBundlePolicy bundlePolicy; + required boolean certificatesProvided; + sequence<RTCIceServerInternal> iceServers = []; + RTCIceTransportPolicy iceTransportPolicy; + required boolean peerIdentityProvided; + DOMString sdpSemantics; +}; + +dictionary RTCSdpHistoryInternal { + required DOMString pcid; + sequence<RTCSdpHistoryEntryInternal> sdpHistory = []; +}; + +// A collection of RTCStats dictionaries, plus some other info. Used by +// WebrtcGlobalInformation for about:webrtc, and telemetry. +dictionary RTCStatsReportInternal : RTCStatsCollection { + required DOMString pcid; + required unsigned long browserId; + RTCConfigurationInternal configuration; + DOMString jsepSessionErrors; + // TODO demux from RTCStatsReportInternal in bug 1830824 + sequence<RTCSdpHistoryEntryInternal> sdpHistory = []; + required DOMHighResTimeStamp timestamp; + double callDurationMs; + required unsigned long iceRestarts; + required unsigned long iceRollbacks; + boolean offerer; // Is the PC the offerer + required boolean closed; // Is the PC now closed +}; + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface RTCStatsReport { + + // TODO(bug 1586109): Remove this once we no longer need to be able to + // construct empty RTCStatsReports from JS. + [ChromeOnly] + constructor(); + + readonly maplike<DOMString, object>; +}; diff --git a/dom/webidl/RTCTrackEvent.webidl b/dom/webidl/RTCTrackEvent.webidl new file mode 100644 index 0000000000..dd251f775f --- /dev/null +++ b/dom/webidl/RTCTrackEvent.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://w3c.github.io/webrtc-pc/#idl-def-RTCTrackEvent + */ + +dictionary RTCTrackEventInit : EventInit { + required RTCRtpReceiver receiver; + required MediaStreamTrack track; + sequence<MediaStream> streams = []; + required RTCRtpTransceiver transceiver; +}; + +[Pref="media.peerconnection.enabled", + Exposed=Window] +interface RTCTrackEvent : Event { + constructor(DOMString type, RTCTrackEventInit eventInitDict); + + readonly attribute RTCRtpReceiver receiver; + readonly attribute MediaStreamTrack track; + +// TODO: Use FrozenArray once available. (Bug 1236777) +// readonly attribute FrozenArray<MediaStream> streams; + + [Frozen, Cached, Pure] + readonly attribute sequence<MediaStream> streams; // workaround + readonly attribute RTCRtpTransceiver transceiver; +}; diff --git a/dom/webidl/RTCTransformEvent.webidl b/dom/webidl/RTCTransformEvent.webidl new file mode 100644 index 0000000000..b8f48faab6 --- /dev/null +++ b/dom/webidl/RTCTransformEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.w3.org/TR/webrtc-encoded-transform + */ + +[Pref="media.peerconnection.enabled", + Pref="media.peerconnection.scripttransform.enabled", + Exposed=DedicatedWorker] +interface RTCTransformEvent : Event { + constructor(DOMString type, RTCTransformEventInit eventInitDict); + readonly attribute RTCRtpScriptTransformer transformer; +}; + +dictionary RTCTransformEventInit : EventInit { + required RTCRtpScriptTransformer transformer; +}; diff --git a/dom/webidl/RadioNodeList.webidl b/dom/webidl/RadioNodeList.webidl new file mode 100644 index 0000000000..d9d500204c --- /dev/null +++ b/dom/webidl/RadioNodeList.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlformcontrolscollection-0 + * + * © Copyright 2004-2014 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface RadioNodeList : NodeList { + [NeedsCallerType] + attribute DOMString value; +}; diff --git a/dom/webidl/Range.webidl b/dom/webidl/Range.webidl new file mode 100644 index 0000000000..9d06ec09c7 --- /dev/null +++ b/dom/webidl/Range.webidl @@ -0,0 +1,96 @@ +/* -*- 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/#range + * http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment + * http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +// Use ProbablyShortLivingWrapper so that the Range object could be deleted +// as soon as possible, and thus slow down DOM operations less. +[Exposed=Window, ProbablyShortLivingWrapper] +interface Range : AbstractRange { + [Throws] + constructor(); + + [Throws] + readonly attribute Node commonAncestorContainer; + + [Throws, BinaryName="setStartJS"] + undefined setStart(Node refNode, unsigned long offset); + [Throws, BinaryName="setEndJS"] + undefined setEnd(Node refNode, unsigned long offset); + [Throws, BinaryName="setStartBeforeJS"] + undefined setStartBefore(Node refNode); + [Throws, BinaryName="setStartAfterJS"] + undefined setStartAfter(Node refNode); + [Throws, BinaryName="setEndBeforeJS"] + undefined setEndBefore(Node refNode); + [Throws, BinaryName="setEndAfterJS"] + undefined setEndAfter(Node refNode); + [BinaryName="collapseJS"] + undefined collapse(optional boolean toStart = false); + [Throws, BinaryName="selectNodeJS"] + undefined selectNode(Node refNode); + [Throws, BinaryName="selectNodeContentsJS"] + undefined selectNodeContents(Node refNode); + + const unsigned short START_TO_START = 0; + const unsigned short START_TO_END = 1; + const unsigned short END_TO_END = 2; + const unsigned short END_TO_START = 3; + [Throws] + short compareBoundaryPoints(unsigned short how, Range sourceRange); + [CEReactions, Throws] + undefined deleteContents(); + [CEReactions, Throws] + DocumentFragment extractContents(); + [CEReactions, Throws] + DocumentFragment cloneContents(); + [CEReactions, Throws] + undefined insertNode(Node node); + [CEReactions, Throws] + undefined surroundContents(Node newParent); + + Range cloneRange(); + undefined detach(); + + [Throws] + boolean isPointInRange(Node node, unsigned long offset); + [Throws] + short comparePoint(Node node, unsigned long offset); + + [Throws] + boolean intersectsNode(Node node); + + [Throws, BinaryName="ToString"] + stringifier; +}; + +// http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment +partial interface Range { + [CEReactions, Throws, UseCounter] + DocumentFragment createContextualFragment(DOMString fragment); +}; + +// http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface +partial interface Range { + DOMRectList? getClientRects(); + DOMRect getBoundingClientRect(); +}; + +dictionary ClientRectsAndTexts { + required DOMRectList rectList; + required sequence<DOMString> textList; +}; + +partial interface Range { + [ChromeOnly, Throws] + ClientRectsAndTexts getClientRectsAndTexts(); +}; diff --git a/dom/webidl/ReadableByteStreamController.webidl b/dom/webidl/ReadableByteStreamController.webidl new file mode 100644 index 0000000000..74dbfc4c4b --- /dev/null +++ b/dom/webidl/ReadableByteStreamController.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#rbs-controller-class-definition + */ + +[Exposed=*] +interface ReadableByteStreamController { + [Throws] // Throws on OOM + readonly attribute ReadableStreamBYOBRequest? byobRequest; + + readonly attribute unrestricted double? desiredSize; + + [Throws] + undefined close(); + + [Throws] + undefined enqueue(ArrayBufferView chunk); + + [Throws] + undefined error(optional any e); +}; diff --git a/dom/webidl/ReadableStream.webidl b/dom/webidl/ReadableStream.webidl new file mode 100644 index 0000000000..f5d2b86a7d --- /dev/null +++ b/dom/webidl/ReadableStream.webidl @@ -0,0 +1,59 @@ +/* -*- 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://streams.spec.whatwg.org/#rs-class-definition + */ + +[Exposed=*] // [Transferable] - See Bug 1562065 +interface ReadableStream { + [Throws] + constructor(optional object underlyingSource, optional QueuingStrategy strategy = {}); + + [Pref="dom.streams.from.enabled", Throws] + static ReadableStream from(any asyncIterable); + + readonly attribute boolean locked; + + [NewObject] + Promise<undefined> cancel(optional any reason); + + [Throws] + ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options = {}); + + [Throws] + ReadableStream pipeThrough(ReadableWritablePair transform, optional StreamPipeOptions options = {}); + + [NewObject] + Promise<undefined> pipeTo(WritableStream destination, optional StreamPipeOptions options = {}); + + [Throws] + sequence<ReadableStream> tee(); + + [GenerateReturnMethod] + async iterable<any>(optional ReadableStreamIteratorOptions options = {}); +}; + +enum ReadableStreamReaderMode { "byob" }; + +dictionary ReadableStreamGetReaderOptions { + ReadableStreamReaderMode mode; +}; + +dictionary ReadableStreamIteratorOptions { + boolean preventCancel = false; +}; + +dictionary ReadableWritablePair { + required ReadableStream readable; + required WritableStream writable; +}; + +dictionary StreamPipeOptions { + boolean preventClose = false; + boolean preventAbort = false; + boolean preventCancel = false; + AbortSignal signal; +}; diff --git a/dom/webidl/ReadableStreamBYOBReader.webidl b/dom/webidl/ReadableStreamBYOBReader.webidl new file mode 100644 index 0000000000..d19167b4ad --- /dev/null +++ b/dom/webidl/ReadableStreamBYOBReader.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#byob-reader-class-definition + */ + +[Exposed=*] +interface ReadableStreamBYOBReader { + [Throws] + constructor(ReadableStream stream); + + [NewObject] + Promise<ReadableStreamReadResult> read(ArrayBufferView view); + + [Throws] + undefined releaseLock(); +}; +ReadableStreamBYOBReader includes ReadableStreamGenericReader; diff --git a/dom/webidl/ReadableStreamBYOBRequest.webidl b/dom/webidl/ReadableStreamBYOBRequest.webidl new file mode 100644 index 0000000000..cc9a6b0f44 --- /dev/null +++ b/dom/webidl/ReadableStreamBYOBRequest.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#rs-byob-request-class-definition + */ + +[Exposed=*] +interface ReadableStreamBYOBRequest { + readonly attribute ArrayBufferView? view; + + [Throws] + undefined respond([EnforceRange] unsigned long long bytesWritten); + + [Throws] + undefined respondWithNewView(ArrayBufferView view); +}; diff --git a/dom/webidl/ReadableStreamDefaultController.webidl b/dom/webidl/ReadableStreamDefaultController.webidl new file mode 100644 index 0000000000..0964d4b1d6 --- /dev/null +++ b/dom/webidl/ReadableStreamDefaultController.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#rs-default-controller-class-definition + */ + +[Exposed=*] +interface ReadableStreamDefaultController { + readonly attribute unrestricted double? desiredSize; + + [Throws] + undefined close(); + + [Throws] + undefined enqueue(optional any chunk); + + [Throws] + undefined error(optional any e); +}; diff --git a/dom/webidl/ReadableStreamDefaultReader.webidl b/dom/webidl/ReadableStreamDefaultReader.webidl new file mode 100644 index 0000000000..21a9293b0c --- /dev/null +++ b/dom/webidl/ReadableStreamDefaultReader.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#generic-reader-mixin-definition + * https://streams.spec.whatwg.org/#default-reader-class-definition + */ + +typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader; + +enum ReadableStreamType { "bytes" }; + +interface mixin ReadableStreamGenericReader { + readonly attribute Promise<undefined> closed; + + [NewObject] + Promise<undefined> cancel(optional any reason); +}; + +[Exposed=*] +interface ReadableStreamDefaultReader { + [Throws] + constructor(ReadableStream stream); + + [NewObject] + Promise<ReadableStreamReadResult> read(); + + [Throws] + undefined releaseLock(); +}; +ReadableStreamDefaultReader includes ReadableStreamGenericReader; + + +dictionary ReadableStreamReadResult { + any value; + boolean done; +}; diff --git a/dom/webidl/ReferrerPolicy.webidl b/dom/webidl/ReferrerPolicy.webidl new file mode 100644 index 0000000000..804b0ea243 --- /dev/null +++ b/dom/webidl/ReferrerPolicy.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information please see + * https://w3c.github.io/webappsec-referrer-policy#idl-index + */ + +enum ReferrerPolicy { + "", + "no-referrer", + "no-referrer-when-downgrade", + "origin", + "origin-when-cross-origin", + "unsafe-url", "same-origin", + "strict-origin", + "strict-origin-when-cross-origin" +}; diff --git a/dom/webidl/Reporting.webidl b/dom/webidl/Reporting.webidl new file mode 100644 index 0000000000..db0582411c --- /dev/null +++ b/dom/webidl/Reporting.webidl @@ -0,0 +1,99 @@ +/* -*- 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/reporting/#interface-reporting-observer + */ + +[Pref="dom.reporting.enabled", + Exposed=(Window,Worker)] +interface ReportBody { + [Default] object toJSON +(); +}; + +[Pref="dom.reporting.enabled", + Exposed=(Window,Worker)] +interface Report { + [Default] object toJSON +(); + readonly attribute DOMString type; + readonly attribute DOMString url; + readonly attribute ReportBody? body; +}; + +[Pref="dom.reporting.enabled", + Exposed=(Window,Worker)] +interface ReportingObserver { + [Throws] + constructor(ReportingObserverCallback callback, optional ReportingObserverOptions options = {}); + undefined observe(); + undefined disconnect(); + ReportList takeRecords(); +}; + +callback ReportingObserverCallback = undefined (sequence<Report> reports, ReportingObserver observer); + +dictionary ReportingObserverOptions { + sequence<DOMString> types; + boolean buffered = false; +}; + +typedef sequence<Report> ReportList; + +[Pref="dom.reporting.enabled", + Exposed=Window] +interface DeprecationReportBody : ReportBody { + readonly attribute DOMString id; + // The spec currently has Date, but that's not a type that exists in Web IDL. + // In any case, we always return null, so we just need _some_ nullable type + // here. + readonly attribute DOMTimeStamp? anticipatedRemoval; + readonly attribute DOMString message; + readonly attribute DOMString? sourceFile; + readonly attribute unsigned long? lineNumber; + readonly attribute unsigned long? columnNumber; +}; + +[Deprecated="DeprecatedTestingInterface", + Pref="dom.reporting.testing.enabled", + Exposed=(Window,DedicatedWorker)] +interface TestingDeprecatedInterface { + constructor(); + + [Deprecated="DeprecatedTestingMethod"] + undefined deprecatedMethod(); + + [Deprecated="DeprecatedTestingAttribute"] + readonly attribute boolean deprecatedAttribute; +}; + +// Used internally to process the JSON +[GenerateInit] +dictionary ReportingHeaderValue { + sequence<ReportingItem> items; +}; + +// Used internally to process the JSON +dictionary ReportingItem { + // This is a long. + any max_age; + // This is a sequence of ReportingEndpoint. + any endpoints; + // This is a string. If missing, the value is 'default'. + any group; + boolean include_subdomains = false; +}; + +// Used internally to process the JSON +[GenerateInit] +dictionary ReportingEndpoint { + // This is a string. + any url; + // This is an unsigned long. + any priority; + // This is an unsigned long. + any weight; +}; diff --git a/dom/webidl/Request.webidl b/dom/webidl/Request.webidl new file mode 100644 index 0000000000..1aa6be963f --- /dev/null +++ b/dom/webidl/Request.webidl @@ -0,0 +1,82 @@ +/* -*- Mode: IDL; tab-width: 1; 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://fetch.spec.whatwg.org/#request-class + */ + +typedef (Request or USVString) RequestInfo; +typedef unsigned long nsContentPolicyType; + +[Exposed=(Window,Worker)] +interface Request { + [Throws] + constructor(RequestInfo input, optional RequestInit init = {}); + + readonly attribute ByteString method; + readonly attribute USVString url; + [SameObject, BinaryName="headers_"] readonly attribute Headers headers; + + readonly attribute RequestDestination destination; + readonly attribute USVString referrer; + [BinaryName="referrerPolicy_"] + readonly attribute ReferrerPolicy referrerPolicy; + readonly attribute RequestMode mode; + readonly attribute RequestCredentials credentials; + readonly attribute RequestCache cache; + readonly attribute RequestRedirect redirect; + readonly attribute DOMString integrity; + + // If a main-thread fetch() promise rejects, the error passed will be a + // nsresult code. + [ChromeOnly] + readonly attribute boolean mozErrors; + + [BinaryName="getOrCreateSignal"] + readonly attribute AbortSignal signal; + + [Throws, + NewObject] Request clone(); + + // Bug 1124638 - Allow chrome callers to set the context. + [ChromeOnly] + undefined overrideContentPolicyType(nsContentPolicyType context); +}; +Request includes Body; + +// <https://fetch.spec.whatwg.org/#requestinit>. +dictionary RequestInit { + ByteString method; + HeadersInit headers; + BodyInit? body; + USVString referrer; + ReferrerPolicy referrerPolicy; + RequestMode mode; + RequestCredentials credentials; + RequestCache cache; + RequestRedirect redirect; + DOMString integrity; + + [ChromeOnly] + boolean mozErrors; + + AbortSignal? signal; + + [Pref="dom.fetchObserver.enabled"] + ObserverCallback observe; +}; + +enum RequestDestination { + "", + "audio", "audioworklet", "document", "embed", "font", "frame", "iframe", + "image", "manifest", "object", "paintworklet", "report", "script", + "sharedworker", "style", "track", "video", "worker", "xslt" +}; + +enum RequestMode { "same-origin", "no-cors", "cors", "navigate" }; +enum RequestCredentials { "omit", "same-origin", "include" }; +enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }; +enum RequestRedirect { "follow", "error", "manual" }; +enum RequestPriority { "high" , "low" , "auto" }; diff --git a/dom/webidl/ResizeObserver.webidl b/dom/webidl/ResizeObserver.webidl new file mode 100644 index 0000000000..ba91751616 --- /dev/null +++ b/dom/webidl/ResizeObserver.webidl @@ -0,0 +1,50 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.csswg.org/resize-observer/ + */ + +enum ResizeObserverBoxOptions { + "border-box", + "content-box", + "device-pixel-content-box" +}; + +dictionary ResizeObserverOptions { + ResizeObserverBoxOptions box = "content-box"; +}; + +[Exposed=Window] +interface ResizeObserver { + [Throws] + constructor(ResizeObserverCallback callback); + + undefined observe(Element target, optional ResizeObserverOptions options = {}); + undefined unobserve(Element target); + undefined disconnect(); +}; + +callback ResizeObserverCallback = undefined (sequence<ResizeObserverEntry> entries, ResizeObserver observer); + +[Exposed=Window] +interface ResizeObserverEntry { + readonly attribute Element target; + readonly attribute DOMRectReadOnly contentRect; + // We are using [Pure, Cached, Frozen] sequence until `FrozenArray` is implemented. + // See https://bugzilla.mozilla.org/show_bug.cgi?id=1236777 for more details. + [Frozen, Cached, Pure] + readonly attribute sequence<ResizeObserverSize> borderBoxSize; + [Frozen, Cached, Pure] + readonly attribute sequence<ResizeObserverSize> contentBoxSize; + [Frozen, Cached, Pure] + readonly attribute sequence<ResizeObserverSize> devicePixelContentBoxSize; +}; + +[Exposed=Window] +interface ResizeObserverSize { + readonly attribute unrestricted double inlineSize; + readonly attribute unrestricted double blockSize; +}; diff --git a/dom/webidl/Response.webidl b/dom/webidl/Response.webidl new file mode 100644 index 0000000000..d04453c37c --- /dev/null +++ b/dom/webidl/Response.webidl @@ -0,0 +1,57 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://fetch.spec.whatwg.org/#response-class + */ + +[Exposed=(Window,Worker)] +interface Response { + // This should be constructor(optional BodyInit... but BodyInit doesn't + // include ReadableStream yet because we don't want to expose Streams API to + // Request. + [Throws] + constructor(optional (Blob or BufferSource or FormData or URLSearchParams or ReadableStream or USVString)? body = null, + optional ResponseInit init = {}); + + [NewObject] static Response error(); + [Throws, + NewObject] static Response redirect(USVString url, optional unsigned short status = 302); + [BinaryName=CreateFromJson, Throws, + NewObject] static Response json(any data, optional ResponseInit init = {}); + + readonly attribute ResponseType type; + + readonly attribute USVString url; + readonly attribute boolean redirected; + readonly attribute unsigned short status; + readonly attribute boolean ok; + readonly attribute ByteString statusText; + [SameObject, BinaryName="headers_"] readonly attribute Headers headers; + + [Throws, + NewObject] Response clone(); + + [ChromeOnly, NewObject, Throws] Response cloneUnfiltered(); + + // For testing only. + [ChromeOnly] readonly attribute boolean hasCacheInfoChannel; +}; +Response includes Body; + +// This should be part of Body but we don't want to expose body to request yet. +// See bug 1387483. +partial interface Response { + [GetterThrows] + readonly attribute ReadableStream? body; +}; + +dictionary ResponseInit { + unsigned short status = 200; + ByteString statusText = ""; + HeadersInit headers; +}; + +enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" }; diff --git a/dom/webidl/SVGAElement.webidl b/dom/webidl/SVGAElement.webidl new file mode 100644 index 0000000000..94363513ea --- /dev/null +++ b/dom/webidl/SVGAElement.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAElement : SVGGraphicsElement { + readonly attribute SVGAnimatedString target; + + [SetterThrows] + attribute DOMString download; + [SetterThrows] + attribute DOMString ping; + [SetterThrows] + attribute DOMString rel; + [SetterThrows] + attribute DOMString referrerPolicy; + [PutForwards=value] + readonly attribute DOMTokenList relList; + [SetterThrows] + attribute DOMString hreflang; + [SetterThrows] + attribute DOMString type; + + [Throws] + attribute DOMString text; +}; + +SVGAElement includes SVGURIReference; diff --git a/dom/webidl/SVGAngle.webidl b/dom/webidl/SVGAngle.webidl new file mode 100644 index 0000000000..9535831daa --- /dev/null +++ b/dom/webidl/SVGAngle.webidl @@ -0,0 +1,35 @@ +/* -*- 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/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAngle { + + // Angle Unit Types + const unsigned short SVG_ANGLETYPE_UNKNOWN = 0; + const unsigned short SVG_ANGLETYPE_UNSPECIFIED = 1; + const unsigned short SVG_ANGLETYPE_DEG = 2; + const unsigned short SVG_ANGLETYPE_RAD = 3; + const unsigned short SVG_ANGLETYPE_GRAD = 4; + + readonly attribute unsigned short unitType; + [SetterThrows] + attribute float value; + [SetterThrows] + attribute float valueInSpecifiedUnits; + [SetterThrows] + attribute DOMString valueAsString; + + [Throws] + undefined newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits); + [Throws] + undefined convertToSpecifiedUnits(unsigned short unitType); +}; diff --git a/dom/webidl/SVGAnimateElement.webidl b/dom/webidl/SVGAnimateElement.webidl new file mode 100644 index 0000000000..24204801bf --- /dev/null +++ b/dom/webidl/SVGAnimateElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimateElement : SVGAnimationElement { +}; diff --git a/dom/webidl/SVGAnimateMotionElement.webidl b/dom/webidl/SVGAnimateMotionElement.webidl new file mode 100644 index 0000000000..e6485347de --- /dev/null +++ b/dom/webidl/SVGAnimateMotionElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimateMotionElement : SVGAnimationElement { +}; diff --git a/dom/webidl/SVGAnimateTransformElement.webidl b/dom/webidl/SVGAnimateTransformElement.webidl new file mode 100644 index 0000000000..6a08e23b14 --- /dev/null +++ b/dom/webidl/SVGAnimateTransformElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimateTransformElement : SVGAnimationElement { +}; diff --git a/dom/webidl/SVGAnimatedAngle.webidl b/dom/webidl/SVGAnimatedAngle.webidl new file mode 100644 index 0000000000..082662fb9f --- /dev/null +++ b/dom/webidl/SVGAnimatedAngle.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedAngle { + [Constant] + readonly attribute SVGAngle baseVal; + [Constant] + readonly attribute SVGAngle animVal; +}; diff --git a/dom/webidl/SVGAnimatedBoolean.webidl b/dom/webidl/SVGAnimatedBoolean.webidl new file mode 100644 index 0000000000..17007fd544 --- /dev/null +++ b/dom/webidl/SVGAnimatedBoolean.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedBoolean { + attribute boolean baseVal; + readonly attribute boolean animVal; +}; diff --git a/dom/webidl/SVGAnimatedEnumeration.webidl b/dom/webidl/SVGAnimatedEnumeration.webidl new file mode 100644 index 0000000000..58597a54a3 --- /dev/null +++ b/dom/webidl/SVGAnimatedEnumeration.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedEnumeration + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedEnumeration { + [SetterThrows] + attribute unsigned short baseVal; + readonly attribute unsigned short animVal; +}; diff --git a/dom/webidl/SVGAnimatedInteger.webidl b/dom/webidl/SVGAnimatedInteger.webidl new file mode 100644 index 0000000000..f1eee2b5ee --- /dev/null +++ b/dom/webidl/SVGAnimatedInteger.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedInteger + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedInteger { + attribute long baseVal; + readonly attribute long animVal; +}; diff --git a/dom/webidl/SVGAnimatedLength.webidl b/dom/webidl/SVGAnimatedLength.webidl new file mode 100644 index 0000000000..69f9bb0e6f --- /dev/null +++ b/dom/webidl/SVGAnimatedLength.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedLength { + [Constant] + readonly attribute SVGLength baseVal; + [Constant] + readonly attribute SVGLength animVal; +}; diff --git a/dom/webidl/SVGAnimatedLengthList.webidl b/dom/webidl/SVGAnimatedLengthList.webidl new file mode 100644 index 0000000000..8e1b24ae2f --- /dev/null +++ b/dom/webidl/SVGAnimatedLengthList.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedLengthList { + [Constant] + readonly attribute SVGLengthList baseVal; + [Constant] + readonly attribute SVGLengthList animVal; +}; diff --git a/dom/webidl/SVGAnimatedNumber.webidl b/dom/webidl/SVGAnimatedNumber.webidl new file mode 100644 index 0000000000..31f6f06d55 --- /dev/null +++ b/dom/webidl/SVGAnimatedNumber.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedNumber + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedNumber { + attribute float baseVal; + readonly attribute float animVal; +}; diff --git a/dom/webidl/SVGAnimatedNumberList.webidl b/dom/webidl/SVGAnimatedNumberList.webidl new file mode 100644 index 0000000000..dc7b975d38 --- /dev/null +++ b/dom/webidl/SVGAnimatedNumberList.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedNumberList { + [Constant] + readonly attribute SVGNumberList baseVal; + [Constant] + readonly attribute SVGNumberList animVal; +}; diff --git a/dom/webidl/SVGAnimatedPathData.webidl b/dom/webidl/SVGAnimatedPathData.webidl new file mode 100644 index 0000000000..45e544a65b --- /dev/null +++ b/dom/webidl/SVGAnimatedPathData.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin SVGAnimatedPathData { + [Pref="dom.svg.pathSeg.enabled"] + readonly attribute SVGPathSegList pathSegList; + [Pref="dom.svg.pathSeg.enabled"] + readonly attribute SVGPathSegList animatedPathSegList; +}; diff --git a/dom/webidl/SVGAnimatedPoints.webidl b/dom/webidl/SVGAnimatedPoints.webidl new file mode 100644 index 0000000000..633549a68d --- /dev/null +++ b/dom/webidl/SVGAnimatedPoints.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin SVGAnimatedPoints { + [Constant] + readonly attribute SVGPointList points; + [Constant] + readonly attribute SVGPointList animatedPoints; +}; diff --git a/dom/webidl/SVGAnimatedPreserveAspectRatio.webidl b/dom/webidl/SVGAnimatedPreserveAspectRatio.webidl new file mode 100644 index 0000000000..f0872d5263 --- /dev/null +++ b/dom/webidl/SVGAnimatedPreserveAspectRatio.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedPreserveAspectRatio { + [Constant] + readonly attribute SVGPreserveAspectRatio baseVal; + [Constant] + readonly attribute SVGPreserveAspectRatio animVal; +}; diff --git a/dom/webidl/SVGAnimatedRect.webidl b/dom/webidl/SVGAnimatedRect.webidl new file mode 100644 index 0000000000..ebfd707f79 --- /dev/null +++ b/dom/webidl/SVGAnimatedRect.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedRect { + readonly attribute SVGRect? baseVal; + readonly attribute SVGRect? animVal; +}; diff --git a/dom/webidl/SVGAnimatedString.webidl b/dom/webidl/SVGAnimatedString.webidl new file mode 100644 index 0000000000..5a28bfd805 --- /dev/null +++ b/dom/webidl/SVGAnimatedString.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedString { + attribute DOMString baseVal; + readonly attribute DOMString animVal; +}; diff --git a/dom/webidl/SVGAnimatedTransformList.webidl b/dom/webidl/SVGAnimatedTransformList.webidl new file mode 100644 index 0000000000..0de2cb2251 --- /dev/null +++ b/dom/webidl/SVGAnimatedTransformList.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimatedTransformList { + [Constant] + readonly attribute SVGTransformList baseVal; + [Constant] + readonly attribute SVGTransformList animVal; +}; diff --git a/dom/webidl/SVGAnimationElement.webidl b/dom/webidl/SVGAnimationElement.webidl new file mode 100644 index 0000000000..71502fa3f1 --- /dev/null +++ b/dom/webidl/SVGAnimationElement.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGAnimationElement : SVGElement { + + readonly attribute SVGElement? targetElement; + + attribute EventHandler onbegin; + attribute EventHandler onend; + attribute EventHandler onrepeat; + + [Throws] + float getStartTime(); + [BinaryName="getCurrentTimeAsFloat"] + float getCurrentTime(); + [Throws] + float getSimpleDuration(); + + [Throws] + undefined beginElement(); + [Throws] + undefined beginElementAt(float offset); + [Throws] + undefined endElement(); + [Throws] + undefined endElementAt(float offset); +}; + +SVGAnimationElement includes SVGTests; diff --git a/dom/webidl/SVGCircleElement.webidl b/dom/webidl/SVGCircleElement.webidl new file mode 100644 index 0000000000..06aee7da29 --- /dev/null +++ b/dom/webidl/SVGCircleElement.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGCircleElement : SVGGeometryElement { + [Constant] + readonly attribute SVGAnimatedLength cx; + [Constant] + readonly attribute SVGAnimatedLength cy; + [Constant] + readonly attribute SVGAnimatedLength r; +}; diff --git a/dom/webidl/SVGClipPathElement.webidl b/dom/webidl/SVGClipPathElement.webidl new file mode 100644 index 0000000000..5ed5adc39d --- /dev/null +++ b/dom/webidl/SVGClipPathElement.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGClipPathElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedEnumeration clipPathUnits; + [Constant] + readonly attribute SVGAnimatedTransformList transform; +}; diff --git a/dom/webidl/SVGComponentTransferFunctionElement.webidl b/dom/webidl/SVGComponentTransferFunctionElement.webidl new file mode 100644 index 0000000000..e24c8f499e --- /dev/null +++ b/dom/webidl/SVGComponentTransferFunctionElement.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGComponentTransferFunctionElement : SVGElement { + // Component Transfer Types + const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0; + const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1; + const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2; + const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3; + const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4; + const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5; + + [Constant] + readonly attribute SVGAnimatedEnumeration type; + [Constant] + readonly attribute SVGAnimatedNumberList tableValues; + [Constant] + readonly attribute SVGAnimatedNumber slope; + [Constant] + readonly attribute SVGAnimatedNumber intercept; + [Constant] + readonly attribute SVGAnimatedNumber amplitude; + [Constant] + readonly attribute SVGAnimatedNumber exponent; + [Constant] + readonly attribute SVGAnimatedNumber offset; +}; diff --git a/dom/webidl/SVGDefsElement.webidl b/dom/webidl/SVGDefsElement.webidl new file mode 100644 index 0000000000..5f21ff7674 --- /dev/null +++ b/dom/webidl/SVGDefsElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGDefsElement : SVGGraphicsElement { +}; diff --git a/dom/webidl/SVGDescElement.webidl b/dom/webidl/SVGDescElement.webidl new file mode 100644 index 0000000000..7a2a4668fd --- /dev/null +++ b/dom/webidl/SVGDescElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGDescElement : SVGElement { +}; diff --git a/dom/webidl/SVGElement.webidl b/dom/webidl/SVGElement.webidl new file mode 100644 index 0000000000..7d2e6022f4 --- /dev/null +++ b/dom/webidl/SVGElement.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGElement : Element { + attribute DOMString id; + + [Constant] + readonly attribute SVGAnimatedString className; + + readonly attribute SVGSVGElement? ownerSVGElement; + readonly attribute SVGElement? viewportElement; + + attribute DOMString nonce; +}; + +SVGElement includes GlobalEventHandlers; +SVGElement includes HTMLOrForeignElement; +SVGElement includes ElementCSSInlineStyle; +SVGElement includes TouchEventHandlers; +SVGElement includes OnErrorEventHandlerForNodes; diff --git a/dom/webidl/SVGEllipseElement.webidl b/dom/webidl/SVGEllipseElement.webidl new file mode 100644 index 0000000000..e18a841086 --- /dev/null +++ b/dom/webidl/SVGEllipseElement.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGEllipseElement : SVGGeometryElement { + [Constant] + readonly attribute SVGAnimatedLength cx; + [Constant] + readonly attribute SVGAnimatedLength cy; + [Constant] + readonly attribute SVGAnimatedLength rx; + [Constant] + readonly attribute SVGAnimatedLength ry; +}; diff --git a/dom/webidl/SVGFEBlendElement.webidl b/dom/webidl/SVGFEBlendElement.webidl new file mode 100644 index 0000000000..9a2590d724 --- /dev/null +++ b/dom/webidl/SVGFEBlendElement.webidl @@ -0,0 +1,42 @@ +/* -*- 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/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEBlendElement : SVGElement { + + // Blend Mode Types + const unsigned short SVG_FEBLEND_MODE_UNKNOWN = 0; + const unsigned short SVG_FEBLEND_MODE_NORMAL = 1; + const unsigned short SVG_FEBLEND_MODE_MULTIPLY = 2; + const unsigned short SVG_FEBLEND_MODE_SCREEN = 3; + const unsigned short SVG_FEBLEND_MODE_DARKEN = 4; + const unsigned short SVG_FEBLEND_MODE_LIGHTEN = 5; + const unsigned short SVG_FEBLEND_MODE_OVERLAY = 6; + const unsigned short SVG_FEBLEND_MODE_COLOR_DODGE = 7; + const unsigned short SVG_FEBLEND_MODE_COLOR_BURN = 8; + const unsigned short SVG_FEBLEND_MODE_HARD_LIGHT = 9; + const unsigned short SVG_FEBLEND_MODE_SOFT_LIGHT = 10; + const unsigned short SVG_FEBLEND_MODE_DIFFERENCE = 11; + const unsigned short SVG_FEBLEND_MODE_EXCLUSION = 12; + const unsigned short SVG_FEBLEND_MODE_HUE = 13; + const unsigned short SVG_FEBLEND_MODE_SATURATION = 14; + const unsigned short SVG_FEBLEND_MODE_COLOR = 15; + const unsigned short SVG_FEBLEND_MODE_LUMINOSITY = 16; + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedString in2; + [Constant] + readonly attribute SVGAnimatedEnumeration mode; +}; + +SVGFEBlendElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEColorMatrixElement.webidl b/dom/webidl/SVGFEColorMatrixElement.webidl new file mode 100644 index 0000000000..a067a574fe --- /dev/null +++ b/dom/webidl/SVGFEColorMatrixElement.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEColorMatrixElement : SVGElement { + + // Color Matrix Types + const unsigned short SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0; + const unsigned short SVG_FECOLORMATRIX_TYPE_MATRIX = 1; + const unsigned short SVG_FECOLORMATRIX_TYPE_SATURATE = 2; + const unsigned short SVG_FECOLORMATRIX_TYPE_HUEROTATE = 3; + const unsigned short SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4; + + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedEnumeration type; + [Constant] + readonly attribute SVGAnimatedNumberList values; +}; + +SVGFEColorMatrixElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEComponentTransferElement.webidl b/dom/webidl/SVGFEComponentTransferElement.webidl new file mode 100644 index 0000000000..cdd472e5f6 --- /dev/null +++ b/dom/webidl/SVGFEComponentTransferElement.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEComponentTransferElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedString in1; +}; + +SVGFEComponentTransferElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFECompositeElement.webidl b/dom/webidl/SVGFECompositeElement.webidl new file mode 100644 index 0000000000..04862bf5a9 --- /dev/null +++ b/dom/webidl/SVGFECompositeElement.webidl @@ -0,0 +1,42 @@ +/* -*- 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/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFECompositeElement : SVGElement { + + // Composite Operators + const unsigned short SVG_FECOMPOSITE_OPERATOR_UNKNOWN = 0; + const unsigned short SVG_FECOMPOSITE_OPERATOR_OVER = 1; + const unsigned short SVG_FECOMPOSITE_OPERATOR_IN = 2; + const unsigned short SVG_FECOMPOSITE_OPERATOR_OUT = 3; + const unsigned short SVG_FECOMPOSITE_OPERATOR_ATOP = 4; + const unsigned short SVG_FECOMPOSITE_OPERATOR_XOR = 5; + const unsigned short SVG_FECOMPOSITE_OPERATOR_ARITHMETIC = 6; + const unsigned short SVG_FECOMPOSITE_OPERATOR_LIGHTER = 7; + + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedString in2; + [Constant] + readonly attribute SVGAnimatedEnumeration operator; + [Constant] + readonly attribute SVGAnimatedNumber k1; + [Constant] + readonly attribute SVGAnimatedNumber k2; + [Constant] + readonly attribute SVGAnimatedNumber k3; + [Constant] + readonly attribute SVGAnimatedNumber k4; +}; + +SVGFECompositeElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEConvolveMatrixElement.webidl b/dom/webidl/SVGFEConvolveMatrixElement.webidl new file mode 100644 index 0000000000..13b7606568 --- /dev/null +++ b/dom/webidl/SVGFEConvolveMatrixElement.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEConvolveMatrixElement : SVGElement { + + // Edge Mode Values + const unsigned short SVG_EDGEMODE_UNKNOWN = 0; + const unsigned short SVG_EDGEMODE_DUPLICATE = 1; + const unsigned short SVG_EDGEMODE_WRAP = 2; + const unsigned short SVG_EDGEMODE_NONE = 3; + + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedInteger orderX; + [Constant] + readonly attribute SVGAnimatedInteger orderY; + [Constant] + readonly attribute SVGAnimatedNumberList kernelMatrix; + [Constant] + readonly attribute SVGAnimatedNumber divisor; + [Constant] + readonly attribute SVGAnimatedNumber bias; + [Constant] + readonly attribute SVGAnimatedInteger targetX; + [Constant] + readonly attribute SVGAnimatedInteger targetY; + [Constant] + readonly attribute SVGAnimatedEnumeration edgeMode; + [Constant] + readonly attribute SVGAnimatedNumber kernelUnitLengthX; + [Constant] + readonly attribute SVGAnimatedNumber kernelUnitLengthY; + [Constant] + readonly attribute SVGAnimatedBoolean preserveAlpha; +}; + +SVGFEConvolveMatrixElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEDiffuseLightingElement.webidl b/dom/webidl/SVGFEDiffuseLightingElement.webidl new file mode 100644 index 0000000000..17429cb874 --- /dev/null +++ b/dom/webidl/SVGFEDiffuseLightingElement.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEDiffuseLightingElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedNumber surfaceScale; + [Constant] + readonly attribute SVGAnimatedNumber diffuseConstant; + [Constant] + readonly attribute SVGAnimatedNumber kernelUnitLengthX; + [Constant] + readonly attribute SVGAnimatedNumber kernelUnitLengthY; +}; + +SVGFEDiffuseLightingElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEDisplacementMapElement.webidl b/dom/webidl/SVGFEDisplacementMapElement.webidl new file mode 100644 index 0000000000..05eb550911 --- /dev/null +++ b/dom/webidl/SVGFEDisplacementMapElement.webidl @@ -0,0 +1,35 @@ +/* -*- 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/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEDisplacementMapElement : SVGElement { + + // Channel Selectors + const unsigned short SVG_CHANNEL_UNKNOWN = 0; + const unsigned short SVG_CHANNEL_R = 1; + const unsigned short SVG_CHANNEL_G = 2; + const unsigned short SVG_CHANNEL_B = 3; + const unsigned short SVG_CHANNEL_A = 4; + + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedString in2; + [Constant] + readonly attribute SVGAnimatedNumber scale; + [Constant] + readonly attribute SVGAnimatedEnumeration xChannelSelector; + [Constant] + readonly attribute SVGAnimatedEnumeration yChannelSelector; +}; + +SVGFEDisplacementMapElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEDistantLightElement.webidl b/dom/webidl/SVGFEDistantLightElement.webidl new file mode 100644 index 0000000000..09576510d1 --- /dev/null +++ b/dom/webidl/SVGFEDistantLightElement.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEDistantLightElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedNumber azimuth; + [Constant] + readonly attribute SVGAnimatedNumber elevation; +}; diff --git a/dom/webidl/SVGFEDropShadowElement.webidl b/dom/webidl/SVGFEDropShadowElement.webidl new file mode 100644 index 0000000000..3dd29d53fc --- /dev/null +++ b/dom/webidl/SVGFEDropShadowElement.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEDropShadowElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedNumber dx; + [Constant] + readonly attribute SVGAnimatedNumber dy; + [Constant] + readonly attribute SVGAnimatedNumber stdDeviationX; + [Constant] + readonly attribute SVGAnimatedNumber stdDeviationY; + + undefined setStdDeviation(float stdDeviationX, float stdDeviationY); +}; + +SVGFEDropShadowElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEFloodElement.webidl b/dom/webidl/SVGFEFloodElement.webidl new file mode 100644 index 0000000000..7130c23bfc --- /dev/null +++ b/dom/webidl/SVGFEFloodElement.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEFloodElement : SVGElement { +}; + +SVGFEFloodElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEFuncAElement.webidl b/dom/webidl/SVGFEFuncAElement.webidl new file mode 100644 index 0000000000..d51583a5a8 --- /dev/null +++ b/dom/webidl/SVGFEFuncAElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEFuncAElement : SVGComponentTransferFunctionElement { +}; diff --git a/dom/webidl/SVGFEFuncBElement.webidl b/dom/webidl/SVGFEFuncBElement.webidl new file mode 100644 index 0000000000..c88f91e8bb --- /dev/null +++ b/dom/webidl/SVGFEFuncBElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEFuncBElement : SVGComponentTransferFunctionElement { +}; diff --git a/dom/webidl/SVGFEFuncGElement.webidl b/dom/webidl/SVGFEFuncGElement.webidl new file mode 100644 index 0000000000..683cee3ad6 --- /dev/null +++ b/dom/webidl/SVGFEFuncGElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEFuncGElement : SVGComponentTransferFunctionElement { +}; diff --git a/dom/webidl/SVGFEFuncRElement.webidl b/dom/webidl/SVGFEFuncRElement.webidl new file mode 100644 index 0000000000..1a27924a8d --- /dev/null +++ b/dom/webidl/SVGFEFuncRElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html + * + * Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEFuncRElement : SVGComponentTransferFunctionElement { +}; diff --git a/dom/webidl/SVGFEGaussianBlurElement.webidl b/dom/webidl/SVGFEGaussianBlurElement.webidl new file mode 100644 index 0000000000..1abae94dcd --- /dev/null +++ b/dom/webidl/SVGFEGaussianBlurElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEGaussianBlurElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedNumber stdDeviationX; + [Constant] + readonly attribute SVGAnimatedNumber stdDeviationY; + + undefined setStdDeviation(float stdDeviationX, float stdDeviationY); +}; + +SVGFEGaussianBlurElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEImageElement.webidl b/dom/webidl/SVGFEImageElement.webidl new file mode 100644 index 0000000000..e6f4519195 --- /dev/null +++ b/dom/webidl/SVGFEImageElement.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEImageElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; + [SetterThrows] + attribute DOMString? crossOrigin; +}; + +SVGFEImageElement includes SVGFilterPrimitiveStandardAttributes; +SVGFEImageElement includes SVGURIReference; diff --git a/dom/webidl/SVGFEMergeElement.webidl b/dom/webidl/SVGFEMergeElement.webidl new file mode 100644 index 0000000000..855df10d96 --- /dev/null +++ b/dom/webidl/SVGFEMergeElement.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEMergeElement : SVGElement { +}; + +SVGFEMergeElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEMergeNodeElement.webidl b/dom/webidl/SVGFEMergeNodeElement.webidl new file mode 100644 index 0000000000..f680fc5495 --- /dev/null +++ b/dom/webidl/SVGFEMergeNodeElement.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEMergeNodeElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedString in1; +}; diff --git a/dom/webidl/SVGFEMorphologyElement.webidl b/dom/webidl/SVGFEMorphologyElement.webidl new file mode 100644 index 0000000000..8126028e66 --- /dev/null +++ b/dom/webidl/SVGFEMorphologyElement.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEMorphologyElement : SVGElement { + + // Morphology Operators + const unsigned short SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0; + const unsigned short SVG_MORPHOLOGY_OPERATOR_ERODE = 1; + const unsigned short SVG_MORPHOLOGY_OPERATOR_DILATE = 2; + + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedEnumeration operator; + [Constant] + readonly attribute SVGAnimatedNumber radiusX; + [Constant] + readonly attribute SVGAnimatedNumber radiusY; +}; + +SVGFEMorphologyElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEOffsetElement.webidl b/dom/webidl/SVGFEOffsetElement.webidl new file mode 100644 index 0000000000..2371813ea4 --- /dev/null +++ b/dom/webidl/SVGFEOffsetElement.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEOffsetElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedNumber dx; + [Constant] + readonly attribute SVGAnimatedNumber dy; +}; + +SVGFEOffsetElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEPointLightElement.webidl b/dom/webidl/SVGFEPointLightElement.webidl new file mode 100644 index 0000000000..50c4d5af62 --- /dev/null +++ b/dom/webidl/SVGFEPointLightElement.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFEPointLightElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedNumber x; + [Constant] + readonly attribute SVGAnimatedNumber y; + [Constant] + readonly attribute SVGAnimatedNumber z; +}; diff --git a/dom/webidl/SVGFESpecularLightingElement.webidl b/dom/webidl/SVGFESpecularLightingElement.webidl new file mode 100644 index 0000000000..2c456f7c2b --- /dev/null +++ b/dom/webidl/SVGFESpecularLightingElement.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFESpecularLightingElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedString in1; + [Constant] + readonly attribute SVGAnimatedNumber surfaceScale; + [Constant] + readonly attribute SVGAnimatedNumber specularConstant; + [Constant] + readonly attribute SVGAnimatedNumber specularExponent; + [Constant] + readonly attribute SVGAnimatedNumber kernelUnitLengthX; + [Constant] + readonly attribute SVGAnimatedNumber kernelUnitLengthY; +}; + +SVGFESpecularLightingElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFESpotLightElement.webidl b/dom/webidl/SVGFESpotLightElement.webidl new file mode 100644 index 0000000000..6735123375 --- /dev/null +++ b/dom/webidl/SVGFESpotLightElement.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFESpotLightElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedNumber x; + [Constant] + readonly attribute SVGAnimatedNumber y; + [Constant] + readonly attribute SVGAnimatedNumber z; + [Constant] + readonly attribute SVGAnimatedNumber pointsAtX; + [Constant] + readonly attribute SVGAnimatedNumber pointsAtY; + [Constant] + readonly attribute SVGAnimatedNumber pointsAtZ; + [Constant] + readonly attribute SVGAnimatedNumber specularExponent; + [Constant] + readonly attribute SVGAnimatedNumber limitingConeAngle; +}; diff --git a/dom/webidl/SVGFETileElement.webidl b/dom/webidl/SVGFETileElement.webidl new file mode 100644 index 0000000000..2571982dc7 --- /dev/null +++ b/dom/webidl/SVGFETileElement.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFETileElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedString in1; +}; + +SVGFETileElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFETurbulenceElement.webidl b/dom/webidl/SVGFETurbulenceElement.webidl new file mode 100644 index 0000000000..ad592c84e9 --- /dev/null +++ b/dom/webidl/SVGFETurbulenceElement.webidl @@ -0,0 +1,40 @@ +/* -*- 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/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFETurbulenceElement : SVGElement { + + // Turbulence Types + const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0; + const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1; + const unsigned short SVG_TURBULENCE_TYPE_TURBULENCE = 2; + + // Stitch Options + const unsigned short SVG_STITCHTYPE_UNKNOWN = 0; + const unsigned short SVG_STITCHTYPE_STITCH = 1; + const unsigned short SVG_STITCHTYPE_NOSTITCH = 2; + + [Constant] + readonly attribute SVGAnimatedNumber baseFrequencyX; + [Constant] + readonly attribute SVGAnimatedNumber baseFrequencyY; + [Constant] + readonly attribute SVGAnimatedInteger numOctaves; + [Constant] + readonly attribute SVGAnimatedNumber seed; + [Constant] + readonly attribute SVGAnimatedEnumeration stitchTiles; + [Constant] + readonly attribute SVGAnimatedEnumeration type; +}; + +SVGFETurbulenceElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFilterElement.webidl b/dom/webidl/SVGFilterElement.webidl new file mode 100644 index 0000000000..42bfd09aee --- /dev/null +++ b/dom/webidl/SVGFilterElement.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGFilterElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedEnumeration filterUnits; + [Constant] + readonly attribute SVGAnimatedEnumeration primitiveUnits; + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; + + // ImageData apply(ImageData source); +}; + +SVGFilterElement includes SVGURIReference; diff --git a/dom/webidl/SVGFilterPrimitiveStandardAttributes.webidl b/dom/webidl/SVGFilterPrimitiveStandardAttributes.webidl new file mode 100644 index 0000000000..02fa882d80 --- /dev/null +++ b/dom/webidl/SVGFilterPrimitiveStandardAttributes.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin SVGFilterPrimitiveStandardAttributes { + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; + [Constant] + readonly attribute SVGAnimatedString result; +}; diff --git a/dom/webidl/SVGFitToViewBox.webidl b/dom/webidl/SVGFitToViewBox.webidl new file mode 100644 index 0000000000..650afd15e1 --- /dev/null +++ b/dom/webidl/SVGFitToViewBox.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin SVGFitToViewBox { + [Constant] + readonly attribute SVGAnimatedRect viewBox; + [Constant] + readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; +}; diff --git a/dom/webidl/SVGForeignObjectElement.webidl b/dom/webidl/SVGForeignObjectElement.webidl new file mode 100644 index 0000000000..788fb4baa9 --- /dev/null +++ b/dom/webidl/SVGForeignObjectElement.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGForeignObjectElement : SVGGraphicsElement { + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; +}; diff --git a/dom/webidl/SVGGElement.webidl b/dom/webidl/SVGGElement.webidl new file mode 100644 index 0000000000..3714bbee8b --- /dev/null +++ b/dom/webidl/SVGGElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGGElement : SVGGraphicsElement { +}; diff --git a/dom/webidl/SVGGeometryElement.webidl b/dom/webidl/SVGGeometryElement.webidl new file mode 100644 index 0000000000..6895b2677f --- /dev/null +++ b/dom/webidl/SVGGeometryElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGGeometryElement : SVGGraphicsElement { + [SameObject] + readonly attribute SVGAnimatedNumber pathLength; + + boolean isPointInFill(optional DOMPointInit point = {}); + boolean isPointInStroke(optional DOMPointInit point = {}); + + [BinaryName="getTotalLengthForBinding"] + float getTotalLength(); + [NewObject, Throws] + SVGPoint getPointAtLength(float distance); +}; diff --git a/dom/webidl/SVGGradientElement.webidl b/dom/webidl/SVGGradientElement.webidl new file mode 100644 index 0000000000..7b74db779d --- /dev/null +++ b/dom/webidl/SVGGradientElement.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://svgwg.org/svg2-draft/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGGradientElement : SVGElement { + + // Spread Method Types + const unsigned short SVG_SPREADMETHOD_UNKNOWN = 0; + const unsigned short SVG_SPREADMETHOD_PAD = 1; + const unsigned short SVG_SPREADMETHOD_REFLECT = 2; + const unsigned short SVG_SPREADMETHOD_REPEAT = 3; + + [Constant] + readonly attribute SVGAnimatedEnumeration gradientUnits; + [Constant] + readonly attribute SVGAnimatedTransformList gradientTransform; + [Constant] + readonly attribute SVGAnimatedEnumeration spreadMethod; +}; + +SVGGradientElement includes SVGURIReference; diff --git a/dom/webidl/SVGGraphicsElement.webidl b/dom/webidl/SVGGraphicsElement.webidl new file mode 100644 index 0000000000..65a87c2501 --- /dev/null +++ b/dom/webidl/SVGGraphicsElement.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary SVGBoundingBoxOptions { + boolean fill = true; + boolean stroke = false; + boolean markers = false; + boolean clipped = false; +}; + +[Exposed=Window] +interface SVGGraphicsElement : SVGElement { + readonly attribute SVGAnimatedTransformList transform; + + [Deprecated="SVGNearestViewportElement", + Pref="svg.nearestAndFarthestViewportElement.enabled"] + readonly attribute SVGElement? nearestViewportElement; + [Deprecated="SVGFarthestViewportElement", + Pref="svg.nearestAndFarthestViewportElement.enabled"] + readonly attribute SVGElement? farthestViewportElement; + + [NewObject] + SVGRect getBBox(optional SVGBoundingBoxOptions aOptions = {}); + SVGMatrix? getCTM(); + SVGMatrix? getScreenCTM(); +}; + +SVGGraphicsElement includes SVGTests; diff --git a/dom/webidl/SVGImageElement.webidl b/dom/webidl/SVGImageElement.webidl new file mode 100644 index 0000000000..f2dd659695 --- /dev/null +++ b/dom/webidl/SVGImageElement.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGImageElement : SVGGraphicsElement { + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; + [Constant] + readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; + [SetterThrows] + attribute DOMString? crossOrigin; + [CEReactions, SetterThrows] + attribute DOMString decoding; + [NewObject] + Promise<undefined> decode(); +}; + +SVGImageElement includes MozImageLoadingContent; +SVGImageElement includes SVGURIReference; diff --git a/dom/webidl/SVGLength.webidl b/dom/webidl/SVGLength.webidl new file mode 100644 index 0000000000..0ab930a231 --- /dev/null +++ b/dom/webidl/SVGLength.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGLength { + + // Length Unit Types + const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0; + const unsigned short SVG_LENGTHTYPE_NUMBER = 1; + const unsigned short SVG_LENGTHTYPE_PERCENTAGE = 2; + const unsigned short SVG_LENGTHTYPE_EMS = 3; + const unsigned short SVG_LENGTHTYPE_EXS = 4; + const unsigned short SVG_LENGTHTYPE_PX = 5; + const unsigned short SVG_LENGTHTYPE_CM = 6; + const unsigned short SVG_LENGTHTYPE_MM = 7; + const unsigned short SVG_LENGTHTYPE_IN = 8; + const unsigned short SVG_LENGTHTYPE_PT = 9; + const unsigned short SVG_LENGTHTYPE_PC = 10; + + readonly attribute unsigned short unitType; + [Throws] + attribute float value; + [SetterThrows] + attribute float valueInSpecifiedUnits; + [SetterThrows] + attribute DOMString valueAsString; + + [Throws] + undefined newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits); + [Throws] + undefined convertToSpecifiedUnits(unsigned short unitType); +}; diff --git a/dom/webidl/SVGLengthList.webidl b/dom/webidl/SVGLengthList.webidl new file mode 100644 index 0000000000..6a12df46e6 --- /dev/null +++ b/dom/webidl/SVGLengthList.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG11/ + * https://svgwg.org/svg2-draft/types.html#InterfaceSVGLengthList + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGLengthList { + readonly attribute unsigned long numberOfItems; + [Throws] + undefined clear(); + [Throws] + SVGLength initialize(SVGLength newItem); + [Throws] + getter SVGLength getItem(unsigned long index); + [Throws] + SVGLength insertItemBefore(SVGLength newItem, unsigned long index); + [Throws] + SVGLength replaceItem(SVGLength newItem, unsigned long index); + [Throws] + SVGLength removeItem(unsigned long index); + [Throws] + SVGLength appendItem(SVGLength newItem); + [Throws] + setter undefined (unsigned long index, SVGLength newItem); + + // Mozilla-specific stuff + readonly attribute unsigned long length; // synonym for numberOfItems +}; diff --git a/dom/webidl/SVGLineElement.webidl b/dom/webidl/SVGLineElement.webidl new file mode 100644 index 0000000000..ccf581432c --- /dev/null +++ b/dom/webidl/SVGLineElement.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGLineElement : SVGGeometryElement { + [Constant] + readonly attribute SVGAnimatedLength x1; + [Constant] + readonly attribute SVGAnimatedLength y1; + [Constant] + readonly attribute SVGAnimatedLength x2; + [Constant] + readonly attribute SVGAnimatedLength y2; +}; diff --git a/dom/webidl/SVGLinearGradientElement.webidl b/dom/webidl/SVGLinearGradientElement.webidl new file mode 100644 index 0000000000..db4690f438 --- /dev/null +++ b/dom/webidl/SVGLinearGradientElement.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://svgwg.org/svg2-draft/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGLinearGradientElement : SVGGradientElement { + [Constant] + readonly attribute SVGAnimatedLength x1; + [Constant] + readonly attribute SVGAnimatedLength y1; + [Constant] + readonly attribute SVGAnimatedLength x2; + [Constant] + readonly attribute SVGAnimatedLength y2; +}; diff --git a/dom/webidl/SVGMPathElement.webidl b/dom/webidl/SVGMPathElement.webidl new file mode 100644 index 0000000000..7999a8d744 --- /dev/null +++ b/dom/webidl/SVGMPathElement.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGMPathElement : SVGElement { +}; + +SVGMPathElement includes SVGURIReference; diff --git a/dom/webidl/SVGMarkerElement.webidl b/dom/webidl/SVGMarkerElement.webidl new file mode 100644 index 0000000000..1c5ab43d80 --- /dev/null +++ b/dom/webidl/SVGMarkerElement.webidl @@ -0,0 +1,46 @@ +/* -*- 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/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGMarkerElement : SVGElement { + + // Marker Unit Types + const unsigned short SVG_MARKERUNITS_UNKNOWN = 0; + const unsigned short SVG_MARKERUNITS_USERSPACEONUSE = 1; + const unsigned short SVG_MARKERUNITS_STROKEWIDTH = 2; + + // Marker Orientation Types + const unsigned short SVG_MARKER_ORIENT_UNKNOWN = 0; + const unsigned short SVG_MARKER_ORIENT_AUTO = 1; + const unsigned short SVG_MARKER_ORIENT_ANGLE = 2; + const unsigned short SVG_MARKER_ORIENT_AUTO_START_REVERSE = 3; + + [Constant] + readonly attribute SVGAnimatedLength refX; + [Constant] + readonly attribute SVGAnimatedLength refY; + [Constant] + readonly attribute SVGAnimatedEnumeration markerUnits; + [Constant] + readonly attribute SVGAnimatedLength markerWidth; + [Constant] + readonly attribute SVGAnimatedLength markerHeight; + [Constant] + readonly attribute SVGAnimatedEnumeration orientType; + [Constant] + readonly attribute SVGAnimatedAngle orientAngle; + + undefined setOrientToAuto(); + undefined setOrientToAngle(SVGAngle angle); +}; + +SVGMarkerElement includes SVGFitToViewBox; diff --git a/dom/webidl/SVGMaskElement.webidl b/dom/webidl/SVGMaskElement.webidl new file mode 100644 index 0000000000..f15a372abe --- /dev/null +++ b/dom/webidl/SVGMaskElement.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGMaskElement : SVGElement { + + // Mask Types + const unsigned short SVG_MASKTYPE_LUMINANCE = 0; + const unsigned short SVG_MASKTYPE_ALPHA = 1; + + [Constant] + readonly attribute SVGAnimatedEnumeration maskUnits; + [Constant] + readonly attribute SVGAnimatedEnumeration maskContentUnits; + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; +}; diff --git a/dom/webidl/SVGMatrix.webidl b/dom/webidl/SVGMatrix.webidl new file mode 100644 index 0000000000..e3136fad28 --- /dev/null +++ b/dom/webidl/SVGMatrix.webidl @@ -0,0 +1,51 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGMatrix { + + [SetterThrows] + attribute float a; + [SetterThrows] + attribute float b; + [SetterThrows] + attribute float c; + [SetterThrows] + attribute float d; + [SetterThrows] + attribute float e; + [SetterThrows] + attribute float f; + + [NewObject] + SVGMatrix multiply(SVGMatrix secondMatrix); + [NewObject, Throws] + SVGMatrix inverse(); + [NewObject] + SVGMatrix translate(float x, float y); + [NewObject] + SVGMatrix scale(float scaleFactor); + [NewObject] + SVGMatrix scaleNonUniform(float scaleFactorX, float scaleFactorY); + [NewObject] + SVGMatrix rotate(float angle); + [NewObject, Throws] + SVGMatrix rotateFromVector(float x, float y); + [NewObject] + SVGMatrix flipX(); + [NewObject] + SVGMatrix flipY(); + [NewObject, Throws] + SVGMatrix skewX(float angle); + [NewObject, Throws] + SVGMatrix skewY(float angle); +}; diff --git a/dom/webidl/SVGMetadataElement.webidl b/dom/webidl/SVGMetadataElement.webidl new file mode 100644 index 0000000000..bd6bdd6682 --- /dev/null +++ b/dom/webidl/SVGMetadataElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGMetadataElement : SVGElement { +}; diff --git a/dom/webidl/SVGNumber.webidl b/dom/webidl/SVGNumber.webidl new file mode 100644 index 0000000000..71921c8466 --- /dev/null +++ b/dom/webidl/SVGNumber.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGNumber { + [SetterThrows] + attribute float value; +}; diff --git a/dom/webidl/SVGNumberList.webidl b/dom/webidl/SVGNumberList.webidl new file mode 100644 index 0000000000..f231024e65 --- /dev/null +++ b/dom/webidl/SVGNumberList.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG11/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGNumberList { + readonly attribute unsigned long numberOfItems; + [Throws] + undefined clear(); + [Throws] + SVGNumber initialize(SVGNumber newItem); + [Throws] + getter SVGNumber getItem(unsigned long index); + [Throws] + SVGNumber insertItemBefore(SVGNumber newItem, unsigned long index); + [Throws] + SVGNumber replaceItem(SVGNumber newItem, unsigned long index); + [Throws] + SVGNumber removeItem(unsigned long index); + [Throws] + SVGNumber appendItem(SVGNumber newItem); + + // Mozilla-specific stuff + readonly attribute unsigned long length; // synonym for numberOfItems +}; diff --git a/dom/webidl/SVGPathElement.webidl b/dom/webidl/SVGPathElement.webidl new file mode 100644 index 0000000000..5dbb638e85 --- /dev/null +++ b/dom/webidl/SVGPathElement.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ +[Exposed=Window] +interface SVGPathElement : SVGGeometryElement { + [Pref="dom.svg.pathSeg.enabled"] + unsigned long getPathSegAtLength(float distance); +}; + +SVGPathElement includes SVGAnimatedPathData; diff --git a/dom/webidl/SVGPathSeg.webidl b/dom/webidl/SVGPathSeg.webidl new file mode 100644 index 0000000000..af0fb39847 --- /dev/null +++ b/dom/webidl/SVGPathSeg.webidl @@ -0,0 +1,254 @@ +/* -*- 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/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSeg { + + // Path Segment Types + const unsigned short PATHSEG_UNKNOWN = 0; + const unsigned short PATHSEG_CLOSEPATH = 1; + const unsigned short PATHSEG_MOVETO_ABS = 2; + const unsigned short PATHSEG_MOVETO_REL = 3; + const unsigned short PATHSEG_LINETO_ABS = 4; + const unsigned short PATHSEG_LINETO_REL = 5; + const unsigned short PATHSEG_CURVETO_CUBIC_ABS = 6; + const unsigned short PATHSEG_CURVETO_CUBIC_REL = 7; + const unsigned short PATHSEG_CURVETO_QUADRATIC_ABS = 8; + const unsigned short PATHSEG_CURVETO_QUADRATIC_REL = 9; + const unsigned short PATHSEG_ARC_ABS = 10; + const unsigned short PATHSEG_ARC_REL = 11; + const unsigned short PATHSEG_LINETO_HORIZONTAL_ABS = 12; + const unsigned short PATHSEG_LINETO_HORIZONTAL_REL = 13; + const unsigned short PATHSEG_LINETO_VERTICAL_ABS = 14; + const unsigned short PATHSEG_LINETO_VERTICAL_REL = 15; + const unsigned short PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16; + const unsigned short PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17; + const unsigned short PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18; + const unsigned short PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19; + + [Pure] + readonly attribute unsigned short pathSegType; + [Pure] + readonly attribute DOMString pathSegTypeAsLetter; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegClosePath : SVGPathSeg { +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegMovetoAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegMovetoRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoCubicAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x1; + [SetterThrows] + attribute float y1; + [SetterThrows] + attribute float x2; + [SetterThrows] + attribute float y2; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoCubicRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x1; + [SetterThrows] + attribute float y1; + [SetterThrows] + attribute float x2; + [SetterThrows] + attribute float y2; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoQuadraticAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x1; + [SetterThrows] + attribute float y1; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoQuadraticRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x1; + [SetterThrows] + attribute float y1; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegArcAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float r1; + [SetterThrows] + attribute float r2; + [SetterThrows] + attribute float angle; + [SetterThrows] + attribute boolean largeArcFlag; + [SetterThrows] + attribute boolean sweepFlag; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegArcRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float r1; + [SetterThrows] + attribute float r2; + [SetterThrows] + attribute float angle; + [SetterThrows] + attribute boolean largeArcFlag; + [SetterThrows] + attribute boolean sweepFlag; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoHorizontalAbs : SVGPathSeg { + [SetterThrows] + attribute float x; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoHorizontalRel : SVGPathSeg { + [SetterThrows] + attribute float x; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoVerticalAbs : SVGPathSeg { + [SetterThrows] + attribute float y; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoVerticalRel : SVGPathSeg { + [SetterThrows] + attribute float y; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoCubicSmoothAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x2; + [SetterThrows] + attribute float y2; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoCubicSmoothRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x2; + [SetterThrows] + attribute float y2; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoQuadraticSmoothAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoQuadraticSmoothRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; diff --git a/dom/webidl/SVGPathSegList.webidl b/dom/webidl/SVGPathSegList.webidl new file mode 100644 index 0000000000..48d003663b --- /dev/null +++ b/dom/webidl/SVGPathSegList.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG11/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window, + Pref="dom.svg.pathSeg.enabled"] +interface SVGPathSegList { + readonly attribute unsigned long numberOfItems; + [Throws] + getter SVGPathSeg getItem(unsigned long index); + + // Mozilla-specific stuff + readonly attribute unsigned long length; // synonym for numberOfItems +}; diff --git a/dom/webidl/SVGPatternElement.webidl b/dom/webidl/SVGPatternElement.webidl new file mode 100644 index 0000000000..c69d450cfe --- /dev/null +++ b/dom/webidl/SVGPatternElement.webidl @@ -0,0 +1,32 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/pservers.html#InterfaceSVGPatternElement + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGPatternElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedEnumeration patternUnits; + [Constant] + readonly attribute SVGAnimatedEnumeration patternContentUnits; + [Constant] + readonly attribute SVGAnimatedTransformList patternTransform; + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; +}; + +SVGPatternElement includes SVGFitToViewBox; +SVGPatternElement includes SVGURIReference; diff --git a/dom/webidl/SVGPoint.webidl b/dom/webidl/SVGPoint.webidl new file mode 100644 index 0000000000..f66457975f --- /dev/null +++ b/dom/webidl/SVGPoint.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGPoint { + + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + + [NewObject, Throws] + SVGPoint matrixTransform(optional DOMMatrix2DInit matrix = {}); +}; diff --git a/dom/webidl/SVGPointList.webidl b/dom/webidl/SVGPointList.webidl new file mode 100644 index 0000000000..45a41d613d --- /dev/null +++ b/dom/webidl/SVGPointList.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG11/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGPointList { + readonly attribute unsigned long numberOfItems; + [Throws] + undefined clear(); + [Throws] + SVGPoint initialize(SVGPoint newItem); + [Throws] + getter SVGPoint getItem(unsigned long index); + [Throws] + SVGPoint insertItemBefore(SVGPoint newItem, unsigned long index); + [Throws] + SVGPoint replaceItem(SVGPoint newItem, unsigned long index); + [Throws] + SVGPoint removeItem(unsigned long index); + [Throws] + SVGPoint appendItem(SVGPoint newItem); + + // Mozilla-specific stuff + readonly attribute unsigned long length; // synonym for numberOfItems +}; diff --git a/dom/webidl/SVGPolygonElement.webidl b/dom/webidl/SVGPolygonElement.webidl new file mode 100644 index 0000000000..8cf9fd0131 --- /dev/null +++ b/dom/webidl/SVGPolygonElement.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGPolygonElement : SVGGeometryElement { +}; + +SVGPolygonElement includes SVGAnimatedPoints; diff --git a/dom/webidl/SVGPolylineElement.webidl b/dom/webidl/SVGPolylineElement.webidl new file mode 100644 index 0000000000..612322c988 --- /dev/null +++ b/dom/webidl/SVGPolylineElement.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGPolylineElement : SVGGeometryElement { +}; + +SVGPolylineElement includes SVGAnimatedPoints; diff --git a/dom/webidl/SVGPreserveAspectRatio.webidl b/dom/webidl/SVGPreserveAspectRatio.webidl new file mode 100644 index 0000000000..4154d94c8c --- /dev/null +++ b/dom/webidl/SVGPreserveAspectRatio.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGPreserveAspectRatio { + + // Alignment Types + const unsigned short SVG_PRESERVEASPECTRATIO_UNKNOWN = 0; + const unsigned short SVG_PRESERVEASPECTRATIO_NONE = 1; + const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMIN = 2; + const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3; + const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4; + const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMID = 5; + const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMID = 6; + const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMID = 7; + const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMAX = 8; + const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9; + const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10; + + // Meet-or-slice Types + const unsigned short SVG_MEETORSLICE_UNKNOWN = 0; + const unsigned short SVG_MEETORSLICE_MEET = 1; + const unsigned short SVG_MEETORSLICE_SLICE = 2; + + [SetterThrows] + attribute unsigned short align; + [SetterThrows] + attribute unsigned short meetOrSlice; +}; diff --git a/dom/webidl/SVGRadialGradientElement.webidl b/dom/webidl/SVGRadialGradientElement.webidl new file mode 100644 index 0000000000..376ff6e56f --- /dev/null +++ b/dom/webidl/SVGRadialGradientElement.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://svgwg.org/svg2-draft/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGRadialGradientElement : SVGGradientElement { + [Constant] + readonly attribute SVGAnimatedLength cx; + [Constant] + readonly attribute SVGAnimatedLength cy; + [Constant] + readonly attribute SVGAnimatedLength r; + [Constant] + readonly attribute SVGAnimatedLength fx; + [Constant] + readonly attribute SVGAnimatedLength fy; + // XXX: Bug 1242048 + // [SameObject] + readonly attribute SVGAnimatedLength fr; +}; diff --git a/dom/webidl/SVGRect.webidl b/dom/webidl/SVGRect.webidl new file mode 100644 index 0000000000..dceb09dbbb --- /dev/null +++ b/dom/webidl/SVGRect.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGRect { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float width; + [SetterThrows] + attribute float height; +}; diff --git a/dom/webidl/SVGRectElement.webidl b/dom/webidl/SVGRectElement.webidl new file mode 100644 index 0000000000..f62a326e5b --- /dev/null +++ b/dom/webidl/SVGRectElement.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGRectElement : SVGGeometryElement { + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; + [Constant] + readonly attribute SVGAnimatedLength rx; + [Constant] + readonly attribute SVGAnimatedLength ry; +}; diff --git a/dom/webidl/SVGSVGElement.webidl b/dom/webidl/SVGSVGElement.webidl new file mode 100644 index 0000000000..e28ddc3805 --- /dev/null +++ b/dom/webidl/SVGSVGElement.webidl @@ -0,0 +1,69 @@ +/* -*- 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/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGSVGElement : SVGGraphicsElement { + + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; + [UseCounter] + attribute float currentScale; + readonly attribute SVGPoint currentTranslate; + + [DependsOn=Nothing, Affects=Nothing] + unsigned long suspendRedraw(unsigned long maxWaitMilliseconds); + [DependsOn=Nothing, Affects=Nothing] + undefined unsuspendRedraw(unsigned long suspendHandleID); + [DependsOn=Nothing, Affects=Nothing] + undefined unsuspendRedrawAll(); + [DependsOn=Nothing, Affects=Nothing] + undefined forceRedraw(); + undefined pauseAnimations(); + undefined unpauseAnimations(); + boolean animationsPaused(); + [BinaryName="getCurrentTimeAsFloat"] + float getCurrentTime(); + undefined setCurrentTime(float seconds); + // NodeList getIntersectionList(SVGRect rect, SVGElement referenceElement); + // NodeList getEnclosureList(SVGRect rect, SVGElement referenceElement); + // boolean checkIntersection(SVGElement element, SVGRect rect); + // boolean checkEnclosure(SVGElement element, SVGRect rect); + [Deprecated="SVGDeselectAll"] + undefined deselectAll(); + [NewObject] + SVGNumber createSVGNumber(); + [NewObject] + SVGLength createSVGLength(); + [NewObject] + SVGAngle createSVGAngle(); + [NewObject] + SVGPoint createSVGPoint(); + [NewObject] + SVGMatrix createSVGMatrix(); + [NewObject] + SVGRect createSVGRect(); + [NewObject] + SVGTransform createSVGTransform(); + [NewObject, Throws] + SVGTransform createSVGTransformFromMatrix(optional DOMMatrix2DInit matrix = {}); + [UseCounter] + Element? getElementById(DOMString elementId); +}; + +SVGSVGElement includes SVGFitToViewBox; +SVGSVGElement includes SVGZoomAndPan; diff --git a/dom/webidl/SVGScriptElement.webidl b/dom/webidl/SVGScriptElement.webidl new file mode 100644 index 0000000000..914bfd606e --- /dev/null +++ b/dom/webidl/SVGScriptElement.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGScriptElement : SVGElement { + [SetterThrows] + attribute DOMString type; + // See https://github.com/w3c/svgwg/issues/918 + attribute boolean async; + attribute boolean defer; + [SetterThrows] + attribute DOMString? crossOrigin; +}; + +SVGScriptElement includes SVGURIReference; diff --git a/dom/webidl/SVGSetElement.webidl b/dom/webidl/SVGSetElement.webidl new file mode 100644 index 0000000000..cad45e4b21 --- /dev/null +++ b/dom/webidl/SVGSetElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGSetElement : SVGAnimationElement { +}; diff --git a/dom/webidl/SVGStopElement.webidl b/dom/webidl/SVGStopElement.webidl new file mode 100644 index 0000000000..27a900a0c2 --- /dev/null +++ b/dom/webidl/SVGStopElement.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGStopElement : SVGElement { + [Constant] + readonly attribute SVGAnimatedNumber offset; +}; diff --git a/dom/webidl/SVGStringList.webidl b/dom/webidl/SVGStringList.webidl new file mode 100644 index 0000000000..eb3c2d3a83 --- /dev/null +++ b/dom/webidl/SVGStringList.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://svgwg.org/svg2-draft/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGStringList { + readonly attribute unsigned long length; + readonly attribute unsigned long numberOfItems; + + undefined clear(); + [Throws] + DOMString initialize(DOMString newItem); + [Throws] + DOMString getItem(unsigned long index); + getter DOMString(unsigned long index); + [Throws] + DOMString insertItemBefore(DOMString newItem, unsigned long index); + [Throws] + DOMString replaceItem(DOMString newItem, unsigned long index); + [Throws] + DOMString removeItem(unsigned long index); + [Throws] + DOMString appendItem(DOMString newItem); + //setter undefined (unsigned long index, DOMString newItem); +}; diff --git a/dom/webidl/SVGStyleElement.webidl b/dom/webidl/SVGStyleElement.webidl new file mode 100644 index 0000000000..e905fcdee5 --- /dev/null +++ b/dom/webidl/SVGStyleElement.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGStyleElement : SVGElement { + [Pure] + attribute boolean disabled; + [SetterThrows] + attribute DOMString type; + [SetterThrows] + attribute DOMString media; + [SetterThrows] + attribute DOMString title; +}; +SVGStyleElement includes LinkStyle; diff --git a/dom/webidl/SVGSwitchElement.webidl b/dom/webidl/SVGSwitchElement.webidl new file mode 100644 index 0000000000..7c08a90349 --- /dev/null +++ b/dom/webidl/SVGSwitchElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGSwitchElement : SVGGraphicsElement { +}; diff --git a/dom/webidl/SVGSymbolElement.webidl b/dom/webidl/SVGSymbolElement.webidl new file mode 100644 index 0000000000..76861ff5af --- /dev/null +++ b/dom/webidl/SVGSymbolElement.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/struct.html#InterfaceSVGSymbolElement + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGSymbolElement : SVGElement { +}; + +SVGSymbolElement includes SVGFitToViewBox; +SVGSymbolElement includes SVGTests; diff --git a/dom/webidl/SVGTSpanElement.webidl b/dom/webidl/SVGTSpanElement.webidl new file mode 100644 index 0000000000..10dec3e5fd --- /dev/null +++ b/dom/webidl/SVGTSpanElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGTSpanElement : SVGTextPositioningElement { +}; diff --git a/dom/webidl/SVGTests.webidl b/dom/webidl/SVGTests.webidl new file mode 100644 index 0000000000..6f7ec360ea --- /dev/null +++ b/dom/webidl/SVGTests.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin SVGTests { + + readonly attribute SVGStringList requiredExtensions; + readonly attribute SVGStringList systemLanguage; +}; diff --git a/dom/webidl/SVGTextContentElement.webidl b/dom/webidl/SVGTextContentElement.webidl new file mode 100644 index 0000000000..467ea0c695 --- /dev/null +++ b/dom/webidl/SVGTextContentElement.webidl @@ -0,0 +1,41 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGTextContentElement : SVGGraphicsElement { + + // lengthAdjust Types + const unsigned short LENGTHADJUST_UNKNOWN = 0; + const unsigned short LENGTHADJUST_SPACING = 1; + const unsigned short LENGTHADJUST_SPACINGANDGLYPHS = 2; + + [Constant] + readonly attribute SVGAnimatedLength textLength; + [Constant] + readonly attribute SVGAnimatedEnumeration lengthAdjust; + + long getNumberOfChars(); + float getComputedTextLength(); + [Throws] + float getSubStringLength(unsigned long charnum, unsigned long nchars); + [Throws] + SVGPoint getStartPositionOfChar(unsigned long charnum); + [Throws] + SVGPoint getEndPositionOfChar(unsigned long charnum); + [NewObject, Throws] + SVGRect getExtentOfChar(unsigned long charnum); + [Throws] + float getRotationOfChar(unsigned long charnum); + long getCharNumAtPosition(optional DOMPointInit point = {}); + [Throws] + undefined selectSubString(unsigned long charnum, unsigned long nchars); +}; diff --git a/dom/webidl/SVGTextElement.webidl b/dom/webidl/SVGTextElement.webidl new file mode 100644 index 0000000000..fc6b711f94 --- /dev/null +++ b/dom/webidl/SVGTextElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGTextElement : SVGTextPositioningElement { +}; diff --git a/dom/webidl/SVGTextPathElement.webidl b/dom/webidl/SVGTextPathElement.webidl new file mode 100644 index 0000000000..5905e69a5c --- /dev/null +++ b/dom/webidl/SVGTextPathElement.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGTextPathElement : SVGTextContentElement { + + // textPath Method Types + const unsigned short TEXTPATH_METHODTYPE_UNKNOWN = 0; + const unsigned short TEXTPATH_METHODTYPE_ALIGN = 1; + const unsigned short TEXTPATH_METHODTYPE_STRETCH = 2; + + // textPath Spacing Types + const unsigned short TEXTPATH_SPACINGTYPE_UNKNOWN = 0; + const unsigned short TEXTPATH_SPACINGTYPE_AUTO = 1; + const unsigned short TEXTPATH_SPACINGTYPE_EXACT = 2; + + [Constant] + readonly attribute SVGAnimatedLength startOffset; + [Constant] + readonly attribute SVGAnimatedEnumeration method; + [Constant] + readonly attribute SVGAnimatedEnumeration spacing; +}; + +SVGTextPathElement includes SVGURIReference; diff --git a/dom/webidl/SVGTextPositioningElement.webidl b/dom/webidl/SVGTextPositioningElement.webidl new file mode 100644 index 0000000000..21d2367cde --- /dev/null +++ b/dom/webidl/SVGTextPositioningElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGTextPositioningElement : SVGTextContentElement { + [Constant] + readonly attribute SVGAnimatedLengthList x; + [Constant] + readonly attribute SVGAnimatedLengthList y; + [Constant] + readonly attribute SVGAnimatedLengthList dx; + [Constant] + readonly attribute SVGAnimatedLengthList dy; + [Constant] + readonly attribute SVGAnimatedNumberList rotate; +}; diff --git a/dom/webidl/SVGTitleElement.webidl b/dom/webidl/SVGTitleElement.webidl new file mode 100644 index 0000000000..469b7bead5 --- /dev/null +++ b/dom/webidl/SVGTitleElement.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGTitleElement : SVGElement { +}; diff --git a/dom/webidl/SVGTransform.webidl b/dom/webidl/SVGTransform.webidl new file mode 100644 index 0000000000..621c84b997 --- /dev/null +++ b/dom/webidl/SVGTransform.webidl @@ -0,0 +1,42 @@ +/* -*- 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/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGTransform { + + // Transform Types + const unsigned short SVG_TRANSFORM_UNKNOWN = 0; + const unsigned short SVG_TRANSFORM_MATRIX = 1; + const unsigned short SVG_TRANSFORM_TRANSLATE = 2; + const unsigned short SVG_TRANSFORM_SCALE = 3; + const unsigned short SVG_TRANSFORM_ROTATE = 4; + const unsigned short SVG_TRANSFORM_SKEWX = 5; + const unsigned short SVG_TRANSFORM_SKEWY = 6; + + readonly attribute unsigned short type; + [BinaryName="getMatrix"] + readonly attribute SVGMatrix matrix; + readonly attribute float angle; + + [Throws] + undefined setMatrix(optional DOMMatrix2DInit matrix = {}); + [Throws] + undefined setTranslate(float tx, float ty); + [Throws] + undefined setScale(float sx, float sy); + [Throws] + undefined setRotate(float angle, float cx, float cy); + [Throws] + undefined setSkewX(float angle); + [Throws] + undefined setSkewY(float angle); +}; diff --git a/dom/webidl/SVGTransformList.webidl b/dom/webidl/SVGTransformList.webidl new file mode 100644 index 0000000000..a29926a651 --- /dev/null +++ b/dom/webidl/SVGTransformList.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG11/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGTransformList { + readonly attribute unsigned long numberOfItems; + [Throws] + undefined clear(); + [Throws] + SVGTransform initialize(SVGTransform newItem); + [Throws] + getter SVGTransform getItem(unsigned long index); + [Throws] + SVGTransform insertItemBefore(SVGTransform newItem, unsigned long index); + [Throws] + SVGTransform replaceItem(SVGTransform newItem, unsigned long index); + [Throws] + SVGTransform removeItem(unsigned long index); + [Throws] + SVGTransform appendItem(SVGTransform newItem); + [Throws] + SVGTransform createSVGTransformFromMatrix(optional DOMMatrix2DInit matrix = {}); + [Throws] + SVGTransform? consolidate(); + + // Mozilla-specific stuff + readonly attribute unsigned long length; // synonym for numberOfItems +}; diff --git a/dom/webidl/SVGURIReference.webidl b/dom/webidl/SVGURIReference.webidl new file mode 100644 index 0000000000..12d216a025 --- /dev/null +++ b/dom/webidl/SVGURIReference.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin SVGURIReference { + [Constant] + readonly attribute SVGAnimatedString href; +}; diff --git a/dom/webidl/SVGUnitTypes.webidl b/dom/webidl/SVGUnitTypes.webidl new file mode 100644 index 0000000000..c1c82d6fcb --- /dev/null +++ b/dom/webidl/SVGUnitTypes.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://svgwg.org/svg2-draft/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGUnitTypes { + // Unit Types + const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0; + const unsigned short SVG_UNIT_TYPE_USERSPACEONUSE = 1; + const unsigned short SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 2; +}; diff --git a/dom/webidl/SVGUseElement.webidl b/dom/webidl/SVGUseElement.webidl new file mode 100644 index 0000000000..1da30df0a5 --- /dev/null +++ b/dom/webidl/SVGUseElement.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGUseElement : SVGGraphicsElement { + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; + //readonly attribute SVGElementInstance instanceRoot; + //readonly attribute SVGElementInstance animatedInstanceRoot; +}; + +SVGUseElement includes SVGURIReference; diff --git a/dom/webidl/SVGViewElement.webidl b/dom/webidl/SVGViewElement.webidl new file mode 100644 index 0000000000..e70620e2c1 --- /dev/null +++ b/dom/webidl/SVGViewElement.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface SVGViewElement : SVGElement { +}; + +SVGViewElement includes SVGFitToViewBox; +SVGViewElement includes SVGZoomAndPan; diff --git a/dom/webidl/SVGZoomAndPan.webidl b/dom/webidl/SVGZoomAndPan.webidl new file mode 100644 index 0000000000..d6c9aa012f --- /dev/null +++ b/dom/webidl/SVGZoomAndPan.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface mixin SVGZoomAndPan { + // Zoom and Pan Types + const unsigned short SVG_ZOOMANDPAN_UNKNOWN = 0; + const unsigned short SVG_ZOOMANDPAN_DISABLE = 1; + const unsigned short SVG_ZOOMANDPAN_MAGNIFY = 2; + + [SetterThrows] + attribute unsigned short zoomAndPan; +}; diff --git a/dom/webidl/Sanitizer.webidl b/dom/webidl/Sanitizer.webidl new file mode 100644 index 0000000000..5ddea5fb18 --- /dev/null +++ b/dom/webidl/Sanitizer.webidl @@ -0,0 +1,59 @@ +/* -*- 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://wicg.github.io/sanitizer-api/#sanitizer + * https://wicg.github.io/sanitizer-api/#config + * + * * Copyright © 2020 the Contributors to the HTML Sanitizer API Specification, + * published by the Web Platform Incubator Community Group under the W3C Community Contributor License Agreement (CLA). + */ + +// NOTE: This IDL is still under development: +// https://github.com/WICG/sanitizer-api/issues/181 + + +dictionary SanitizerElementNamespace { + required DOMString name; + DOMString? _namespace = "http://www.w3.org/1999/xhtml"; +}; + +// Used by "elements" +dictionary SanitizerElementNamespaceWithAttributes : SanitizerElementNamespace { + sequence<SanitizerAttribute> attributes; + sequence<SanitizerAttribute> removeAttributes; +}; + +typedef (DOMString or SanitizerElementNamespace) SanitizerElement; +typedef (DOMString or SanitizerElementNamespaceWithAttributes) SanitizerElementWithAttributes; + +dictionary SanitizerAttributeNamespace { + required DOMString name; + DOMString? _namespace = null; +}; +typedef (DOMString or SanitizerAttributeNamespace) SanitizerAttribute; + +dictionary SanitizerConfig { + sequence<SanitizerElementWithAttributes> elements; + sequence<SanitizerElement> removeElements; + sequence<SanitizerElement> replaceWithChildrenElements; + + sequence<SanitizerAttribute> attributes; + sequence<SanitizerAttribute> removeAttributes; + + boolean customElements; + boolean unknownMarkup; // Name TBD! + boolean comments; +}; + +typedef (DocumentFragment or Document) SanitizerInput; + +[Exposed=Window, SecureContext, Pref="dom.security.sanitizer.enabled"] +interface Sanitizer { + [Throws, UseCounter] + constructor(optional SanitizerConfig sanitizerConfig = {}); + [UseCounter, Throws] + DocumentFragment sanitize(SanitizerInput input); +}; diff --git a/dom/webidl/Screen.webidl b/dom/webidl/Screen.webidl new file mode 100644 index 0000000000..c929fe4b48 --- /dev/null +++ b/dom/webidl/Screen.webidl @@ -0,0 +1,73 @@ +/* -*- 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/. */ + +[Exposed=Window] +interface Screen : EventTarget { + // CSSOM-View + // http://dev.w3.org/csswg/cssom-view/#the-screen-interface + readonly attribute long availWidth; + readonly attribute long availHeight; + readonly attribute long width; + readonly attribute long height; + readonly attribute long colorDepth; + readonly attribute long pixelDepth; + + readonly attribute long top; + readonly attribute long left; + readonly attribute long availTop; + readonly attribute long availLeft; + + /** + * DEPRECATED, use ScreenOrientation API instead. + * Returns the current screen orientation. + * Can be: landscape-primary, landscape-secondary, + * portrait-primary or portrait-secondary. + */ + [NeedsCallerType] + readonly attribute DOMString mozOrientation; + + attribute EventHandler onmozorientationchange; + + /** + * DEPRECATED, use ScreenOrientation API instead. + * Lock/unlock screen orientation to the specified type. + * + * FIXME(emilio): These do literally nothing, we should + * try to remove these. + */ + boolean mozLockOrientation(DOMString orientation); + boolean mozLockOrientation(sequence<DOMString> orientation); + undefined mozUnlockOrientation(); +}; + +// https://w3c.github.io/screen-orientation +partial interface Screen { + readonly attribute ScreenOrientation orientation; +}; + +// https://wicg.github.io/media-capabilities/#idl-index +enum ScreenColorGamut { + "srgb", + "p3", + "rec2020", +}; + +[Func="nsScreen::MediaCapabilitiesEnabled", + Exposed=Window] +interface ScreenLuminance { + readonly attribute double min; + readonly attribute double max; + readonly attribute double maxAverage; +}; + +partial interface Screen { + [Func="nsScreen::MediaCapabilitiesEnabled"] + readonly attribute ScreenColorGamut colorGamut; + [Func="nsScreen::MediaCapabilitiesEnabled"] + readonly attribute ScreenLuminance? luminance; + + [Func="nsScreen::MediaCapabilitiesEnabled"] + attribute EventHandler onchange; +}; diff --git a/dom/webidl/ScreenOrientation.webidl b/dom/webidl/ScreenOrientation.webidl new file mode 100644 index 0000000000..9a911991b6 --- /dev/null +++ b/dom/webidl/ScreenOrientation.webidl @@ -0,0 +1,42 @@ +/* -*- 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/screen-orientation + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights + * Reserved. W3C liability, trademark and document use rules apply. + */ + +enum OrientationType { + "portrait-primary", + "portrait-secondary", + "landscape-primary", + "landscape-secondary" +}; + +enum OrientationLockType { + "any", + "natural", + "landscape", + "portrait", + "portrait-primary", + "portrait-secondary", + "landscape-primary", + "landscape-secondary" +}; + +[Exposed=Window] +interface ScreenOrientation : EventTarget { + [NewObject] + Promise<undefined> lock(OrientationLockType orientation); + [Throws] + undefined unlock(); + [Throws, NeedsCallerType] + readonly attribute OrientationType type; + [Throws, NeedsCallerType] + readonly attribute unsigned short angle; + attribute EventHandler onchange; +}; diff --git a/dom/webidl/ScriptProcessorNode.webidl b/dom/webidl/ScriptProcessorNode.webidl new file mode 100644 index 0000000000..7df0cf6112 --- /dev/null +++ b/dom/webidl/ScriptProcessorNode.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface ScriptProcessorNode : AudioNode { + + attribute EventHandler onaudioprocess; + + readonly attribute long bufferSize; + +}; + +// Mozilla extension +ScriptProcessorNode includes AudioNodePassThrough; diff --git a/dom/webidl/ScrollAreaEvent.webidl b/dom/webidl/ScrollAreaEvent.webidl new file mode 100644 index 0000000000..47fd684bf6 --- /dev/null +++ b/dom/webidl/ScrollAreaEvent.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface ScrollAreaEvent : UIEvent +{ + readonly attribute float x; + readonly attribute float y; + readonly attribute float width; + readonly attribute float height; + + undefined initScrollAreaEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional Window? view = null, + optional long detail = 0, + optional float x = 0, + optional float y = 0, + optional float width = 0, + optional float height = 0); +}; diff --git a/dom/webidl/ScrollViewChangeEvent.webidl b/dom/webidl/ScrollViewChangeEvent.webidl new file mode 100644 index 0000000000..df9f83b7b6 --- /dev/null +++ b/dom/webidl/ScrollViewChangeEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +enum ScrollState {"started", "stopped"}; + +dictionary ScrollViewChangeEventInit : EventInit { + ScrollState state = "started"; +}; + +[ChromeOnly, + Exposed=Window] +interface ScrollViewChangeEvent : Event { + constructor(DOMString type, + optional ScrollViewChangeEventInit eventInit = {}); + + readonly attribute ScrollState state; +}; diff --git a/dom/webidl/SecurityPolicyViolationEvent.webidl b/dom/webidl/SecurityPolicyViolationEvent.webidl new file mode 100644 index 0000000000..5578238347 --- /dev/null +++ b/dom/webidl/SecurityPolicyViolationEvent.webidl @@ -0,0 +1,45 @@ +/* This Source Code Form is subject to the terms of 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 SecurityPolicyViolationEventDisposition +{ + "enforce", "report" +}; + +[Exposed=Window] +interface SecurityPolicyViolationEvent : Event +{ + constructor(DOMString type, + optional SecurityPolicyViolationEventInit eventInitDict = {}); + + readonly attribute DOMString documentURI; + readonly attribute DOMString referrer; + readonly attribute DOMString blockedURI; + readonly attribute DOMString violatedDirective; + readonly attribute DOMString effectiveDirective; + readonly attribute DOMString originalPolicy; + readonly attribute DOMString sourceFile; + readonly attribute DOMString sample; + readonly attribute SecurityPolicyViolationEventDisposition disposition; + readonly attribute unsigned short statusCode; + readonly attribute long lineNumber; + readonly attribute long columnNumber; +}; + +[GenerateInitFromJSON, GenerateToJSON] +dictionary SecurityPolicyViolationEventInit : EventInit +{ + DOMString documentURI = ""; + DOMString referrer = ""; + DOMString blockedURI = ""; + DOMString violatedDirective = ""; + DOMString effectiveDirective = ""; + DOMString originalPolicy = ""; + DOMString sourceFile = ""; + DOMString sample = ""; + SecurityPolicyViolationEventDisposition disposition = "report"; + unsigned short statusCode = 0; + long lineNumber = 0; + long columnNumber = 0; +}; diff --git a/dom/webidl/Selection.webidl b/dom/webidl/Selection.webidl new file mode 100644 index 0000000000..496ebc0813 --- /dev/null +++ b/dom/webidl/Selection.webidl @@ -0,0 +1,159 @@ +/* -*- 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/selection-api/#selection-interface + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface Selection { + [NeedsCallerType] + readonly attribute Node? anchorNode; + [NeedsCallerType] + readonly attribute unsigned long anchorOffset; + [NeedsCallerType] + readonly attribute Node? focusNode; + [NeedsCallerType] + readonly attribute unsigned long focusOffset; + readonly attribute boolean isCollapsed; + /** + * Returns the number of ranges in the selection. + */ + readonly attribute unsigned long rangeCount; + readonly attribute DOMString type; + /** + * Returns the range at the specified index. Throws if the index is + * out of range. + */ + [Throws] + Range getRangeAt(unsigned long index); + /** + * Adds a range to the current selection. + */ + [Throws, BinaryName="addRangeJS"] + undefined addRange(Range range); + /** + * Removes a range from the current selection. + */ + [Throws, BinaryName="removeRangeAndUnselectFramesAndNotifyListeners"] + undefined removeRange(Range range); + /** + * Removes all ranges from the current selection. + */ + [Throws] + undefined removeAllRanges(); + [Throws, BinaryName="RemoveAllRanges"] + undefined empty(); + [Throws, BinaryName="collapseJS"] + undefined collapse(Node? node, optional unsigned long offset = 0); + [Throws, BinaryName="collapseJS"] + undefined setPosition(Node? node, optional unsigned long offset = 0); + [Throws, BinaryName="collapseToStartJS"] + undefined collapseToStart(); + [Throws, BinaryName="collapseToEndJS"] + undefined collapseToEnd(); + [Throws, BinaryName="extendJS"] + undefined extend(Node node, optional unsigned long offset = 0); + [Throws, BinaryName="setBaseAndExtentJS"] + undefined setBaseAndExtent(Node anchorNode, + unsigned long anchorOffset, + Node focusNode, + unsigned long focusOffset); + [Throws, BinaryName="selectAllChildrenJS"] + undefined selectAllChildren(Node node); + [CEReactions, Throws] + undefined deleteFromDocument(); + [Throws] + boolean containsNode(Node node, + optional boolean allowPartialContainment = false); + stringifier DOMString (); +}; + +// Additional methods not currently in the spec +partial interface Selection { + [Throws] + undefined modify(DOMString alter, DOMString direction, + DOMString granularity); +}; + +// Additional chrome-only methods. +interface nsISelectionListener; +partial interface Selection { + /** + * A true value means "selection after newline"; false means "selection before + * newline" when a selection is positioned "between lines". + */ + [ChromeOnly,Throws, BinaryName=interlinePositionJS] + attribute boolean interlinePosition; + + [Throws] + attribute short? caretBidiLevel; + + [ChromeOnly,Throws] + DOMString toStringWithFormat(DOMString formatType, unsigned long flags, long wrapColumn); + [ChromeOnly] + undefined addSelectionListener(nsISelectionListener newListener); + [ChromeOnly] + undefined removeSelectionListener(nsISelectionListener listenerToRemove); + + [ChromeOnly,BinaryName="rawType"] + readonly attribute short selectionType; + + /** + * Return array of ranges intersecting with the given DOM interval. + */ + [ChromeOnly,Throws,Pref="dom.testing.selection.GetRangesForInterval"] + sequence<Range> GetRangesForInterval(Node beginNode, long beginOffset, Node endNode, long endOffset, + boolean allowAdjacent); + + /** + * Scrolls a region of the selection, so that it is visible in + * the scrolled view. + * + * @param aRegion the region inside the selection to scroll into view + * (see selection region constants defined in + * nsISelectionController). + * @param aIsSynchronous when true, scrolls the selection into view + * before returning. If false, posts a request which + * is processed at some point after the method returns. + * @param aVPercent how to align the frame vertically. + * @param aHPercent how to align the frame horizontally. + */ + [ChromeOnly,Throws] + undefined scrollIntoView(short aRegion, boolean aIsSynchronous, short aVPercent, short aHPercent); + + /** + * setColors() sets custom colors for the selection. + * Currently, this is supported only when the selection type is SELECTION_FIND. + * Otherwise, throws an exception. + * + * @param aForegroundColor The foreground color of the selection. + * If this is "currentColor", foreground color + * isn't changed by this selection. + * @param aBackgroundColor The background color of the selection. + * If this is "transparent", background color is + * never painted. + * @param aAltForegroundColor The alternative foreground color of the + * selection. + * If aBackgroundColor doesn't have sufficient + * contrast with its around or foreground color + * if "currentColor" is specified, alternative + * colors are used if it have higher contrast. + * @param aAltBackgroundColor The alternative background color of the + * selection. + */ + [ChromeOnly,Throws] + undefined setColors(DOMString aForegroundColor, DOMString aBackgroundColor, + DOMString aAltForegroundColor, DOMString aAltBackgroundColor); + + /** + * resetColors() forget the customized colors which were set by setColors(). + */ + [ChromeOnly] + undefined resetColors(); +}; diff --git a/dom/webidl/ServiceWorker.webidl b/dom/webidl/ServiceWorker.webidl new file mode 100644 index 0000000000..a62790b5dc --- /dev/null +++ b/dom/webidl/ServiceWorker.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-obj + * + */ + +// Still unclear what should be subclassed. +// https://github.com/slightlyoff/ServiceWorker/issues/189 +[Func="ServiceWorkerVisible", + // FIXME(nsm): Bug 1113522. This is exposed to satisfy webidl constraints, but it won't actually work. + Exposed=(Window,Worker)] +interface ServiceWorker : EventTarget { + readonly attribute USVString scriptURL; + readonly attribute ServiceWorkerState state; + + attribute EventHandler onstatechange; + + [Throws] + undefined postMessage(any message, sequence<object> transferable); + [Throws] + undefined postMessage(any message, optional StructuredSerializeOptions options = {}); +}; + +ServiceWorker includes AbstractWorker; + +enum ServiceWorkerState { + // https://github.com/w3c/ServiceWorker/issues/1162 + "parsed", + + "installing", + "installed", + "activating", + "activated", + "redundant" +}; diff --git a/dom/webidl/ServiceWorkerContainer.webidl b/dom/webidl/ServiceWorkerContainer.webidl new file mode 100644 index 0000000000..cecc2e01ab --- /dev/null +++ b/dom/webidl/ServiceWorkerContainer.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/ServiceWorker/#serviceworkercontainer + * + */ + +[Func="ServiceWorkersEnabled", + Exposed=Window] +interface ServiceWorkerContainer : EventTarget { + // FIXME(nsm): + // https://github.com/slightlyoff/ServiceWorker/issues/198 + // and discussion at https://etherpad.mozilla.org/serviceworker07apr + readonly attribute ServiceWorker? controller; + + [Throws] + readonly attribute Promise<ServiceWorkerRegistration> ready; + + [NewObject, NeedsCallerType] + Promise<ServiceWorkerRegistration> register(USVString scriptURL, + optional RegistrationOptions options = {}); + + [NewObject] + Promise<(ServiceWorkerRegistration or undefined)> getRegistration(optional USVString documentURL = ""); + + [NewObject] + Promise<sequence<ServiceWorkerRegistration>> getRegistrations(); + + undefined startMessages(); + + attribute EventHandler oncontrollerchange; + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; + +// Testing only. +partial interface ServiceWorkerContainer { + [Throws,Pref="dom.serviceWorkers.testing.enabled"] + DOMString getScopeForUrl(DOMString url); +}; + +dictionary RegistrationOptions { + USVString scope; + ServiceWorkerUpdateViaCache updateViaCache = "imports"; +}; diff --git a/dom/webidl/ServiceWorkerGlobalScope.webidl b/dom/webidl/ServiceWorkerGlobalScope.webidl new file mode 100644 index 0000000000..914fc37c8b --- /dev/null +++ b/dom/webidl/ServiceWorkerGlobalScope.webidl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * http://w3c.github.io/push-api/ + * https://notifications.spec.whatwg.org/ + * + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +[Global=(Worker,ServiceWorker), + Exposed=ServiceWorker] +interface ServiceWorkerGlobalScope : WorkerGlobalScope { + [SameObject, BinaryName="GetClients"] + readonly attribute Clients clients; + [SameObject] readonly attribute ServiceWorkerRegistration registration; + + [Throws, NewObject] + Promise<undefined> skipWaiting(); + + attribute EventHandler oninstall; + attribute EventHandler onactivate; + + attribute EventHandler onfetch; + + // The event.source of these MessageEvents are instances of Client + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; + +// These are from w3c.github.io/push-api/ +partial interface ServiceWorkerGlobalScope { + attribute EventHandler onpush; + attribute EventHandler onpushsubscriptionchange; +}; + +// https://notifications.spec.whatwg.org/ +partial interface ServiceWorkerGlobalScope { + attribute EventHandler onnotificationclick; + attribute EventHandler onnotificationclose; +}; + +// Mixin the WebExtensions API globals (the actual properties are only available to +// extension service workers, locked behind a Func="extensions::ExtensionAPIAllowed" annotation). +ServiceWorkerGlobalScope includes ExtensionGlobalsMixin; diff --git a/dom/webidl/ServiceWorkerRegistration.webidl b/dom/webidl/ServiceWorkerRegistration.webidl new file mode 100644 index 0000000000..6acb887cd6 --- /dev/null +++ b/dom/webidl/ServiceWorkerRegistration.webidl @@ -0,0 +1,54 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * https://w3c.github.io/push-api/ + * https://notifications.spec.whatwg.org/ + */ + +[Func="ServiceWorkerVisible", + Exposed=(Window,Worker)] +interface ServiceWorkerRegistration : EventTarget { + readonly attribute ServiceWorker? installing; + readonly attribute ServiceWorker? waiting; + readonly attribute ServiceWorker? active; + + [Pref="dom.serviceWorkers.navigationPreload.enabled", SameObject] + readonly attribute NavigationPreloadManager navigationPreload; + + readonly attribute USVString scope; + [Throws] + readonly attribute ServiceWorkerUpdateViaCache updateViaCache; + + [Throws, NewObject] + Promise<undefined> update(); + + [Throws, NewObject] + Promise<boolean> unregister(); + + // event + attribute EventHandler onupdatefound; +}; + +enum ServiceWorkerUpdateViaCache { + "imports", + "all", + "none" +}; + +// https://w3c.github.io/push-api/ +partial interface ServiceWorkerRegistration { + [Throws, Exposed=(Window,Worker), Pref="dom.push.enabled"] + readonly attribute PushManager pushManager; +}; + +// https://notifications.spec.whatwg.org/ +partial interface ServiceWorkerRegistration { + [NewObject, Func="mozilla::dom::Notification::PrefEnabled"] + Promise<undefined> showNotification(DOMString title, optional NotificationOptions options = {}); + [NewObject, Func="mozilla::dom::Notification::PrefEnabled"] + Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter = {}); +}; diff --git a/dom/webidl/ShadowRealmGlobalScope.webidl b/dom/webidl/ShadowRealmGlobalScope.webidl new file mode 100644 index 0000000000..5593a9b2c7 --- /dev/null +++ b/dom/webidl/ShadowRealmGlobalScope.webidl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// This interface exists purely to register a new global as part of +// code generation so that we can properly hook this into +// shadow realms. +[Global=(ShadowRealmGlobal), Exposed=ShadowRealmGlobal, LegacyNoInterfaceObject] +interface ShadowRealmGlobalScope { }; diff --git a/dom/webidl/ShadowRoot.webidl b/dom/webidl/ShadowRoot.webidl new file mode 100644 index 0000000000..57051c5e7f --- /dev/null +++ b/dom/webidl/ShadowRoot.webidl @@ -0,0 +1,67 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +// https://dom.spec.whatwg.org/#enumdef-shadowrootmode +enum ShadowRootMode { + "open", + "closed" +}; + +enum SlotAssignmentMode { "manual", "named" }; + +// https://dom.spec.whatwg.org/#shadowroot +[Exposed=Window, + InstrumentedProps=(pictureInPictureElement)] +interface ShadowRoot : DocumentFragment +{ + // Shadow DOM v1 + readonly attribute ShadowRootMode mode; + readonly attribute boolean delegatesFocus; + readonly attribute SlotAssignmentMode slotAssignment; + [Pref="dom.webcomponents.shadowdom.declarative.enabled"] + readonly attribute boolean clonable; + readonly attribute Element host; + attribute EventHandler onslotchange; + + Element? getElementById(DOMString elementId); + + // https://w3c.github.io/DOM-Parsing/#the-innerhtml-mixin + [CEReactions, SetterThrows] + attribute [LegacyNullToEmptyString] DOMString innerHTML; + + // When JS invokes importNode or createElement, the binding code needs to + // create a reflector, and so invoking those methods directly on the content + // document would cause the reflector to be created in the content scope, + // at which point it would be difficult to move into the UA Widget scope. + // As such, these methods allow UA widget code to simultaneously create nodes + // and associate them with the UA widget tree, so that the reflectors get + // created in the right scope. + [CEReactions, Throws, Func="IsChromeOrUAWidget"] + Node importNodeAndAppendChildAt(Node parentNode, Node node, optional boolean deep = false); + + [CEReactions, Throws, Func="IsChromeOrUAWidget"] + Node createElementAndAppendChildAt(Node parentNode, DOMString localName); + + // For triggering UA Widget scope in tests. + [ChromeOnly] + undefined setIsUAWidget(); + [ChromeOnly] + boolean isUAWidget(); +}; + +partial interface ShadowRoot { + // https://html.spec.whatwg.org/#dom-shadowroot-sethtmlunsafe + [Pref="dom.webcomponents.shadowdom.declarative.enabled"] + undefined setHTMLUnsafe(DOMString html); +}; + +ShadowRoot includes DocumentOrShadowRoot; diff --git a/dom/webidl/SharedWorker.webidl b/dom/webidl/SharedWorker.webidl new file mode 100644 index 0000000000..3a4d9b3ebe --- /dev/null +++ b/dom/webidl/SharedWorker.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface SharedWorker : EventTarget { + [Throws] + constructor(USVString scriptURL, + optional (DOMString or WorkerOptions) options = {}); + + readonly attribute MessagePort port; +}; + +SharedWorker includes AbstractWorker; diff --git a/dom/webidl/SharedWorkerGlobalScope.webidl b/dom/webidl/SharedWorkerGlobalScope.webidl new file mode 100644 index 0000000000..c0ff63217d --- /dev/null +++ b/dom/webidl/SharedWorkerGlobalScope.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#the-workerglobalscope-common-interface + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera + * Software ASA. + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +[Global=(Worker,SharedWorker), + Exposed=SharedWorker] +interface SharedWorkerGlobalScope : WorkerGlobalScope { + [Replaceable] + readonly attribute DOMString name; + + undefined close(); + + attribute EventHandler onconnect; +}; diff --git a/dom/webidl/SimpleGestureEvent.webidl b/dom/webidl/SimpleGestureEvent.webidl new file mode 100644 index 0000000000..048f49df48 --- /dev/null +++ b/dom/webidl/SimpleGestureEvent.webidl @@ -0,0 +1,201 @@ +/* -*- 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 SimpleGestureEvent interface is the datatype for all + * Mozilla-specific simple gesture events in the Document Object Model. + * + * The following events are generated: + * + * MozSwipeGestureMayStart - Generated when the user starts a horizontal + * swipe across the input device, but before we know whether the user + * is actually scrolling past a scroll edge. + * This event asks two questions: Should a swipe really be started, and + * in which directions should the user be able to swipe? The first + * question is answered by event listeners by calling or not calling + * preventDefault() on the event. Since a swipe swallows all scroll + * events, the default action of the swipe start event is *not* to + * start a swipe. Call preventDefault() if you want a swipe to be + * started. Doing so won't necessarily result in a swipe being started, + * it only communicates an intention. Once Gecko determines whether a + * swipe should actually be started, it will send a MozSwipeGestureStart + * event. + * The second question (swipe-able directions) is answered in the + * allowedDirections field. + * + * MozSwipeGestureStart - This event signals the start of a swipe. + * It guarantees a future MozSwipeGestureEnd event that will signal + * the end of a swipe animation. + * + * MozSwipeGestureUpdate - Generated periodically while the user is + * continuing a horizontal swipe gesture. The "delta" value represents + * the current absolute gesture amount. This event may even be sent + * after a MozSwipeGesture event fired in order to allow for fluid + * completion of a swipe animation. The direction value is meaningless + * on swipe update events. + * + * MozSwipeGestureEnd - Generated when the swipe animation is completed. + * + * MozSwipeGesture - Generated when the user releases a swipe across + * across the input device. This event signals that the actual swipe + * operation is complete, even though the animation might not be finished + * yet. This event can be sent without accompanying start / update / end + * events, and it can also be handled on its own if the consumer doesn't + * want to handle swipe animation events. + * Only the direction value has any significance, the delta value is + * meaningless. + * + * MozMagnifyGestureStart - Generated when the user begins the magnify + * ("pinch") gesture. The "delta" value represents the initial + * movement. + * + * MozMagnifyGestureUpdate - Generated periodically while the user is + * continuing the magnify ("pinch") gesture. The "delta" value + * represents the movement since the last MozMagnifyGestureStart or + * MozMagnifyGestureUpdate event. + * + * MozMagnifyGesture - Generated when the user has completed the + * magnify ("pinch") gesture. If you only want to receive a single + * event when the magnify gesture is complete, you only need to hook + * this event and can safely ignore the MozMagnifyGestureStart and the + * MozMagnifyGestureUpdate events. The "delta" value is the cumulative + * amount represented by the user's gesture. + * + * MozRotateGestureStart - Generated when the user begins the rotation + * gesture. The "delta" value represents the initial rotation. + * + * MozRotateGestureUpdate - Generated periodically while the user is + * continuing the rotation gesture. The "delta" value represents the + * rotation since the last MozRotateGestureStart or + * MozRotateGestureUpdate event. + * + * MozRotateGesture - Generated when the user has completed the + * rotation gesture. If you only want to receive a single event when + * the rotation gesture is complete, you only need to hook this event + * and can safely ignore the MozRotateGestureStart and the + * MozRotateGestureUpdate events. The "delta" value is the cumulative + * amount of rotation represented by the user's gesture. + * + * MozTapGesture - Generated when the user executes a two finger + * tap gesture on the input device. Client coordinates contain the + * center point of the tap. + * (XXX On OS X, only Lion (10.7) and up) + * + * MozPressTapGesture - Generated when the user executes a press + * and tap two finger gesture (first finger down, second finger down, + * second finger up, first finger up) on the input device. + * Client coordinates contain the center pivot point of the action. + * (XXX Not implemented on Mac) + * + * MozEdgeUIGesture - Generated when the user swipes the display to + * invoke edge ui. + * (XXX Win8 only) + * + * Default behavior: + * + * Some operating systems support default behaviors for gesture events + * when they are not handled by the application. Consumers should + * use event.preventDefault() to prevent default behavior when + * consuming events. + */ + +[ChromeOnly, + Exposed=Window] +interface SimpleGestureEvent : MouseEvent +{ + /* Swipe direction constants */ + const unsigned long DIRECTION_UP = 1; + const unsigned long DIRECTION_DOWN = 2; + const unsigned long DIRECTION_LEFT = 4; + const unsigned long DIRECTION_RIGHT = 8; + + /* Rotational direction constants */ + const unsigned long ROTATION_COUNTERCLOCKWISE = 1; + const unsigned long ROTATION_CLOCKWISE = 2; + + /* Read-write value for swipe events. + * + * Reports the directions that can be swiped to; multiple directions + * should be OR'ed together. + * + * The allowedDirections field is designed to be set on SwipeGestureMayStart + * events by event listeners. Its value after event dispatch determines + * the behavior of the swipe animation that might be about to begin. + * Specifically, if the user swipes in a direction that can't be swiped + * to, the animation will have a bounce effect. + * Future SwipeGestureUpdate, SwipeGesture and SwipeGestureEnd events + * will carry the allowDirections value that was set on the SwipeMayStart + * event. Changing this field on non-SwipeGestureMayStart events doesn't + * have any effect. + */ + attribute unsigned long allowedDirections; + + /* Direction of a gesture. Diagonals are indicated by OR'ing the + * applicable constants together. + * + * Swipes gestures may occur in any direction. + * + * Magnify gestures do not have a direction. + * + * Rotation gestures will be either ROTATION_COUNTERCLOCKWISE or + * ROTATION_CLOCKWISE. + */ + readonly attribute unsigned long direction; + + /* Delta value for magnify, rotate and swipe gestures. + * + * For rotation, the value is in degrees and is positive for + * clockwise rotation and negative for counterclockwise + * rotation. + * + * For magnification, the value will be positive for a "zoom in" + * (i.e, increased magnification) and negative for a "zoom out" + * (i.e., decreased magnification). The particular units + * represented by the "delta" are currently implementation specific. + * + * XXX - The units for measuring magnification are currently + * unspecified because the units used by Mac OS X are currently + * undocumented. The values are typically in the range of 0.0 to + * 100.0, but it is only safe currently to rely on the delta being + * positive or negative. + * + * For swipe start, update and end events, the value is a fraction + * of one "page". If the resulting swipe will have DIRECTION_LEFT, the + * delta value will be positive; for DIRECTION_RIGHT, delta is negative. + * If this seems backwards to you, look at it this way: If the current + * page is pushed to the right during the animation (positive delta), + * the page left to the current page will be visible after the swipe + * (DIRECTION_LEFT). + * + * Units on Windows represent the difference between the initial + * and current/final width between the two touch points on the input + * device and are measured in pixels. + */ + readonly attribute double delta; + + /* Click count value for taps. */ + readonly attribute unsigned long clickCount; + + undefined initSimpleGestureEvent(DOMString typeArg, + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional Window? viewArg = null, + optional long detailArg = 0, + optional long screenXArg = 0, + optional long screenYArg = 0, + optional long clientXArg = 0, + optional long clientYArg = 0, + optional boolean ctrlKeyArg = false, + optional boolean altKeyArg = false, + optional boolean shiftKeyArg = false, + optional boolean metaKeyArg = false, + optional short buttonArg = 0, + optional EventTarget? relatedTargetArg = null, + optional unsigned long allowedDirectionsArg = 0, + optional unsigned long directionArg = 0, + optional double deltaArg = 0, + optional unsigned long clickCount = 0); +}; diff --git a/dom/webidl/SocketCommon.webidl b/dom/webidl/SocketCommon.webidl new file mode 100644 index 0000000000..044199ea2b --- /dev/null +++ b/dom/webidl/SocketCommon.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/2012/sysapps/tcp-udp-sockets/#readystate + */ + +enum SocketReadyState { + "opening", + "open", + "closing", + "closed", + "halfclosed" +}; diff --git a/dom/webidl/SourceBuffer.webidl b/dom/webidl/SourceBuffer.webidl new file mode 100644 index 0000000000..0ca93422ec --- /dev/null +++ b/dom/webidl/SourceBuffer.webidl @@ -0,0 +1,67 @@ +/* -*- 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://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum SourceBufferAppendMode { + "segments", + "sequence" +}; + +[Pref="media.mediasource.enabled", + Exposed=Window] +interface SourceBuffer : EventTarget { + [SetterThrows] + attribute SourceBufferAppendMode mode; + readonly attribute boolean updating; + [Throws] + readonly attribute TimeRanges buffered; + [SetterThrows] + attribute double timestampOffset; + //readonly attribute AudioTrackList audioTracks; + //readonly attribute VideoTrackList videoTracks; + //readonly attribute TextTrackList textTracks; + [SetterThrows] + attribute double appendWindowStart; + [SetterThrows] + attribute unrestricted double appendWindowEnd; + attribute EventHandler onupdatestart; + attribute EventHandler onupdate; + attribute EventHandler onupdateend; + attribute EventHandler onerror; + attribute EventHandler onabort; + [Throws] + undefined appendBuffer(ArrayBuffer data); + [Throws] + undefined appendBuffer(ArrayBufferView data); + //[Throws] + //undefined appendStream(Stream stream, [EnforceRange] optional unsigned long long maxSize); + [Throws] + undefined abort(); + [Throws] + undefined remove(double start, unrestricted double end); +}; + +// Mozilla extensions for experimental features +partial interface SourceBuffer { + // Experimental function as proposed in: + // https://github.com/w3c/media-source/issues/100 for promise proposal. + [NewObject, Pref="media.mediasource.experimental.enabled"] + Promise<undefined> appendBufferAsync(ArrayBuffer data); + [NewObject, Pref="media.mediasource.experimental.enabled"] + Promise<undefined> appendBufferAsync(ArrayBufferView data); + [NewObject, Pref="media.mediasource.experimental.enabled"] + Promise<undefined> removeAsync(double start, unrestricted double end); + + // Experimental function as proposed in: + // https://github.com/w3c/media-source/issues/155 + [Throws] + undefined changeType(DOMString type); +}; diff --git a/dom/webidl/SourceBufferList.webidl b/dom/webidl/SourceBufferList.webidl new file mode 100644 index 0000000000..ff5d85fa34 --- /dev/null +++ b/dom/webidl/SourceBufferList.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.mediasource.enabled", + Exposed=Window] +interface SourceBufferList : EventTarget { + readonly attribute unsigned long length; + attribute EventHandler onaddsourcebuffer; + attribute EventHandler onremovesourcebuffer; + getter SourceBuffer (unsigned long index); +}; diff --git a/dom/webidl/SpeechGrammar.webidl b/dom/webidl/SpeechGrammar.webidl new file mode 100644 index 0000000000..4e74a94fd2 --- /dev/null +++ b/dom/webidl/SpeechGrammar.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.recognition.enable", + LegacyFactoryFunction=webkitSpeechGrammar, + Func="SpeechRecognition::IsAuthorized", + Exposed=Window] +interface SpeechGrammar { + constructor(); + + [Throws] + attribute DOMString src; + [Throws] + attribute float weight; +}; diff --git a/dom/webidl/SpeechGrammarList.webidl b/dom/webidl/SpeechGrammarList.webidl new file mode 100644 index 0000000000..d45c11c25a --- /dev/null +++ b/dom/webidl/SpeechGrammarList.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.recognition.enable", + LegacyFactoryFunction=webkitSpeechGrammarList, + Func="SpeechRecognition::IsAuthorized", + Exposed=Window] +interface SpeechGrammarList { + constructor(); + + readonly attribute unsigned long length; + [Throws] + getter SpeechGrammar item(unsigned long index); + [Throws] + undefined addFromURI(DOMString src, optional float weight); + [Throws] + undefined addFromString(DOMString string, optional float weight); +}; diff --git a/dom/webidl/SpeechRecognition.webidl b/dom/webidl/SpeechRecognition.webidl new file mode 100644 index 0000000000..cae6a44536 --- /dev/null +++ b/dom/webidl/SpeechRecognition.webidl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.recognition.enable", + LegacyFactoryFunction=webkitSpeechRecognition, + Func="SpeechRecognition::IsAuthorized", + Exposed=Window] +interface SpeechRecognition : EventTarget { + [Throws] + constructor(); + + // recognition parameters + attribute SpeechGrammarList grammars; + attribute DOMString lang; + [Throws] + attribute boolean continuous; + attribute boolean interimResults; + attribute unsigned long maxAlternatives; + [Throws] + attribute DOMString serviceURI; + + // methods to drive the speech interaction + [Throws, NeedsCallerType] + undefined start(optional MediaStream stream); + undefined stop(); + undefined abort(); + + // event methods + attribute EventHandler onaudiostart; + attribute EventHandler onsoundstart; + attribute EventHandler onspeechstart; + attribute EventHandler onspeechend; + attribute EventHandler onsoundend; + attribute EventHandler onaudioend; + attribute EventHandler onresult; + attribute EventHandler onnomatch; + attribute EventHandler onerror; + attribute EventHandler onstart; + attribute EventHandler onend; +}; diff --git a/dom/webidl/SpeechRecognitionAlternative.webidl b/dom/webidl/SpeechRecognitionAlternative.webidl new file mode 100644 index 0000000000..746c6b125b --- /dev/null +++ b/dom/webidl/SpeechRecognitionAlternative.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.recognition.enable", + Func="SpeechRecognition::IsAuthorized", + Exposed=Window] +interface SpeechRecognitionAlternative { + readonly attribute DOMString transcript; + readonly attribute float confidence; +}; diff --git a/dom/webidl/SpeechRecognitionError.webidl b/dom/webidl/SpeechRecognitionError.webidl new file mode 100644 index 0000000000..7e1905eece --- /dev/null +++ b/dom/webidl/SpeechRecognitionError.webidl @@ -0,0 +1,34 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +enum SpeechRecognitionErrorCode { + "no-speech", + "aborted", + "audio-capture", + "network", + "not-allowed", + "service-not-allowed", + "bad-grammar", + "language-not-supported" +}; + +[Pref="media.webspeech.recognition.enable", + Func="SpeechRecognition::IsAuthorized", + Exposed=Window] +interface SpeechRecognitionError : Event +{ + constructor(DOMString type, + optional SpeechRecognitionErrorInit eventInitDict = {}); + + readonly attribute SpeechRecognitionErrorCode error; + readonly attribute DOMString? message; +}; + +dictionary SpeechRecognitionErrorInit : EventInit +{ + SpeechRecognitionErrorCode error = "no-speech"; + DOMString message = ""; +}; diff --git a/dom/webidl/SpeechRecognitionEvent.webidl b/dom/webidl/SpeechRecognitionEvent.webidl new file mode 100644 index 0000000000..8dc3fd77ac --- /dev/null +++ b/dom/webidl/SpeechRecognitionEvent.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +interface nsISupports; + +[Pref="media.webspeech.recognition.enable", + Func="SpeechRecognition::IsAuthorized", + Exposed=Window] +interface SpeechRecognitionEvent : Event +{ + constructor(DOMString type, + optional SpeechRecognitionEventInit eventInitDict = {}); + + readonly attribute unsigned long resultIndex; + readonly attribute SpeechRecognitionResultList? results; + readonly attribute any interpretation; + readonly attribute Document? emma; +}; + +dictionary SpeechRecognitionEventInit : EventInit +{ + unsigned long resultIndex = 0; + SpeechRecognitionResultList? results = null; + any interpretation = null; + Document? emma = null; +}; diff --git a/dom/webidl/SpeechRecognitionResult.webidl b/dom/webidl/SpeechRecognitionResult.webidl new file mode 100644 index 0000000000..46cf650781 --- /dev/null +++ b/dom/webidl/SpeechRecognitionResult.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.recognition.enable", + Func="SpeechRecognition::IsAuthorized", + Exposed=Window] +interface SpeechRecognitionResult { + readonly attribute unsigned long length; + getter SpeechRecognitionAlternative item(unsigned long index); + readonly attribute boolean isFinal; +}; diff --git a/dom/webidl/SpeechRecognitionResultList.webidl b/dom/webidl/SpeechRecognitionResultList.webidl new file mode 100644 index 0000000000..eb11edc976 --- /dev/null +++ b/dom/webidl/SpeechRecognitionResultList.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.recognition.enable", + Func="SpeechRecognition::IsAuthorized", + Exposed=Window] +interface SpeechRecognitionResultList { + readonly attribute unsigned long length; + getter SpeechRecognitionResult item(unsigned long index); +}; diff --git a/dom/webidl/SpeechSynthesis.webidl b/dom/webidl/SpeechSynthesis.webidl new file mode 100644 index 0000000000..fc6583be86 --- /dev/null +++ b/dom/webidl/SpeechSynthesis.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.synth.enabled", + Exposed=Window] +interface SpeechSynthesis : EventTarget{ + readonly attribute boolean pending; + readonly attribute boolean speaking; + readonly attribute boolean paused; + + undefined speak(SpeechSynthesisUtterance utterance); + undefined cancel(); + undefined pause(); + undefined resume(); + sequence<SpeechSynthesisVoice> getVoices(); + + attribute EventHandler onvoiceschanged; + + [ChromeOnly] + // Force an utterance to end. Circumvents bad speech service implementations. + undefined forceEnd(); +}; diff --git a/dom/webidl/SpeechSynthesisErrorEvent.webidl b/dom/webidl/SpeechSynthesisErrorEvent.webidl new file mode 100644 index 0000000000..baab54f025 --- /dev/null +++ b/dom/webidl/SpeechSynthesisErrorEvent.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum SpeechSynthesisErrorCode { + "canceled", + "interrupted", + "audio-busy", + "audio-hardware", + "network", + "synthesis-unavailable", + "synthesis-failed", + "language-unavailable", + "voice-unavailable", + "text-too-long", + "invalid-argument", +}; + +[Pref="media.webspeech.synth.enabled", + Exposed=Window] +interface SpeechSynthesisErrorEvent : SpeechSynthesisEvent { + constructor(DOMString type, SpeechSynthesisErrorEventInit eventInitDict); + + readonly attribute SpeechSynthesisErrorCode error; +}; + +dictionary SpeechSynthesisErrorEventInit : SpeechSynthesisEventInit +{ + required SpeechSynthesisErrorCode error; +}; diff --git a/dom/webidl/SpeechSynthesisEvent.webidl b/dom/webidl/SpeechSynthesisEvent.webidl new file mode 100644 index 0000000000..7eabe1096b --- /dev/null +++ b/dom/webidl/SpeechSynthesisEvent.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.synth.enabled", + Exposed=Window] +interface SpeechSynthesisEvent : Event +{ + constructor(DOMString type, SpeechSynthesisEventInit eventInitDict); + + readonly attribute SpeechSynthesisUtterance utterance; + readonly attribute unsigned long charIndex; + readonly attribute unsigned long? charLength; + readonly attribute float elapsedTime; + readonly attribute DOMString? name; +}; + +dictionary SpeechSynthesisEventInit : EventInit +{ + required SpeechSynthesisUtterance utterance; + unsigned long charIndex = 0; + unsigned long? charLength = null; + float elapsedTime = 0; + DOMString name = ""; +}; diff --git a/dom/webidl/SpeechSynthesisUtterance.webidl b/dom/webidl/SpeechSynthesisUtterance.webidl new file mode 100644 index 0000000000..334b1adf91 --- /dev/null +++ b/dom/webidl/SpeechSynthesisUtterance.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.synth.enabled", + Exposed=Window] +interface SpeechSynthesisUtterance : EventTarget { + [Throws] + constructor(); + [Throws] + constructor(DOMString text); + + attribute DOMString text; + attribute DOMString lang; + attribute SpeechSynthesisVoice? voice; + attribute float volume; + attribute float rate; + attribute float pitch; + + attribute EventHandler onstart; + attribute EventHandler onend; + attribute EventHandler onerror; + attribute EventHandler onpause; + attribute EventHandler onresume; + attribute EventHandler onmark; + attribute EventHandler onboundary; + + [ChromeOnly] + readonly attribute DOMString chosenVoiceURI; +}; diff --git a/dom/webidl/SpeechSynthesisVoice.webidl b/dom/webidl/SpeechSynthesisVoice.webidl new file mode 100644 index 0000000000..a457b9593b --- /dev/null +++ b/dom/webidl/SpeechSynthesisVoice.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.webspeech.synth.enabled", + Exposed=Window] +interface SpeechSynthesisVoice { + readonly attribute DOMString voiceURI; + readonly attribute DOMString name; + readonly attribute DOMString lang; + readonly attribute boolean localService; + readonly attribute boolean default; +}; diff --git a/dom/webidl/StaticRange.webidl b/dom/webidl/StaticRange.webidl new file mode 100644 index 0000000000..be4e702389 --- /dev/null +++ b/dom/webidl/StaticRange.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#staticrange + * + * Copyright 2012 W3C (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface StaticRange : AbstractRange { + [Throws] + constructor(StaticRangeInit init); + // And no additional functions/properties. +}; + +dictionary StaticRangeInit { + required Node startContainer; + required unsigned long startOffset; + required Node endContainer; + required unsigned long endOffset; +}; diff --git a/dom/webidl/StereoPannerNode.webidl b/dom/webidl/StereoPannerNode.webidl new file mode 100644 index 0000000000..1a5313f936 --- /dev/null +++ b/dom/webidl/StereoPannerNode.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary StereoPannerOptions : AudioNodeOptions { + float pan = 0; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface StereoPannerNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, + optional StereoPannerOptions options = {}); + + readonly attribute AudioParam pan; +}; + +// Mozilla extension +StereoPannerNode includes AudioNodePassThrough; diff --git a/dom/webidl/Storage.webidl b/dom/webidl/Storage.webidl new file mode 100644 index 0000000000..5ee5e2c737 --- /dev/null +++ b/dom/webidl/Storage.webidl @@ -0,0 +1,101 @@ +/* -*- 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/html/#the-storage-interface +* +* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and +* Opera Software ASA. You are granted a license to use, reproduce +* and create derivative works of this document. +*/ + +[Exposed=Window] +interface Storage { + [Throws, NeedsSubjectPrincipal] + readonly attribute unsigned long length; + + [Throws, NeedsSubjectPrincipal] + DOMString? key(unsigned long index); + + [Throws, NeedsSubjectPrincipal] + getter DOMString? getItem(DOMString key); + + [Throws, NeedsSubjectPrincipal] + setter undefined setItem(DOMString key, DOMString value); + + [Throws, NeedsSubjectPrincipal] + deleter undefined removeItem(DOMString key); + + [Throws, NeedsSubjectPrincipal] + undefined clear(); + + [ChromeOnly] + readonly attribute boolean isSessionOnly; +}; + +/** + * Testing methods that exist only for the benefit of automated glass-box + * testing. Will never be exposed to content at large and unlikely to be useful + * in a WebDriver context. + */ +partial interface Storage { + /** + * Does a security-check and ensures the underlying database has been opened + * without actually calling any database methods. (Read-only methods will + * have a similar effect but also impact the state of the snapshot.) + */ + [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"] + undefined open(); + + /** + * Automatically ends any explicit snapshot and drops the reference to the + * underlying database, but does not otherwise perturb the database. + */ + [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"] + undefined close(); + + /** + * Ensures the database has been opened and initiates an explicit snapshot. + * Snapshots are normally automatically ended and checkpointed back to the + * parent, but explicitly opened snapshots must be explicitly ended via + * `endExplicitSnapshot` or `close`. + */ + [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"] + undefined beginExplicitSnapshot(); + + /** + * Checkpoints the explicitly begun snapshot. This is only useful for testing + * of snapshot re-using when multiple checkpoints are involved. There's no + * need to call this before `endExplicitSnapshot` because it checkpoints the + * snapshot before it's ended. + */ + [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"] + undefined checkpointExplicitSnapshot(); + + /** + * Ends the explicitly begun snapshot and retains the underlying database. + * Compare with `close` which also drops the reference to the database. + */ + [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"] + undefined endExplicitSnapshot(); + + /** + * Returns true if the underlying database has been opened, the database is + * not being closed and it has a snapshot (initialized implicitly or + * explicitly). + */ + [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"] + readonly attribute boolean hasSnapshot; + + /** + * Returns snapshot usage. + * + * @throws NS_ERROR_NOT_AVAILABLE if the underlying database hasn't been + * opened or the database is being closed or it doesn't have a + * snapshot. + */ + [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"] + readonly attribute long long snapshotUsage; +}; diff --git a/dom/webidl/StorageEvent.webidl b/dom/webidl/StorageEvent.webidl new file mode 100644 index 0000000000..b41d144603 --- /dev/null +++ b/dom/webidl/StorageEvent.webidl @@ -0,0 +1,42 @@ +/* -*- 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 for a client side storage. See + * http://dev.w3.org/html5/webstorage/#the-storage-event + * for more information. + * + * Event sent to a window when a storage area changes. + */ + +[Exposed=Window] +interface StorageEvent : Event +{ + constructor(DOMString type, optional StorageEventInit eventInitDict = {}); + + readonly attribute DOMString? key; + readonly attribute DOMString? oldValue; + readonly attribute DOMString? newValue; + readonly attribute DOMString? url; + readonly attribute Storage? storageArea; + + // Bug 1016053 - This is not spec compliant. + undefined initStorageEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional DOMString? key = null, + optional DOMString? oldValue = null, + optional DOMString? newValue = null, + optional DOMString? url = null, + optional Storage? storageArea = null); +}; + +dictionary StorageEventInit : EventInit +{ + DOMString? key = null; + DOMString? oldValue = null; + DOMString? newValue = null; + DOMString url = ""; + Storage? storageArea = null; +}; diff --git a/dom/webidl/StorageManager.webidl b/dom/webidl/StorageManager.webidl new file mode 100644 index 0000000000..0ce05c510a --- /dev/null +++ b/dom/webidl/StorageManager.webidl @@ -0,0 +1,43 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://storage.spec.whatwg.org/#storagemanager + * + */ + +[SecureContext, Exposed=(Window,Worker)] +interface StorageManager { + [NewObject] + Promise<boolean> persisted(); + + [Exposed=Window, NewObject] + Promise<boolean> persist(); + + [NewObject] + Promise<StorageEstimate> estimate(); +}; + +dictionary StorageEstimate { + unsigned long long usage; + unsigned long long quota; +}; + +[SecureContext] +partial interface StorageManager { + [Pref="dom.fs.enabled", NewObject] + Promise<FileSystemDirectoryHandle> getDirectory(); +}; + +/** + * Testing methods that exist only for the benefit of automated glass-box + * testing. Will never be exposed to content at large and unlikely to be useful + * in a WebDriver context. + */ +[SecureContext] +partial interface StorageManager { + [ChromeOnly] + undefined shutdown(); +}; diff --git a/dom/webidl/StreamFilter.webidl b/dom/webidl/StreamFilter.webidl new file mode 100644 index 0000000000..a45b392dc0 --- /dev/null +++ b/dom/webidl/StreamFilter.webidl @@ -0,0 +1,144 @@ +/* -*- 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 Mozilla-specific WebExtension API, which is not available to web + * content. It allows monitoring and filtering of HTTP response stream data. + * + * This API should currently be considered experimental, and is not defined by + * any standard. + */ + +enum StreamFilterStatus { + /** + * The StreamFilter is not fully initialized. No methods may be called until + * a "start" event has been received. + */ + "uninitialized", + /** + * The underlying channel is currently transferring data, which will be + * dispatched via "data" events. + */ + "transferringdata", + /** + * The underlying channel has finished transferring data. Data may still be + * written via write() calls at this point. + */ + "finishedtransferringdata", + /** + * Data transfer is currently suspended. It may be resumed by a call to + * resume(). Data may still be written via write() calls in this state. + */ + "suspended", + /** + * The channel has been closed by a call to close(). No further data wlil be + * delivered via "data" events, and no further data may be written via + * write() calls. + */ + "closed", + /** + * The channel has been disconnected by a call to disconnect(). All further + * data will be delivered directly, without passing through the filter. No + * further events will be dispatched, and no further data may be written by + * write() calls. + */ + "disconnected", + /** + * An error has occurred and the channel is disconnected. The `error` + * property contains the details of the error. + */ + "failed", +}; + +/** + * An interface which allows an extension to intercept, and optionally modify, + * response data from an HTTP request. + */ +[Exposed=Window, + Func="mozilla::extensions::StreamFilter::IsAllowedInContext"] +interface StreamFilter : EventTarget { + /** + * Creates a stream filter for the given add-on and the given extension ID. + */ + [ChromeOnly] + static StreamFilter create(unsigned long long requestId, DOMString addonId); + + /** + * Suspends processing of the request. After this is called, no further data + * will be delivered until the request is resumed. + */ + [Throws] + undefined suspend(); + + /** + * Resumes delivery of data for a suspended request. + */ + [Throws] + undefined resume(); + + /** + * Closes the request. After this is called, no more data may be written to + * the stream, and no further data will be delivered. + * + * This *must* be called after the consumer is finished writing data, unless + * disconnect() has already been called. + */ + [Throws] + undefined close(); + + /** + * Disconnects the stream filter from the request. After this is called, no + * further data will be delivered to the filter, and any unprocessed data + * will be written directly to the output stream. + */ + [Throws] + undefined disconnect(); + + /** + * Writes a chunk of data to the output stream. This may not be called + * before the "start" event has been received. + */ + [Throws] + undefined write((ArrayBuffer or Uint8Array) data); + + /** + * Returns the current status of the stream. + */ + [Pure] + readonly attribute StreamFilterStatus status; + + /** + * After an "error" event has been dispatched, this contains a message + * describing the error. + */ + [Pure] + readonly attribute DOMString error; + + /** + * Dispatched with a StreamFilterDataEvent whenever incoming data is + * available on the stream. This data will not be delivered to the output + * stream unless it is explicitly written via a write() call. + */ + attribute EventHandler ondata; + + /** + * Dispatched when the stream is opened, and is about to begin delivering + * data. + */ + attribute EventHandler onstart; + + /** + * Dispatched when the stream has closed, and has no more data to deliver. + * The output stream remains open and writable until close() is called. + */ + attribute EventHandler onstop; + + /** + * Dispatched when an error has occurred. No further data may be read or + * written after this point. + */ + attribute EventHandler onerror; +}; diff --git a/dom/webidl/StreamFilterDataEvent.webidl b/dom/webidl/StreamFilterDataEvent.webidl new file mode 100644 index 0000000000..63ee1bcdbe --- /dev/null +++ b/dom/webidl/StreamFilterDataEvent.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * This is a Mozilla-specific WebExtension API, which is not available to web + * content. It allows monitoring and filtering of HTTP response stream data. + * + * This API should currently be considered experimental, and is not defined by + * any standard. + */ + +[Func="mozilla::extensions::StreamFilter::IsAllowedInContext", + Exposed=Window] +interface StreamFilterDataEvent : Event { + constructor(DOMString type, + optional StreamFilterDataEventInit eventInitDict = {}); + + /** + * Contains a chunk of data read from the input stream. + */ + [Pure] + readonly attribute ArrayBuffer data; +}; + +dictionary StreamFilterDataEventInit : EventInit { + required ArrayBuffer data; +}; diff --git a/dom/webidl/StructuredCloneTester.webidl b/dom/webidl/StructuredCloneTester.webidl new file mode 100644 index 0000000000..4892bd49ae --- /dev/null +++ b/dom/webidl/StructuredCloneTester.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=(Window,Worker), + Pref="dom.testing.structuredclonetester.enabled", + Serializable] +interface StructuredCloneTester { + constructor(boolean serializable, boolean deserializable); + + readonly attribute boolean serializable; + readonly attribute boolean deserializable; +}; diff --git a/dom/webidl/StyleSheet.webidl b/dom/webidl/StyleSheet.webidl new file mode 100644 index 0000000000..29ceb4c9a6 --- /dev/null +++ b/dom/webidl/StyleSheet.webidl @@ -0,0 +1,53 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/cssom/ + */ + +[Exposed=Window] +interface StyleSheet { + [Constant] + readonly attribute DOMString type; + [Constant, Throws] + readonly attribute DOMString? href; + // Spec says "Node", but it can go null when the node gets a new + // sheet. That's also why it's not [Constant] + [Pure] + readonly attribute Node? ownerNode; + [Pure] + readonly attribute StyleSheet? parentStyleSheet; + [Pure] + readonly attribute DOMString? title; + [Constant, PutForwards=mediaText] + readonly attribute MediaList media; + [Pure] + attribute boolean disabled; + // The source map URL for this style sheet. The source map URL can + // be found in one of two ways. + // + // If a SourceMap or X-SourceMap response header is seen, this is + // the value. If both are seen, SourceMap is preferred. Because + // this relies on the HTTP response, it can change if checked before + // the response is available -- which is why it is not [Constant]. + // + // If the style sheet has the special "# sourceMappingURL=" comment, + // then this is the URL specified there. + // + // If the source map URL is not found by either of these methods, + // then this is an empty string. + [ChromeOnly, Pure] + readonly attribute UTF8String sourceMapURL; + // The source URL for this style sheet. If the style sheet has the + // special "# sourceURL=" comment, then this is the URL specified + // there. If no such comment is found, then this is the empty + // string. + [ChromeOnly, Pure] + readonly attribute UTF8String sourceURL; + [ChromeOnly, Pure] + readonly attribute Document? associatedDocument; + [ChromeOnly, Pure, BinaryName="isConstructed"] + readonly attribute boolean constructed; +}; diff --git a/dom/webidl/StyleSheetList.webidl b/dom/webidl/StyleSheetList.webidl new file mode 100644 index 0000000000..98eb5cee98 --- /dev/null +++ b/dom/webidl/StyleSheetList.webidl @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of 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://drafts.csswg.org/cssom/#stylesheetlist +[Exposed=Window] +interface StyleSheetList { + getter CSSStyleSheet? item(unsigned long index); + readonly attribute unsigned long length; +}; diff --git a/dom/webidl/SubmitEvent.webidl b/dom/webidl/SubmitEvent.webidl new file mode 100644 index 0000000000..43507fe675 --- /dev/null +++ b/dom/webidl/SubmitEvent.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submitevent + */ + +[Exposed=Window] +interface SubmitEvent : Event { + constructor(DOMString type, optional SubmitEventInit eventInitDict = {}); + + readonly attribute HTMLElement? submitter; +}; + +dictionary SubmitEventInit : EventInit { + HTMLElement? submitter = null; +}; diff --git a/dom/webidl/SubtleCrypto.webidl b/dom/webidl/SubtleCrypto.webidl new file mode 100644 index 0000000000..6c7842b1f2 --- /dev/null +++ b/dom/webidl/SubtleCrypto.webidl @@ -0,0 +1,245 @@ +/* -*- 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/WebCryptoAPI/ + */ + +typedef DOMString KeyType; +typedef DOMString KeyUsage; +typedef DOMString NamedCurve; +typedef Uint8Array BigInteger; + +/***** Algorithm dictionaries *****/ + +dictionary Algorithm { + required DOMString name; +}; + +[GenerateInit] +dictionary AesCbcParams : Algorithm { + required BufferSource iv; +}; + +[GenerateInit] +dictionary AesCtrParams : Algorithm { + required BufferSource counter; + required [EnforceRange] octet length; +}; + +[GenerateInit] +dictionary AesGcmParams : Algorithm { + required BufferSource iv; + BufferSource additionalData; + [EnforceRange] octet tagLength; +}; + +dictionary HmacImportParams : Algorithm { + required AlgorithmIdentifier hash; +}; + +[GenerateInit] +dictionary Pbkdf2Params : Algorithm { + required BufferSource salt; + required [EnforceRange] unsigned long iterations; + required AlgorithmIdentifier hash; +}; + +[GenerateInit] +dictionary RsaHashedImportParams { + required AlgorithmIdentifier hash; +}; + +dictionary AesKeyGenParams : Algorithm { + required [EnforceRange] unsigned short length; +}; + +[GenerateInit] +dictionary HmacKeyGenParams : Algorithm { + required AlgorithmIdentifier hash; + [EnforceRange] unsigned long length; +}; + +[GenerateInit] +dictionary RsaHashedKeyGenParams : Algorithm { + required [EnforceRange] unsigned long modulusLength; + required BigInteger publicExponent; + required AlgorithmIdentifier hash; +}; + +[GenerateInit] +dictionary RsaOaepParams : Algorithm { + BufferSource label; +}; + +[GenerateInit] +dictionary RsaPssParams : Algorithm { + required [EnforceRange] unsigned long saltLength; +}; + +[GenerateInit] +dictionary EcKeyGenParams : Algorithm { + required NamedCurve namedCurve; +}; + +[GenerateInit] +dictionary AesDerivedKeyParams : Algorithm { + required [EnforceRange] unsigned long length; +}; + +[GenerateInit] +dictionary HmacDerivedKeyParams : HmacImportParams { + [EnforceRange] unsigned long length; +}; + +[GenerateInit] +dictionary EcdhKeyDeriveParams : Algorithm { + required CryptoKey public; +}; + +[GenerateInit] +dictionary DhImportKeyParams : Algorithm { + required BigInteger prime; + required BigInteger generator; +}; + +[GenerateInit] +dictionary EcdsaParams : Algorithm { + required AlgorithmIdentifier hash; +}; + +[GenerateInit] +dictionary EcKeyImportParams : Algorithm { + NamedCurve namedCurve; +}; + +[GenerateInit] +dictionary HkdfParams : Algorithm { + required AlgorithmIdentifier hash; + required BufferSource salt; + required BufferSource info; +}; + +/***** JWK *****/ + +dictionary RsaOtherPrimesInfo { + // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms + required DOMString r; + required DOMString d; + required DOMString t; +}; + +[GenerateInitFromJSON, GenerateToJSON] +dictionary JsonWebKey { + // The following fields are defined in Section 3.1 of JSON Web Key + required DOMString kty; + DOMString use; + sequence<DOMString> key_ops; + DOMString alg; + + // The following fields are defined in JSON Web Key Parameters Registration + boolean ext; + + // The following fields are defined in Section 6 of JSON Web Algorithms + DOMString crv; + DOMString x; + DOMString y; + DOMString d; + DOMString n; + DOMString e; + DOMString p; + DOMString q; + DOMString dp; + DOMString dq; + DOMString qi; + sequence<RsaOtherPrimesInfo> oth; + DOMString k; +}; + + +/***** The Main API *****/ + +[Serializable, + SecureContext, + Exposed=(Window,Worker)] +interface CryptoKey { + readonly attribute KeyType type; + readonly attribute boolean extractable; + [Cached, Constant, Throws] readonly attribute object algorithm; + [Cached, Constant, Frozen] readonly attribute sequence<KeyUsage> usages; +}; + +[GenerateConversionToJS] +dictionary CryptoKeyPair { + required CryptoKey publicKey; + required CryptoKey privateKey; +}; + +typedef DOMString KeyFormat; +typedef (object or DOMString) AlgorithmIdentifier; + +[Exposed=(Window,Worker), + SecureContext] +interface SubtleCrypto { + [NewObject] + Promise<any> encrypt(AlgorithmIdentifier algorithm, + CryptoKey key, + BufferSource data); + [NewObject] + Promise<any> decrypt(AlgorithmIdentifier algorithm, + CryptoKey key, + BufferSource data); + [NewObject] + Promise<any> sign(AlgorithmIdentifier algorithm, + CryptoKey key, + BufferSource data); + [NewObject] + Promise<any> verify(AlgorithmIdentifier algorithm, + CryptoKey key, + BufferSource signature, + BufferSource data); + [NewObject] + Promise<any> digest(AlgorithmIdentifier algorithm, + BufferSource data); + + [NewObject] + Promise<any> generateKey(AlgorithmIdentifier algorithm, + boolean extractable, + sequence<KeyUsage> keyUsages ); + [NewObject] + Promise<any> deriveKey(AlgorithmIdentifier algorithm, + CryptoKey baseKey, + AlgorithmIdentifier derivedKeyType, + boolean extractable, + sequence<KeyUsage> keyUsages ); + [NewObject] + Promise<any> deriveBits(AlgorithmIdentifier algorithm, + CryptoKey baseKey, + unsigned long length); + + [NewObject] + Promise<any> importKey(KeyFormat format, + object keyData, + AlgorithmIdentifier algorithm, + boolean extractable, + sequence<KeyUsage> keyUsages ); + [NewObject] + Promise<any> exportKey(KeyFormat format, CryptoKey key); + + [NewObject] + Promise<any> wrapKey(KeyFormat format, + CryptoKey key, + CryptoKey wrappingKey, + AlgorithmIdentifier wrapAlgorithm); + + [NewObject] + Promise<any> unwrapKey(KeyFormat format, + BufferSource wrappedKey, + CryptoKey unwrappingKey, + AlgorithmIdentifier unwrapAlgorithm, + AlgorithmIdentifier unwrappedKeyAlgorithm, + boolean extractable, + sequence<KeyUsage> keyUsages ); +}; diff --git a/dom/webidl/TCPServerSocket.webidl b/dom/webidl/TCPServerSocket.webidl new file mode 100644 index 0000000000..259bd3f6b4 --- /dev/null +++ b/dom/webidl/TCPServerSocket.webidl @@ -0,0 +1,45 @@ +/* -*- 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/. */ + +/** + * TCPServerSocket + * + * An interface to a server socket that can accept incoming connections for gaia apps. + */ + +dictionary ServerSocketOptions { + TCPSocketBinaryType binaryType = "string"; +}; + +[Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", + Exposed=Window] +interface TCPServerSocket : EventTarget { + [Throws] + constructor(unsigned short port, optional ServerSocketOptions options = {}, + optional unsigned short backlog = 0); + + /** + * The port of this server socket object. + */ + readonly attribute unsigned short localPort; + + /** + * The "connect" event is dispatched when a client connection is accepted. + * The event object will be a TCPServerSocketEvent containing a TCPSocket + * instance, which is used for communication between client and server. + */ + attribute EventHandler onconnect; + + /** + * The "error" event will be dispatched when a listening server socket is + * unexpectedly disconnected. + */ + attribute EventHandler onerror; + + /** + * Close the server socket. + */ + undefined close(); +}; diff --git a/dom/webidl/TCPServerSocketEvent.webidl b/dom/webidl/TCPServerSocketEvent.webidl new file mode 100644 index 0000000000..23f502deb8 --- /dev/null +++ b/dom/webidl/TCPServerSocketEvent.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +[Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", + Exposed=Window] +interface TCPServerSocketEvent : Event { + constructor(DOMString type, + optional TCPServerSocketEventInit eventInitDict = {}); + + readonly attribute TCPSocket socket; +}; + +dictionary TCPServerSocketEventInit : EventInit { + TCPSocket? socket = null; +}; diff --git a/dom/webidl/TCPSocket.webidl b/dom/webidl/TCPSocket.webidl new file mode 100644 index 0000000000..cf5ab4fdd5 --- /dev/null +++ b/dom/webidl/TCPSocket.webidl @@ -0,0 +1,221 @@ +/* -*- 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/. */ + +/** + * TCPSocket exposes a TCP client socket (no server sockets yet) + * to highly privileged apps. It provides a buffered, non-blocking + * interface for sending. For receiving, it uses an asynchronous, + * event handler based interface. + */ + +interface nsISocketTransport; + +enum TCPSocketBinaryType { + "arraybuffer", + "string" +}; + +dictionary SocketOptions { + boolean useSecureTransport = false; + TCPSocketBinaryType binaryType = "string"; +}; + +enum TCPReadyState { + "connecting", + "open", + "closing", + "closed", +}; + +[LegacyNoInterfaceObject, + Exposed=Window] +interface LegacyMozTCPSocket { + /** + * Legacy constructor for API compatibility. + */ + [Throws] + TCPSocket open(DOMString host, unsigned short port, optional SocketOptions options = {}); + + [Throws] + TCPServerSocket listen(unsigned short port, optional ServerSocketOptions options = {}, optional unsigned short backlog = 0); +}; + +[Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", + Exposed=Window] +interface TCPSocket : EventTarget { + [Throws] + constructor(DOMString host, unsigned short port, + optional SocketOptions options = {}); + + /** + * Upgrade an insecure connection to use TLS. Throws if the ready state is not OPEN. + */ + [Throws] undefined upgradeToSecure(); + + /** + * The raw internal socket transport. + */ + readonly attribute nsISocketTransport? transport; + + /** + * The UTF16 host of this socket object. + */ + readonly attribute USVString host; + + /** + * The port of this socket object. + */ + readonly attribute unsigned short port; + + /** + * True if this socket object is an SSL socket. + */ + readonly attribute boolean ssl; + + /** + * The number of bytes which have previously been buffered by calls to + * send on this socket. + */ + readonly attribute unsigned long long bufferedAmount; + + /** + * Pause reading incoming data and invocations of the ondata handler until + * resume is called. Can be called multiple times without resuming. + */ + undefined suspend(); + + /** + * Resume reading incoming data and invoking ondata as usual. There must be + * an equal number of resume as suspends that took place. Throws if the + * socket is not suspended. + */ + [Throws] + undefined resume(); + + /** + * Close the socket. + */ + undefined close(); + + /** + * Close the socket immediately without waiting for unsent data. + */ + [ChromeOnly] undefined closeImmediately(); + + /** + * Write data to the socket. + * + * @param data The data to write to the socket. + * + * @return Send returns true or false as a hint to the caller that + * they may either continue sending more data immediately, or + * may want to wait until the other side has read some of the + * data which has already been written to the socket before + * buffering more. If send returns true, then less than 64k + * has been buffered and it's safe to immediately write more. + * If send returns false, then more than 64k has been buffered, + * and the caller may wish to wait until the ondrain event + * handler has been called before buffering more data by more + * calls to send. + * + * @throws Throws if the ready state is not OPEN. + */ + [Throws] + boolean send(ByteString data); + + /** + * Write data to the socket. + * + * @param data The data to write to the socket. + * @param byteOffset The offset within the data from which to begin writing. + * @param byteLength The number of bytes to write. + * Defaults to the byte length of the ArrayBuffer if not present, + * and clamped to (length - byteOffset). + * + * @return Send returns true or false as a hint to the caller that + * they may either continue sending more data immediately, or + * may want to wait until the other side has read some of the + * data which has already been written to the socket before + * buffering more. If send returns true, then less than 64k + * has been buffered and it's safe to immediately write more. + * If send returns false, then more than 64k has been buffered, + * and the caller may wish to wait until the ondrain event + * handler has been called before buffering more data by more + * calls to send. + * + * @throws Throws if the ready state is not OPEN. + */ + [Throws] + boolean send(ArrayBuffer data, optional unsigned long byteOffset = 0, optional unsigned long byteLength); + + /** + * The readyState attribute indicates which state the socket is currently + * in. + */ + readonly attribute TCPReadyState readyState; + + /** + * The binaryType attribute indicates which mode this socket uses for + * sending and receiving data. If the binaryType: "arraybuffer" option + * was passed to the open method that created this socket, binaryType + * will be "arraybuffer". Otherwise, it will be "string". + */ + readonly attribute TCPSocketBinaryType binaryType; + + /** + * The "open" event is dispatched when the connection to the server + * has been established. If the connection is refused, the "error" event + * will be dispatched, instead. + */ + attribute EventHandler onopen; + + /** + * After send has buffered more than 64k of data, it returns false to + * indicate that the client should pause before sending more data, to + * avoid accumulating large buffers. This is only advisory, and the client + * is free to ignore it and buffer as much data as desired, but if reducing + * the size of buffers is important (especially for a streaming application) + * the "drain" event will be dispatched once the previously-buffered data has + * been written to the network, at which point the client can resume calling + * send again. + */ + attribute EventHandler ondrain; + + /** + * The "data" event will be dispatched repeatedly and asynchronously after + * "open" is dispatched, every time some data was available from the server + * and was read. The event object will be a TCPSocketEvent; if the "arraybuffer" + * binaryType was passed to the constructor, the data attribute of the event + * object will be an ArrayBuffer. If not, it will be a normal JavaScript string, + * truncated at the first null byte found in the payload and the remainder + * interpreted as ASCII bytes. + * + * At any time, the client may choose to pause reading and receiving "data" + * events by calling the socket's suspend() method. Further "data" events + * will be paused until resume() is called. + */ + attribute EventHandler ondata; + + /** + * The "error" event will be dispatched when there is an error. The event + * object will be a TCPSocketErrorEvent. + * + * If an "error" event is dispatched before an "open" one, the connection + * was refused, and the "close" event will not be dispatched. If an "error" + * event is dispatched after an "open" event, the connection was lost, + * and a "close" event will be dispatched subsequently. + */ + attribute EventHandler onerror; + + /** + * The "close" event is dispatched once the underlying network socket + * has been closed, either by the server, or by the client calling + * close. + * + * If the "error" event was not dispatched before "close", then one of + * the sides cleanly closed the connection. + */ + attribute EventHandler onclose; +}; diff --git a/dom/webidl/TCPSocketErrorEvent.webidl b/dom/webidl/TCPSocketErrorEvent.webidl new file mode 100644 index 0000000000..2a530c352e --- /dev/null +++ b/dom/webidl/TCPSocketErrorEvent.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Dispatched as part of the "error" event in the following situations: +* - if there's an error detected when the TCPSocket closes +* - if there's an internal error while sending data +* - if there's an error connecting to the host +*/ + +[Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", + Exposed=Window] +interface TCPSocketErrorEvent : Event { + constructor(DOMString type, + optional TCPSocketErrorEventInit eventInitDict = {}); + + readonly attribute DOMString name; + readonly attribute DOMString message; + readonly attribute unsigned long errorCode; // The internal nsresult error code. +}; + +dictionary TCPSocketErrorEventInit : EventInit +{ + DOMString name = ""; + DOMString message = ""; + unsigned long errorCode = 0; +}; diff --git a/dom/webidl/TCPSocketEvent.webidl b/dom/webidl/TCPSocketEvent.webidl new file mode 100644 index 0000000000..408a3938ad --- /dev/null +++ b/dom/webidl/TCPSocketEvent.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * TCPSocketEvent is the event dispatched for all of the events described by TCPSocket, + * except the "error" event. It contains the socket that was associated with the event, + * the type of event, and the data associated with the event if the event is a "data" event. + */ + +[Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", + Exposed=Window] +interface TCPSocketEvent : Event { + constructor(DOMString type, optional TCPSocketEventInit eventInitDict = {}); + + /** + * If the event is a "data" event, data will be the bytes read from the network; + * if the binaryType of the socket was "arraybuffer", this value will be of type + * ArrayBuffer, otherwise, it will be a ByteString. + * + * For other events, data will be an empty string. + */ + //TODO: make this (ArrayBuffer or ByteString) after sorting out the rooting required. (bug 1121634) + readonly attribute any data; +}; + +dictionary TCPSocketEventInit : EventInit { + //TODO: make this (ArrayBuffer or ByteString) after sorting out the rooting required. (bug 1121634) + any data = null; +}; diff --git a/dom/webidl/TaskPriorityChangeEvent.webidl b/dom/webidl/TaskPriorityChangeEvent.webidl new file mode 100644 index 0000000000..8a75657511 --- /dev/null +++ b/dom/webidl/TaskPriorityChangeEvent.webidl @@ -0,0 +1,13 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +[Exposed=(Window, Worker), Pref="dom.enable_web_task_scheduling"] +interface TaskPriorityChangeEvent : Event { + constructor (DOMString type , TaskPriorityChangeEventInit priorityChangeEventInitDict); + readonly attribute TaskPriority previousPriority; +}; + +dictionary TaskPriorityChangeEventInit : EventInit { + required TaskPriority previousPriority; +}; diff --git a/dom/webidl/TestFunctions.webidl b/dom/webidl/TestFunctions.webidl new file mode 100644 index 0000000000..fcc52016a1 --- /dev/null +++ b/dom/webidl/TestFunctions.webidl @@ -0,0 +1,154 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// A dumping ground for random testing functions + +callback PromiseReturner = Promise<any>(); +callback PromiseReturner2 = Promise<any>(any arg, DOMString arg2); + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface WrapperCachedNonISupportsTestInterface { + [Pref="dom.webidl.test1"] constructor(); +}; + +[Trial="TestTrial", Exposed=*] +interface TestTrialInterface { + constructor(); +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceLength { + [ChromeOnly] + constructor(boolean arg); +}; + +// The type of string C++ sees. +enum StringType { + "literal", // A string with the LITERAL flag. + "stringbuffer", // A string with the REFCOUNTED flag. + "inline", // A string with the INLINE flag. + "other", // Anything else. +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestFunctions { + constructor(); + + [Throws] + static undefined throwUncatchableException(); + + // Simply returns its argument. Can be used to test Promise + // argument processing behavior. + static Promise<any> passThroughPromise(Promise<any> arg); + + // Returns whatever Promise the given PromiseReturner returned. + [Throws] + static Promise<any> passThroughCallbackPromise(PromiseReturner callback); + + // Some basic tests for string binding round-tripping behavior. + undefined setStringData(DOMString arg); + + // Get the string data, using an nsAString argument on the C++ side. + // This will just use Assign/operator=, whatever that does. + DOMString getStringDataAsAString(); + + // Get the string data, but only "length" chars of it, using an + // nsAString argument on the C++ side. This will always copy on the + // C++ side. + DOMString getStringDataAsAString(unsigned long length); + + // Get the string data, but only "length" chars of it, using a + // DOMString argument on the C++ side and trying to hand it + // stringbuffers. If length not passed, use our full length. + DOMString getStringDataAsDOMString(optional unsigned long length); + + // Get a short (short enough to fit in a JS inline string) literal string. + DOMString getShortLiteralString(); + + // Get a medium (long enough to not be a JS inline, but short enough + // to fit in a FakeString inline buffer) literal string. + DOMString getMediumLiteralString(); + + // Get a long (long enough to not fit in any inline buffers) literal string. + DOMString getLongLiteralString(); + + // Get a stringbuffer string for whatever string is passed in. + DOMString getStringbufferString(DOMString input); + + // Get the type of string that the C++ sees after going through bindings. + StringType getStringType(DOMString str); + + // Returns true if both the incoming string and the stored (via setStringData()) + // string have stringbuffers and they're the same stringbuffer. + boolean stringbufferMatchesStored(DOMString str); + + // Functions that just punch through to mozITestInterfaceJS.idl + [Throws] + undefined testThrowNsresult(); + [Throws] + undefined testThrowNsresultFromNative(); + + // Throws an InvalidStateError to auto-create a rejected promise. + [Throws] + static Promise<any> throwToRejectPromise(); + + // Some attributes for the toJSON to work with. + readonly attribute long one; + [Func="mozilla::dom::TestFunctions::ObjectFromAboutBlank"] + readonly attribute long two; + + // Testing for how default toJSON behaves. + [Default] object toJSON(); + + // This returns a wrappercached non-ISupports object. While this will always + // return the same object, no optimization attributes like [Pure] should be + // used here because the object should not be held alive from JS by the + // bindings. This is needed to test wrapper preservation for weak map keys. + // See bug 1351501. + readonly attribute WrapperCachedNonISupportsTestInterface wrapperCachedNonISupportsObject; + + attribute [Clamp] octet? clampedNullableOctet; + attribute [EnforceRange] octet? enforcedNullableOctet; + + // Testing for [AllowShared] + [GetterThrows] + attribute ArrayBufferView arrayBufferView; + [GetterThrows] + attribute [AllowShared] ArrayBufferView allowSharedArrayBufferView; + [Cached, Pure, GetterThrows] + attribute sequence<ArrayBufferView> sequenceOfArrayBufferView; + [Cached, Pure, GetterThrows] + attribute sequence<[AllowShared] ArrayBufferView> sequenceOfAllowSharedArrayBufferView; + [GetterThrows] + attribute ArrayBuffer arrayBuffer; + [GetterThrows] + attribute [AllowShared] ArrayBuffer allowSharedArrayBuffer; + [Cached, Pure, GetterThrows] + attribute sequence<ArrayBuffer> sequenceOfArrayBuffer; + [Cached, Pure, GetterThrows] + attribute sequence<[AllowShared] ArrayBuffer> sequenceOfAllowSharedArrayBuffer; + undefined testNotAllowShared(ArrayBufferView buffer); + undefined testNotAllowShared(ArrayBuffer buffer); + undefined testNotAllowShared(DOMString buffer); + undefined testAllowShared([AllowShared] ArrayBufferView buffer); + undefined testAllowShared([AllowShared] ArrayBuffer buffer); + undefined testDictWithAllowShared(optional DictWithAllowSharedBufferSource buffer = {}); + undefined testUnionOfBuffferSource((ArrayBuffer or ArrayBufferView or DOMString) foo); + undefined testUnionOfAllowSharedBuffferSource(([AllowShared] ArrayBuffer or [AllowShared] ArrayBufferView) foo); + + boolean staticAndNonStaticOverload(); + static boolean staticAndNonStaticOverload(optional unsigned long foo); +}; + +dictionary DictWithAllowSharedBufferSource { + ArrayBuffer arrayBuffer; + ArrayBufferView arrayBufferView; + [AllowShared] ArrayBuffer allowSharedArrayBuffer; + [AllowShared] ArrayBufferView allowSharedArrayBufferView; +}; diff --git a/dom/webidl/TestInterfaceJS.webidl b/dom/webidl/TestInterfaceJS.webidl new file mode 100644 index 0000000000..9b7eaee95d --- /dev/null +++ b/dom/webidl/TestInterfaceJS.webidl @@ -0,0 +1,84 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +dictionary TestInterfaceJSUnionableDictionary { + object objectMember; + any anyMember; +}; + +[JSImplementation="@mozilla.org/dom/test-interface-js;1", + Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceJS : EventTarget { + [Throws] + constructor(optional any anyArg, optional object objectArg, + optional TestInterfaceJSDictionary dictionaryArg = {}); + + readonly attribute any anyArg; + readonly attribute object objectArg; + TestInterfaceJSDictionary getDictionaryArg(); + attribute any anyAttr; + attribute object objectAttr; + TestInterfaceJSDictionary getDictionaryAttr(); + undefined setDictionaryAttr(optional TestInterfaceJSDictionary dict = {}); + any pingPongAny(any arg); + object pingPongObject(object obj); + any pingPongObjectOrString((object or DOMString) objOrString); + TestInterfaceJSDictionary pingPongDictionary(optional TestInterfaceJSDictionary dict = {}); + long pingPongDictionaryOrLong(optional (TestInterfaceJSUnionableDictionary or long) dictOrLong = {}); + DOMString pingPongRecord(record<DOMString, any> rec); + long objectSequenceLength(sequence<object> seq); + long anySequenceLength(sequence<any> seq); + + // For testing bug 968335. + DOMString getCallerPrincipal(); + + DOMString convertSVS(USVString svs); + + (TestInterfaceJS or long) pingPongUnion((TestInterfaceJS or long) something); + (DOMString or TestInterfaceJS?) pingPongUnionContainingNull((TestInterfaceJS? or DOMString) something); + (TestInterfaceJS or long)? pingPongNullableUnion((TestInterfaceJS or long)? something); + (Location or TestInterfaceJS) returnBadUnion(); + + // Test for sequence overloading and union behavior + undefined testSequenceOverload(sequence<DOMString> arg); + undefined testSequenceOverload(DOMString arg); + + undefined testSequenceUnion((sequence<DOMString> or DOMString) arg); + + // Tests for exception-throwing behavior + [Throws] + undefined testThrowError(); + + [Throws] + undefined testThrowDOMException(); + + [Throws] + undefined testThrowTypeError(); + + [Throws] + undefined testThrowCallbackError(Function callback); + + [Throws] + undefined testThrowXraySelfHosted(); + + [Throws] + undefined testThrowSelfHosted(); + + // Tests for promise-rejection behavior + Promise<undefined> testPromiseWithThrowingChromePromiseInit(); + Promise<undefined> testPromiseWithThrowingContentPromiseInit(Function func); + Promise<undefined> testPromiseWithDOMExceptionThrowingPromiseInit(); + Promise<undefined> testPromiseWithThrowingChromeThenFunction(); + Promise<undefined> testPromiseWithThrowingContentThenFunction(AnyCallback func); + Promise<undefined> testPromiseWithDOMExceptionThrowingThenFunction(); + Promise<undefined> testPromiseWithThrowingChromeThenable(); + Promise<undefined> testPromiseWithThrowingContentThenable(object thenable); + Promise<undefined> testPromiseWithDOMExceptionThrowingThenable(); + + // Event handler tests + attribute EventHandler onsomething; +}; diff --git a/dom/webidl/TestInterfaceJSDictionaries.webidl b/dom/webidl/TestInterfaceJSDictionaries.webidl new file mode 100644 index 0000000000..24bddcf4b7 --- /dev/null +++ b/dom/webidl/TestInterfaceJSDictionaries.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// +// These dictionaries are in a separate WebIDL file to avoid circular include +// problems. One of the dictionary includes a union as a member, so that +// dictionary's header needs to include UnionTypes.h. But the API in +// TestInterfaceJS also declares a union of dictionaries, so _that_ +// dictionary's header needs to be included _by_ UnionTypes.h. The solution +// is to separate those two dictionaries into separate header files. +// + +dictionary TestInterfaceJSDictionary2 { + object innerObject; +}; + +dictionary TestInterfaceJSDictionary { + TestInterfaceJSDictionary2 innerDictionary; + object objectMember; + any anyMember; + (object or DOMString) objectOrStringMember; + sequence<any> anySequenceMember; + record<DOMString, object> objectRecordMember; +}; diff --git a/dom/webidl/TestInterfaceJSMaplikeSetlikeIterable.webidl b/dom/webidl/TestInterfaceJSMaplikeSetlikeIterable.webidl new file mode 100644 index 0000000000..1b5c823ad5 --- /dev/null +++ b/dom/webidl/TestInterfaceJSMaplikeSetlikeIterable.webidl @@ -0,0 +1,152 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceMaplike { + [Throws] + constructor(); + + maplike<DOMString, long>; + undefined setInternal(DOMString aKey, long aValue); + undefined clearInternal(); + boolean deleteInternal(DOMString aKey); + boolean hasInternal(DOMString aKey); + [Throws] + long getInternal(DOMString aKey); +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceMaplikeObject { + [Throws] + constructor(); + + readonly maplike<DOMString, TestInterfaceMaplike>; + undefined setInternal(DOMString aKey); + undefined clearInternal(); + boolean deleteInternal(DOMString aKey); + boolean hasInternal(DOMString aKey); + [Throws] + TestInterfaceMaplike? getInternal(DOMString aKey); +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceMaplikeJSObject { + [Throws] + constructor(); + + readonly maplike<DOMString, object>; + undefined setInternal(DOMString aKey, object aObject); + undefined clearInternal(); + boolean deleteInternal(DOMString aKey); + boolean hasInternal(DOMString aKey); + [Throws] + object? getInternal(DOMString aKey); +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceSetlike { + [Throws] + constructor(); + + setlike<DOMString>; +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceSetlikeNode { + [Throws] + constructor(); + + setlike<Node>; +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceIterableSingle { + [Throws] + constructor(); + + iterable<long>; + getter long(unsigned long index); + readonly attribute unsigned long length; +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceIterableDouble { + [Throws] + constructor(); + + iterable<DOMString, DOMString>; +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceIterableDoubleUnion { + [Throws] + constructor(); + + iterable<DOMString, (DOMString or long)>; +}; + +dictionary TestInterfaceAsyncIterableSingleOptions { + boolean failToInit = false; +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceAsyncIterableSingle { + [Throws] + constructor(optional TestInterfaceAsyncIterableSingleOptions options = {}); + + async iterable<long>; +}; + +callback TestThrowingCallback = undefined(); + +dictionary TestInterfaceAsyncIteratorOptions { + unsigned long multiplier = 1; + sequence<Promise<any>> blockingPromises = []; + unsigned long failNextAfter = 4294967295; + boolean throwFromNext = false; + TestThrowingCallback throwFromReturn; +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceAsyncIterableSingleWithArgs { + [Throws] + constructor(); + + [GenerateReturnMethod] + async iterable<long>(optional TestInterfaceAsyncIteratorOptions options = {}); + + readonly attribute long returnCallCount; + + readonly attribute any returnLastCalledWith; +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceAsyncIterableDouble { + [Throws] + constructor(); + + async iterable<DOMString, DOMString>; +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceAsyncIterableDoubleUnion { + [Throws] + constructor(); + + async iterable<DOMString, (DOMString or long)>; +}; diff --git a/dom/webidl/TestInterfaceObservableArray.webidl b/dom/webidl/TestInterfaceObservableArray.webidl new file mode 100644 index 0000000000..f608790ba5 --- /dev/null +++ b/dom/webidl/TestInterfaceObservableArray.webidl @@ -0,0 +1,66 @@ +/* -*- 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 SetDeleteObjectCallback = undefined (object value, unsigned long index); +callback SetDeleteBooleanCallback = undefined (boolean value, unsigned long index); +callback SetDeleteInterfaceCallback = undefined (TestInterfaceObservableArray value, unsigned long index); + +dictionary ObservableArrayCallbacks { + SetDeleteObjectCallback setObjectCallback; + SetDeleteObjectCallback deleteObjectCallback; + SetDeleteBooleanCallback setBooleanCallback; + SetDeleteBooleanCallback deleteBooleanCallback; + SetDeleteInterfaceCallback setInterfaceCallback; + SetDeleteInterfaceCallback deleteInterfaceCallback; +}; + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface TestInterfaceObservableArray { + [Throws] + constructor(optional ObservableArrayCallbacks callbacks = {}); + + // Testing for ObservableArray + attribute ObservableArray<boolean> observableArrayBoolean; + attribute ObservableArray<object> observableArrayObject; + attribute ObservableArray<TestInterfaceObservableArray> observableArrayInterface; + + // Tests for C++ helper function + [Throws] + boolean booleanElementAtInternal(unsigned long index); + [Throws] + TestInterfaceObservableArray interfaceElementAtInternal(unsigned long index); + [Throws] + object objectElementAtInternal(unsigned long index); + + [Throws] + undefined booleanReplaceElementAtInternal(unsigned long index, boolean value); + [Throws] + undefined interfaceReplaceElementAtInternal(unsigned long index, TestInterfaceObservableArray value); + [Throws] + undefined objectReplaceElementAtInternal(unsigned long index, object value); + + [Throws] + undefined booleanAppendElementInternal(boolean value); + [Throws] + undefined interfaceAppendElementInternal(TestInterfaceObservableArray value); + [Throws] + undefined objectAppendElementInternal(object value); + + [Throws] + undefined booleanRemoveLastElementInternal(); + [Throws] + undefined interfaceRemoveLastElementInternal(); + [Throws] + undefined objectRemoveLastElementInternal(); + + [Throws] + unsigned long booleanLengthInternal(); + [Throws] + unsigned long interfaceLengthInternal(); + [Throws] + unsigned long objectLengthInternal(); +}; diff --git a/dom/webidl/TestUtils.webidl b/dom/webidl/TestUtils.webidl new file mode 100644 index 0000000000..8ba99edbc9 --- /dev/null +++ b/dom/webidl/TestUtils.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://testutils.spec.whatwg.org/#the-testutils-namespace + */ + +[Exposed=(Window,Worker), + Pref="dom.testing.testutils.enabled"] +namespace TestUtils { + [NewObject, Throws] Promise<undefined> gc(); +}; diff --git a/dom/webidl/Text.webidl b/dom/webidl/Text.webidl new file mode 100644 index 0000000000..11ea0219e1 --- /dev/null +++ b/dom/webidl/Text.webidl @@ -0,0 +1,31 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window, ProbablyShortLivingWrapper] +interface Text : CharacterData { + [Throws] + constructor(optional DOMString data = ""); + + [Throws] + Text splitText(unsigned long offset); + readonly attribute DOMString wholeText; +}; + +partial interface Text { + [BinaryName="assignedSlotByMode"] + readonly attribute HTMLSlotElement? assignedSlot; + + [ChromeOnly, BinaryName="assignedSlot"] + readonly attribute HTMLSlotElement? openOrClosedAssignedSlot; +}; + +Text includes GeometryUtils; diff --git a/dom/webidl/TextClause.webidl b/dom/webidl/TextClause.webidl new file mode 100644 index 0000000000..9ed1c71843 --- /dev/null +++ b/dom/webidl/TextClause.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[ChromeOnly, + Exposed=Window] +interface TextClause +{ + // The start offset of TextClause + readonly attribute long startOffset; + + // The end offset of TextClause + readonly attribute long endOffset; + + // If the TextClause is Caret or not + readonly attribute boolean isCaret; + + // If the TextClause is TargetClause or not + readonly attribute boolean isTargetClause; +}; diff --git a/dom/webidl/TextDecoder.webidl b/dom/webidl/TextDecoder.webidl new file mode 100644 index 0000000000..fc01d7c8f7 --- /dev/null +++ b/dom/webidl/TextDecoder.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://encoding.spec.whatwg.org/#interface-textdecoder + */ + +interface mixin TextDecoderCommon { + [Constant] + readonly attribute DOMString encoding; + [Constant] + readonly attribute boolean fatal; + [Constant] + readonly attribute boolean ignoreBOM; +}; + +[Exposed=(Window,Worker)] +interface TextDecoder { + [Throws] + constructor(optional DOMString label = "utf-8", + optional TextDecoderOptions options = {}); + + [Throws] + USVString decode(optional BufferSource input, optional TextDecodeOptions options = {}); +}; +TextDecoder includes TextDecoderCommon; + +dictionary TextDecoderOptions { + boolean fatal = false; + boolean ignoreBOM = false; +}; + +dictionary TextDecodeOptions { + boolean stream = false; +}; diff --git a/dom/webidl/TextDecoderStream.webidl b/dom/webidl/TextDecoderStream.webidl new file mode 100644 index 0000000000..a4ffca41cc --- /dev/null +++ b/dom/webidl/TextDecoderStream.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://encoding.spec.whatwg.org/#interface-textdecoderstream + */ + +[Exposed=*] +interface TextDecoderStream { + [Throws] + constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options = {}); +}; +TextDecoderStream includes TextDecoderCommon; +TextDecoderStream includes GenericTransformStream; diff --git a/dom/webidl/TextEncoder.webidl b/dom/webidl/TextEncoder.webidl new file mode 100644 index 0000000000..120d4693d1 --- /dev/null +++ b/dom/webidl/TextEncoder.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://encoding.spec.whatwg.org/#interface-textencoder + */ + +interface mixin TextEncoderCommon { + /* + * This is DOMString in the spec, but the value is always ASCII + * and short. By declaring this as ByteString, we get the same + * end result (storage as inline Latin1 string in SpiderMonkey) + * with fewer conversions. + */ + [Constant] + readonly attribute ByteString encoding; +}; + +dictionary TextEncoderEncodeIntoResult { + unsigned long long read; + unsigned long long written; +}; + +[Exposed=(Window,Worker)] +interface TextEncoder { + constructor(); + + /* + * This is spec-wise USVString but marking it as UTF8String as an + * optimization. (The SpiderMonkey-provided conversion to UTF-8 takes care of + * replacing lone surrogates with the REPLACEMENT CHARACTER, so the + * observable behavior of USVString is matched.) + */ + [NewObject, Throws] + Uint8Array encode(optional UTF8String input = ""); + + /* + * The same comment about UTF8String as above applies here with JSString. + * + * We use JSString because we don't want to encode the full string, just as + * much as the capacity of the Uint8Array. + */ + [CanOOM] + TextEncoderEncodeIntoResult encodeInto(JSString source, Uint8Array destination); +}; +TextEncoder includes TextEncoderCommon; diff --git a/dom/webidl/TextEncoderStream.webidl b/dom/webidl/TextEncoderStream.webidl new file mode 100644 index 0000000000..2d9b8ad22d --- /dev/null +++ b/dom/webidl/TextEncoderStream.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://encoding.spec.whatwg.org/#interface-textdecoderstream + */ + +[Exposed=*] +interface TextEncoderStream { + [Throws] + constructor(); +}; +TextEncoderStream includes TextEncoderCommon; +TextEncoderStream includes GenericTransformStream; diff --git a/dom/webidl/TextTrack.webidl b/dom/webidl/TextTrack.webidl new file mode 100644 index 0000000000..f7a997067a --- /dev/null +++ b/dom/webidl/TextTrack.webidl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#texttrack + */ + +enum TextTrackKind { + "subtitles", + "captions", + "descriptions", + "chapters", + "metadata" +}; + +enum TextTrackMode { + "disabled", + "hidden", + "showing" +}; + +[Exposed=Window] +interface TextTrack : EventTarget { + readonly attribute TextTrackKind kind; + readonly attribute DOMString label; + readonly attribute DOMString language; + + readonly attribute DOMString id; + readonly attribute DOMString inBandMetadataTrackDispatchType; + + attribute TextTrackMode mode; + + readonly attribute TextTrackCueList? cues; + readonly attribute TextTrackCueList? activeCues; + + undefined addCue(VTTCue cue); + [Throws] + undefined removeCue(VTTCue cue); + + attribute EventHandler oncuechange; +}; + +// Mozilla Extensions +partial interface TextTrack { + [ChromeOnly] + readonly attribute TextTrackList? textTrackList; +}; diff --git a/dom/webidl/TextTrackCue.webidl b/dom/webidl/TextTrackCue.webidl new file mode 100644 index 0000000000..444d470bbd --- /dev/null +++ b/dom/webidl/TextTrackCue.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/#texttrackcue + */ + +[Exposed=Window] +interface TextTrackCue : EventTarget { + readonly attribute TextTrack? track; + + attribute DOMString id; + attribute double startTime; + attribute double endTime; + attribute boolean pauseOnExit; + + attribute EventHandler onenter; + attribute EventHandler onexit; +}; diff --git a/dom/webidl/TextTrackCueList.webidl b/dom/webidl/TextTrackCueList.webidl new file mode 100644 index 0000000000..b9f82c7549 --- /dev/null +++ b/dom/webidl/TextTrackCueList.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#texttrackcuelist + */ + +[Exposed=Window] +interface TextTrackCueList { + readonly attribute unsigned long length; + getter VTTCue (unsigned long index); + VTTCue? getCueById(DOMString id); +}; diff --git a/dom/webidl/TextTrackList.webidl b/dom/webidl/TextTrackList.webidl new file mode 100644 index 0000000000..e46208d6cb --- /dev/null +++ b/dom/webidl/TextTrackList.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#texttracklist + */ + +[Exposed=Window] +interface TextTrackList : EventTarget { + readonly attribute unsigned long length; + getter TextTrack (unsigned long index); + TextTrack? getTrackById(DOMString id); + + attribute EventHandler onchange; + attribute EventHandler onaddtrack; + attribute EventHandler onremovetrack; +}; + +// Mozilla extensions +partial interface TextTrackList { + [ChromeOnly] + readonly attribute HTMLMediaElement? mediaElement; +}; diff --git a/dom/webidl/TimeEvent.webidl b/dom/webidl/TimeEvent.webidl new file mode 100644 index 0000000000..a1b19b537d --- /dev/null +++ b/dom/webidl/TimeEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface please see + * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface TimeEvent : Event +{ + readonly attribute long detail; + readonly attribute WindowProxy? view; + undefined initTimeEvent(DOMString aType, + optional Window? aView = null, + optional long aDetail = 0); +}; diff --git a/dom/webidl/TimeRanges.webidl b/dom/webidl/TimeRanges.webidl new file mode 100644 index 0000000000..f09be7c168 --- /dev/null +++ b/dom/webidl/TimeRanges.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#timeranges + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface TimeRanges { + readonly attribute unsigned long length; + + [Throws] + double start(unsigned long index); + + [Throws] + double end(unsigned long index); +}; diff --git a/dom/webidl/ToggleEvent.webidl b/dom/webidl/ToggleEvent.webidl new file mode 100644 index 0000000000..bff4c41062 --- /dev/null +++ b/dom/webidl/ToggleEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/popover.html#the-toggleevent-interface + */ + +[Exposed=Window] +interface ToggleEvent : Event { + constructor(DOMString type, optional ToggleEventInit eventInitDict = {}); + readonly attribute DOMString oldState; + readonly attribute DOMString newState; +}; + +dictionary ToggleEventInit : EventInit { + DOMString oldState = ""; + DOMString newState = ""; +}; diff --git a/dom/webidl/Touch.webidl b/dom/webidl/Touch.webidl new file mode 100644 index 0000000000..344295a0e8 --- /dev/null +++ b/dom/webidl/Touch.webidl @@ -0,0 +1,52 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/webevents/raw-file/default/touchevents.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary TouchInit { + required long identifier; + required EventTarget target; + long clientX = 0; + long clientY = 0; + long screenX = 0; + long screenY = 0; + long pageX = 0; + long pageY = 0; + float radiusX = 0; + float radiusY = 0; + float rotationAngle = 0; + float force = 0; +}; + +[Func="mozilla::dom::Touch::PrefEnabled", + Exposed=Window] +interface Touch { + constructor(TouchInit touchInitDict); + + readonly attribute long identifier; + readonly attribute EventTarget? target; + [NeedsCallerType] + readonly attribute long screenX; + [NeedsCallerType] + readonly attribute long screenY; + + readonly attribute long clientX; + readonly attribute long clientY; + readonly attribute long pageX; + readonly attribute long pageY; + [NeedsCallerType] + readonly attribute long radiusX; + [NeedsCallerType] + readonly attribute long radiusY; + [NeedsCallerType] + readonly attribute float rotationAngle; + [NeedsCallerType] + readonly attribute float force; +}; diff --git a/dom/webidl/TouchEvent.webidl b/dom/webidl/TouchEvent.webidl new file mode 100644 index 0000000000..9cc14505da --- /dev/null +++ b/dom/webidl/TouchEvent.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +dictionary TouchEventInit : EventModifierInit { + sequence<Touch> touches = []; + sequence<Touch> targetTouches = []; + sequence<Touch> changedTouches = []; +}; + +[Func="mozilla::dom::TouchEvent::PrefEnabled", + Exposed=Window] +interface TouchEvent : UIEvent { + constructor(DOMString type, optional TouchEventInit eventInitDict = {}); + + readonly attribute TouchList touches; + readonly attribute TouchList targetTouches; + readonly attribute TouchList changedTouches; + + readonly attribute boolean altKey; + readonly attribute boolean metaKey; + readonly attribute boolean ctrlKey; + readonly attribute boolean shiftKey; + + undefined initTouchEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional Window? view = null, + optional long detail = 0, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false, + optional TouchList? touches = null, + optional TouchList? targetTouches = null, + optional TouchList? changedTouches = null); +}; diff --git a/dom/webidl/TouchList.webidl b/dom/webidl/TouchList.webidl new file mode 100644 index 0000000000..a6fc8f5e3d --- /dev/null +++ b/dom/webidl/TouchList.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/webevents/raw-file/v1/touchevents.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Func="mozilla::dom::TouchList::PrefEnabled", + Exposed=Window] +interface TouchList { + [Pure] + readonly attribute unsigned long length; + getter Touch? item(unsigned long index); +}; diff --git a/dom/webidl/TrackEvent.webidl b/dom/webidl/TrackEvent.webidl new file mode 100644 index 0000000000..730c2b8148 --- /dev/null +++ b/dom/webidl/TrackEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#trackevent + */ + +[Exposed=Window] +interface TrackEvent : Event +{ + constructor(DOMString type, optional TrackEventInit eventInitDict = {}); + + readonly attribute (VideoTrack or AudioTrack or TextTrack)? track; +}; + +dictionary TrackEventInit : EventInit +{ + (VideoTrack or AudioTrack or TextTrack)? track = null; +}; diff --git a/dom/webidl/TransformStream.webidl b/dom/webidl/TransformStream.webidl new file mode 100644 index 0000000000..3dcc74eedd --- /dev/null +++ b/dom/webidl/TransformStream.webidl @@ -0,0 +1,19 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#ts-class-definition + */ + +[Exposed=*] // [Transferable] - See Bug 1562065 +interface TransformStream { + [Throws] + constructor(optional object transformer, + optional QueuingStrategy writableStrategy = {}, + optional QueuingStrategy readableStrategy = {}); + + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; +}; diff --git a/dom/webidl/TransformStreamDefaultController.webidl b/dom/webidl/TransformStreamDefaultController.webidl new file mode 100644 index 0000000000..d7808672aa --- /dev/null +++ b/dom/webidl/TransformStreamDefaultController.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#ts-default-controller-class-definition + */ + +[Exposed=*] +interface TransformStreamDefaultController { + readonly attribute unrestricted double? desiredSize; + [Throws] undefined enqueue(optional any chunk); + [Throws] undefined error(optional any reason); + [Throws] undefined terminate(); +}; diff --git a/dom/webidl/Transformer.webidl b/dom/webidl/Transformer.webidl new file mode 100644 index 0000000000..215a0fe24b --- /dev/null +++ b/dom/webidl/Transformer.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#transformer-api + */ + +[GenerateInit] +dictionary Transformer { + TransformerStartCallback start; + TransformerTransformCallback transform; + TransformerFlushCallback flush; + any readableType; + any writableType; +}; + +callback TransformerStartCallback = any (TransformStreamDefaultController controller); +callback TransformerFlushCallback = Promise<undefined> (TransformStreamDefaultController controller); +callback TransformerTransformCallback = Promise<undefined> (any chunk, TransformStreamDefaultController controller); diff --git a/dom/webidl/TransitionEvent.webidl b/dom/webidl/TransitionEvent.webidl new file mode 100644 index 0000000000..b609e414d3 --- /dev/null +++ b/dom/webidl/TransitionEvent.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Transition events are defined in: + * http://www.w3.org/TR/css3-transitions/#transition-events- + * http://dev.w3.org/csswg/css3-transitions/#transition-events- + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface TransitionEvent : Event { + constructor(DOMString type, optional TransitionEventInit eventInitDict = {}); + + readonly attribute DOMString propertyName; + readonly attribute float elapsedTime; + readonly attribute DOMString pseudoElement; +}; + +dictionary TransitionEventInit : EventInit { + DOMString propertyName = ""; + float elapsedTime = 0; + DOMString pseudoElement = ""; +}; diff --git a/dom/webidl/TreeWalker.webidl b/dom/webidl/TreeWalker.webidl new file mode 100644 index 0000000000..a94224ef7b --- /dev/null +++ b/dom/webidl/TreeWalker.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/2012/WD-dom-20120105/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface TreeWalker { + [Constant] + readonly attribute Node root; + [Constant] + readonly attribute unsigned long whatToShow; + [Constant] + readonly attribute NodeFilter? filter; + [Pure, SetterThrows] + attribute Node currentNode; + + [Throws] + Node? parentNode(); + [Throws] + Node? firstChild(); + [Throws] + Node? lastChild(); + [Throws] + Node? previousSibling(); + [Throws] + Node? nextSibling(); + [Throws] + Node? previousNode(); + [Throws] + Node? nextNode(); +}; diff --git a/dom/webidl/UDPMessageEvent.webidl b/dom/webidl/UDPMessageEvent.webidl new file mode 100644 index 0000000000..22ffc83f89 --- /dev/null +++ b/dom/webidl/UDPMessageEvent.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/raw-sockets/#interface-udpmessageevent + */ + +//Bug 1056444: This interface should be removed after UDPSocket.input/UDPSocket.output are ready. +[Pref="dom.udpsocket.enabled", + ChromeOnly, + Exposed=Window] +interface UDPMessageEvent : Event { + constructor(DOMString type, + optional UDPMessageEventInit eventInitDict = {}); + + readonly attribute DOMString remoteAddress; + readonly attribute unsigned short remotePort; + readonly attribute any data; +}; + +dictionary UDPMessageEventInit : EventInit { + DOMString remoteAddress = ""; + unsigned short remotePort = 0; + any data = null; +}; diff --git a/dom/webidl/UDPSocket.webidl b/dom/webidl/UDPSocket.webidl new file mode 100644 index 0000000000..a345253a6c --- /dev/null +++ b/dom/webidl/UDPSocket.webidl @@ -0,0 +1,43 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/2012/sysapps/tcp-udp-sockets/#interface-udpsocket + * http://www.w3.org/2012/sysapps/tcp-udp-sockets/#dictionary-udpoptions + */ + +dictionary UDPOptions { + DOMString localAddress; + unsigned short localPort; + DOMString remoteAddress; + unsigned short remotePort; + boolean addressReuse = true; + boolean loopback = false; +}; + +[Pref="dom.udpsocket.enabled", + ChromeOnly, + Exposed=Window] +interface UDPSocket : EventTarget { + [Throws] + constructor(optional UDPOptions options = {}); + + readonly attribute DOMString? localAddress; + readonly attribute unsigned short? localPort; + readonly attribute DOMString? remoteAddress; + readonly attribute unsigned short? remotePort; + readonly attribute boolean addressReuse; + readonly attribute boolean loopback; + readonly attribute SocketReadyState readyState; + readonly attribute Promise<undefined> opened; + readonly attribute Promise<undefined> closed; +// readonly attribute ReadableStream input; //Bug 1056444: Stream API is not ready +// readonly attribute WriteableStream output; //Bug 1056444: Stream API is not ready + attribute EventHandler onmessage; //Bug 1056444: use event interface before Stream API is ready + Promise<undefined> close (); + [Throws] undefined joinMulticastGroup (DOMString multicastGroupAddress); + [Throws] undefined leaveMulticastGroup (DOMString multicastGroupAddress); + [Throws] boolean send ((DOMString or Blob or ArrayBuffer or ArrayBufferView) data, optional DOMString? remoteAddress, optional unsigned short? remotePort); //Bug 1056444: use send method before Stream API is ready +}; diff --git a/dom/webidl/UIEvent.webidl b/dom/webidl/UIEvent.webidl new file mode 100644 index 0000000000..d384210092 --- /dev/null +++ b/dom/webidl/UIEvent.webidl @@ -0,0 +1,64 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface please see + * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface UIEvent : Event +{ + constructor(DOMString type, optional UIEventInit eventInitDict = {}); + + readonly attribute WindowProxy? view; + readonly attribute long detail; + undefined initUIEvent(DOMString aType, + optional boolean aCanBubble = false, + optional boolean aCancelable = false, + optional Window? aView = null, + optional long aDetail = 0); +}; + +// Additional DOM0 properties. +partial interface UIEvent { + const long SCROLL_PAGE_UP = -32768; + const long SCROLL_PAGE_DOWN = 32768; + + readonly attribute long layerX; + readonly attribute long layerY; + [NeedsCallerType] + readonly attribute unsigned long which; + readonly attribute Node? rangeParent; + readonly attribute long rangeOffset; +}; + +dictionary UIEventInit : EventInit +{ + Window? view = null; + long detail = 0; +}; + +// NOTE: Gecko doesn't support commented out modifiers yet. +dictionary EventModifierInit : UIEventInit +{ + boolean ctrlKey = false; + boolean shiftKey = false; + boolean altKey = false; + boolean metaKey = false; + boolean modifierAltGraph = false; + boolean modifierCapsLock = false; + boolean modifierFn = false; + boolean modifierFnLock = false; + // boolean modifierHyper = false; + boolean modifierNumLock = false; + boolean modifierOS = false; + boolean modifierScrollLock = false; + // boolean modifierSuper = false; + boolean modifierSymbol = false; + boolean modifierSymbolLock = false; +}; diff --git a/dom/webidl/URL.webidl b/dom/webidl/URL.webidl new file mode 100644 index 0000000000..9cdd7f7aac --- /dev/null +++ b/dom/webidl/URL.webidl @@ -0,0 +1,59 @@ +/* -*- 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 origins of this IDL file are + * http://url.spec.whatwg.org/#api + * https://w3c.github.io/FileAPI/#creating-revoking + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface URI; + +[Exposed=(Window,Worker,WorkerDebugger), + LegacyWindowAlias=webkitURL] +interface URL { + [Throws] + constructor(USVString url, optional USVString base); + + static boolean canParse(USVString url, optional USVString base); + + [SetterThrows] + stringifier attribute USVString href; + readonly attribute USVString origin; + attribute USVString protocol; + attribute USVString username; + attribute USVString password; + attribute USVString host; + attribute USVString hostname; + attribute USVString port; + attribute USVString pathname; + attribute USVString search; + [SameObject] + readonly attribute URLSearchParams searchParams; + attribute USVString hash; + + [ChromeOnly] + readonly attribute URI URI; + [ChromeOnly] + static URL fromURI(URI uri); + + USVString toJSON(); +}; + +[Exposed=(Window,DedicatedWorker,SharedWorker)] +partial interface URL { + [Throws] + static DOMString createObjectURL(Blob blob); + [Throws] + static undefined revokeObjectURL(DOMString url); + [ChromeOnly, Throws] + static boolean isValidObjectURL(DOMString url); + + // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html + [Throws] + static DOMString createObjectURL(MediaSource source); +}; diff --git a/dom/webidl/URLSearchParams.webidl b/dom/webidl/URLSearchParams.webidl new file mode 100644 index 0000000000..de4922b33c --- /dev/null +++ b/dom/webidl/URLSearchParams.webidl @@ -0,0 +1,36 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://url.spec.whatwg.org/#urlsearchparams + * + * To the extent possible under law, the editors have waived all copyright + * and related or neighboring rights to this work. In addition, as of 17 + * February 2013, the editors have made this specification available under + * the Open Web Foundation Agreement Version 1.0, which is available at + * http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. + */ + +[Exposed=(Window,Worker,WorkerDebugger)] +interface URLSearchParams { + [Throws] + constructor(optional (sequence<sequence<USVString>> or + record<USVString, USVString> or USVString) init = ""); + + readonly attribute unsigned long size; + + undefined append(USVString name, USVString value); + undefined delete(USVString name, optional USVString value); + USVString? get(USVString name); + sequence<USVString> getAll(USVString name); + boolean has(USVString name, optional USVString value); + undefined set(USVString name, USVString value); + + [Throws] + undefined sort(); + + iterable<USVString, USVString>; + stringifier; +}; diff --git a/dom/webidl/UnderlyingSink.webidl b/dom/webidl/UnderlyingSink.webidl new file mode 100644 index 0000000000..6207589344 --- /dev/null +++ b/dom/webidl/UnderlyingSink.webidl @@ -0,0 +1,22 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#underlying-sink-api + */ + +[GenerateInit] +dictionary UnderlyingSink { + UnderlyingSinkStartCallback start; + UnderlyingSinkWriteCallback write; + UnderlyingSinkCloseCallback close; + UnderlyingSinkAbortCallback abort; + any type; +}; + +callback UnderlyingSinkStartCallback = any (WritableStreamDefaultController controller); +callback UnderlyingSinkWriteCallback = Promise<undefined> (any chunk, WritableStreamDefaultController controller); +callback UnderlyingSinkCloseCallback = Promise<undefined> (); +callback UnderlyingSinkAbortCallback = Promise<undefined> (optional any reason); diff --git a/dom/webidl/UnderlyingSource.webidl b/dom/webidl/UnderlyingSource.webidl new file mode 100644 index 0000000000..7b9a95fd6b --- /dev/null +++ b/dom/webidl/UnderlyingSource.webidl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#underlying-source-api + */ + +[GenerateInit] +dictionary UnderlyingSource { + UnderlyingSourceStartCallback start; + UnderlyingSourcePullCallback pull; + UnderlyingSourceCancelCallback cancel; + ReadableStreamType type; + [EnforceRange] unsigned long long autoAllocateChunkSize; +}; + +typedef (ReadableStreamDefaultController or ReadableByteStreamController) ReadableStreamController; + +callback UnderlyingSourceStartCallback = any (ReadableStreamController controller); +callback UnderlyingSourcePullCallback = Promise<undefined> (ReadableStreamController controller); +callback UnderlyingSourceCancelCallback = Promise<undefined> (optional any reason); diff --git a/dom/webidl/UserActivation.webidl b/dom/webidl/UserActivation.webidl new file mode 100644 index 0000000000..f8f79c3872 --- /dev/null +++ b/dom/webidl/UserActivation.webidl @@ -0,0 +1,14 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/interaction.html#the-useractivation-interface + */ + +[Exposed=Window] +interface UserActivation { + readonly attribute boolean hasBeenActive; + readonly attribute boolean isActive; +}; diff --git a/dom/webidl/UserProximityEvent.webidl b/dom/webidl/UserProximityEvent.webidl new file mode 100644 index 0000000000..67ae1ceef2 --- /dev/null +++ b/dom/webidl/UserProximityEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Pref="device.sensors.proximity.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", + Exposed=Window] +interface UserProximityEvent : Event +{ + constructor(DOMString type, + optional UserProximityEventInit eventInitDict = {}); + + readonly attribute boolean near; +}; + +dictionary UserProximityEventInit : EventInit +{ + boolean near = false; +}; diff --git a/dom/webidl/VRDisplay.webidl b/dom/webidl/VRDisplay.webidl new file mode 100644 index 0000000000..d1ce4b949e --- /dev/null +++ b/dom/webidl/VRDisplay.webidl @@ -0,0 +1,325 @@ +/* -*- 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://immersive-web.github.io/webvr/spec/1.1/ + */ + +enum VREye { + "left", + "right" +}; + +[Pref="dom.vr.enabled", + HeaderFile="mozilla/dom/VRDisplay.h", + SecureContext, + Exposed=Window] +interface VRFieldOfView { + readonly attribute double upDegrees; + readonly attribute double rightDegrees; + readonly attribute double downDegrees; + readonly attribute double leftDegrees; +}; + +typedef (HTMLCanvasElement or OffscreenCanvas) VRSource; + +dictionary VRLayer { + /** + * XXX - When WebVR in WebWorkers is implemented, HTMLCanvasElement below + * should be replaced with VRSource. + */ + HTMLCanvasElement? source = null; + + /** + * The left and right viewports contain 4 values defining the viewport + * rectangles within the canvas to present to the eye in UV space. + * [0] left offset of the viewport (0.0 - 1.0) + * [1] top offset of the viewport (0.0 - 1.0) + * [2] width of the viewport (0.0 - 1.0) + * [3] height of the viewport (0.0 - 1.0) + * + * When no values are passed, they will be processed as though the left + * and right sides of the viewport were passed: + * + * leftBounds: [0.0, 0.0, 0.5, 1.0] + * rightBounds: [0.5, 0.0, 0.5, 1.0] + */ + sequence<float> leftBounds = []; + sequence<float> rightBounds = []; +}; + +/** + * Values describing the capabilities of a VRDisplay. + * These are expected to be static per-device/per-user. + */ +[Pref="dom.vr.enabled", + HeaderFile="mozilla/dom/VRDisplay.h", + SecureContext, + Exposed=Window] +interface VRDisplayCapabilities { + /** + * hasPosition is true if the VRDisplay is capable of tracking its position. + */ + readonly attribute boolean hasPosition; + + /** + * hasOrientation is true if the VRDisplay is capable of tracking its orientation. + */ + readonly attribute boolean hasOrientation; + + /** + * Whether the VRDisplay is separate from the device’s + * primary display. If presenting VR content will obscure + * other content on the device, this should be false. When + * false, the application should not attempt to mirror VR content + * or update non-VR UI because that content will not be visible. + */ + readonly attribute boolean hasExternalDisplay; + + /** + * Whether the VRDisplay is capable of presenting content to an HMD or similar device. + * Can be used to indicate “magic window” devices that are capable of 6DoF tracking but for + * which requestPresent is not meaningful. If false then calls to requestPresent should + * always fail, and getEyeParameters should return null. + */ + readonly attribute boolean canPresent; + + /** + * Indicates the maximum length of the array that requestPresent() will accept. MUST be 1 if + canPresent is true, 0 otherwise. + */ + readonly attribute unsigned long maxLayers; +}; + +/** + * Values describing the the stage / play area for devices + * that support room-scale experiences. + */ +[Pref="dom.vr.enabled", + HeaderFile="mozilla/dom/VRDisplay.h", + SecureContext, + Exposed=Window] +interface VRStageParameters { + /** + * A 16-element array containing the components of a column-major 4x4 + * affine transform matrix. This matrix transforms the sitting-space position + * returned by get{Immediate}Pose() to a standing-space position. + */ + [Throws] readonly attribute Float32Array sittingToStandingTransform; + + /** + * Dimensions of the play-area bounds. The bounds are defined + * as an axis-aligned rectangle on the floor. + * The center of the rectangle is at (0,0,0) in standing-space + * coordinates. + * These bounds are defined for safety purposes. + * Content should not require the user to move beyond these + * bounds; however, it is possible for the user to ignore + * the bounds resulting in position values outside of + * this rectangle. + */ + readonly attribute float sizeX; + readonly attribute float sizeZ; +}; + +[Pref="dom.vr.enabled", + HeaderFile="mozilla/dom/VRDisplay.h", + SecureContext, + Exposed=Window] +interface VRPose +{ + /** + * position, linearVelocity, and linearAcceleration are 3-component vectors. + * position is relative to a sitting space. Transforming this point with + * VRStageParameters.sittingToStandingTransform converts this to standing space. + */ + [Constant, Throws] readonly attribute Float32Array? position; + [Constant, Throws] readonly attribute Float32Array? linearVelocity; + [Constant, Throws] readonly attribute Float32Array? linearAcceleration; + + /* orientation is a 4-entry array representing the components of a quaternion. */ + [Constant, Throws] readonly attribute Float32Array? orientation; + /* angularVelocity and angularAcceleration are the components of 3-dimensional vectors. */ + [Constant, Throws] readonly attribute Float32Array? angularVelocity; + [Constant, Throws] readonly attribute Float32Array? angularAcceleration; +}; + +[Pref="dom.vr.enabled", + HeaderFile="mozilla/dom/VRDisplay.h", + SecureContext, + Exposed=Window] +interface VRFrameData { + constructor(); + + readonly attribute DOMHighResTimeStamp timestamp; + + [Throws, Pure] readonly attribute Float32Array leftProjectionMatrix; + [Throws, Pure] readonly attribute Float32Array leftViewMatrix; + + [Throws, Pure] readonly attribute Float32Array rightProjectionMatrix; + [Throws, Pure] readonly attribute Float32Array rightViewMatrix; + + [Pure] readonly attribute VRPose pose; +}; + +[Pref="dom.vr.enabled", + HeaderFile="mozilla/dom/VRDisplay.h", + SecureContext, + Exposed=Window] +interface VREyeParameters { + /** + * offset is a 3-component vector representing an offset to + * translate the eye. This value may vary from frame + * to frame if the user adjusts their headset ipd. + */ + [Constant, Throws] readonly attribute Float32Array offset; + + /* These values may vary as the user adjusts their headset ipd. */ + [Constant] readonly attribute VRFieldOfView fieldOfView; + + /** + * renderWidth and renderHeight specify the recommended render target + * size of each eye viewport, in pixels. If multiple eyes are rendered + * in a single render target, then the render target should be made large + * enough to fit both viewports. + */ + [Constant] readonly attribute unsigned long renderWidth; + [Constant] readonly attribute unsigned long renderHeight; +}; + +[Pref="dom.vr.enabled", + HeaderFile="mozilla/dom/VRDisplay.h", + SecureContext, + Exposed=Window] +interface VRDisplay : EventTarget { + /** + * presentingGroups is a bitmask indicating which VR session groups + * have an active VR presentation. + */ + [ChromeOnly] readonly attribute unsigned long presentingGroups; + /** + * Setting groupMask causes submitted frames by VR sessions that + * aren't included in the bitmasked groups to be ignored. + * Non-chrome content is not aware of the value of groupMask. + * VRDisplay.RequestAnimationFrame will still fire for VR sessions + * that are hidden by groupMask, enabling their performance to be + * measured by chrome UI that is presented in other groups. + * This is expected to be used in cases where chrome UI is presenting + * information during link traversal or presenting options when content + * performance is too low for comfort. + * The VR refresh / VSync cycle is driven by the visible content + * and the non-visible content may have a throttled refresh rate. + */ + [ChromeOnly] attribute unsigned long groupMask; + + readonly attribute boolean isConnected; + readonly attribute boolean isPresenting; + + /** + * Dictionary of capabilities describing the VRDisplay. + */ + [Constant] readonly attribute VRDisplayCapabilities capabilities; + + /** + * If this VRDisplay supports room-scale experiences, the optional + * stage attribute contains details on the room-scale parameters. + */ + readonly attribute VRStageParameters? stageParameters; + + /* Return the current VREyeParameters for the given eye. */ + VREyeParameters getEyeParameters(VREye whichEye); + + /** + * An identifier for this distinct VRDisplay. Used as an + * association point in the Gamepad API. + */ + [Constant] readonly attribute unsigned long displayId; + + /** + * A display name, a user-readable name identifying it. + */ + [Constant] readonly attribute DOMString displayName; + + /** + * Populates the passed VRFrameData with the information required to render + * the current frame. + */ + boolean getFrameData(VRFrameData frameData); + + /** + * Return a VRPose containing the future predicted pose of the VRDisplay + * when the current frame will be presented. Subsequent calls to getPose() + * MUST return a VRPose with the same values until the next call to + * submitFrame(). + * + * The VRPose will contain the position, orientation, velocity, + * and acceleration of each of these properties. + */ + [NewObject] VRPose getPose(); + + /** + * Reset the pose for this display, treating its current position and + * orientation as the "origin/zero" values. VRPose.position, + * VRPose.orientation, and VRStageParameters.sittingToStandingTransform may be + * updated when calling resetPose(). This should be called in only + * sitting-space experiences. + */ + undefined resetPose(); + + /** + * z-depth defining the near plane of the eye view frustum + * enables mapping of values in the render target depth + * attachment to scene coordinates. Initially set to 0.01. + */ + attribute double depthNear; + + /** + * z-depth defining the far plane of the eye view frustum + * enables mapping of values in the render target depth + * attachment to scene coordinates. Initially set to 10000.0. + */ + attribute double depthFar; + + /** + * The callback passed to `requestAnimationFrame` will be called + * any time a new frame should be rendered. When the VRDisplay is + * presenting the callback will be called at the native refresh + * rate of the HMD. When not presenting this function acts + * identically to how window.requestAnimationFrame acts. Content should + * make no assumptions of frame rate or vsync behavior as the HMD runs + * asynchronously from other displays and at differing refresh rates. + */ + [Throws] long requestAnimationFrame(FrameRequestCallback callback); + + /** + * Passing the value returned by `requestAnimationFrame` to + * `cancelAnimationFrame` will unregister the callback. + */ + [Throws] undefined cancelAnimationFrame(long handle); + + /** + * Begin presenting to the VRDisplay. Must be called in response to a user gesture. + * Repeat calls while already presenting will update the VRLayers being displayed. + */ + [NewObject, NeedsCallerType] Promise<undefined> requestPresent(sequence<VRLayer> layers); + + /** + * Stops presenting to the VRDisplay. + */ + [NewObject] Promise<undefined> exitPresent(); + + /** + * Get the layers currently being presented. + */ + sequence<VRLayer> getLayers(); + + /** + * The VRLayer provided to the VRDisplay will be captured and presented + * in the HMD. Calling this function has the same effect on the source + * canvas as any other operation that uses its source image, and canvases + * created without preserveDrawingBuffer set to true will be cleared. + */ + undefined submitFrame(); +}; diff --git a/dom/webidl/VRDisplayEvent.webidl b/dom/webidl/VRDisplayEvent.webidl new file mode 100644 index 0000000000..41407ec615 --- /dev/null +++ b/dom/webidl/VRDisplayEvent.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +enum VRDisplayEventReason { + "mounted", + "navigation", + "requested", + "unmounted", +}; + +dictionary VRDisplayEventInit : EventInit { + required VRDisplay display; + VRDisplayEventReason reason; +}; + +[Pref="dom.vr.enabled", + SecureContext, + Exposed=Window] +interface VRDisplayEvent : Event { + constructor(DOMString type, VRDisplayEventInit eventInitDict); + + readonly attribute VRDisplay display; + readonly attribute VRDisplayEventReason? reason; +}; diff --git a/dom/webidl/VRServiceTest.webidl b/dom/webidl/VRServiceTest.webidl new file mode 100644 index 0000000000..fec95dba07 --- /dev/null +++ b/dom/webidl/VRServiceTest.webidl @@ -0,0 +1,84 @@ +/* This Source Code Form is subject to the terms of 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 WebIDL is just for WebVR testing. + */ + +[Pref="dom.vr.puppet.enabled", + HeaderFile="mozilla/dom/VRServiceTest.h", + Exposed=Window] +interface VRMockDisplay { + undefined create(); + attribute boolean capPosition; + attribute boolean capOrientation; + attribute boolean capPresent; + attribute boolean capExternal; + attribute boolean capAngularAcceleration; + attribute boolean capLinearAcceleration; + attribute boolean capStageParameters; + attribute boolean capMountDetection; + attribute boolean capPositionEmulated; + undefined setEyeFOV(VREye eye, + double upDegree, double rightDegree, + double downDegree, double leftDegree); + undefined setEyeOffset(VREye eye, double offsetX, + double offsetY, double offsetZ); + undefined setEyeResolution(unsigned long renderWidth, + unsigned long renderHeight); + undefined setConnected(boolean connected); + undefined setMounted(boolean mounted); + undefined setStageSize(double width, double height); + [Throws] undefined setSittingToStandingTransform(Float32Array sittingToStandingTransform); + [Throws] undefined setPose(Float32Array? position, Float32Array? linearVelocity, + Float32Array? linearAcceleration, Float32Array? orientation, + Float32Array? angularVelocity, Float32Array? angularAcceleration); +}; + +[Pref="dom.vr.puppet.enabled", + HeaderFile="mozilla/dom/VRServiceTest.h", + Exposed=Window] +interface VRMockController { + undefined create(); + undefined clear(); + attribute GamepadHand hand; + attribute boolean capPosition; + attribute boolean capOrientation; + attribute boolean capAngularAcceleration; + attribute boolean capLinearAcceleration; + attribute unsigned long axisCount; + attribute unsigned long buttonCount; + attribute unsigned long hapticCount; + [Throws] undefined setPose(Float32Array? position, Float32Array? linearVelocity, + Float32Array? linearAcceleration, Float32Array? orientation, + Float32Array? angularVelocity, Float32Array? angularAcceleration); + undefined setButtonPressed(unsigned long buttonIdx, boolean pressed); + undefined setButtonTouched(unsigned long buttonIdx, boolean touched); + undefined setButtonTrigger(unsigned long buttonIdx, double trigger); + undefined setAxisValue(unsigned long axisIdx, double value); +}; + +[Pref="dom.vr.puppet.enabled", + HeaderFile="mozilla/dom/VRServiceTest.h", + Exposed=Window] +interface VRServiceTest { + VRMockDisplay getVRDisplay(); + [Throws] VRMockController getVRController(unsigned long controllerIdx); + [NewObject] Promise<undefined> run(); + [NewObject] Promise<undefined> reset(); + undefined commit(); + undefined end(); + undefined clearAll(); + undefined timeout(unsigned long duration); + undefined wait(unsigned long duration); + undefined waitSubmit(); + undefined waitPresentationStart(); + undefined waitPresentationEnd(); + [Throws] + undefined waitHapticIntensity(unsigned long controllerIdx, unsigned long hapticIdx, double intensity); + undefined captureFrame(); + undefined acknowledgeFrame(); + undefined rejectFrame(); + undefined startTimer(); + undefined stopTimer(); +}; diff --git a/dom/webidl/VTTCue.webidl b/dom/webidl/VTTCue.webidl new file mode 100644 index 0000000000..d18a732976 --- /dev/null +++ b/dom/webidl/VTTCue.webidl @@ -0,0 +1,75 @@ +/* -*- 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/html5/webvtt/#the-vttcue-interface + */ + +enum AutoKeyword { "auto" }; + +enum LineAlignSetting { + "start", + "center", + "end" +}; + +enum PositionAlignSetting { + "line-left", + "center", + "line-right", + "auto" +}; + +enum AlignSetting { + "start", + "center", + "end", + "left", + "right" +}; + +enum DirectionSetting { + "", + "rl", + "lr" +}; + +[Exposed=Window] +interface VTTCue : TextTrackCue { + [Throws] + constructor(double startTime, double endTime, DOMString text); + + attribute VTTRegion? region; + attribute DirectionSetting vertical; + attribute boolean snapToLines; + attribute (double or AutoKeyword) line; + [SetterThrows] + attribute LineAlignSetting lineAlign; + [SetterThrows] + attribute (double or AutoKeyword) position; + [SetterThrows] + attribute PositionAlignSetting positionAlign; + [SetterThrows] + attribute double size; + attribute AlignSetting align; + attribute DOMString text; + DocumentFragment getCueAsHTML(); +}; + +// Mozilla extensions. +partial interface VTTCue { + [ChromeOnly] + attribute HTMLDivElement? displayState; + [ChromeOnly] + readonly attribute boolean hasBeenReset; + [ChromeOnly] + readonly attribute double computedLine; + [ChromeOnly] + readonly attribute double computedPosition; + [ChromeOnly] + readonly attribute PositionAlignSetting computedPositionAlign; + [ChromeOnly] + readonly attribute boolean getActive; +}; diff --git a/dom/webidl/VTTRegion.webidl b/dom/webidl/VTTRegion.webidl new file mode 100644 index 0000000000..d9f1204da1 --- /dev/null +++ b/dom/webidl/VTTRegion.webidl @@ -0,0 +1,35 @@ +/* -*- 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/webvtt/#the-vttregion-interface + */ + +enum ScrollSetting { + "", + "up" +}; + +[Exposed=Window] +interface VTTRegion { + [Throws] + constructor(); + + attribute DOMString id; + [SetterThrows] + attribute double width; + [SetterThrows] + attribute long lines; + [SetterThrows] + attribute double regionAnchorX; + [SetterThrows] + attribute double regionAnchorY; + [SetterThrows] + attribute double viewportAnchorX; + [SetterThrows] + attribute double viewportAnchorY; + + attribute ScrollSetting scroll; +}; diff --git a/dom/webidl/ValidityState.webidl b/dom/webidl/ValidityState.webidl new file mode 100644 index 0000000000..9df58a975e --- /dev/null +++ b/dom/webidl/ValidityState.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#validitystate + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ + +[Exposed=Window] +interface ValidityState { + readonly attribute boolean valueMissing; + readonly attribute boolean typeMismatch; + readonly attribute boolean patternMismatch; + readonly attribute boolean tooLong; + readonly attribute boolean tooShort; + readonly attribute boolean rangeUnderflow; + readonly attribute boolean rangeOverflow; + readonly attribute boolean stepMismatch; + readonly attribute boolean badInput; + readonly attribute boolean customError; + readonly attribute boolean valid; +}; diff --git a/dom/webidl/VideoColorSpace.webidl b/dom/webidl/VideoColorSpace.webidl new file mode 100644 index 0000000000..c2ff8e81ad --- /dev/null +++ b/dom/webidl/VideoColorSpace.webidl @@ -0,0 +1,54 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/webcodecs/#videocolorspace + */ + +[Exposed=(Window,DedicatedWorker), Pref="dom.media.webcodecs.enabled"] +interface VideoColorSpace { + [Throws] + constructor(optional VideoColorSpaceInit init = {}); + + readonly attribute VideoColorPrimaries? primaries; + readonly attribute VideoTransferCharacteristics? transfer; + readonly attribute VideoMatrixCoefficients? matrix; + readonly attribute boolean? fullRange; + + // https://github.com/w3c/webcodecs/issues/486 + [Default] object toJSON(); +}; + +dictionary VideoColorSpaceInit { + VideoColorPrimaries? primaries = null; + VideoTransferCharacteristics? transfer = null; + VideoMatrixCoefficients? matrix = null; + boolean? fullRange = null; +}; + +enum VideoColorPrimaries { + "bt709", // BT.709, sRGB + "bt470bg", // BT.601 PAL + "smpte170m", // BT.601 NTSC + "bt2020", // BT.2020, BT.2100 + "smpte432", // P3 D65 +}; + +enum VideoTransferCharacteristics { + "bt709", // BT.709 + "smpte170m", // BT.601 (functionally the same as bt709) + "iec61966-2-1", // sRGB + "linear", // linear RGB + "pq", // BT.2100 PQ + "hlg", // BT.2100 HLG +}; + +enum VideoMatrixCoefficients { + "rgb", // sRGB + "bt709", // BT.709 + "bt470bg", // BT.601 PAL + "smpte170m", // BT.601 NTSC (functionally the same as bt470bg) + "bt2020-ncl", // BT.2020 NCL +}; diff --git a/dom/webidl/VideoDecoder.webidl b/dom/webidl/VideoDecoder.webidl new file mode 100644 index 0000000000..0c8f5c9b5e --- /dev/null +++ b/dom/webidl/VideoDecoder.webidl @@ -0,0 +1,71 @@ +/* -*- 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/webcodecs/#videodecoder + */ + +[Exposed=(Window,DedicatedWorker), SecureContext, Pref="dom.media.webcodecs.enabled"] +interface VideoDecoder : EventTarget { + [Throws] + constructor(VideoDecoderInit init); + + readonly attribute CodecState state; + readonly attribute unsigned long decodeQueueSize; + attribute EventHandler ondequeue; + + [Throws] + undefined configure(VideoDecoderConfig config); + [Throws] + undefined decode(EncodedVideoChunk chunk); + [NewObject, Throws] + Promise<undefined> flush(); + [Throws] + undefined reset(); + [Throws] + undefined close(); + + [NewObject, Throws] + static Promise<VideoDecoderSupport> isConfigSupported(VideoDecoderConfig config); +}; + +dictionary VideoDecoderInit { + required VideoFrameOutputCallback output; + required WebCodecsErrorCallback error; +}; + +callback VideoFrameOutputCallback = undefined(VideoFrame output); + +dictionary VideoDecoderSupport { + boolean supported; + VideoDecoderConfig config; +}; + +dictionary VideoDecoderConfig { + required DOMString codec; + // Bug 1696216: Should be 1696216 [AllowShared] BufferSource description; + ([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) description; + [EnforceRange] unsigned long codedWidth; + [EnforceRange] unsigned long codedHeight; + [EnforceRange] unsigned long displayAspectWidth; + [EnforceRange] unsigned long displayAspectHeight; + VideoColorSpaceInit colorSpace; + HardwareAcceleration hardwareAcceleration = "no-preference"; + boolean optimizeForLatency; +}; + +enum HardwareAcceleration { + "no-preference", + "prefer-hardware", + "prefer-software", +}; + +enum CodecState { + "unconfigured", + "configured", + "closed" +}; + +callback WebCodecsErrorCallback = undefined(DOMException error); diff --git a/dom/webidl/VideoEncoder.webidl b/dom/webidl/VideoEncoder.webidl new file mode 100644 index 0000000000..5fd40ca3c6 --- /dev/null +++ b/dom/webidl/VideoEncoder.webidl @@ -0,0 +1,120 @@ +/* -*- 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/webcodecs/#videoencoder + * + * Some members of this API are codec-specific, in which case the source of the + * IDL are in the codec-specific registry entries, that are listed in + * https://w3c.github.io/webcodecs/codec_registry.html. Those members are + * commented with a link of the document in which the member is listed. + */ + +[Exposed=(Window,DedicatedWorker), SecureContext, Pref="dom.media.webcodecs.enabled"] +interface VideoEncoder : EventTarget { + [Throws] + constructor(VideoEncoderInit init); + + readonly attribute CodecState state; + readonly attribute unsigned long encodeQueueSize; + attribute EventHandler ondequeue; + + [Throws] + undefined configure(VideoEncoderConfig config); + [Throws, BinaryName="VideoEncoder::EncodeVideoFrame"] + undefined encode(VideoFrame frame , optional VideoEncoderEncodeOptions options = {}); + [Throws] + Promise<undefined> flush(); + [Throws] + undefined reset(); + [Throws] + undefined close(); + + [NewObject, Throws] + static Promise<VideoEncoderSupport> isConfigSupported(VideoEncoderConfig config); +}; + +dictionary VideoEncoderInit { + required EncodedVideoChunkOutputCallback output; + required WebCodecsErrorCallback error; +}; + +callback EncodedVideoChunkOutputCallback = + undefined (EncodedVideoChunk chunk, + optional EncodedVideoChunkMetadata metadata = {}); + +// AVC (H264)-specific +// https://w3c.github.io/webcodecs/avc_codec_registration.html +enum AvcBitstreamFormat { + "annexb", + "avc", +}; + +// AVC (H264)-specific +// https://w3c.github.io/webcodecs/avc_codec_registration.html +dictionary AvcEncoderConfig { + AvcBitstreamFormat format = "avc"; +}; + +dictionary VideoEncoderConfig { + required DOMString codec; + required [EnforceRange] unsigned long width; + required [EnforceRange] unsigned long height; + [EnforceRange] unsigned long displayWidth; + [EnforceRange] unsigned long displayHeight; + [EnforceRange] unsigned long long bitrate; + double framerate; + HardwareAcceleration hardwareAcceleration = "no-preference"; + AlphaOption alpha = "discard"; + DOMString scalabilityMode; + VideoEncoderBitrateMode bitrateMode = "variable"; + LatencyMode latencyMode = "quality"; + DOMString contentHint; + // AVC (H264)-specific + // https://w3c.github.io/webcodecs/avc_codec_registration.html + AvcEncoderConfig avc; +}; + +dictionary VideoEncoderEncodeOptions { + boolean keyFrame = false; + // AVC (H264)-specific + // https://w3c.github.io/webcodecs/avc_codec_registration.html + VideoEncoderEncodeOptionsForAvc avc; +}; + +// AVC (H264)-specific +// https://w3c.github.io/webcodecs/avc_codec_registration.html +dictionary VideoEncoderEncodeOptionsForAvc { + unsigned short? quantizer; +}; + +enum VideoEncoderBitrateMode { + "constant", + "variable", + // AVC (H264)-specific + // https://w3c.github.io/webcodecs/avc_codec_registration.html + "quantizer" +}; + +enum LatencyMode { + "quality", + "realtime" +}; + +dictionary VideoEncoderSupport { + boolean supported; + VideoEncoderConfig config; +}; + +dictionary EncodedVideoChunkMetadata { + VideoDecoderConfig decoderConfig; + SvcOutputMetadata svc; + // Not implemented https://bugzilla.mozilla.org/show_bug.cgi?id=1867067 + // BufferSource alphaSideData; +}; + +dictionary SvcOutputMetadata { + unsigned long temporalLayerId; +}; diff --git a/dom/webidl/VideoFrame.webidl b/dom/webidl/VideoFrame.webidl new file mode 100644 index 0000000000..ebb4496b0a --- /dev/null +++ b/dom/webidl/VideoFrame.webidl @@ -0,0 +1,137 @@ +/* -*- 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/webcodecs/#videoframe + */ + +enum AlphaOption { + "keep", + "discard", +}; + +// [Serializable, Transferable] are implemented without adding attributes here. +[Exposed=(Window,DedicatedWorker), Pref="dom.media.webcodecs.enabled"] +interface VideoFrame { + // The constructors should be shorten to: + // ``` + // constructor([AllowShared] BufferSource data, VideoFrameBufferInit init); + // constructor(CanvasImageSource image, optional VideoFrameInit init = {}); + // ``` + // However, `[AllowShared] BufferSource` doesn't work for now (bug 1696216), and + // `No support for unions as distinguishing arguments yet` error occurs when using + // `constructor(CanvasImageSource image, optional VideoFrameInit init = {})` and + // `constructor(([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) data, VideoFrameBufferInit init)` + // at the same time (bug 1786410). + [Throws] + constructor(HTMLImageElement imageElement, optional VideoFrameInit init = {}); + [Throws] + constructor(SVGImageElement svgImageElement, optional VideoFrameInit init = {}); + [Throws] + constructor(HTMLCanvasElement canvasElement, optional VideoFrameInit init = {}); + [Throws] + constructor(HTMLVideoElement videoElement, optional VideoFrameInit init = {}); + [Throws] + constructor(OffscreenCanvas offscreenCanvas, optional VideoFrameInit init = {}); + [Throws] + constructor(ImageBitmap imageBitmap, optional VideoFrameInit init = {}); + [Throws] + constructor(VideoFrame videoFrame, optional VideoFrameInit init = {}); + [Throws] + constructor([AllowShared] ArrayBufferView bufferView, VideoFrameBufferInit init); + [Throws] + constructor([AllowShared] ArrayBuffer buffer, VideoFrameBufferInit init); + + + readonly attribute VideoPixelFormat? format; + readonly attribute unsigned long codedWidth; + readonly attribute unsigned long codedHeight; + readonly attribute DOMRectReadOnly? codedRect; + readonly attribute DOMRectReadOnly? visibleRect; + readonly attribute unsigned long displayWidth; + readonly attribute unsigned long displayHeight; + readonly attribute unsigned long long? duration; // microseconds + readonly attribute long long timestamp; // microseconds + readonly attribute VideoColorSpace colorSpace; + + [Throws] + unsigned long allocationSize( + optional VideoFrameCopyToOptions options = {}); + [Throws] + Promise<sequence<PlaneLayout>> copyTo( + // bug 1696216: Should be `copyTo([AllowShared] BufferSource destination, ...)` + ([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) destination, + optional VideoFrameCopyToOptions options = {}); + [Throws] + VideoFrame clone(); + undefined close(); +}; + +dictionary VideoFrameInit { + unsigned long long duration; // microseconds + long long timestamp; // microseconds + AlphaOption alpha = "keep"; + + // Default matches image. May be used to efficiently crop. Will trigger + // new computation of displayWidth and displayHeight using image’s pixel + // aspect ratio unless an explicit displayWidth and displayHeight are given. + DOMRectInit visibleRect; + + // Default matches image unless visibleRect is provided. + [EnforceRange] unsigned long displayWidth; + [EnforceRange] unsigned long displayHeight; +}; + +dictionary VideoFrameBufferInit { + required VideoPixelFormat format; + required [EnforceRange] unsigned long codedWidth; + required [EnforceRange] unsigned long codedHeight; + required [EnforceRange] long long timestamp; // microseconds + [EnforceRange] unsigned long long duration; // microseconds + + // Default layout is tightly-packed. + sequence<PlaneLayout> layout; + + // Default visible rect is coded size positioned at (0,0) + DOMRectInit visibleRect; + + // Default display dimensions match visibleRect. + [EnforceRange] unsigned long displayWidth; + [EnforceRange] unsigned long displayHeight; + + VideoColorSpaceInit colorSpace; +}; + +dictionary VideoFrameCopyToOptions { + DOMRectInit rect; + sequence<PlaneLayout> layout; +}; + +dictionary PlaneLayout { + // TODO: https://github.com/w3c/webcodecs/pull/488 + required [EnforceRange] unsigned long offset; + required [EnforceRange] unsigned long stride; +}; + +enum VideoPixelFormat { + // 4:2:0 Y, U, V + "I420", + // 4:2:0 Y, U, V, A + "I420A", + // 4:2:2 Y, U, V + "I422", + // 4:4:4 Y, U, V + "I444", + // 4:2:0 Y, UV + "NV12", + // 32bpp RGBA + "RGBA", + // 32bpp RGBX (opaque) + "RGBX", + // 32bpp BGRA + "BGRA", + // 32bpp BGRX (opaque) + "BGRX", +}; diff --git a/dom/webidl/VideoPlaybackQuality.webidl b/dom/webidl/VideoPlaybackQuality.webidl new file mode 100644 index 0000000000..67e44d5f05 --- /dev/null +++ b/dom/webidl/VideoPlaybackQuality.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="media.mediasource.enabled", + Exposed=Window] +interface VideoPlaybackQuality { + readonly attribute DOMHighResTimeStamp creationTime; + readonly attribute unsigned long totalVideoFrames; + readonly attribute unsigned long droppedVideoFrames; +// At Risk: readonly attribute double totalFrameDelay; +}; diff --git a/dom/webidl/VideoTrack.webidl b/dom/webidl/VideoTrack.webidl new file mode 100644 index 0000000000..6c628cbced --- /dev/null +++ b/dom/webidl/VideoTrack.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#videotrack + */ + +[Pref="media.track.enabled", + Exposed=Window] +interface VideoTrack { + readonly attribute DOMString id; + readonly attribute DOMString kind; + readonly attribute DOMString label; + readonly attribute DOMString language; + attribute boolean selected; +}; diff --git a/dom/webidl/VideoTrackList.webidl b/dom/webidl/VideoTrackList.webidl new file mode 100644 index 0000000000..8d8bd67360 --- /dev/null +++ b/dom/webidl/VideoTrackList.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#videotracklist + */ + +[Pref="media.track.enabled", + Exposed=Window] +interface VideoTrackList : EventTarget { + readonly attribute unsigned long length; + getter VideoTrack (unsigned long index); + VideoTrack? getTrackById(DOMString id); + readonly attribute long selectedIndex; + + attribute EventHandler onchange; + attribute EventHandler onaddtrack; + attribute EventHandler onremovetrack; +}; diff --git a/dom/webidl/VisualViewport.webidl b/dom/webidl/VisualViewport.webidl new file mode 100644 index 0000000000..cacda509b6 --- /dev/null +++ b/dom/webidl/VisualViewport.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * https://wicg.github.io/visual-viewport/#the-visualviewport-interface + */ + +[Exposed=Window] +interface VisualViewport : EventTarget { + readonly attribute double offsetLeft; + readonly attribute double offsetTop; + + readonly attribute double pageLeft; + readonly attribute double pageTop; + + readonly attribute double width; + readonly attribute double height; + + readonly attribute double scale; + + attribute EventHandler onresize; + attribute EventHandler onscroll; +}; diff --git a/dom/webidl/WakeLock.webidl b/dom/webidl/WakeLock.webidl new file mode 100644 index 0000000000..f2e714f938 --- /dev/null +++ b/dom/webidl/WakeLock.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/screen-wake-lock/ + */ + +[SecureContext, Exposed=(Window), Pref="dom.screenwakelock.enabled"] +interface WakeLock { + [Throws] + Promise<WakeLockSentinel> request(optional WakeLockType type = "screen"); +}; + +enum WakeLockType { "screen" }; diff --git a/dom/webidl/WakeLockSentinel.webidl b/dom/webidl/WakeLockSentinel.webidl new file mode 100644 index 0000000000..d1a6de33c1 --- /dev/null +++ b/dom/webidl/WakeLockSentinel.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/screen-wake-lock/ + */ + +[SecureContext, Exposed=(Window), Pref="dom.screenwakelock.enabled"] +interface WakeLockSentinel : EventTarget { + readonly attribute boolean released; + readonly attribute WakeLockType type; + [BinaryName="releaseLock", Throws] + Promise<undefined> release(); + attribute EventHandler onrelease; +}; diff --git a/dom/webidl/WaveShaperNode.webidl b/dom/webidl/WaveShaperNode.webidl new file mode 100644 index 0000000000..22a198e7e3 --- /dev/null +++ b/dom/webidl/WaveShaperNode.webidl @@ -0,0 +1,38 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum OverSampleType { + "none", + "2x", + "4x" +}; + +dictionary WaveShaperOptions : AudioNodeOptions { + sequence<float> curve; + OverSampleType oversample = "none"; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface WaveShaperNode : AudioNode { + [Throws] + constructor(BaseAudioContext context, + optional WaveShaperOptions options = {}); + + [Cached, Pure, Throws] + attribute Float32Array? curve; + attribute OverSampleType oversample; + +}; + +// Mozilla extension +WaveShaperNode includes AudioNodePassThrough; diff --git a/dom/webidl/WebAuthentication.webidl b/dom/webidl/WebAuthentication.webidl new file mode 100644 index 0000000000..ca20b387cd --- /dev/null +++ b/dom/webidl/WebAuthentication.webidl @@ -0,0 +1,320 @@ +/* -*- 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/webauthn/ + */ + +/***** Interfaces to Data *****/ + +[SecureContext, Pref="security.webauth.webauthn", + Exposed=Window] +interface PublicKeyCredential : Credential { + [SameObject, Throws] readonly attribute ArrayBuffer rawId; + [SameObject] readonly attribute AuthenticatorResponse response; + readonly attribute DOMString? authenticatorAttachment; + AuthenticationExtensionsClientOutputs getClientExtensionResults(); + [NewObject] static Promise<boolean> isConditionalMediationAvailable(); + [Throws, Pref="security.webauthn.enable_json_serialization_methods"] object toJSON(); +}; + +typedef DOMString Base64URLString; + +[GenerateConversionToJS] +dictionary RegistrationResponseJSON { + required Base64URLString id; + required Base64URLString rawId; + required AuthenticatorAttestationResponseJSON response; + DOMString authenticatorAttachment; + required AuthenticationExtensionsClientOutputsJSON clientExtensionResults; + required DOMString type; +}; + +[GenerateConversionToJS] +dictionary AuthenticatorAttestationResponseJSON { + required Base64URLString clientDataJSON; + required Base64URLString authenticatorData; + required sequence<DOMString> transports; + // The publicKey field will be missing if pubKeyCredParams was used to + // negotiate a public-key algorithm that the user agent doesn’t + // understand. (See section “Easily accessing credential data” for a + // list of which algorithms user agents must support.) If using such an + // algorithm then the public key must be parsed directly from + // attestationObject or authenticatorData. + Base64URLString publicKey; + required long long publicKeyAlgorithm; + // This value contains copies of some of the fields above. See + // section “Easily accessing credential data”. + required Base64URLString attestationObject; +}; + +[GenerateConversionToJS] +dictionary AuthenticationResponseJSON { + required Base64URLString id; + required Base64URLString rawId; + required AuthenticatorAssertionResponseJSON response; + DOMString authenticatorAttachment; + required AuthenticationExtensionsClientOutputsJSON clientExtensionResults; + required DOMString type; +}; + +[GenerateConversionToJS] +dictionary AuthenticatorAssertionResponseJSON { + required Base64URLString clientDataJSON; + required Base64URLString authenticatorData; + required Base64URLString signature; + Base64URLString userHandle; + Base64URLString attestationObject; +}; + +[GenerateConversionToJS] +dictionary AuthenticationExtensionsClientOutputsJSON { +}; + +[SecureContext] +partial interface PublicKeyCredential { + [NewObject] static Promise<boolean> isUserVerifyingPlatformAuthenticatorAvailable(); +}; + +[SecureContext] +partial interface PublicKeyCredential { + [Throws, Pref="security.webauthn.enable_json_serialization_methods"] static PublicKeyCredentialCreationOptions parseCreationOptionsFromJSON(PublicKeyCredentialCreationOptionsJSON options); +}; + +dictionary PublicKeyCredentialCreationOptionsJSON { + required PublicKeyCredentialRpEntity rp; + required PublicKeyCredentialUserEntityJSON user; + required Base64URLString challenge; + required sequence<PublicKeyCredentialParameters> pubKeyCredParams; + unsigned long timeout; + sequence<PublicKeyCredentialDescriptorJSON> excludeCredentials = []; + AuthenticatorSelectionCriteria authenticatorSelection; + sequence<DOMString> hints = []; + DOMString attestation = "none"; + sequence<DOMString> attestationFormats = []; + AuthenticationExtensionsClientInputsJSON extensions; +}; + +dictionary PublicKeyCredentialUserEntityJSON { + required Base64URLString id; + required DOMString name; + required DOMString displayName; +}; + +dictionary PublicKeyCredentialDescriptorJSON { + required Base64URLString id; + required DOMString type; + sequence<DOMString> transports; +}; + +dictionary AuthenticationExtensionsClientInputsJSON { +}; + +[SecureContext] +partial interface PublicKeyCredential { + [Throws, Pref="security.webauthn.enable_json_serialization_methods"] static PublicKeyCredentialRequestOptions parseRequestOptionsFromJSON(PublicKeyCredentialRequestOptionsJSON options); +}; + +dictionary PublicKeyCredentialRequestOptionsJSON { + required Base64URLString challenge; + unsigned long timeout; + DOMString rpId; + sequence<PublicKeyCredentialDescriptorJSON> allowCredentials = []; + DOMString userVerification = "preferred"; + sequence<DOMString> hints = []; + DOMString attestation = "none"; + sequence<DOMString> attestationFormats = []; + AuthenticationExtensionsClientInputsJSON extensions; +}; + +[SecureContext, Pref="security.webauth.webauthn", + Exposed=Window] +interface AuthenticatorResponse { + [SameObject, Throws] readonly attribute ArrayBuffer clientDataJSON; +}; + +[SecureContext, Pref="security.webauth.webauthn", + Exposed=Window] +interface AuthenticatorAttestationResponse : AuthenticatorResponse { + [SameObject, Throws] readonly attribute ArrayBuffer attestationObject; + sequence<DOMString> getTransports(); + [Throws] ArrayBuffer getAuthenticatorData(); + [Throws] ArrayBuffer? getPublicKey(); + [Throws] COSEAlgorithmIdentifier getPublicKeyAlgorithm(); +}; + +[SecureContext, Pref="security.webauth.webauthn", + Exposed=Window] +interface AuthenticatorAssertionResponse : AuthenticatorResponse { + [SameObject, Throws] readonly attribute ArrayBuffer authenticatorData; + [SameObject, Throws] readonly attribute ArrayBuffer signature; + [SameObject, Throws] readonly attribute ArrayBuffer? userHandle; +}; + +dictionary PublicKeyCredentialParameters { + required DOMString type; + required COSEAlgorithmIdentifier alg; +}; + +dictionary PublicKeyCredentialCreationOptions { + required PublicKeyCredentialRpEntity rp; + required PublicKeyCredentialUserEntity user; + + required BufferSource challenge; + required sequence<PublicKeyCredentialParameters> pubKeyCredParams; + + unsigned long timeout; + sequence<PublicKeyCredentialDescriptor> excludeCredentials = []; + // FIXME: bug 1493860: should this "= {}" be here? + AuthenticatorSelectionCriteria authenticatorSelection = {}; + DOMString attestation = "none"; + // FIXME: bug 1493860: should this "= {}" be here? + AuthenticationExtensionsClientInputs extensions = {}; +}; + +dictionary PublicKeyCredentialEntity { + required DOMString name; +}; + +dictionary PublicKeyCredentialRpEntity : PublicKeyCredentialEntity { + DOMString id; +}; + +dictionary PublicKeyCredentialUserEntity : PublicKeyCredentialEntity { + required BufferSource id; + required DOMString displayName; +}; + +dictionary AuthenticatorSelectionCriteria { + DOMString authenticatorAttachment; + DOMString residentKey; + boolean requireResidentKey = false; + DOMString userVerification = "preferred"; +}; + +dictionary PublicKeyCredentialRequestOptions { + required BufferSource challenge; + unsigned long timeout; + USVString rpId; + sequence<PublicKeyCredentialDescriptor> allowCredentials = []; + DOMString userVerification = "preferred"; + // FIXME: bug 1493860: should this "= {}" be here? + AuthenticationExtensionsClientInputs extensions = {}; +}; + +dictionary AuthenticationExtensionsClientInputs { +}; + +dictionary AuthenticationExtensionsClientOutputs { +}; + +typedef record<DOMString, DOMString> AuthenticationExtensionsAuthenticatorInputs; + +[GenerateToJSON] +dictionary CollectedClientData { + required DOMString type; + required DOMString challenge; + required DOMString origin; + TokenBinding tokenBinding; +}; + +dictionary TokenBinding { + required DOMString status; + DOMString id; +}; + +dictionary PublicKeyCredentialDescriptor { + required DOMString type; + required BufferSource id; + // Transports is a string that is matched against the AuthenticatorTransport + // enumeration so that we have forward-compatibility for new transports. + sequence<DOMString> transports; +}; + +typedef long COSEAlgorithmIdentifier; + +typedef sequence<AAGUID> AuthenticatorSelectionList; + +typedef BufferSource AAGUID; + +partial dictionary AuthenticationExtensionsClientInputs { + USVString appid; +}; + +partial dictionary AuthenticationExtensionsClientOutputs { + boolean appid; +}; + +// The spec does not define any partial dictionaries that modify +// AuthenticationExtensionsClientInputsJSON, but this seems to be an error. All changes to +// AuthenticationExtensionsClientInputs must be accompanied by changes to +// AuthenticationExtensionsClientInputsJSON for parseCreationOptionsFromJSON and +// parseRequestOptionsFromJSON to function correctly. +// (see: https://github.com/w3c/webauthn/issues/1968). +partial dictionary AuthenticationExtensionsClientInputsJSON { + USVString appid; +}; + +// We also deviate from the spec by mirroring changes to AuthenticationExtensionsClientOutputs in +// AuthenticationExtensionsClientOutputsJSON. +partial dictionary AuthenticationExtensionsClientOutputsJSON { + boolean appid; +}; + +partial dictionary AuthenticationExtensionsClientInputs { + boolean credProps; +}; + +partial dictionary AuthenticationExtensionsClientInputsJSON { + boolean credProps; +}; + +dictionary CredentialPropertiesOutput { + boolean rk; +}; + +partial dictionary AuthenticationExtensionsClientOutputs { + CredentialPropertiesOutput credProps; +}; + +partial dictionary AuthenticationExtensionsClientOutputsJSON { + CredentialPropertiesOutput credProps; +}; + +/* + * CTAP2 Extensions + * <https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-errata-20220621.html#sctn-defined-extensions> + */ + +// hmac-secret +// <https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-errata-20220621.html#sctn-hmac-secret-extension> +// note: we don't support hmac-secret in get(), so we only define the create() +// inputs and outputs here. + +partial dictionary AuthenticationExtensionsClientInputs { + boolean hmacCreateSecret; +}; + +partial dictionary AuthenticationExtensionsClientOutputs { + boolean hmacCreateSecret; +}; + +partial dictionary AuthenticationExtensionsClientInputsJSON { + boolean hmacCreateSecret; +}; + +partial dictionary AuthenticationExtensionsClientOutputsJSON { + boolean hmacCreateSecret; +}; + +// hmac-secret +// <https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-errata-20220621.html#sctn-minpinlength-extension> +partial dictionary AuthenticationExtensionsClientInputs { + boolean minPinLength; +}; + +partial dictionary AuthenticationExtensionsClientInputsJSON { + boolean minPinLength; +}; diff --git a/dom/webidl/WebGL2RenderingContext.webidl b/dom/webidl/WebGL2RenderingContext.webidl new file mode 100644 index 0000000000..765d2a5213 --- /dev/null +++ b/dom/webidl/WebGL2RenderingContext.webidl @@ -0,0 +1,764 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of 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 source for this IDL is found at https://www.khronos.org/registry/webgl/specs/latest/2.0 + * This IDL depends on WebGLRenderingContext.webidl + */ + +typedef long long GLint64; +typedef unsigned long long GLuint64; + +[Pref="webgl.enable-webgl2", + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread", + Exposed=(Window,Worker)] +interface WebGLSampler { +}; + +[Pref="webgl.enable-webgl2", + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread", + Exposed=(Window,Worker)] +interface WebGLSync { +}; + +[Pref="webgl.enable-webgl2", + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread", + Exposed=(Window,Worker)] +interface WebGLTransformFeedback { +}; + +typedef ([AllowShared] Uint32Array or sequence<GLuint>) Uint32List; + +// WebGL2 spec has this as an empty interface that pulls in everything +// via WebGL2RenderingContextBase. +[Pref="webgl.enable-webgl2", + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread", + Exposed=(Window,Worker)] +interface WebGL2RenderingContext +{ +}; + +interface mixin WebGL2RenderingContextBase +{ + const GLenum READ_BUFFER = 0x0C02; + const GLenum UNPACK_ROW_LENGTH = 0x0CF2; + const GLenum UNPACK_SKIP_ROWS = 0x0CF3; + const GLenum UNPACK_SKIP_PIXELS = 0x0CF4; + const GLenum PACK_ROW_LENGTH = 0x0D02; + const GLenum PACK_SKIP_ROWS = 0x0D03; + const GLenum PACK_SKIP_PIXELS = 0x0D04; + const GLenum COLOR = 0x1800; + const GLenum DEPTH = 0x1801; + const GLenum STENCIL = 0x1802; + const GLenum RED = 0x1903; + const GLenum RGB8 = 0x8051; + const GLenum RGBA8 = 0x8058; + const GLenum RGB10_A2 = 0x8059; + const GLenum TEXTURE_BINDING_3D = 0x806A; + const GLenum UNPACK_SKIP_IMAGES = 0x806D; + const GLenum UNPACK_IMAGE_HEIGHT = 0x806E; + const GLenum TEXTURE_3D = 0x806F; + const GLenum TEXTURE_WRAP_R = 0x8072; + const GLenum MAX_3D_TEXTURE_SIZE = 0x8073; + const GLenum UNSIGNED_INT_2_10_10_10_REV = 0x8368; + const GLenum MAX_ELEMENTS_VERTICES = 0x80E8; + const GLenum MAX_ELEMENTS_INDICES = 0x80E9; + const GLenum TEXTURE_MIN_LOD = 0x813A; + const GLenum TEXTURE_MAX_LOD = 0x813B; + const GLenum TEXTURE_BASE_LEVEL = 0x813C; + const GLenum TEXTURE_MAX_LEVEL = 0x813D; + const GLenum MIN = 0x8007; + const GLenum MAX = 0x8008; + const GLenum DEPTH_COMPONENT24 = 0x81A6; + const GLenum MAX_TEXTURE_LOD_BIAS = 0x84FD; + const GLenum TEXTURE_COMPARE_MODE = 0x884C; + const GLenum TEXTURE_COMPARE_FUNC = 0x884D; + const GLenum CURRENT_QUERY = 0x8865; + const GLenum QUERY_RESULT = 0x8866; + const GLenum QUERY_RESULT_AVAILABLE = 0x8867; + const GLenum STREAM_READ = 0x88E1; + const GLenum STREAM_COPY = 0x88E2; + const GLenum STATIC_READ = 0x88E5; + const GLenum STATIC_COPY = 0x88E6; + const GLenum DYNAMIC_READ = 0x88E9; + const GLenum DYNAMIC_COPY = 0x88EA; + const GLenum MAX_DRAW_BUFFERS = 0x8824; + const GLenum DRAW_BUFFER0 = 0x8825; + const GLenum DRAW_BUFFER1 = 0x8826; + const GLenum DRAW_BUFFER2 = 0x8827; + const GLenum DRAW_BUFFER3 = 0x8828; + const GLenum DRAW_BUFFER4 = 0x8829; + const GLenum DRAW_BUFFER5 = 0x882A; + const GLenum DRAW_BUFFER6 = 0x882B; + const GLenum DRAW_BUFFER7 = 0x882C; + const GLenum DRAW_BUFFER8 = 0x882D; + const GLenum DRAW_BUFFER9 = 0x882E; + const GLenum DRAW_BUFFER10 = 0x882F; + const GLenum DRAW_BUFFER11 = 0x8830; + const GLenum DRAW_BUFFER12 = 0x8831; + const GLenum DRAW_BUFFER13 = 0x8832; + const GLenum DRAW_BUFFER14 = 0x8833; + const GLenum DRAW_BUFFER15 = 0x8834; + const GLenum MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; + const GLenum MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; + const GLenum SAMPLER_3D = 0x8B5F; + const GLenum SAMPLER_2D_SHADOW = 0x8B62; + const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; + const GLenum PIXEL_PACK_BUFFER = 0x88EB; + const GLenum PIXEL_UNPACK_BUFFER = 0x88EC; + const GLenum PIXEL_PACK_BUFFER_BINDING = 0x88ED; + const GLenum PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; + const GLenum FLOAT_MAT2x3 = 0x8B65; + const GLenum FLOAT_MAT2x4 = 0x8B66; + const GLenum FLOAT_MAT3x2 = 0x8B67; + const GLenum FLOAT_MAT3x4 = 0x8B68; + const GLenum FLOAT_MAT4x2 = 0x8B69; + const GLenum FLOAT_MAT4x3 = 0x8B6A; + const GLenum SRGB = 0x8C40; + const GLenum SRGB8 = 0x8C41; + const GLenum SRGB8_ALPHA8 = 0x8C43; + const GLenum COMPARE_REF_TO_TEXTURE = 0x884E; + const GLenum RGBA32F = 0x8814; + const GLenum RGB32F = 0x8815; + const GLenum RGBA16F = 0x881A; + const GLenum RGB16F = 0x881B; + const GLenum VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; + const GLenum MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; + const GLenum MIN_PROGRAM_TEXEL_OFFSET = 0x8904; + const GLenum MAX_PROGRAM_TEXEL_OFFSET = 0x8905; + const GLenum MAX_VARYING_COMPONENTS = 0x8B4B; + const GLenum TEXTURE_2D_ARRAY = 0x8C1A; + const GLenum TEXTURE_BINDING_2D_ARRAY = 0x8C1D; + const GLenum R11F_G11F_B10F = 0x8C3A; + const GLenum UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; + const GLenum RGB9_E5 = 0x8C3D; + const GLenum UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; + const GLenum TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; + const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; + const GLenum TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; + const GLenum TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; + const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; + const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; + const GLenum RASTERIZER_DISCARD = 0x8C89; + const GLenum MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; + const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; + const GLenum INTERLEAVED_ATTRIBS = 0x8C8C; + const GLenum SEPARATE_ATTRIBS = 0x8C8D; + const GLenum TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; + const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; + const GLenum RGBA32UI = 0x8D70; + const GLenum RGB32UI = 0x8D71; + const GLenum RGBA16UI = 0x8D76; + const GLenum RGB16UI = 0x8D77; + const GLenum RGBA8UI = 0x8D7C; + const GLenum RGB8UI = 0x8D7D; + const GLenum RGBA32I = 0x8D82; + const GLenum RGB32I = 0x8D83; + const GLenum RGBA16I = 0x8D88; + const GLenum RGB16I = 0x8D89; + const GLenum RGBA8I = 0x8D8E; + const GLenum RGB8I = 0x8D8F; + const GLenum RED_INTEGER = 0x8D94; + const GLenum RGB_INTEGER = 0x8D98; + const GLenum RGBA_INTEGER = 0x8D99; + const GLenum SAMPLER_2D_ARRAY = 0x8DC1; + const GLenum SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; + const GLenum SAMPLER_CUBE_SHADOW = 0x8DC5; + const GLenum UNSIGNED_INT_VEC2 = 0x8DC6; + const GLenum UNSIGNED_INT_VEC3 = 0x8DC7; + const GLenum UNSIGNED_INT_VEC4 = 0x8DC8; + const GLenum INT_SAMPLER_2D = 0x8DCA; + const GLenum INT_SAMPLER_3D = 0x8DCB; + const GLenum INT_SAMPLER_CUBE = 0x8DCC; + const GLenum INT_SAMPLER_2D_ARRAY = 0x8DCF; + const GLenum UNSIGNED_INT_SAMPLER_2D = 0x8DD2; + const GLenum UNSIGNED_INT_SAMPLER_3D = 0x8DD3; + const GLenum UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; + const GLenum UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; + const GLenum DEPTH_COMPONENT32F = 0x8CAC; + const GLenum DEPTH32F_STENCIL8 = 0x8CAD; + const GLenum FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; + const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; + const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; + const GLenum FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; + const GLenum FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; + const GLenum FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; + const GLenum FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; + const GLenum FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; + const GLenum FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; + const GLenum FRAMEBUFFER_DEFAULT = 0x8218; + const GLenum UNSIGNED_INT_24_8 = 0x84FA; + const GLenum DEPTH24_STENCIL8 = 0x88F0; + const GLenum UNSIGNED_NORMALIZED = 0x8C17; + const GLenum DRAW_FRAMEBUFFER_BINDING = 0x8CA6; /* Same as FRAMEBUFFER_BINDING */ + const GLenum READ_FRAMEBUFFER = 0x8CA8; + const GLenum DRAW_FRAMEBUFFER = 0x8CA9; + const GLenum READ_FRAMEBUFFER_BINDING = 0x8CAA; + const GLenum RENDERBUFFER_SAMPLES = 0x8CAB; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; + const GLenum MAX_COLOR_ATTACHMENTS = 0x8CDF; + const GLenum COLOR_ATTACHMENT1 = 0x8CE1; + const GLenum COLOR_ATTACHMENT2 = 0x8CE2; + const GLenum COLOR_ATTACHMENT3 = 0x8CE3; + const GLenum COLOR_ATTACHMENT4 = 0x8CE4; + const GLenum COLOR_ATTACHMENT5 = 0x8CE5; + const GLenum COLOR_ATTACHMENT6 = 0x8CE6; + const GLenum COLOR_ATTACHMENT7 = 0x8CE7; + const GLenum COLOR_ATTACHMENT8 = 0x8CE8; + const GLenum COLOR_ATTACHMENT9 = 0x8CE9; + const GLenum COLOR_ATTACHMENT10 = 0x8CEA; + const GLenum COLOR_ATTACHMENT11 = 0x8CEB; + const GLenum COLOR_ATTACHMENT12 = 0x8CEC; + const GLenum COLOR_ATTACHMENT13 = 0x8CED; + const GLenum COLOR_ATTACHMENT14 = 0x8CEE; + const GLenum COLOR_ATTACHMENT15 = 0x8CEF; + const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; + const GLenum MAX_SAMPLES = 0x8D57; + const GLenum HALF_FLOAT = 0x140B; + const GLenum RG = 0x8227; + const GLenum RG_INTEGER = 0x8228; + const GLenum R8 = 0x8229; + const GLenum RG8 = 0x822B; + const GLenum R16F = 0x822D; + const GLenum R32F = 0x822E; + const GLenum RG16F = 0x822F; + const GLenum RG32F = 0x8230; + const GLenum R8I = 0x8231; + const GLenum R8UI = 0x8232; + const GLenum R16I = 0x8233; + const GLenum R16UI = 0x8234; + const GLenum R32I = 0x8235; + const GLenum R32UI = 0x8236; + const GLenum RG8I = 0x8237; + const GLenum RG8UI = 0x8238; + const GLenum RG16I = 0x8239; + const GLenum RG16UI = 0x823A; + const GLenum RG32I = 0x823B; + const GLenum RG32UI = 0x823C; + const GLenum VERTEX_ARRAY_BINDING = 0x85B5; + const GLenum R8_SNORM = 0x8F94; + const GLenum RG8_SNORM = 0x8F95; + const GLenum RGB8_SNORM = 0x8F96; + const GLenum RGBA8_SNORM = 0x8F97; + const GLenum SIGNED_NORMALIZED = 0x8F9C; + const GLenum COPY_READ_BUFFER = 0x8F36; + const GLenum COPY_WRITE_BUFFER = 0x8F37; + const GLenum COPY_READ_BUFFER_BINDING = 0x8F36; /* Same as COPY_READ_BUFFER */ + const GLenum COPY_WRITE_BUFFER_BINDING = 0x8F37; /* Same as COPY_WRITE_BUFFER */ + const GLenum UNIFORM_BUFFER = 0x8A11; + const GLenum UNIFORM_BUFFER_BINDING = 0x8A28; + const GLenum UNIFORM_BUFFER_START = 0x8A29; + const GLenum UNIFORM_BUFFER_SIZE = 0x8A2A; + const GLenum MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B; + const GLenum MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D; + const GLenum MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E; + const GLenum MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F; + const GLenum MAX_UNIFORM_BLOCK_SIZE = 0x8A30; + const GLenum MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31; + const GLenum MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33; + const GLenum UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34; + const GLenum ACTIVE_UNIFORM_BLOCKS = 0x8A36; + const GLenum UNIFORM_TYPE = 0x8A37; + const GLenum UNIFORM_SIZE = 0x8A38; + const GLenum UNIFORM_BLOCK_INDEX = 0x8A3A; + const GLenum UNIFORM_OFFSET = 0x8A3B; + const GLenum UNIFORM_ARRAY_STRIDE = 0x8A3C; + const GLenum UNIFORM_MATRIX_STRIDE = 0x8A3D; + const GLenum UNIFORM_IS_ROW_MAJOR = 0x8A3E; + const GLenum UNIFORM_BLOCK_BINDING = 0x8A3F; + const GLenum UNIFORM_BLOCK_DATA_SIZE = 0x8A40; + const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42; + const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43; + const GLenum UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44; + const GLenum UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46; + const GLenum INVALID_INDEX = 0xFFFFFFFF; + const GLenum MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; + const GLenum MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; + const GLenum MAX_SERVER_WAIT_TIMEOUT = 0x9111; + const GLenum OBJECT_TYPE = 0x9112; + const GLenum SYNC_CONDITION = 0x9113; + const GLenum SYNC_STATUS = 0x9114; + const GLenum SYNC_FLAGS = 0x9115; + const GLenum SYNC_FENCE = 0x9116; + const GLenum SYNC_GPU_COMMANDS_COMPLETE = 0x9117; + const GLenum UNSIGNALED = 0x9118; + const GLenum SIGNALED = 0x9119; + const GLenum ALREADY_SIGNALED = 0x911A; + const GLenum TIMEOUT_EXPIRED = 0x911B; + const GLenum CONDITION_SATISFIED = 0x911C; + const GLenum WAIT_FAILED = 0x911D; + const GLenum SYNC_FLUSH_COMMANDS_BIT = 0x00000001; + const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; + const GLenum ANY_SAMPLES_PASSED = 0x8C2F; + const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; + const GLenum SAMPLER_BINDING = 0x8919; + const GLenum RGB10_A2UI = 0x906F; + const GLenum INT_2_10_10_10_REV = 0x8D9F; + const GLenum TRANSFORM_FEEDBACK = 0x8E22; + const GLenum TRANSFORM_FEEDBACK_PAUSED = 0x8E23; + const GLenum TRANSFORM_FEEDBACK_ACTIVE = 0x8E24; + const GLenum TRANSFORM_FEEDBACK_BINDING = 0x8E25; + const GLenum TEXTURE_IMMUTABLE_FORMAT = 0x912F; + const GLenum MAX_ELEMENT_INDEX = 0x8D6B; + const GLenum TEXTURE_IMMUTABLE_LEVELS = 0x82DF; + + const GLint64 TIMEOUT_IGNORED = -1; + + /* WebGL-specific enums */ + const GLenum MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247; + + /* Buffer objects */ + // WebGL1: + undefined bufferData(GLenum target, GLsizeiptr size, GLenum usage); + undefined bufferData(GLenum target, [AllowShared] ArrayBuffer? srcData, GLenum usage); + undefined bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage); + undefined bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBuffer srcData); + undefined bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBufferView srcData); + // WebGL2: + undefined bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage, + GLuint srcOffset, optional GLuint length = 0); + undefined bufferSubData(GLenum target, GLintptr dstByteOffset, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset, optional GLuint length = 0); + + undefined copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, + GLintptr writeOffset, GLsizeiptr size); + // MapBufferRange, in particular its read-only and write-only modes, + // can not be exposed safely to JavaScript. GetBufferSubData + // replaces it for the purpose of fetching data back from the GPU. + undefined getBufferSubData(GLenum target, GLintptr srcByteOffset, [AllowShared] ArrayBufferView dstData, + optional GLuint dstOffset = 0, optional GLuint length = 0); + + /* Framebuffer objects */ + undefined blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, + GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + undefined framebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, + GLint layer); + + [Throws] + undefined invalidateFramebuffer(GLenum target, sequence<GLenum> attachments); + + [Throws] + undefined invalidateSubFramebuffer(GLenum target, sequence<GLenum> attachments, + GLint x, GLint y, GLsizei width, GLsizei height); + + undefined readBuffer(GLenum src); + + /* Renderbuffer objects */ + [Throws] + any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname); + undefined renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, + GLsizei width, GLsizei height); + + /* Texture objects */ + undefined texStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, + GLsizei height); + undefined texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth); + + // WebGL1 legacy entrypoints: + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLint border, GLenum format, + GLenum type, [AllowShared] ArrayBufferView? pixels); + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLCanvasElement source); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLImageElement source); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, ImageBitmap source); + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, ImageData source); + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, OffscreenCanvas source); + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, VideoFrame source); + + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLCanvasElement source); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLImageElement source); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageBitmap source); + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageData source); + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, OffscreenCanvas source); + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, VideoFrame source); + + // WebGL2 entrypoints: + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, GLintptr pboOffset); + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + HTMLCanvasElement source); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + HTMLImageElement source); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + ImageBitmap source); + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + ImageData source); + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + OffscreenCanvas source); + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + VideoFrame source); + [Throws] // Another overhead throws. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset); + + [Throws] // Another overhead throws. + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset); + [Throws] + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + HTMLCanvasElement source); // May throw DOMException + [Throws] + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + HTMLImageElement source); // May throw DOMException + [Throws] + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + ImageBitmap source); + [Throws] // Another overhead throws. + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + ImageData source); + [Throws] // Another overhead throws. + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + OffscreenCanvas source); + [Throws] // Another overhead throws. + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + VideoFrame source); + [Throws] // Another overhead throws. + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView? srcData); + [Throws] // Another overhead throws. + undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset); + + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, GLintptr pboOffset); + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + HTMLCanvasElement source); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + HTMLImageElement source); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + ImageBitmap source); + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + ImageData source); + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + OffscreenCanvas source); + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + VideoFrame source); + [Throws] // Another overhead throws. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset); + + [Throws] // Another overhead throws. + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + GLintptr pboOffset); + [Throws] + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + HTMLCanvasElement source); // May throw DOMException + [Throws] + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + HTMLImageElement source); // May throw DOMException + [Throws] + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + ImageBitmap source); + [Throws] // Another overhead throws. + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + ImageData source); + [Throws] // Another overhead throws. + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + OffscreenCanvas source); + [Throws] // Another overhead throws. + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + VideoFrame source); + [Throws] // Another overhead throws. + undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + [AllowShared] ArrayBufferView? srcData, optional GLuint srcOffset = 0); + + undefined copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, GLsizei width, GLsizei height); + + undefined compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, GLintptr offset); + undefined compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLint border, [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); + + undefined compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset); + undefined compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); + + undefined compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset); + undefined compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, + [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, + optional GLuint srcLengthOverride = 0); + + undefined compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLsizei imageSize, GLintptr offset); + undefined compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, + GLenum format, [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, + optional GLuint srcLengthOverride = 0); + + /* Programs and shaders */ + [WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name); + + /* Uniforms */ + undefined uniform1ui(WebGLUniformLocation? location, GLuint v0); + undefined uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1); + undefined uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2); + undefined uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); + + undefined uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + undefined uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + undefined uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + undefined uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + + undefined uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + undefined uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + undefined uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + undefined uniform4iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + + undefined uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + undefined uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + undefined uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + undefined uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + + undefined uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + undefined uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + undefined uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + + undefined uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + undefined uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + undefined uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + + undefined uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + undefined uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + + /* Vertex attribs */ + undefined vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w); + undefined vertexAttribI4iv(GLuint index, Int32List values); + undefined vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); + undefined vertexAttribI4uiv(GLuint index, Uint32List values); + undefined vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); + + /* Writing to the drawing buffer */ + undefined vertexAttribDivisor(GLuint index, GLuint divisor); + undefined drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); + undefined drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount); + undefined drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset); + + /* Reading back pixels */ + // WebGL1: + [Throws, NeedsCallerType] // Throws on readback in a write-only context. + undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, + [AllowShared] ArrayBufferView? dstData); + // WebGL2: + [Throws, NeedsCallerType] // Throws on readback in a write-only context. + undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, + GLintptr offset); + [Throws, NeedsCallerType] // Throws on readback in a write-only context. + undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, + [AllowShared] ArrayBufferView dstData, GLuint dstOffset); + + /* Multiple Render Targets */ + undefined drawBuffers(sequence<GLenum> buffers); + + undefined clearBufferfv(GLenum buffer, GLint drawbuffer, Float32List values, + optional GLuint srcOffset = 0); + undefined clearBufferiv(GLenum buffer, GLint drawbuffer, Int32List values, + optional GLuint srcOffset = 0); + undefined clearBufferuiv(GLenum buffer, GLint drawbuffer, Uint32List values, + optional GLuint srcOffset = 0); + + undefined clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); + + /* Query Objects */ + WebGLQuery? createQuery(); + undefined deleteQuery(WebGLQuery? query); + [WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? query); + undefined beginQuery(GLenum target, WebGLQuery query); + undefined endQuery(GLenum target); + any getQuery(GLenum target, GLenum pname); + any getQueryParameter(WebGLQuery query, GLenum pname); + + /* Sampler Objects */ + WebGLSampler? createSampler(); + undefined deleteSampler(WebGLSampler? sampler); + [WebGLHandlesContextLoss] GLboolean isSampler(WebGLSampler? sampler); + undefined bindSampler(GLuint unit, WebGLSampler? sampler); + undefined samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param); + undefined samplerParameterf(WebGLSampler sampler, GLenum pname, GLfloat param); + any getSamplerParameter(WebGLSampler sampler, GLenum pname); + + /* Sync objects */ + WebGLSync? fenceSync(GLenum condition, GLbitfield flags); + [WebGLHandlesContextLoss] GLboolean isSync(WebGLSync? sync); + undefined deleteSync(WebGLSync? sync); + GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout); + undefined waitSync(WebGLSync sync, GLbitfield flags, GLint64 timeout); + any getSyncParameter(WebGLSync sync, GLenum pname); + + /* Transform Feedback */ + WebGLTransformFeedback? createTransformFeedback(); + undefined deleteTransformFeedback(WebGLTransformFeedback? tf); + [WebGLHandlesContextLoss] GLboolean isTransformFeedback(WebGLTransformFeedback? tf); + undefined bindTransformFeedback(GLenum target, WebGLTransformFeedback? tf); + undefined beginTransformFeedback(GLenum primitiveMode); + undefined endTransformFeedback(); + undefined transformFeedbackVaryings(WebGLProgram program, sequence<DOMString> varyings, GLenum bufferMode); + [NewObject] + WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram program, GLuint index); + undefined pauseTransformFeedback(); + undefined resumeTransformFeedback(); + + /* Uniform Buffer Objects and Transform Feedback Buffers */ + undefined bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer); + undefined bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size); + [Throws] // GetOrCreateDOMReflector can fail. + any getIndexedParameter(GLenum target, GLuint index); + sequence<GLuint>? getUniformIndices(WebGLProgram program, sequence<DOMString> uniformNames); + any getActiveUniforms(WebGLProgram program, sequence<GLuint> uniformIndices, GLenum pname); + GLuint getUniformBlockIndex(WebGLProgram program, DOMString uniformBlockName); + [Throws] // Creating a Uint32Array can fail. + any getActiveUniformBlockParameter(WebGLProgram program, GLuint uniformBlockIndex, GLenum pname); + DOMString? getActiveUniformBlockName(WebGLProgram program, GLuint uniformBlockIndex); + undefined uniformBlockBinding(WebGLProgram program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); + + /* Vertex Array Objects */ + WebGLVertexArrayObject? createVertexArray(); + undefined deleteVertexArray(WebGLVertexArrayObject? vertexArray); + [WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray); + undefined bindVertexArray(WebGLVertexArrayObject? array); +}; + +WebGL2RenderingContext includes WebGLRenderingContextBase; +WebGL2RenderingContext includes WebGL2RenderingContextBase; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_color_buffer_float { +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface OVR_multiview2 { + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR = 0x9630; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR = 0x9632; + const GLenum MAX_VIEWS_OVR = 0x9631; + const GLenum FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR = 0x9633; + + undefined framebufferTextureMultiviewOVR(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, GLint baseViewIndex, GLsizei numViews); +}; diff --git a/dom/webidl/WebGLContextEvent.webidl b/dom/webidl/WebGLContextEvent.webidl new file mode 100644 index 0000000000..02fd9b4fa1 --- /dev/null +++ b/dom/webidl/WebGLContextEvent.webidl @@ -0,0 +1,21 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + + * The origin of this IDL file is + * https://www.khronos.org/registry/webgl/specs/latest/1.0/#fire-a-webgl-context-event + */ + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLContextEvent : Event { + constructor(DOMString type, optional WebGLContextEventInit eventInit = {}); + + readonly attribute DOMString statusMessage; +}; + +// EventInit is defined in the DOM4 specification. +dictionary WebGLContextEventInit : EventInit { + DOMString statusMessage = ""; +}; diff --git a/dom/webidl/WebGLRenderingContext.webidl b/dom/webidl/WebGLRenderingContext.webidl new file mode 100644 index 0000000000..00585a06bf --- /dev/null +++ b/dom/webidl/WebGLRenderingContext.webidl @@ -0,0 +1,1237 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://www.khronos.org/registry/webgl/specs/latest/webgl.idl + * + * Copyright © 2012 Khronos Group + */ + +// WebGL IDL definitions scraped from the Khronos specification: +// https://www.khronos.org/registry/webgl/specs/latest/ +// +// This IDL depends on the typed array specification defined at: +// https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl + +typedef unsigned long GLenum; +typedef boolean GLboolean; +typedef unsigned long GLbitfield; +typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */ +typedef short GLshort; +typedef long GLint; +typedef long GLsizei; +typedef long long GLintptr; +typedef long long GLsizeiptr; +// Ideally the typedef below would use 'unsigned byte', but that doesn't currently exist in Web IDL. +typedef octet GLubyte; /* 'octet' should be an unsigned 8 bit type. */ +typedef unsigned short GLushort; +typedef unsigned long GLuint; +typedef unrestricted float GLfloat; +typedef unrestricted float GLclampf; +typedef unsigned long long GLuint64EXT; + +// The power preference settings are documented in the WebGLContextAttributes +// section of the specification. +enum WebGLPowerPreference { "default", "low-power", "high-performance" }; +enum PredefinedColorSpace { "srgb", "display-p3" }; + +[GenerateInit] +dictionary WebGLContextAttributes { + // We deviate from the spec for alpha and antialias: + // * alpha: Historically, we might use rgb565 instead of rgb(x)8, for + // memory bandwidth optimization. + // * antialias: On Android, DPI is high and mem-bandwidth is low, so we + // default to antialias:false if it's not set. + GLboolean alpha; // = true; // Default is controlled by webgl.default-no-alpha. + GLboolean depth = true; + GLboolean stencil = false; + GLboolean antialias; // = true; // Default is controlled by webgl.default-antialias. + GLboolean premultipliedAlpha = true; + GLboolean preserveDrawingBuffer = false; + GLboolean failIfMajorPerformanceCaveat = false; + WebGLPowerPreference powerPreference = "default"; + + // We are experimenting here, though this should be close to where we end up. + [Pref="webgl.colorspaces.prototype"] + PredefinedColorSpace colorSpace; // = "srgb"; Default is gfx::ColorSpace2::UNKNOWN for now. +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLBuffer { +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLFramebuffer { +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLProgram { +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLRenderbuffer { +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLShader { +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLTexture { +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLUniformLocation { +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLVertexArrayObject { +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLActiveInfo { + readonly attribute GLint size; + readonly attribute GLenum type; + readonly attribute DOMString name; +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLShaderPrecisionFormat { + readonly attribute GLint rangeMin; + readonly attribute GLint rangeMax; + readonly attribute GLint precision; +}; + +typedef ([AllowShared] Float32Array or sequence<GLfloat>) Float32List; +typedef ([AllowShared] Int32Array or sequence<GLint>) Int32List; + +// Shared mixin for the things that WebGLRenderingContext and +// WebGL2RenderingContext have in common. This doesn't have all the things they +// have in common, because we don't support splitting multiple overloads of the +// same method across separate interfaces and pulling them in with "includes". +[Exposed=(Window, Worker)] +interface mixin WebGLRenderingContextBase { + /* ClearBufferMask */ + const GLenum DEPTH_BUFFER_BIT = 0x00000100; + const GLenum STENCIL_BUFFER_BIT = 0x00000400; + const GLenum COLOR_BUFFER_BIT = 0x00004000; + + /* BeginMode */ + const GLenum POINTS = 0x0000; + const GLenum LINES = 0x0001; + const GLenum LINE_LOOP = 0x0002; + const GLenum LINE_STRIP = 0x0003; + const GLenum TRIANGLES = 0x0004; + const GLenum TRIANGLE_STRIP = 0x0005; + const GLenum TRIANGLE_FAN = 0x0006; + + /* AlphaFunction (not supported in ES20) */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* BlendingFactorDest */ + const GLenum ZERO = 0; + const GLenum ONE = 1; + const GLenum SRC_COLOR = 0x0300; + const GLenum ONE_MINUS_SRC_COLOR = 0x0301; + const GLenum SRC_ALPHA = 0x0302; + const GLenum ONE_MINUS_SRC_ALPHA = 0x0303; + const GLenum DST_ALPHA = 0x0304; + const GLenum ONE_MINUS_DST_ALPHA = 0x0305; + + /* BlendingFactorSrc */ + /* ZERO */ + /* ONE */ + const GLenum DST_COLOR = 0x0306; + const GLenum ONE_MINUS_DST_COLOR = 0x0307; + const GLenum SRC_ALPHA_SATURATE = 0x0308; + /* SRC_ALPHA */ + /* ONE_MINUS_SRC_ALPHA */ + /* DST_ALPHA */ + /* ONE_MINUS_DST_ALPHA */ + + /* BlendEquationSeparate */ + const GLenum FUNC_ADD = 0x8006; + const GLenum BLEND_EQUATION = 0x8009; + const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ + const GLenum BLEND_EQUATION_ALPHA = 0x883D; + + /* BlendSubtract */ + const GLenum FUNC_SUBTRACT = 0x800A; + const GLenum FUNC_REVERSE_SUBTRACT = 0x800B; + + /* Separate Blend Functions */ + const GLenum BLEND_DST_RGB = 0x80C8; + const GLenum BLEND_SRC_RGB = 0x80C9; + const GLenum BLEND_DST_ALPHA = 0x80CA; + const GLenum BLEND_SRC_ALPHA = 0x80CB; + const GLenum CONSTANT_COLOR = 0x8001; + const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002; + const GLenum CONSTANT_ALPHA = 0x8003; + const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004; + const GLenum BLEND_COLOR = 0x8005; + + /* Buffer Objects */ + const GLenum ARRAY_BUFFER = 0x8892; + const GLenum ELEMENT_ARRAY_BUFFER = 0x8893; + const GLenum ARRAY_BUFFER_BINDING = 0x8894; + const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + + const GLenum STREAM_DRAW = 0x88E0; + const GLenum STATIC_DRAW = 0x88E4; + const GLenum DYNAMIC_DRAW = 0x88E8; + + const GLenum BUFFER_SIZE = 0x8764; + const GLenum BUFFER_USAGE = 0x8765; + + const GLenum CURRENT_VERTEX_ATTRIB = 0x8626; + + /* CullFaceMode */ + const GLenum FRONT = 0x0404; + const GLenum BACK = 0x0405; + const GLenum FRONT_AND_BACK = 0x0408; + + /* DepthFunction */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* EnableCap */ + /* TEXTURE_2D */ + const GLenum CULL_FACE = 0x0B44; + const GLenum BLEND = 0x0BE2; + const GLenum DITHER = 0x0BD0; + const GLenum STENCIL_TEST = 0x0B90; + const GLenum DEPTH_TEST = 0x0B71; + const GLenum SCISSOR_TEST = 0x0C11; + const GLenum POLYGON_OFFSET_FILL = 0x8037; + const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E; + const GLenum SAMPLE_COVERAGE = 0x80A0; + + /* ErrorCode */ + const GLenum NO_ERROR = 0; + const GLenum INVALID_ENUM = 0x0500; + const GLenum INVALID_VALUE = 0x0501; + const GLenum INVALID_OPERATION = 0x0502; + const GLenum OUT_OF_MEMORY = 0x0505; + + /* FrontFaceDirection */ + const GLenum CW = 0x0900; + const GLenum CCW = 0x0901; + + /* GetPName */ + const GLenum LINE_WIDTH = 0x0B21; + const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D; + const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E; + const GLenum CULL_FACE_MODE = 0x0B45; + const GLenum FRONT_FACE = 0x0B46; + const GLenum DEPTH_RANGE = 0x0B70; + const GLenum DEPTH_WRITEMASK = 0x0B72; + const GLenum DEPTH_CLEAR_VALUE = 0x0B73; + const GLenum DEPTH_FUNC = 0x0B74; + const GLenum STENCIL_CLEAR_VALUE = 0x0B91; + const GLenum STENCIL_FUNC = 0x0B92; + const GLenum STENCIL_FAIL = 0x0B94; + const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95; + const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96; + const GLenum STENCIL_REF = 0x0B97; + const GLenum STENCIL_VALUE_MASK = 0x0B93; + const GLenum STENCIL_WRITEMASK = 0x0B98; + const GLenum STENCIL_BACK_FUNC = 0x8800; + const GLenum STENCIL_BACK_FAIL = 0x8801; + const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; + const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; + const GLenum STENCIL_BACK_REF = 0x8CA3; + const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4; + const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5; + const GLenum VIEWPORT = 0x0BA2; + const GLenum SCISSOR_BOX = 0x0C10; + /* SCISSOR_TEST */ + const GLenum COLOR_CLEAR_VALUE = 0x0C22; + const GLenum COLOR_WRITEMASK = 0x0C23; + const GLenum UNPACK_ALIGNMENT = 0x0CF5; + const GLenum PACK_ALIGNMENT = 0x0D05; + const GLenum MAX_TEXTURE_SIZE = 0x0D33; + const GLenum MAX_VIEWPORT_DIMS = 0x0D3A; + const GLenum SUBPIXEL_BITS = 0x0D50; + const GLenum RED_BITS = 0x0D52; + const GLenum GREEN_BITS = 0x0D53; + const GLenum BLUE_BITS = 0x0D54; + const GLenum ALPHA_BITS = 0x0D55; + const GLenum DEPTH_BITS = 0x0D56; + const GLenum STENCIL_BITS = 0x0D57; + const GLenum POLYGON_OFFSET_UNITS = 0x2A00; + /* POLYGON_OFFSET_FILL */ + const GLenum POLYGON_OFFSET_FACTOR = 0x8038; + const GLenum TEXTURE_BINDING_2D = 0x8069; + const GLenum SAMPLE_BUFFERS = 0x80A8; + const GLenum SAMPLES = 0x80A9; + const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA; + const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB; + + /* GetTextureParameter */ + /* TEXTURE_MAG_FILTER */ + /* TEXTURE_MIN_FILTER */ + /* TEXTURE_WRAP_S */ + /* TEXTURE_WRAP_T */ + + const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3; + + /* HintMode */ + const GLenum DONT_CARE = 0x1100; + const GLenum FASTEST = 0x1101; + const GLenum NICEST = 0x1102; + + /* HintTarget */ + const GLenum GENERATE_MIPMAP_HINT = 0x8192; + + /* DataType */ + const GLenum BYTE = 0x1400; + const GLenum UNSIGNED_BYTE = 0x1401; + const GLenum SHORT = 0x1402; + const GLenum UNSIGNED_SHORT = 0x1403; + const GLenum INT = 0x1404; + const GLenum UNSIGNED_INT = 0x1405; + const GLenum FLOAT = 0x1406; + + /* PixelFormat */ + const GLenum DEPTH_COMPONENT = 0x1902; + const GLenum ALPHA = 0x1906; + const GLenum RGB = 0x1907; + const GLenum RGBA = 0x1908; + const GLenum LUMINANCE = 0x1909; + const GLenum LUMINANCE_ALPHA = 0x190A; + + /* PixelType */ + /* UNSIGNED_BYTE */ + const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033; + const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034; + const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363; + + /* Shaders */ + const GLenum FRAGMENT_SHADER = 0x8B30; + const GLenum VERTEX_SHADER = 0x8B31; + const GLenum MAX_VERTEX_ATTRIBS = 0x8869; + const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; + const GLenum MAX_VARYING_VECTORS = 0x8DFC; + const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; + const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; + const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872; + const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; + const GLenum SHADER_TYPE = 0x8B4F; + const GLenum DELETE_STATUS = 0x8B80; + const GLenum LINK_STATUS = 0x8B82; + const GLenum VALIDATE_STATUS = 0x8B83; + const GLenum ATTACHED_SHADERS = 0x8B85; + const GLenum ACTIVE_UNIFORMS = 0x8B86; + const GLenum ACTIVE_ATTRIBUTES = 0x8B89; + const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C; + const GLenum CURRENT_PROGRAM = 0x8B8D; + + /* StencilFunction */ + const GLenum NEVER = 0x0200; + const GLenum LESS = 0x0201; + const GLenum EQUAL = 0x0202; + const GLenum LEQUAL = 0x0203; + const GLenum GREATER = 0x0204; + const GLenum NOTEQUAL = 0x0205; + const GLenum GEQUAL = 0x0206; + const GLenum ALWAYS = 0x0207; + + /* StencilOp */ + /* ZERO */ + const GLenum KEEP = 0x1E00; + const GLenum REPLACE = 0x1E01; + const GLenum INCR = 0x1E02; + const GLenum DECR = 0x1E03; + const GLenum INVERT = 0x150A; + const GLenum INCR_WRAP = 0x8507; + const GLenum DECR_WRAP = 0x8508; + + /* StringName */ + const GLenum VENDOR = 0x1F00; + const GLenum RENDERER = 0x1F01; + const GLenum VERSION = 0x1F02; + + /* TextureMagFilter */ + const GLenum NEAREST = 0x2600; + const GLenum LINEAR = 0x2601; + + /* TextureMinFilter */ + /* NEAREST */ + /* LINEAR */ + const GLenum NEAREST_MIPMAP_NEAREST = 0x2700; + const GLenum LINEAR_MIPMAP_NEAREST = 0x2701; + const GLenum NEAREST_MIPMAP_LINEAR = 0x2702; + const GLenum LINEAR_MIPMAP_LINEAR = 0x2703; + + /* TextureParameterName */ + const GLenum TEXTURE_MAG_FILTER = 0x2800; + const GLenum TEXTURE_MIN_FILTER = 0x2801; + const GLenum TEXTURE_WRAP_S = 0x2802; + const GLenum TEXTURE_WRAP_T = 0x2803; + + /* TextureTarget */ + const GLenum TEXTURE_2D = 0x0DE1; + const GLenum TEXTURE = 0x1702; + + const GLenum TEXTURE_CUBE_MAP = 0x8513; + const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514; + const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; + const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; + const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; + const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; + const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; + const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; + const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; + + /* TextureUnit */ + const GLenum TEXTURE0 = 0x84C0; + const GLenum TEXTURE1 = 0x84C1; + const GLenum TEXTURE2 = 0x84C2; + const GLenum TEXTURE3 = 0x84C3; + const GLenum TEXTURE4 = 0x84C4; + const GLenum TEXTURE5 = 0x84C5; + const GLenum TEXTURE6 = 0x84C6; + const GLenum TEXTURE7 = 0x84C7; + const GLenum TEXTURE8 = 0x84C8; + const GLenum TEXTURE9 = 0x84C9; + const GLenum TEXTURE10 = 0x84CA; + const GLenum TEXTURE11 = 0x84CB; + const GLenum TEXTURE12 = 0x84CC; + const GLenum TEXTURE13 = 0x84CD; + const GLenum TEXTURE14 = 0x84CE; + const GLenum TEXTURE15 = 0x84CF; + const GLenum TEXTURE16 = 0x84D0; + const GLenum TEXTURE17 = 0x84D1; + const GLenum TEXTURE18 = 0x84D2; + const GLenum TEXTURE19 = 0x84D3; + const GLenum TEXTURE20 = 0x84D4; + const GLenum TEXTURE21 = 0x84D5; + const GLenum TEXTURE22 = 0x84D6; + const GLenum TEXTURE23 = 0x84D7; + const GLenum TEXTURE24 = 0x84D8; + const GLenum TEXTURE25 = 0x84D9; + const GLenum TEXTURE26 = 0x84DA; + const GLenum TEXTURE27 = 0x84DB; + const GLenum TEXTURE28 = 0x84DC; + const GLenum TEXTURE29 = 0x84DD; + const GLenum TEXTURE30 = 0x84DE; + const GLenum TEXTURE31 = 0x84DF; + const GLenum ACTIVE_TEXTURE = 0x84E0; + + /* TextureWrapMode */ + const GLenum REPEAT = 0x2901; + const GLenum CLAMP_TO_EDGE = 0x812F; + const GLenum MIRRORED_REPEAT = 0x8370; + + /* Uniform Types */ + const GLenum FLOAT_VEC2 = 0x8B50; + const GLenum FLOAT_VEC3 = 0x8B51; + const GLenum FLOAT_VEC4 = 0x8B52; + const GLenum INT_VEC2 = 0x8B53; + const GLenum INT_VEC3 = 0x8B54; + const GLenum INT_VEC4 = 0x8B55; + const GLenum BOOL = 0x8B56; + const GLenum BOOL_VEC2 = 0x8B57; + const GLenum BOOL_VEC3 = 0x8B58; + const GLenum BOOL_VEC4 = 0x8B59; + const GLenum FLOAT_MAT2 = 0x8B5A; + const GLenum FLOAT_MAT3 = 0x8B5B; + const GLenum FLOAT_MAT4 = 0x8B5C; + const GLenum SAMPLER_2D = 0x8B5E; + const GLenum SAMPLER_CUBE = 0x8B60; + + /* Vertex Arrays */ + const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; + const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; + const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; + const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; + const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; + const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; + const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; + + /* Read Format */ + const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; + const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; + + /* Shader Source */ + const GLenum COMPILE_STATUS = 0x8B81; + + /* Shader Precision-Specified Types */ + const GLenum LOW_FLOAT = 0x8DF0; + const GLenum MEDIUM_FLOAT = 0x8DF1; + const GLenum HIGH_FLOAT = 0x8DF2; + const GLenum LOW_INT = 0x8DF3; + const GLenum MEDIUM_INT = 0x8DF4; + const GLenum HIGH_INT = 0x8DF5; + + /* Framebuffer Object. */ + const GLenum FRAMEBUFFER = 0x8D40; + const GLenum RENDERBUFFER = 0x8D41; + + const GLenum RGBA4 = 0x8056; + const GLenum RGB5_A1 = 0x8057; + const GLenum RGB565 = 0x8D62; + const GLenum DEPTH_COMPONENT16 = 0x81A5; + const GLenum STENCIL_INDEX8 = 0x8D48; + const GLenum DEPTH_STENCIL = 0x84F9; + + const GLenum RENDERBUFFER_WIDTH = 0x8D42; + const GLenum RENDERBUFFER_HEIGHT = 0x8D43; + const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; + const GLenum RENDERBUFFER_RED_SIZE = 0x8D50; + const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51; + const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52; + const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53; + const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54; + const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55; + + const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; + const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; + const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; + + const GLenum COLOR_ATTACHMENT0 = 0x8CE0; + const GLenum DEPTH_ATTACHMENT = 0x8D00; + const GLenum STENCIL_ATTACHMENT = 0x8D20; + const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A; + + const GLenum NONE = 0; + + const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5; + const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; + const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; + const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; + const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD; + + const GLenum FRAMEBUFFER_BINDING = 0x8CA6; + const GLenum RENDERBUFFER_BINDING = 0x8CA7; + const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8; + + const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506; + + /* WebGL-specific enums */ + const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240; + const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; + const GLenum CONTEXT_LOST_WEBGL = 0x9242; + const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243; + const GLenum BROWSER_DEFAULT_WEBGL = 0x9244; + + // The canvas might actually be null in some cases, apparently. + readonly attribute CanvasSource? canvas; + readonly attribute GLsizei drawingBufferWidth; + readonly attribute GLsizei drawingBufferHeight; + + [WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes(); + [WebGLHandlesContextLoss] boolean isContextLost(); + + [NeedsCallerType] + sequence<DOMString>? getSupportedExtensions(); + + [Throws, NeedsCallerType] + object? getExtension(DOMString name); + + undefined activeTexture(GLenum texture); + undefined attachShader(WebGLProgram program, WebGLShader shader); + undefined bindAttribLocation(WebGLProgram program, GLuint index, DOMString name); + undefined bindBuffer(GLenum target, WebGLBuffer? buffer); + undefined bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer); + undefined bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer); + undefined bindTexture(GLenum target, WebGLTexture? texture); + undefined blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + undefined blendEquation(GLenum mode); + undefined blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + undefined blendFunc(GLenum sfactor, GLenum dfactor); + undefined blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, + GLenum srcAlpha, GLenum dstAlpha); + + [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target); + undefined clear(GLbitfield mask); + undefined clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + undefined clearDepth(GLclampf depth); + undefined clearStencil(GLint s); + undefined colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + undefined compileShader(WebGLShader shader); + + undefined copyTexImage2D(GLenum target, GLint level, GLenum internalformat, + GLint x, GLint y, GLsizei width, GLsizei height, + GLint border); + undefined copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint x, GLint y, GLsizei width, GLsizei height); + + WebGLBuffer? createBuffer(); + WebGLFramebuffer? createFramebuffer(); + WebGLProgram? createProgram(); + WebGLRenderbuffer? createRenderbuffer(); + WebGLShader? createShader(GLenum type); + WebGLTexture? createTexture(); + + undefined cullFace(GLenum mode); + + undefined deleteBuffer(WebGLBuffer? buffer); + undefined deleteFramebuffer(WebGLFramebuffer? framebuffer); + undefined deleteProgram(WebGLProgram? program); + undefined deleteRenderbuffer(WebGLRenderbuffer? renderbuffer); + undefined deleteShader(WebGLShader? shader); + undefined deleteTexture(WebGLTexture? texture); + + undefined depthFunc(GLenum func); + undefined depthMask(GLboolean flag); + undefined depthRange(GLclampf zNear, GLclampf zFar); + undefined detachShader(WebGLProgram program, WebGLShader shader); + undefined disable(GLenum cap); + undefined disableVertexAttribArray(GLuint index); + undefined drawArrays(GLenum mode, GLint first, GLsizei count); + undefined drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset); + + undefined enable(GLenum cap); + undefined enableVertexAttribArray(GLuint index); + undefined finish(); + undefined flush(); + undefined framebufferRenderbuffer(GLenum target, GLenum attachment, + GLenum renderbuffertarget, + WebGLRenderbuffer? renderbuffer); + undefined framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, + WebGLTexture? texture, GLint level); + undefined frontFace(GLenum mode); + + undefined generateMipmap(GLenum target); + + [NewObject] + WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index); + [NewObject] + WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index); + + sequence<WebGLShader>? getAttachedShaders(WebGLProgram program); + + [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram program, DOMString name); + + any getBufferParameter(GLenum target, GLenum pname); + [Throws] + any getParameter(GLenum pname); + + [WebGLHandlesContextLoss] GLenum getError(); + + [Throws] + any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, + GLenum pname); + any getProgramParameter(WebGLProgram program, GLenum pname); + DOMString? getProgramInfoLog(WebGLProgram program); + any getRenderbufferParameter(GLenum target, GLenum pname); + any getShaderParameter(WebGLShader shader, GLenum pname); + + [NewObject] + WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype); + + DOMString? getShaderInfoLog(WebGLShader shader); + + DOMString? getShaderSource(WebGLShader shader); + + any getTexParameter(GLenum target, GLenum pname); + + any getUniform(WebGLProgram program, WebGLUniformLocation location); + + [NewObject] + WebGLUniformLocation? getUniformLocation(WebGLProgram program, DOMString name); + + [Throws] + any getVertexAttrib(GLuint index, GLenum pname); + + [WebGLHandlesContextLoss] GLintptr getVertexAttribOffset(GLuint index, GLenum pname); + + undefined hint(GLenum target, GLenum mode); + [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer); + [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap); + [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer); + [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program); + [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer); + [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader); + [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture); + undefined lineWidth(GLfloat width); + undefined linkProgram(WebGLProgram program); + undefined pixelStorei(GLenum pname, GLint param); + undefined polygonOffset(GLfloat factor, GLfloat units); + + undefined renderbufferStorage(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height); + undefined sampleCoverage(GLclampf value, GLboolean invert); + undefined scissor(GLint x, GLint y, GLsizei width, GLsizei height); + + undefined shaderSource(WebGLShader shader, DOMString source); + + undefined stencilFunc(GLenum func, GLint ref, GLuint mask); + undefined stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + undefined stencilMask(GLuint mask); + undefined stencilMaskSeparate(GLenum face, GLuint mask); + undefined stencilOp(GLenum fail, GLenum zfail, GLenum zpass); + undefined stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + + undefined texParameterf(GLenum target, GLenum pname, GLfloat param); + undefined texParameteri(GLenum target, GLenum pname, GLint param); + + undefined uniform1f(WebGLUniformLocation? location, GLfloat x); + undefined uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); + undefined uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z); + undefined uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + + undefined uniform1i(WebGLUniformLocation? location, GLint x); + undefined uniform2i(WebGLUniformLocation? location, GLint x, GLint y); + undefined uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z); + undefined uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); + + undefined useProgram(WebGLProgram? program); + undefined validateProgram(WebGLProgram program); + + undefined vertexAttrib1f(GLuint indx, GLfloat x); + undefined vertexAttrib1fv(GLuint indx, Float32List values); + undefined vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); + undefined vertexAttrib2fv(GLuint indx, Float32List values); + undefined vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); + undefined vertexAttrib3fv(GLuint indx, Float32List values); + undefined vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + undefined vertexAttrib4fv(GLuint indx, Float32List values); + undefined vertexAttribPointer(GLuint indx, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, GLintptr offset); + + undefined viewport(GLint x, GLint y, GLsizei width, GLsizei height); +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLRenderingContext { + // bufferData has WebGL2 overloads. + undefined bufferData(GLenum target, GLsizeiptr size, GLenum usage); + undefined bufferData(GLenum target, [AllowShared] ArrayBuffer? data, GLenum usage); + undefined bufferData(GLenum target, [AllowShared] ArrayBufferView data, GLenum usage); + // bufferSubData has WebGL2 overloads. + undefined bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBuffer data); + undefined bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBufferView data); + + // compressedTexImage2D has WebGL2 overloads. + undefined compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLint border, + [AllowShared] ArrayBufferView data); + // compressedTexSubImage2D has WebGL2 overloads. + undefined compressedTexSubImage2D(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, + [AllowShared] ArrayBufferView data); + + // readPixels has WebGL2 overloads. + [Throws, NeedsCallerType] + undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); + + // texImage2D has WebGL2 overloads. + // Overloads must share [Throws]. + [Throws] // Can't actually throw. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLint border, GLenum format, + GLenum type, [AllowShared] ArrayBufferView? pixels); + [Throws] // Can't actually throw. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, ImageBitmap pixels); + [Throws] // Can't actually throw. + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, ImageData pixels); + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, OffscreenCanvas canvas); // May throw DOMException + [Throws] + undefined texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, VideoFrame videoFrame); // May throw DOMException + + // texSubImage2D has WebGL2 overloads. + [Throws] // Can't actually throw. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); + [Throws] // Can't actually throw. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageBitmap pixels); + [Throws] // Can't actually throw. + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageData pixels); + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, OffscreenCanvas canvas); // May throw DOMException + [Throws] + undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, VideoFrame videoFrame); // May throw DOMException + + // uniform*fv have WebGL2 overloads, or rather extensions, that are not + // distinguishable from the WebGL1 versions when called with two arguments. + undefined uniform1fv(WebGLUniformLocation? location, Float32List data); + undefined uniform2fv(WebGLUniformLocation? location, Float32List data); + undefined uniform3fv(WebGLUniformLocation? location, Float32List data); + undefined uniform4fv(WebGLUniformLocation? location, Float32List data); + + // uniform*iv have WebGL2 overloads, or rather extensions, that are not + // distinguishable from the WebGL1 versions when called with two arguments. + undefined uniform1iv(WebGLUniformLocation? location, Int32List data); + undefined uniform2iv(WebGLUniformLocation? location, Int32List data); + undefined uniform3iv(WebGLUniformLocation? location, Int32List data); + undefined uniform4iv(WebGLUniformLocation? location, Int32List data); + + // uniformMatrix*fv have WebGL2 overloads, or rather extensions, that are + // not distinguishable from the WebGL1 versions when called with two + // arguments. + undefined uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data); + undefined uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data); + undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data); +}; + +WebGLRenderingContext includes WebGLRenderingContextBase; + +//////////////////////////////////////// +// specific extension interfaces + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_texture_compression_bptc { + const GLenum COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8E8C; + const GLenum COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 0x8E8D; + const GLenum COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 0x8E8E; + const GLenum COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 0x8E8F; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_texture_compression_rgtc { + const GLenum COMPRESSED_RED_RGTC1_EXT = 0x8DBB; + const GLenum COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC; + const GLenum COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD; + const GLenum COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE; +}; + +// https://www.khronos.org/registry/webgl/extensions/EXT_texture_norm16/ +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_texture_norm16 { + const GLenum R16_EXT = 0x822A; + const GLenum RG16_EXT = 0x822C; + const GLenum RGB16_EXT = 0x8054; + const GLenum RGBA16_EXT = 0x805B; + const GLenum R16_SNORM_EXT = 0x8F98; + const GLenum RG16_SNORM_EXT = 0x8F99; + const GLenum RGB16_SNORM_EXT = 0x8F9A; + const GLenum RGBA16_SNORM_EXT = 0x8F9B; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_compressed_texture_s3tc +{ + const GLenum COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; + const GLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; + const GLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; + const GLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_compressed_texture_s3tc_srgb { + /* Compressed Texture Formats */ + const GLenum COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C; + const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D; + const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E; + const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_compressed_texture_astc { + /* Compressed Texture Format */ + const GLenum COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0; + const GLenum COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1; + const GLenum COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2; + const GLenum COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3; + const GLenum COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4; + const GLenum COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5; + const GLenum COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6; + const GLenum COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7; + const GLenum COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8; + const GLenum COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9; + const GLenum COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA; + const GLenum COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB; + const GLenum COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC; + const GLenum COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD; + + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC; + const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD; + + // Profile query support. + sequence<DOMString>? getSupportedProfiles(); +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_compressed_texture_etc +{ + const GLenum COMPRESSED_R11_EAC = 0x9270; + const GLenum COMPRESSED_SIGNED_R11_EAC = 0x9271; + const GLenum COMPRESSED_RG11_EAC = 0x9272; + const GLenum COMPRESSED_SIGNED_RG11_EAC = 0x9273; + const GLenum COMPRESSED_RGB8_ETC2 = 0x9274; + const GLenum COMPRESSED_SRGB8_ETC2 = 0x9275; + const GLenum COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276; + const GLenum COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277; + const GLenum COMPRESSED_RGBA8_ETC2_EAC = 0x9278; + const GLenum COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_compressed_texture_etc1 +{ + const GLenum COMPRESSED_RGB_ETC1_WEBGL = 0x8D64; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_compressed_texture_pvrtc +{ + const GLenum COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00; + const GLenum COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01; + const GLenum COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02; + const GLenum COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_debug_renderer_info +{ + const GLenum UNMASKED_VENDOR_WEBGL = 0x9245; + const GLenum UNMASKED_RENDERER_WEBGL = 0x9246; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_debug_shaders +{ + DOMString getTranslatedShaderSource(WebGLShader shader); +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_depth_texture +{ + const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface OES_element_index_uint +{ +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_frag_depth +{ +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_lose_context { + undefined loseContext(); + undefined restoreContext(); +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_texture_filter_anisotropic +{ + const GLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; + const GLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_sRGB +{ + const GLenum SRGB_EXT = 0x8C40; + const GLenum SRGB_ALPHA_EXT = 0x8C42; + const GLenum SRGB8_ALPHA8_EXT = 0x8C43; + const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 0x8210; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface OES_standard_derivatives { + const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface OES_texture_float +{ +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_draw_buffers { + const GLenum COLOR_ATTACHMENT0_WEBGL = 0x8CE0; + const GLenum COLOR_ATTACHMENT1_WEBGL = 0x8CE1; + const GLenum COLOR_ATTACHMENT2_WEBGL = 0x8CE2; + const GLenum COLOR_ATTACHMENT3_WEBGL = 0x8CE3; + const GLenum COLOR_ATTACHMENT4_WEBGL = 0x8CE4; + const GLenum COLOR_ATTACHMENT5_WEBGL = 0x8CE5; + const GLenum COLOR_ATTACHMENT6_WEBGL = 0x8CE6; + const GLenum COLOR_ATTACHMENT7_WEBGL = 0x8CE7; + const GLenum COLOR_ATTACHMENT8_WEBGL = 0x8CE8; + const GLenum COLOR_ATTACHMENT9_WEBGL = 0x8CE9; + const GLenum COLOR_ATTACHMENT10_WEBGL = 0x8CEA; + const GLenum COLOR_ATTACHMENT11_WEBGL = 0x8CEB; + const GLenum COLOR_ATTACHMENT12_WEBGL = 0x8CEC; + const GLenum COLOR_ATTACHMENT13_WEBGL = 0x8CED; + const GLenum COLOR_ATTACHMENT14_WEBGL = 0x8CEE; + const GLenum COLOR_ATTACHMENT15_WEBGL = 0x8CEF; + + const GLenum DRAW_BUFFER0_WEBGL = 0x8825; + const GLenum DRAW_BUFFER1_WEBGL = 0x8826; + const GLenum DRAW_BUFFER2_WEBGL = 0x8827; + const GLenum DRAW_BUFFER3_WEBGL = 0x8828; + const GLenum DRAW_BUFFER4_WEBGL = 0x8829; + const GLenum DRAW_BUFFER5_WEBGL = 0x882A; + const GLenum DRAW_BUFFER6_WEBGL = 0x882B; + const GLenum DRAW_BUFFER7_WEBGL = 0x882C; + const GLenum DRAW_BUFFER8_WEBGL = 0x882D; + const GLenum DRAW_BUFFER9_WEBGL = 0x882E; + const GLenum DRAW_BUFFER10_WEBGL = 0x882F; + const GLenum DRAW_BUFFER11_WEBGL = 0x8830; + const GLenum DRAW_BUFFER12_WEBGL = 0x8831; + const GLenum DRAW_BUFFER13_WEBGL = 0x8832; + const GLenum DRAW_BUFFER14_WEBGL = 0x8833; + const GLenum DRAW_BUFFER15_WEBGL = 0x8834; + + const GLenum MAX_COLOR_ATTACHMENTS_WEBGL = 0x8CDF; + const GLenum MAX_DRAW_BUFFERS_WEBGL = 0x8824; + + undefined drawBuffersWEBGL(sequence<GLenum> buffers); +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface OES_texture_float_linear +{ +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_shader_texture_lod +{ +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface OES_texture_half_float +{ + const GLenum HALF_FLOAT_OES = 0x8D61; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface OES_texture_half_float_linear +{ +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_color_buffer_float +{ + const GLenum RGBA32F_EXT = 0x8814; + const GLenum RGB32F_EXT = 0x8815; + const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211; + const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_color_buffer_half_float +{ + const GLenum RGBA16F_EXT = 0x881A; + const GLenum RGB16F_EXT = 0x881B; + const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211; + const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17; +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface OES_vertex_array_object { + const GLenum VERTEX_ARRAY_BINDING_OES = 0x85B5; + + WebGLVertexArrayObject? createVertexArrayOES(); + undefined deleteVertexArrayOES(WebGLVertexArrayObject? arrayObject); + [WebGLHandlesContextLoss] GLboolean isVertexArrayOES(WebGLVertexArrayObject? arrayObject); + undefined bindVertexArrayOES(WebGLVertexArrayObject? arrayObject); +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface ANGLE_instanced_arrays { + const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE; + + undefined drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount); + undefined drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount); + undefined vertexAttribDivisorANGLE(GLuint index, GLuint divisor); +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_blend_minmax { + const GLenum MIN_EXT = 0x8007; + const GLenum MAX_EXT = 0x8008; +}; + +[Exposed=(Window,Worker)] +interface WebGLQuery { +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_disjoint_timer_query { + const GLenum QUERY_COUNTER_BITS_EXT = 0x8864; + const GLenum CURRENT_QUERY_EXT = 0x8865; + const GLenum QUERY_RESULT_EXT = 0x8866; + const GLenum QUERY_RESULT_AVAILABLE_EXT = 0x8867; + const GLenum TIME_ELAPSED_EXT = 0x88BF; + const GLenum TIMESTAMP_EXT = 0x8E28; + const GLenum GPU_DISJOINT_EXT = 0x8FBB; + + WebGLQuery? createQueryEXT(); + undefined deleteQueryEXT(WebGLQuery? query); + [WebGLHandlesContextLoss] boolean isQueryEXT(WebGLQuery? query); + undefined beginQueryEXT(GLenum target, WebGLQuery query); + undefined endQueryEXT(GLenum target); + undefined queryCounterEXT(WebGLQuery query, GLenum target); + any getQueryEXT(GLenum target, GLenum pname); + any getQueryObjectEXT(WebGLQuery query, GLenum pname); +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface MOZ_debug { + const GLenum EXTENSIONS = 0x1F03; + + const GLenum WSI_INFO = 0x10000; + const GLenum UNPACK_REQUIRE_FASTPATH = 0x10001; + const GLenum DOES_INDEX_VALIDATION = 0x10002; + + [Throws] + any getParameter(GLenum pname); +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface EXT_float_blend { +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface OES_fbo_render_mipmap { +}; + +[LegacyNoInterfaceObject, + Exposed=(Window,Worker)] +interface WEBGL_explicit_present { + undefined present(); +}; + +// https://www.khronos.org/registry/webgl/extensions/OES_draw_buffers_indexed/ +[Exposed=(Window,Worker), LegacyNoInterfaceObject] +interface OES_draw_buffers_indexed { + undefined enableiOES(GLenum target, GLuint index); + + undefined disableiOES(GLenum target, GLuint index); + + undefined blendEquationiOES(GLuint buf, GLenum mode); + + undefined blendEquationSeparateiOES(GLuint buf, + GLenum modeRGB, GLenum modeAlpha); + + undefined blendFunciOES(GLuint buf, + GLenum src, GLenum dst); + + undefined blendFuncSeparateiOES(GLuint buf, + GLenum srcRGB, GLenum dstRGB, + GLenum srcAlpha, GLenum dstAlpha); + + undefined colorMaskiOES(GLuint buf, + GLboolean r, GLboolean g, GLboolean b, GLboolean a); +}; + +[Exposed=(Window,Worker), LegacyNoInterfaceObject] +interface WEBGL_provoking_vertex { + const GLenum FIRST_VERTEX_CONVENTION_WEBGL = 0x8E4D; + const GLenum LAST_VERTEX_CONVENTION_WEBGL = 0x8E4E; // default + const GLenum PROVOKING_VERTEX_WEBGL = 0x8E4F; + + undefined provokingVertexWEBGL(GLenum provokeMode); +}; + +// https://immersive-web.github.io/webxr/#dom-webglcontextattributes-xrcompatible +partial dictionary WebGLContextAttributes { + [Pref="dom.vr.webxr.enabled"] + boolean xrCompatible = false; +}; + +// https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible +partial interface mixin WebGLRenderingContextBase { + [NewObject, Pref="dom.vr.webxr.enabled"] + Promise<undefined> makeXRCompatible(); +}; diff --git a/dom/webidl/WebGPU.webidl b/dom/webidl/WebGPU.webidl new file mode 100644 index 0000000000..58e259258d --- /dev/null +++ b/dom/webidl/WebGPU.webidl @@ -0,0 +1,1259 @@ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of 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://gpuweb.github.io/gpuweb/ + */ + +interface mixin GPUObjectBase { + attribute USVString? label; +}; + +dictionary GPUObjectDescriptorBase { + USVString label = ""; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUSupportedLimits { + readonly attribute unsigned long maxTextureDimension1D; + readonly attribute unsigned long maxTextureDimension2D; + readonly attribute unsigned long maxTextureDimension3D; + readonly attribute unsigned long maxTextureArrayLayers; + readonly attribute unsigned long maxBindGroups; + readonly attribute unsigned long maxBindGroupsPlusVertexBuffers; + readonly attribute unsigned long maxBindingsPerBindGroup; + readonly attribute unsigned long maxDynamicUniformBuffersPerPipelineLayout; + readonly attribute unsigned long maxDynamicStorageBuffersPerPipelineLayout; + readonly attribute unsigned long maxSampledTexturesPerShaderStage; + readonly attribute unsigned long maxSamplersPerShaderStage; + readonly attribute unsigned long maxStorageBuffersPerShaderStage; + readonly attribute unsigned long maxStorageTexturesPerShaderStage; + readonly attribute unsigned long maxUniformBuffersPerShaderStage; + readonly attribute unsigned long long maxUniformBufferBindingSize; + readonly attribute unsigned long long maxStorageBufferBindingSize; + readonly attribute unsigned long minUniformBufferOffsetAlignment; + readonly attribute unsigned long minStorageBufferOffsetAlignment; + readonly attribute unsigned long maxVertexBuffers; + readonly attribute unsigned long long maxBufferSize; + readonly attribute unsigned long maxVertexAttributes; + readonly attribute unsigned long maxVertexBufferArrayStride; + readonly attribute unsigned long maxInterStageShaderComponents; + readonly attribute unsigned long maxInterStageShaderVariables; + readonly attribute unsigned long maxColorAttachments; + readonly attribute unsigned long maxColorAttachmentBytesPerSample; + readonly attribute unsigned long maxComputeWorkgroupStorageSize; + readonly attribute unsigned long maxComputeInvocationsPerWorkgroup; + readonly attribute unsigned long maxComputeWorkgroupSizeX; + readonly attribute unsigned long maxComputeWorkgroupSizeY; + readonly attribute unsigned long maxComputeWorkgroupSizeZ; + readonly attribute unsigned long maxComputeWorkgroupsPerDimension; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUSupportedFeatures { + readonly setlike<DOMString>; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUAdapterInfo { + readonly attribute DOMString vendor; + readonly attribute DOMString architecture; + readonly attribute DOMString device; + readonly attribute DOMString description; + + // Non-standard; see <https://bugzilla.mozilla.org/show_bug.cgi?id=1831994>. + [ChromeOnly] readonly attribute DOMString wgpuName; + [ChromeOnly] readonly attribute unsigned long wgpuVendor; + [ChromeOnly] readonly attribute unsigned long wgpuDevice; + [ChromeOnly] readonly attribute DOMString wgpuDeviceType; + [ChromeOnly] readonly attribute DOMString wgpuDriver; + [ChromeOnly] readonly attribute DOMString wgpuDriverInfo; + [ChromeOnly] readonly attribute DOMString wgpuBackend; +}; + +interface mixin NavigatorGPU { + [SameObject, Func="mozilla::webgpu::Instance::PrefEnabled", Exposed=(Window, DedicatedWorker), SecureContext] readonly attribute GPU gpu; +}; +// NOTE: see `dom/webidl/Navigator.webidl` +// Navigator includes NavigatorGPU; +// NOTE: see `dom/webidl/WorkerNavigator.webidl` +// WorkerNavigator includes NavigatorGPU; + +[ + Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext +] +interface GPU { + [Throws] + Promise<GPUAdapter?> requestAdapter(optional GPURequestAdapterOptions options = {}); + GPUTextureFormat getPreferredCanvasFormat(); +}; + +dictionary GPURequestAdapterOptions { + GPUPowerPreference powerPreference; + boolean forceFallbackAdapter = false; +}; + +enum GPUPowerPreference { + "low-power", + "high-performance", +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUAdapter { + [SameObject] readonly attribute GPUSupportedFeatures features; + [SameObject] readonly attribute GPUSupportedLimits limits; + readonly attribute boolean isFallbackAdapter; + + [Throws] + Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {}); + [Throws] + Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []); +}; + +dictionary GPUDeviceDescriptor + : GPUObjectDescriptorBase { + sequence<GPUFeatureName> requiredFeatures = []; + record<DOMString, GPUSize64> requiredLimits; + GPUQueueDescriptor defaultQueue = {}; +}; + +enum GPUFeatureName { + "depth-clip-control", + "depth32float-stencil8", + "texture-compression-bc", + "texture-compression-etc2", + "texture-compression-astc", + "timestamp-query", + "indirect-first-instance", + "shader-f16", + "rg11b10ufloat-renderable", + "bgra8unorm-storage", + "float32-filterable", +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUDevice : EventTarget { + [SameObject] readonly attribute GPUSupportedFeatures features; + [SameObject] readonly attribute GPUSupportedLimits limits; + + [SameObject, BinaryName="getQueue"] readonly attribute GPUQueue queue; + + undefined destroy(); + + [Throws] + GPUBuffer createBuffer(GPUBufferDescriptor descriptor); + GPUTexture createTexture(GPUTextureDescriptor descriptor); + GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {}); + + GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor); + GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor); + GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor); + + [Throws] + GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor); + GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor); + GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor); + [Throws] + Promise<GPUComputePipeline> createComputePipelineAsync(GPUComputePipelineDescriptor descriptor); + [Throws] + Promise<GPURenderPipeline> createRenderPipelineAsync(GPURenderPipelineDescriptor descriptor); + + GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {}); + GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor); + + //GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor); +}; +GPUDevice includes GPUObjectBase; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUBuffer { + readonly attribute GPUSize64Out size; + readonly attribute GPUFlagsConstant usage; + + readonly attribute GPUBufferMapState mapState; + + [Throws] + Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); + [Throws] + ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size); + [Throws] + undefined unmap(); + + [Throws] + undefined destroy(); +}; +GPUBuffer includes GPUObjectBase; + +enum GPUBufferMapState { + "unmapped", + "pending", + "mapped", +}; + +dictionary GPUBufferDescriptor + : GPUObjectDescriptorBase { + required GPUSize64 size; + required GPUBufferUsageFlags usage; + boolean mappedAtCreation = false; +}; + +typedef [EnforceRange] unsigned long GPUBufferUsageFlags; +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUBufferUsage { + const GPUFlagsConstant MAP_READ = 0x0001; + const GPUFlagsConstant MAP_WRITE = 0x0002; + const GPUFlagsConstant COPY_SRC = 0x0004; + const GPUFlagsConstant COPY_DST = 0x0008; + const GPUFlagsConstant INDEX = 0x0010; + const GPUFlagsConstant VERTEX = 0x0020; + const GPUFlagsConstant UNIFORM = 0x0040; + const GPUFlagsConstant STORAGE = 0x0080; + const GPUFlagsConstant INDIRECT = 0x0100; + const GPUFlagsConstant QUERY_RESOLVE = 0x0200; +}; + +typedef [EnforceRange] unsigned long GPUMapModeFlags; +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUMapMode { + const GPUFlagsConstant READ = 0x0001; + const GPUFlagsConstant WRITE = 0x0002; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUTexture { + GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); + + undefined destroy(); + + readonly attribute GPUIntegerCoordinateOut width; + readonly attribute GPUIntegerCoordinateOut height; + readonly attribute GPUIntegerCoordinateOut depthOrArrayLayers; + readonly attribute GPUIntegerCoordinateOut mipLevelCount; + readonly attribute GPUSize32Out sampleCount; + readonly attribute GPUTextureDimension dimension; + readonly attribute GPUTextureFormat format; + readonly attribute GPUFlagsConstant usage; +}; +GPUTexture includes GPUObjectBase; + +dictionary GPUTextureDescriptor + : GPUObjectDescriptorBase { + required GPUExtent3D size; + GPUIntegerCoordinate mipLevelCount = 1; + GPUSize32 sampleCount = 1; + GPUTextureDimension dimension = "2d"; + required GPUTextureFormat format; + required GPUTextureUsageFlags usage; + sequence<GPUTextureFormat> viewFormats = []; +}; + +enum GPUTextureDimension { + "1d", + "2d", + "3d", +}; + +typedef [EnforceRange] unsigned long GPUTextureUsageFlags; +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUTextureUsage { + const GPUFlagsConstant COPY_SRC = 0x01; + const GPUFlagsConstant COPY_DST = 0x02; + const GPUFlagsConstant TEXTURE_BINDING = 0x04; + const GPUFlagsConstant STORAGE_BINDING = 0x08; + const GPUFlagsConstant RENDER_ATTACHMENT = 0x10; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUTextureView { +}; +GPUTextureView includes GPUObjectBase; + +dictionary GPUTextureViewDescriptor + : GPUObjectDescriptorBase { + GPUTextureFormat format; + GPUTextureViewDimension dimension; + GPUTextureAspect aspect = "all"; + GPUIntegerCoordinate baseMipLevel = 0; + GPUIntegerCoordinate mipLevelCount; + GPUIntegerCoordinate baseArrayLayer = 0; + GPUIntegerCoordinate arrayLayerCount; +}; + +enum GPUTextureViewDimension { + "1d", + "2d", + "2d-array", + "cube", + "cube-array", + "3d", +}; + +enum GPUTextureAspect { + "all", + "stencil-only", + "depth-only", +}; + +enum GPUTextureFormat { + // 8-bit formats + "r8unorm", + "r8snorm", + "r8uint", + "r8sint", + + // 16-bit formats + "r16uint", + "r16sint", + "r16float", + "rg8unorm", + "rg8snorm", + "rg8uint", + "rg8sint", + + // 32-bit formats + "r32uint", + "r32sint", + "r32float", + "rg16uint", + "rg16sint", + "rg16float", + "rgba8unorm", + "rgba8unorm-srgb", + "rgba8snorm", + "rgba8uint", + "rgba8sint", + "bgra8unorm", + "bgra8unorm-srgb", + // Packed 32-bit formats + "rgb9e5ufloat", + "rgb10a2unorm", + "rg11b10ufloat", + + // 64-bit formats + "rg32uint", + "rg32sint", + "rg32float", + "rgba16uint", + "rgba16sint", + "rgba16float", + + // 128-bit formats + "rgba32uint", + "rgba32sint", + "rgba32float", + + // Depth/stencil formats + "stencil8", + "depth16unorm", + "depth24plus", + "depth24plus-stencil8", + "depth32float", + + // "depth32float-stencil8" feature + "depth32float-stencil8", + + // BC compressed formats usable if "texture-compression-bc" is both + // supported by the device/user agent and enabled in requestDevice. + "bc1-rgba-unorm", + "bc1-rgba-unorm-srgb", + "bc2-rgba-unorm", + "bc2-rgba-unorm-srgb", + "bc3-rgba-unorm", + "bc3-rgba-unorm-srgb", + "bc4-r-unorm", + "bc4-r-snorm", + "bc5-rg-unorm", + "bc5-rg-snorm", + "bc6h-rgb-ufloat", + "bc6h-rgb-float", + "bc7-rgba-unorm", + "bc7-rgba-unorm-srgb", +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUSampler { +}; +GPUSampler includes GPUObjectBase; + +dictionary GPUSamplerDescriptor + : GPUObjectDescriptorBase { + GPUAddressMode addressModeU = "clamp-to-edge"; + GPUAddressMode addressModeV = "clamp-to-edge"; + GPUAddressMode addressModeW = "clamp-to-edge"; + GPUFilterMode magFilter = "nearest"; + GPUFilterMode minFilter = "nearest"; + GPUMipmapFilterMode mipmapFilter = "nearest"; + float lodMinClamp = 0; + float lodMaxClamp = 1000.0; // TODO: What should this be? + GPUCompareFunction compare; + [Clamp] unsigned short maxAnisotropy = 1; +}; + +enum GPUAddressMode { + "clamp-to-edge", + "repeat", + "mirror-repeat", +}; + +enum GPUFilterMode { + "nearest", + "linear", +}; + +enum GPUMipmapFilterMode { + "nearest", + "linear", +}; + +enum GPUCompareFunction { + "never", + "less", + "equal", + "less-equal", + "greater", + "not-equal", + "greater-equal", + "always", +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUBindGroupLayout { +}; +GPUBindGroupLayout includes GPUObjectBase; + +dictionary GPUBindGroupLayoutDescriptor + : GPUObjectDescriptorBase { + required sequence<GPUBindGroupLayoutEntry> entries; +}; + +dictionary GPUBindGroupLayoutEntry { + required GPUIndex32 binding; + required GPUShaderStageFlags visibility; + + GPUBufferBindingLayout buffer; + GPUSamplerBindingLayout sampler; + GPUTextureBindingLayout texture; + GPUStorageTextureBindingLayout storageTexture; +}; + +typedef [EnforceRange] unsigned long GPUShaderStageFlags; +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUShaderStage { + const GPUFlagsConstant VERTEX = 0x1; + const GPUFlagsConstant FRAGMENT = 0x2; + const GPUFlagsConstant COMPUTE = 0x4; +}; + +enum GPUBufferBindingType { + "uniform", + "storage", + "read-only-storage", +}; + +dictionary GPUBufferBindingLayout { + GPUBufferBindingType type = "uniform"; + boolean hasDynamicOffset = false; + GPUSize64 minBindingSize = 0; +}; + +enum GPUSamplerBindingType { + "filtering", + "non-filtering", + "comparison", +}; + +dictionary GPUSamplerBindingLayout { + GPUSamplerBindingType type = "filtering"; +}; + +enum GPUTextureSampleType { + "float", + "unfilterable-float", + "depth", + "sint", + "uint", +}; + +dictionary GPUTextureBindingLayout { + GPUTextureSampleType sampleType = "float"; + GPUTextureViewDimension viewDimension = "2d"; + boolean multisampled = false; +}; + +enum GPUStorageTextureAccess { + "write-only", +}; + +dictionary GPUStorageTextureBindingLayout { + GPUStorageTextureAccess access = "write-only"; + required GPUTextureFormat format; + GPUTextureViewDimension viewDimension = "2d"; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUBindGroup { +}; +GPUBindGroup includes GPUObjectBase; + +dictionary GPUBindGroupDescriptor + : GPUObjectDescriptorBase { + required GPUBindGroupLayout layout; + required sequence<GPUBindGroupEntry> entries; +}; + +typedef (GPUSampler or GPUTextureView or GPUBufferBinding) GPUBindingResource; + +dictionary GPUBindGroupEntry { + required GPUIndex32 binding; + required GPUBindingResource resource; +}; + +dictionary GPUBufferBinding { + required GPUBuffer buffer; + GPUSize64 offset = 0; + GPUSize64 size; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUPipelineLayout { +}; +GPUPipelineLayout includes GPUObjectBase; + +dictionary GPUPipelineLayoutDescriptor + : GPUObjectDescriptorBase { + required sequence<GPUBindGroupLayout> bindGroupLayouts; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUShaderModule { + [Throws] + Promise<GPUCompilationInfo> compilationInfo(); // To be removed with <https://bugzilla.mozilla.org/show_bug.cgi?id=1846892> + [Throws] + Promise<GPUCompilationInfo> getCompilationInfo(); +}; +GPUShaderModule includes GPUObjectBase; + +dictionary GPUShaderModuleDescriptor + : GPUObjectDescriptorBase { + // UTF8String is not observably different from USVString + required UTF8String code; + object sourceMap; +}; + +enum GPUCompilationMessageType { + "error", + "warning", + "info", +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUCompilationMessage { + readonly attribute DOMString message; + readonly attribute GPUCompilationMessageType type; + readonly attribute unsigned long long lineNum; + readonly attribute unsigned long long linePos; + readonly attribute unsigned long long offset; + readonly attribute unsigned long long length; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUCompilationInfo { + [Cached, Frozen, Pure] + readonly attribute sequence<GPUCompilationMessage> messages; +}; + +enum GPUAutoLayoutMode { + "auto", +}; + +dictionary GPUPipelineDescriptorBase + : GPUObjectDescriptorBase { + required (GPUPipelineLayout or GPUAutoLayoutMode) layout; +}; + +interface mixin GPUPipelineBase { + GPUBindGroupLayout getBindGroupLayout(unsigned long index); +}; + +dictionary GPUProgrammableStage { + required GPUShaderModule module; + required USVString entryPoint; +}; + +//TODO: Serializable +// https://bugzilla.mozilla.org/show_bug.cgi?id=1696219 +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUComputePipeline { +}; +GPUComputePipeline includes GPUObjectBase; +GPUComputePipeline includes GPUPipelineBase; + +dictionary GPUComputePipelineDescriptor + : GPUPipelineDescriptorBase { + required GPUProgrammableStage compute; +}; + +//TODO: Serializable +// https://bugzilla.mozilla.org/show_bug.cgi?id=1696219 +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPURenderPipeline { +}; +GPURenderPipeline includes GPUObjectBase; +GPURenderPipeline includes GPUPipelineBase; + +dictionary GPURenderPipelineDescriptor + : GPUPipelineDescriptorBase { + required GPUVertexState vertex; + GPUPrimitiveState primitive = {}; + GPUDepthStencilState depthStencil; + GPUMultisampleState multisample = {}; + GPUFragmentState fragment; +}; + +dictionary GPUPrimitiveState { + GPUPrimitiveTopology topology = "triangle-list"; + GPUIndexFormat stripIndexFormat; + GPUFrontFace frontFace = "ccw"; + GPUCullMode cullMode = "none"; + + // Requires "depth-clip-control" feature. + boolean unclippedDepth = false; +}; + +enum GPUPrimitiveTopology { + "point-list", + "line-list", + "line-strip", + "triangle-list", + "triangle-strip", +}; + +enum GPUFrontFace { + "ccw", + "cw", +}; + +enum GPUCullMode { + "none", + "front", + "back", +}; + +dictionary GPUMultisampleState { + GPUSize32 count = 1; + GPUSampleMask mask = 0xFFFFFFFF; + boolean alphaToCoverageEnabled = false; +}; + +dictionary GPUFragmentState + : GPUProgrammableStage { + required sequence<GPUColorTargetState> targets; +}; + +dictionary GPUColorTargetState { + required GPUTextureFormat format; + + GPUBlendState blend; + GPUColorWriteFlags writeMask = 0xF; // GPUColorWrite.ALL +}; + +dictionary GPUBlendState { + required GPUBlendComponent color; + required GPUBlendComponent alpha; +}; + +typedef [EnforceRange] unsigned long GPUColorWriteFlags; +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUColorWrite { + const GPUFlagsConstant RED = 0x1; + const GPUFlagsConstant GREEN = 0x2; + const GPUFlagsConstant BLUE = 0x4; + const GPUFlagsConstant ALPHA = 0x8; + const GPUFlagsConstant ALL = 0xF; +}; + +dictionary GPUBlendComponent { + GPUBlendOperation operation = "add"; + GPUBlendFactor srcFactor = "one"; + GPUBlendFactor dstFactor = "zero"; +}; + +enum GPUBlendFactor { + "zero", + "one", + "src", + "one-minus-src", + "src-alpha", + "one-minus-src-alpha", + "dst", + "one-minus-dst", + "dst-alpha", + "one-minus-dst-alpha", + "src-alpha-saturated", + "constant", + "one-minus-constant", +}; + +enum GPUBlendOperation { + "add", + "subtract", + "reverse-subtract", + "min", + "max", +}; + +dictionary GPUDepthStencilState { + required GPUTextureFormat format; + + boolean depthWriteEnabled = false; + GPUCompareFunction depthCompare = "always"; + + GPUStencilFaceState stencilFront = {}; + GPUStencilFaceState stencilBack = {}; + + GPUStencilValue stencilReadMask = 0xFFFFFFFF; + GPUStencilValue stencilWriteMask = 0xFFFFFFFF; + + GPUDepthBias depthBias = 0; + float depthBiasSlopeScale = 0; + float depthBiasClamp = 0; +}; + +dictionary GPUStencilFaceState { + GPUCompareFunction compare = "always"; + GPUStencilOperation failOp = "keep"; + GPUStencilOperation depthFailOp = "keep"; + GPUStencilOperation passOp = "keep"; +}; + +enum GPUStencilOperation { + "keep", + "zero", + "replace", + "invert", + "increment-clamp", + "decrement-clamp", + "increment-wrap", + "decrement-wrap", +}; + +enum GPUIndexFormat { + "uint16", + "uint32", +}; + +enum GPUVertexFormat { + "uint8x2", + "uint8x4", + "sint8x2", + "sint8x4", + "unorm8x2", + "unorm8x4", + "snorm8x2", + "snorm8x4", + "uint16x2", + "uint16x4", + "sint16x2", + "sint16x4", + "unorm16x2", + "unorm16x4", + "snorm16x2", + "snorm16x4", + "float16x2", + "float16x4", + "float32", + "float32x2", + "float32x3", + "float32x4", + "uint32", + "uint32x2", + "uint32x3", + "uint32x4", + "sint32", + "sint32x2", + "sint32x3", + "sint32x4", +}; + +enum GPUVertexStepMode { + "vertex", + "instance", +}; + +dictionary GPUVertexState + : GPUProgrammableStage { + sequence<GPUVertexBufferLayout?> buffers = []; +}; + +dictionary GPUVertexBufferLayout { + required GPUSize64 arrayStride; + GPUVertexStepMode stepMode = "vertex"; + required sequence<GPUVertexAttribute> attributes; +}; + +dictionary GPUVertexAttribute { + required GPUVertexFormat format; + required GPUSize64 offset; + + required GPUIndex32 shaderLocation; +}; + +dictionary GPUImageDataLayout { + GPUSize64 offset = 0; + GPUSize32 bytesPerRow; + GPUSize32 rowsPerImage; +}; + +dictionary GPUImageCopyBuffer + : GPUImageDataLayout { + required GPUBuffer buffer; +}; + +dictionary GPUImageCopyTexture { + required GPUTexture texture; + GPUIntegerCoordinate mipLevel = 0; + GPUOrigin3D origin; + GPUTextureAspect aspect = "all"; +}; + +dictionary GPUImageCopyTextureTagged + : GPUImageCopyTexture { + //GPUPredefinedColorSpace colorSpace = "srgb"; //TODO + boolean premultipliedAlpha = false; +}; + +dictionary GPUImageCopyExternalImage { + required (ImageBitmap or HTMLCanvasElement or OffscreenCanvas) source; + GPUOrigin2D origin = {}; + boolean flipY = false; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUCommandBuffer { +}; +GPUCommandBuffer includes GPUObjectBase; + +dictionary GPUCommandBufferDescriptor + : GPUObjectDescriptorBase { +}; + +interface mixin GPUCommandsMixin { +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUCommandEncoder { + GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); + GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {}); + + undefined copyBufferToBuffer( + GPUBuffer source, + GPUSize64 sourceOffset, + GPUBuffer destination, + GPUSize64 destinationOffset, + GPUSize64 size); + + undefined copyBufferToTexture( + GPUImageCopyBuffer source, + GPUImageCopyTexture destination, + GPUExtent3D copySize); + + undefined copyTextureToBuffer( + GPUImageCopyTexture source, + GPUImageCopyBuffer destination, + GPUExtent3D copySize); + + undefined copyTextureToTexture( + GPUImageCopyTexture source, + GPUImageCopyTexture destination, + GPUExtent3D copySize); + + undefined clearBuffer( + GPUBuffer buffer, + optional GPUSize64 offset = 0, + optional GPUSize64 size); + + GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {}); +}; +GPUCommandEncoder includes GPUObjectBase; +GPUCommandEncoder includes GPUCommandsMixin; +GPUCommandEncoder includes GPUDebugCommandsMixin; + +dictionary GPUCommandEncoderDescriptor + : GPUObjectDescriptorBase { +}; + +interface mixin GPUBindingCommandsMixin { + undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, + optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []); +}; + +interface mixin GPUDebugCommandsMixin { + undefined pushDebugGroup(USVString groupLabel); + undefined popDebugGroup(); + undefined insertDebugMarker(USVString markerLabel); +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUComputePassEncoder { + undefined setPipeline(GPUComputePipeline pipeline); + undefined dispatchWorkgroups(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1); + [Pref="dom.webgpu.indirect-dispatch.enabled"] + undefined dispatchWorkgroupsIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); + + undefined end(); +}; +GPUComputePassEncoder includes GPUObjectBase; +GPUComputePassEncoder includes GPUCommandsMixin; +GPUComputePassEncoder includes GPUDebugCommandsMixin; +GPUComputePassEncoder includes GPUBindingCommandsMixin; + +dictionary GPUComputePassDescriptor + : GPUObjectDescriptorBase { +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPURenderPassEncoder { + undefined setViewport(float x, float y, + float width, float height, + float minDepth, float maxDepth); + + undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y, + GPUIntegerCoordinate width, GPUIntegerCoordinate height); + + undefined setBlendConstant(GPUColor color); + undefined setStencilReference(GPUStencilValue reference); + + //undefined beginOcclusionQuery(GPUSize32 queryIndex); + //undefined endOcclusionQuery(); + + undefined executeBundles(sequence<GPURenderBundle> bundles); + undefined end(); +}; +GPURenderPassEncoder includes GPUObjectBase; +GPURenderPassEncoder includes GPUCommandsMixin; +GPURenderPassEncoder includes GPUDebugCommandsMixin; +GPURenderPassEncoder includes GPUBindingCommandsMixin; +GPURenderPassEncoder includes GPURenderCommandsMixin; + +dictionary GPURenderPassDescriptor + : GPUObjectDescriptorBase { + required sequence<GPURenderPassColorAttachment> colorAttachments; + GPURenderPassDepthStencilAttachment depthStencilAttachment; + GPUQuerySet occlusionQuerySet; +}; + +dictionary GPURenderPassColorAttachment { + required GPUTextureView view; + GPUTextureView resolveTarget; + + GPUColor clearValue; + required GPULoadOp loadOp; + required GPUStoreOp storeOp; +}; + +dictionary GPURenderPassDepthStencilAttachment { + required GPUTextureView view; + + float depthClearValue; + GPULoadOp depthLoadOp; + GPUStoreOp depthStoreOp; + boolean depthReadOnly = false; + + GPUStencilValue stencilClearValue = 0; + GPULoadOp stencilLoadOp; + GPUStoreOp stencilStoreOp; + boolean stencilReadOnly = false; +}; + +enum GPULoadOp { + "load", + "clear", +}; + +enum GPUStoreOp { + "store", + "discard", +}; + +dictionary GPURenderPassLayout + : GPUObjectDescriptorBase { + required sequence<GPUTextureFormat> colorFormats; + GPUTextureFormat depthStencilFormat; + GPUSize32 sampleCount = 1; +}; + +interface mixin GPURenderCommandsMixin { + undefined setPipeline(GPURenderPipeline pipeline); + + undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size = 0); + undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size = 0); + + undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1, + optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0); + undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1, + optional GPUSize32 firstIndex = 0, + optional GPUSignedOffset32 baseVertex = 0, + optional GPUSize32 firstInstance = 0); + + [Pref="dom.webgpu.indirect-dispatch.enabled"] + undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); + [Pref="dom.webgpu.indirect-dispatch.enabled"] + undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPURenderBundle { +}; +GPURenderBundle includes GPUObjectBase; + +dictionary GPURenderBundleDescriptor + : GPUObjectDescriptorBase { +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPURenderBundleEncoder { + GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); +}; +GPURenderBundleEncoder includes GPUObjectBase; +GPURenderBundleEncoder includes GPUCommandsMixin; +GPURenderBundleEncoder includes GPUDebugCommandsMixin; +GPURenderBundleEncoder includes GPUBindingCommandsMixin; +GPURenderBundleEncoder includes GPURenderCommandsMixin; + +dictionary GPURenderBundleEncoderDescriptor + : GPURenderPassLayout { + boolean depthReadOnly = false; + boolean stencilReadOnly = false; +}; + +dictionary GPUQueueDescriptor + : GPUObjectDescriptorBase { +}; + +//TODO: use [AllowShared] on BufferSource +// https://bugzilla.mozilla.org/show_bug.cgi?id=1696216 +// https://github.com/heycam/webidl/issues/961 + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUQueue { + undefined submit(sequence<GPUCommandBuffer> buffers); + + [Throws] + Promise<undefined> onSubmittedWorkDone(); + + [Throws] + undefined writeBuffer( + GPUBuffer buffer, + GPUSize64 bufferOffset, + BufferSource data, + optional GPUSize64 dataOffset = 0, + optional GPUSize64 size); + + [Throws] + undefined writeTexture( + GPUImageCopyTexture destination, + BufferSource data, + GPUImageDataLayout dataLayout, + GPUExtent3D size); + + [Throws] + undefined copyExternalImageToTexture( + GPUImageCopyExternalImage source, + GPUImageCopyTextureTagged destination, + GPUExtent3D copySize); +}; +GPUQueue includes GPUObjectBase; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUQuerySet { + undefined destroy(); +}; +GPUQuerySet includes GPUObjectBase; + +dictionary GPUQuerySetDescriptor + : GPUObjectDescriptorBase { + required GPUQueryType type; + required GPUSize32 count; + sequence<GPUPipelineStatisticName> pipelineStatistics = []; +}; + +enum GPUPipelineStatisticName { + "vertex-shader-invocations", + "clipper-invocations", + "clipper-primitives-out", + "fragment-shader-invocations", + "compute-shader-invocations" +}; + +enum GPUQueryType { + "occlusion", + "pipeline-statistics", + "timestamp", +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUCanvasContext { + readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; + + undefined configure(GPUCanvasConfiguration configuration); + undefined unconfigure(); + + [Throws] + GPUTexture getCurrentTexture(); +}; + +enum GPUCanvasAlphaMode { + "opaque", + "premultiplied", +}; + +dictionary GPUCanvasConfiguration { + required GPUDevice device; + required GPUTextureFormat format; + GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT + sequence<GPUTextureFormat> viewFormats = []; + //GPUPredefinedColorSpace colorSpace = "srgb"; //TODO + GPUCanvasAlphaMode alphaMode = "opaque"; +}; + +enum GPUDeviceLostReason { + "destroyed", +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUDeviceLostInfo { + readonly attribute any reason; // GPUDeviceLostReason or undefined + readonly attribute DOMString message; +}; + +partial interface GPUDevice { + [Throws] + readonly attribute Promise<GPUDeviceLostInfo> lost; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUError { + readonly attribute DOMString message; +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUValidationError + : GPUError { + [Throws] + constructor(DOMString message); +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUOutOfMemoryError + : GPUError { + [Throws] + constructor(DOMString message); +}; + +[Func="mozilla::webgpu::Instance::PrefEnabled", + Exposed=(Window, DedicatedWorker), SecureContext] +interface GPUInternalError + : GPUError { + [Throws] + constructor(DOMString message); +}; + +enum GPUErrorFilter { + "validation", + "out-of-memory", + "internal", +}; + +partial interface GPUDevice { + undefined pushErrorScope(GPUErrorFilter filter); + [Throws] + Promise<GPUError?> popErrorScope(); +}; + +partial interface GPUDevice { + [Exposed=(Window, DedicatedWorker)] + attribute EventHandler onuncapturederror; +}; + +typedef [EnforceRange] unsigned long GPUBufferDynamicOffset; +typedef [EnforceRange] unsigned long GPUStencilValue; +typedef [EnforceRange] unsigned long GPUSampleMask; +typedef [EnforceRange] long GPUDepthBias; + +typedef [EnforceRange] unsigned long long GPUSize64; +typedef [EnforceRange] unsigned long GPUIntegerCoordinate; +typedef [EnforceRange] unsigned long GPUIndex32; +typedef [EnforceRange] unsigned long GPUSize32; +typedef [EnforceRange] long GPUSignedOffset32; + +typedef unsigned long long GPUSize64Out; +typedef unsigned long GPUIntegerCoordinateOut; +typedef unsigned long GPUSize32Out; + +typedef unsigned long GPUFlagsConstant; + +dictionary GPUColorDict { + required double r; + required double g; + required double b; + required double a; +}; +typedef (sequence<double> or GPUColorDict) GPUColor; + +dictionary GPUOrigin2DDict { + GPUIntegerCoordinate x = 0; + GPUIntegerCoordinate y = 0; +}; +typedef (sequence<GPUIntegerCoordinate> or GPUOrigin2DDict) GPUOrigin2D; + +dictionary GPUOrigin3DDict { + GPUIntegerCoordinate x = 0; + GPUIntegerCoordinate y = 0; + GPUIntegerCoordinate z = 0; +}; +typedef (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict) GPUOrigin3D; + +dictionary GPUExtent3DDict { + required GPUIntegerCoordinate width; + GPUIntegerCoordinate height = 1; + GPUIntegerCoordinate depthOrArrayLayers = 1; +}; +typedef (sequence<GPUIntegerCoordinate> or GPUExtent3DDict) GPUExtent3D; diff --git a/dom/webidl/WebSocket.webidl b/dom/webidl/WebSocket.webidl new file mode 100644 index 0000000000..90d0da38e7 --- /dev/null +++ b/dom/webidl/WebSocket.webidl @@ -0,0 +1,76 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/html/#network + * + * © 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 BinaryType { "blob", "arraybuffer" }; + +[Exposed=(Window,Worker)] +interface WebSocket : EventTarget { + [Throws] + constructor(DOMString url, optional (DOMString or sequence<DOMString>) protocols = []); + + readonly attribute DOMString url; + + // ready state + const unsigned short CONNECTING = 0; + const unsigned short OPEN = 1; + const unsigned short CLOSING = 2; + const unsigned short CLOSED = 3; + + readonly attribute unsigned short readyState; + + readonly attribute unsigned long long bufferedAmount; + + // networking + + attribute EventHandler onopen; + + attribute EventHandler onerror; + + attribute EventHandler onclose; + + readonly attribute DOMString extensions; + + readonly attribute DOMString protocol; + + [Throws] + undefined close(optional [Clamp] unsigned short code, optional DOMString reason); + + // messaging + + attribute EventHandler onmessage; + + attribute BinaryType binaryType; + + [Throws] + undefined send(DOMString data); + + [Throws] + undefined send(Blob data); + + [Throws] + undefined send(ArrayBuffer data); + + [Throws] + undefined send(ArrayBufferView data); +}; + +// Support for creating server-side chrome-only WebSocket. Used in +// devtools remote debugging server. +interface nsITransportProvider; + +partial interface WebSocket { + [ChromeOnly, NewObject, Throws] + static WebSocket createServerWebSocket(DOMString url, + sequence<DOMString> protocols, + nsITransportProvider transportProvider, + DOMString negotiatedExtensions); +}; diff --git a/dom/webidl/WebTaskScheduling.webidl b/dom/webidl/WebTaskScheduling.webidl new file mode 100644 index 0000000000..24659f3059 --- /dev/null +++ b/dom/webidl/WebTaskScheduling.webidl @@ -0,0 +1,47 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +enum TaskPriority { + "user-blocking", + "user-visible", + "background" +}; + +[Exposed=(Window, Worker), Pref="dom.enable_web_task_scheduling"] +interface TaskSignal : AbortSignal { + readonly attribute TaskPriority priority; + + attribute EventHandler onprioritychange; +}; + + +dictionary SchedulerPostTaskOptions { + AbortSignal signal; + TaskPriority priority; + [EnforceRange] unsigned long long delay = 0; +}; + +callback SchedulerPostTaskCallback = any (); + +[Exposed=(Window, Worker), Pref="dom.enable_web_task_scheduling"] +interface Scheduler { + [UseCounter] + Promise<any> postTask( + SchedulerPostTaskCallback callback, + optional SchedulerPostTaskOptions options = {} + ); +}; + +dictionary TaskControllerInit { + TaskPriority priority = "user-visible"; +}; + +[Exposed=(Window,Worker), Pref="dom.enable_web_task_scheduling"] +interface TaskController : AbortController { + [Throws] + constructor(optional TaskControllerInit init = {}); + + [Throws] + undefined setPriority(TaskPriority priority); +}; diff --git a/dom/webidl/WebTransport.webidl b/dom/webidl/WebTransport.webidl new file mode 100644 index 0000000000..338249b817 --- /dev/null +++ b/dom/webidl/WebTransport.webidl @@ -0,0 +1,102 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* https://w3c.github.io/webtransport */ + +/* https://w3c.github.io/webtransport/#web-transport-configuration */ + +dictionary WebTransportHash { + DOMString algorithm; + BufferSource value; +}; + +dictionary WebTransportOptions { + boolean allowPooling = false; + boolean requireUnreliable = false; + sequence<WebTransportHash> serverCertificateHashes; + WebTransportCongestionControl congestionControl = "default"; +}; + +enum WebTransportCongestionControl { + "default", + "throughput", + "low-latency", +}; + +/* https://w3c.github.io/webtransport/#web-transport-close-info */ + +dictionary WebTransportCloseInfo { + unsigned long closeCode = 0; + UTF8String reason = ""; +}; + +/* https://w3c.github.io/webtransport/#uni-stream-options */ +dictionary WebTransportSendStreamOptions { + long long? sendOrder = null; +}; + +/* https://w3c.github.io/webtransport/#web-transport-stats */ + +dictionary WebTransportStats { + DOMHighResTimeStamp timestamp; + unsigned long long bytesSent; + unsigned long long packetsSent; + unsigned long long packetsLost; + unsigned long numOutgoingStreamsCreated; + unsigned long numIncomingStreamsCreated; + unsigned long long bytesReceived; + unsigned long long packetsReceived; + DOMHighResTimeStamp smoothedRtt; + DOMHighResTimeStamp rttVariation; + DOMHighResTimeStamp minRtt; + WebTransportDatagramStats datagrams; +}; + +/* https://w3c.github.io/webtransport/#web-transport-stats%E2%91%A0 */ + +dictionary WebTransportDatagramStats { + DOMHighResTimeStamp timestamp; + unsigned long long expiredOutgoing; + unsigned long long droppedIncoming; + unsigned long long lostOutgoing; +}; + +/* https://w3c.github.io/webtransport/#web-transport */ + +[Exposed=(Window,Worker), SecureContext, Pref="network.webtransport.enabled"] +interface WebTransport { + [Throws] + constructor(USVString url, optional WebTransportOptions options = {}); + + [NewObject] + Promise<WebTransportStats> getStats(); + readonly attribute Promise<undefined> ready; + readonly attribute WebTransportReliabilityMode reliability; + readonly attribute WebTransportCongestionControl congestionControl; + readonly attribute Promise<WebTransportCloseInfo> closed; + [Throws] undefined close(optional WebTransportCloseInfo closeInfo = {}); + + [Throws] readonly attribute WebTransportDatagramDuplexStream datagrams; + + [NewObject] + Promise<WebTransportBidirectionalStream> createBidirectionalStream( + optional WebTransportSendStreamOptions options = {}); + /* a ReadableStream of WebTransportBidirectionalStream objects */ + readonly attribute ReadableStream incomingBidirectionalStreams; + + + /* XXX spec says this should be WebTransportSendStream */ + [NewObject] + Promise<WritableStream> createUnidirectionalStream( + optional WebTransportSendStreamOptions options = {}); + /* a ReadableStream of WebTransportReceiveStream objects */ + readonly attribute ReadableStream incomingUnidirectionalStreams; +}; + +enum WebTransportReliabilityMode { + "pending", + "reliable-only", + "supports-unreliable", +}; diff --git a/dom/webidl/WebTransportDatagramDuplexStream.webidl b/dom/webidl/WebTransportDatagramDuplexStream.webidl new file mode 100644 index 0000000000..b7998b7cb5 --- /dev/null +++ b/dom/webidl/WebTransportDatagramDuplexStream.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* https://w3c.github.io/webtransport/#duplex-stream */ + +[Exposed=(Window,Worker), SecureContext, Pref="network.webtransport.datagrams.enabled"] +interface WebTransportDatagramDuplexStream { + readonly attribute ReadableStream readable; + readonly attribute WritableStream writable; + + readonly attribute unsigned long maxDatagramSize; + [Throws] attribute unrestricted double incomingMaxAge; + [Throws] attribute unrestricted double outgoingMaxAge; + [Throws] attribute unrestricted double incomingHighWaterMark; + [Throws] attribute unrestricted double outgoingHighWaterMark; +}; diff --git a/dom/webidl/WebTransportError.webidl b/dom/webidl/WebTransportError.webidl new file mode 100644 index 0000000000..1484d65bf4 --- /dev/null +++ b/dom/webidl/WebTransportError.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* https://w3c.github.io/webtransport/#web-transport-error-interface */ + +[Exposed=(Window,Worker), SecureContext, Pref="network.webtransport.enabled"] +interface WebTransportError : DOMException { + constructor(optional WebTransportErrorInit init = {}); + + readonly attribute WebTransportErrorSource source; + readonly attribute octet? streamErrorCode; +}; + +dictionary WebTransportErrorInit { + [Clamp] octet streamErrorCode; + DOMString message; +}; + +enum WebTransportErrorSource { + "stream", + "session", +}; diff --git a/dom/webidl/WebTransportSendReceiveStream.webidl b/dom/webidl/WebTransportSendReceiveStream.webidl new file mode 100644 index 0000000000..13b91b3e22 --- /dev/null +++ b/dom/webidl/WebTransportSendReceiveStream.webidl @@ -0,0 +1,45 @@ +/* -*- 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/webtransport/#send-stream */ + + +[Exposed=(Window,Worker), SecureContext, Pref="network.webtransport.enabled"] +interface WebTransportSendStream : WritableStream { + attribute long long? sendOrder; + Promise<WebTransportSendStreamStats> getStats(); +}; + +/* https://w3c.github.io/webtransport/#send-stream-stats */ + +dictionary WebTransportSendStreamStats { + DOMHighResTimeStamp timestamp; + unsigned long long bytesWritten; + unsigned long long bytesSent; + unsigned long long bytesAcknowledged; +}; + +/* https://w3c.github.io/webtransport/#receive-stream */ + +[Exposed=(Window,Worker), SecureContext, Pref="network.webtransport.enabled"] +interface WebTransportReceiveStream : ReadableStream { + Promise<WebTransportReceiveStreamStats> getStats(); +}; + +/* https://w3c.github.io/webtransport/#receive-stream-stats */ + +dictionary WebTransportReceiveStreamStats { + DOMHighResTimeStamp timestamp; + unsigned long long bytesReceived; + unsigned long long bytesRead; +}; + +/* https://w3c.github.io/webtransport/#bidirectional-stream */ + +[Exposed=(Window,Worker), SecureContext, Pref="network.webtransport.enabled"] +interface WebTransportBidirectionalStream { + readonly attribute WebTransportReceiveStream readable; + readonly attribute WebTransportSendStream writable; +}; diff --git a/dom/webidl/WebXR.webidl b/dom/webidl/WebXR.webidl new file mode 100644 index 0000000000..302c82156a --- /dev/null +++ b/dom/webidl/WebXR.webidl @@ -0,0 +1,241 @@ +/* -*- 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://immersive-web.github.io/webxr/ + */ + + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRSystem : EventTarget { + // Methods + [NewObject] + Promise<boolean> isSessionSupported(XRSessionMode mode); + [NewObject, NeedsCallerType] + Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit options = {}); + + // Events + attribute EventHandler ondevicechange; +}; + +enum XRSessionMode { + "inline", + "immersive-vr", + "immersive-ar", +}; + +dictionary XRSessionInit { + sequence<any> requiredFeatures; + sequence<any> optionalFeatures; +}; + +enum XRVisibilityState { + "visible", + "visible-blurred", + "hidden", +}; + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRSession : EventTarget { + // Attributes + readonly attribute XRVisibilityState visibilityState; + [SameObject] readonly attribute XRRenderState renderState; + [SameObject] readonly attribute XRInputSourceArray inputSources; + readonly attribute float? frameRate; + readonly attribute Float32Array? supportedFrameRates; + + // Methods + [Throws] + undefined updateRenderState(optional XRRenderStateInit state = {}); + [NewObject] + Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type); + [NewObject] + Promise<undefined> updateTargetFrameRate(float rate); + + [Throws] + long requestAnimationFrame(XRFrameRequestCallback callback); + [Throws] + undefined cancelAnimationFrame(long handle); + + [NewObject] + Promise<undefined> end(); + + // Events + attribute EventHandler onend; + attribute EventHandler oninputsourceschange; + attribute EventHandler onselect; + attribute EventHandler onselectstart; + attribute EventHandler onselectend; + attribute EventHandler onsqueeze; + attribute EventHandler onsqueezestart; + attribute EventHandler onsqueezeend; + attribute EventHandler onvisibilitychange; +}; + +dictionary XRRenderStateInit { + double depthNear; + double depthFar; + double inlineVerticalFieldOfView; + XRWebGLLayer? baseLayer; +}; + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRRenderState { + readonly attribute double depthNear; + readonly attribute double depthFar; + readonly attribute double? inlineVerticalFieldOfView; + readonly attribute XRWebGLLayer? baseLayer; +}; + +callback XRFrameRequestCallback = undefined (DOMHighResTimeStamp time, XRFrame frame); + +[ProbablyShortLivingWrapper, Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRFrame { + [SameObject] readonly attribute XRSession session; + + [Throws] XRViewerPose? getViewerPose(XRReferenceSpace referenceSpace); + [Throws] XRPose? getPose(XRSpace space, XRSpace baseSpace); +}; + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRSpace : EventTarget { + +}; + +enum XRReferenceSpaceType { + "viewer", + "local", + "local-floor", + "bounded-floor", + "unbounded" +}; + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRReferenceSpace : XRSpace { + [NewObject] + XRReferenceSpace getOffsetReferenceSpace(XRRigidTransform originOffset); + + attribute EventHandler onreset; +}; + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRBoundedReferenceSpace : XRReferenceSpace { + // TODO: Use FrozenArray once available. (Bug 1236777) + [Frozen, Cached, Pure] + readonly attribute sequence<DOMPointReadOnly> boundsGeometry; +}; + +enum XREye { + "none", + "left", + "right" +}; + +[ProbablyShortLivingWrapper, Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRView { + readonly attribute XREye eye; + [Throws] + readonly attribute Float32Array projectionMatrix; + [Throws, SameObject] + readonly attribute XRRigidTransform transform; +}; + +[ProbablyShortLivingWrapper, Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRViewport { + readonly attribute long x; + readonly attribute long y; + readonly attribute long width; + readonly attribute long height; +}; + +[ProbablyShortLivingWrapper, Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRRigidTransform { + [Throws] + constructor(optional DOMPointInit position = {}, optional DOMPointInit orientation = {}); + [SameObject] readonly attribute DOMPointReadOnly position; + [SameObject] readonly attribute DOMPointReadOnly orientation; + [Throws] + readonly attribute Float32Array matrix; + [SameObject] readonly attribute XRRigidTransform inverse; +}; + +[ProbablyShortLivingWrapper, Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRPose { + [SameObject] readonly attribute XRRigidTransform transform; + readonly attribute boolean emulatedPosition; +}; + +[ProbablyShortLivingWrapper, Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRViewerPose : XRPose { + // TODO: Use FrozenArray once available. (Bug 1236777) + [Constant, Cached, Frozen] + readonly attribute sequence<XRView> views; +}; + +enum XRHandedness { + "none", + "left", + "right" +}; + +enum XRTargetRayMode { + "gaze", + "tracked-pointer", + "screen" +}; + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRInputSource { + readonly attribute XRHandedness handedness; + readonly attribute XRTargetRayMode targetRayMode; + [SameObject] readonly attribute XRSpace targetRaySpace; + [SameObject] readonly attribute XRSpace? gripSpace; + // TODO: Use FrozenArray once available. (Bug 1236777) + [Constant, Cached, Frozen] + readonly attribute sequence<DOMString> profiles; + // https://immersive-web.github.io/webxr-gamepads-module/ + [SameObject] readonly attribute Gamepad? gamepad; +}; + + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRInputSourceArray { + iterable<XRInputSource>; + readonly attribute unsigned long length; + getter XRInputSource(unsigned long index); +}; + +typedef (WebGLRenderingContext or + WebGL2RenderingContext) XRWebGLRenderingContext; + +dictionary XRWebGLLayerInit { + boolean antialias = true; + boolean depth = true; + boolean stencil = false; + boolean alpha = true; + boolean ignoreDepthValues = false; + double framebufferScaleFactor = 1.0; +}; + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRWebGLLayer { + [Throws] + constructor(XRSession session, + XRWebGLRenderingContext context, + optional XRWebGLLayerInit layerInit = {}); + // Attributes + readonly attribute boolean antialias; + readonly attribute boolean ignoreDepthValues; + + [SameObject] readonly attribute WebGLFramebuffer? framebuffer; + readonly attribute unsigned long framebufferWidth; + readonly attribute unsigned long framebufferHeight; + + // Methods + XRViewport? getViewport(XRView view); + + // Static Methods + static double getNativeFramebufferScaleFactor(XRSession session); +}; diff --git a/dom/webidl/WebrtcGlobalInformation.webidl b/dom/webidl/WebrtcGlobalInformation.webidl new file mode 100644 index 0000000000..053a43d07a --- /dev/null +++ b/dom/webidl/WebrtcGlobalInformation.webidl @@ -0,0 +1,50 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +dictionary WebrtcGlobalStatisticsReport { + sequence<RTCStatsReportInternal> reports = []; + sequence<RTCSdpHistoryInternal> sdpHistories = []; +}; + +dictionary WebrtcGlobalMediaContext { + required boolean hasH264Hardware; +}; + +callback WebrtcGlobalStatisticsCallback = undefined (WebrtcGlobalStatisticsReport reports); +callback WebrtcGlobalStatisticsHistoryPcIdsCallback = undefined (sequence<DOMString> pcIds); +callback WebrtcGlobalStatisticsHistoryCallback = undefined (WebrtcGlobalStatisticsReport reports); +callback WebrtcGlobalLoggingCallback = undefined (sequence<DOMString> logMessages); + +[ChromeOnly, Exposed=Window] +namespace WebrtcGlobalInformation { + + [Throws] + undefined getAllStats(WebrtcGlobalStatisticsCallback callback, + optional DOMString pcIdFilter); + + [Throws] + undefined getStatsHistoryPcIds(WebrtcGlobalStatisticsHistoryPcIdsCallback callback); + + [Throws] + undefined getStatsHistorySince(WebrtcGlobalStatisticsHistoryCallback callback, + DOMString pcIdFilter, + optional DOMHighResTimeStamp after, + optional DOMHighResTimeStamp sdpAfter); + + WebrtcGlobalMediaContext getMediaContext(); + + undefined clearAllStats(); + + [Throws] + undefined getLogging(DOMString pattern, WebrtcGlobalLoggingCallback callback); + + undefined clearLogging(); + + // WebRTC AEC debugging enable + attribute boolean aecDebug; + + readonly attribute DOMString aecDebugLogDir; +}; diff --git a/dom/webidl/WheelEvent.webidl b/dom/webidl/WheelEvent.webidl new file mode 100644 index 0000000000..67357581da --- /dev/null +++ b/dom/webidl/WheelEvent.webidl @@ -0,0 +1,42 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface please see + * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +interface WheelEvent : MouseEvent +{ + constructor(DOMString type, optional WheelEventInit eventInitDict = {}); + + const unsigned long DOM_DELTA_PIXEL = 0x00; + const unsigned long DOM_DELTA_LINE = 0x01; + const unsigned long DOM_DELTA_PAGE = 0x02; + + // Legacy MouseWheelEvent API replaced by standard WheelEvent API. + [NeedsCallerType] + readonly attribute long wheelDeltaX; + [NeedsCallerType] + readonly attribute long wheelDeltaY; + [NeedsCallerType] + readonly attribute long wheelDelta; + + [NeedsCallerType] readonly attribute double deltaX; + [NeedsCallerType] readonly attribute double deltaY; + [NeedsCallerType] readonly attribute double deltaZ; + [NeedsCallerType] readonly attribute unsigned long deltaMode; +}; + +dictionary WheelEventInit : MouseEventInit +{ + double deltaX = 0; + double deltaY = 0; + double deltaZ = 0; + unsigned long deltaMode = 0; +}; diff --git a/dom/webidl/Window.webidl b/dom/webidl/Window.webidl new file mode 100644 index 0000000000..009ec26198 --- /dev/null +++ b/dom/webidl/Window.webidl @@ -0,0 +1,812 @@ +/* -*- 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/ + * https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html + * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html + * http://dev.w3.org/csswg/cssom/ + * http://dev.w3.org/csswg/cssom-view/ + * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html + * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html + * https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html + * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html + * https://w3c.github.io/webappsec-secure-contexts/#monkey-patching-global-object + * https://w3c.github.io/requestidlecallback/ + * https://drafts.css-houdini.org/css-paint-api-1/#dom-window-paintworklet + * https://wicg.github.io/visual-viewport/#the-visualviewport-interface + */ + +interface Principal; +interface nsIBrowserDOMWindow; +interface XULControllers; +interface nsIDOMWindowUtils; +interface nsIPrintSettings; + +// http://www.whatwg.org/specs/web-apps/current-work/ +[Global, LegacyUnenumerableNamedProperties, NeedResolve, + Exposed=Window, + InstrumentedProps=(AbsoluteOrientationSensor, + Accelerometer, + BackgroundFetchManager, + BackgroundFetchRecord, + BackgroundFetchRegistration, + BeforeInstallPromptEvent, + Bluetooth, + BluetoothCharacteristicProperties, + BluetoothDevice, + BluetoothRemoteGATTCharacteristic, + BluetoothRemoteGATTDescriptor, + BluetoothRemoteGATTServer, + BluetoothRemoteGATTService, + BluetoothUUID, + CanvasCaptureMediaStreamTrack, + chrome, + ClipboardItem, + CSSImageValue, + CSSKeywordValue, + CSSMathClamp, + CSSMathInvert, + CSSMathMax, + CSSMathMin, + CSSMathNegate, + CSSMathProduct, + CSSMathSum, + CSSMathValue, + CSSMatrixComponent, + CSSNumericArray, + CSSNumericValue, + CSSPerspective, + CSSPositionValue, + CSSPropertyRule, + CSSRotate, + CSSScale, + CSSSkew, + CSSSkewX, + CSSSkewY, + CSSStyleValue, + CSSTransformComponent, + CSSTransformValue, + CSSTranslate, + CSSUnitValue, + CSSUnparsedValue, + CSSVariableReferenceValue, + defaultStatus, + // Unfortunately, our telemetry histogram name generator + // (the one that generates TelemetryHistogramEnums.h) can't + // handle two DOM methods with names that only differ in + // case, because it forces everything to uppercase. + //defaultstatus, + DeviceMotionEventAcceleration, + DeviceMotionEventRotationRate, + DOMError, + EncodedVideoChunk, + EnterPictureInPictureEvent, + External, + FederatedCredential, + Gyroscope, + HTMLContentElement, + HTMLShadowElement, + ImageCapture, + InputDeviceCapabilities, + InputDeviceInfo, + Keyboard, + KeyboardLayoutMap, + LinearAccelerationSensor, + MediaSettingsRange, + MIDIAccess, + MIDIConnectionEvent, + MIDIInput, + MIDIInputMap, + MIDIMessageEvent, + MIDIOutput, + MIDIOutputMap, + MIDIPort, + NetworkInformation, + offscreenBuffering, + onbeforeinstallprompt, + oncancel, + onmousewheel, + onorientationchange, + onsearch, + onselectionchange, + openDatabase, + orientation, + OrientationSensor, + OverconstrainedError, + PasswordCredential, + PaymentAddress, + PaymentInstruments, + PaymentManager, + PaymentMethodChangeEvent, + PaymentRequest, + PaymentRequestUpdateEvent, + PaymentResponse, + PerformanceLongTaskTiming, + PhotoCapabilities, + PictureInPictureEvent, + PictureInPictureWindow, + Presentation, + PresentationAvailability, + PresentationConnection, + PresentationConnectionAvailableEvent, + PresentationConnectionCloseEvent, + PresentationConnectionList, + PresentationReceiver, + PresentationRequest, + RelativeOrientationSensor, + RemotePlayback, + Report, + ReportBody, + ReportingObserver, + RTCError, + RTCErrorEvent, + RTCIceTransport, + RTCPeerConnectionIceErrorEvent, + Sensor, + SensorErrorEvent, + SpeechRecognitionAlternative, + SpeechRecognitionResult, + SpeechRecognitionResultList, + styleMedia, + StylePropertyMap, + StylePropertyMapReadOnly, + SVGDiscardElement, + SyncManager, + TaskAttributionTiming, + TextEvent, + Touch, + TouchEvent, + TouchList, + USB, + USBAlternateInterface, + USBConfiguration, + USBConnectionEvent, + USBDevice, + USBEndpoint, + USBInterface, + USBInTransferResult, + USBIsochronousInTransferPacket, + USBIsochronousInTransferResult, + USBIsochronousOutTransferPacket, + USBIsochronousOutTransferResult, + USBOutTransferResult, + UserActivation, + VideoColorSpace, + VideoDecoder, + VideoEncoder, + VideoFrame, + WakeLock, + WakeLockSentinel, + webkitCancelAnimationFrame, + webkitMediaStream, + WebKitMutationObserver, + webkitRequestAnimationFrame, + webkitRequestFileSystem, + webkitResolveLocalFileSystemURL, + webkitRTCPeerConnection, + webkitSpeechGrammar, + webkitSpeechGrammarList, + webkitSpeechRecognition, + webkitSpeechRecognitionError, + webkitSpeechRecognitionEvent, + webkitStorageInfo)] +/*sealed*/ interface Window : EventTarget { + // the current browsing context + [LegacyUnforgeable, Constant, StoreInSlot, + CrossOriginReadable] readonly attribute WindowProxy window; + [Replaceable, Constant, StoreInSlot, + CrossOriginReadable] readonly attribute WindowProxy self; + [LegacyUnforgeable, StoreInSlot, Pure] readonly attribute Document? document; + [Throws] attribute DOMString name; + [PutForwards=href, LegacyUnforgeable, CrossOriginReadable, + CrossOriginWritable] readonly attribute Location location; + [Throws] readonly attribute History history; + readonly attribute CustomElementRegistry customElements; + [Replaceable, Throws] readonly attribute BarProp locationbar; + [Replaceable, Throws] readonly attribute BarProp menubar; + [Replaceable, Throws] readonly attribute BarProp personalbar; + [Replaceable, Throws] readonly attribute BarProp scrollbars; + [Replaceable, Throws] readonly attribute BarProp statusbar; + [Replaceable, Throws] readonly attribute BarProp toolbar; + [Throws] attribute DOMString status; + [Throws, CrossOriginCallable, NeedsCallerType] undefined close(); + [Throws, CrossOriginReadable] readonly attribute boolean closed; + [Throws] undefined stop(); + [Throws, CrossOriginCallable, NeedsCallerType] undefined focus(); + [Throws, CrossOriginCallable, NeedsCallerType] undefined blur(); + [Replaceable, Pref="dom.window.event.enabled"] readonly attribute (Event or undefined) event; + + // other browsing contexts + [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy frames; + [Replaceable, CrossOriginReadable] readonly attribute unsigned long length; + //[Unforgeable, Throws, CrossOriginReadable] readonly attribute WindowProxy top; + [LegacyUnforgeable, Throws, CrossOriginReadable] readonly attribute WindowProxy? top; + [Throws, CrossOriginReadable] attribute any opener; + //[Throws] readonly attribute WindowProxy parent; + [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy? parent; + [Throws, NeedsSubjectPrincipal] readonly attribute Element? frameElement; + //[Throws] WindowProxy? open(optional USVString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = ""); + [Throws] WindowProxy? open(optional USVString url = "", optional DOMString target = "", optional [LegacyNullToEmptyString] DOMString features = ""); + getter object (DOMString name); + + // the user agent + readonly attribute Navigator navigator; + [Pref="dom.window.clientinformation.enabled", BinaryName="Navigator"] + readonly attribute Navigator clientInformation; + + [Replaceable] readonly attribute External external; + + // user prompts + [Throws, NeedsSubjectPrincipal] undefined alert(); + [Throws, NeedsSubjectPrincipal] undefined alert(DOMString message); + [Throws, NeedsSubjectPrincipal] boolean confirm(optional DOMString message = ""); + [Throws, NeedsSubjectPrincipal] DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); + [Throws] + undefined print(); + + // Returns a window that you can use for a print preview. + // + // This may reuse an existing window if this window is already a print + // preview document, or if you pass a docshell explicitly. + [Throws, Func="nsContentUtils::IsCallerChromeOrFuzzingEnabled"] + WindowProxy? printPreview(optional nsIPrintSettings? settings = null, + optional nsIWebProgressListener? listener = null, + optional nsIDocShell? docShellToPreviewInto = null); + + [Throws, CrossOriginCallable, NeedsSubjectPrincipal, + BinaryName="postMessageMoz"] + undefined postMessage(any message, DOMString targetOrigin, optional sequence<object> transfer = []); + [Throws, CrossOriginCallable, NeedsSubjectPrincipal, + BinaryName="postMessageMoz"] + undefined postMessage(any message, optional WindowPostMessageOptions options = {}); + + // also has obsolete members +}; +Window includes GlobalEventHandlers; +Window includes WindowEventHandlers; + +// http://www.whatwg.org/specs/web-apps/current-work/ +interface mixin WindowSessionStorage { + //[Throws] readonly attribute Storage sessionStorage; + [Throws] readonly attribute Storage? sessionStorage; +}; +Window includes WindowSessionStorage; + +// http://www.whatwg.org/specs/web-apps/current-work/ +interface mixin WindowLocalStorage { + [Throws] readonly attribute Storage? localStorage; +}; +Window includes WindowLocalStorage; + +// http://www.whatwg.org/specs/web-apps/current-work/ +partial interface Window { + undefined captureEvents(); + undefined releaseEvents(); +}; + +// https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html +partial interface Window { + //[Throws] Selection getSelection(); + [Throws] Selection? getSelection(); +}; + +// https://drafts.csswg.org/cssom/#extensions-to-the-window-interface +partial interface Window { + //[NewObject, Throws] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString? pseudoElt = ""); + [NewObject, Throws] CSSStyleDeclaration? getComputedStyle(Element elt, optional DOMString? pseudoElt = ""); +}; + +// http://dev.w3.org/csswg/cssom-view/ +enum ScrollBehavior { "auto", "instant", "smooth" }; + +dictionary ScrollOptions { + ScrollBehavior behavior = "auto"; +}; + +dictionary ScrollToOptions : ScrollOptions { + unrestricted double left; + unrestricted double top; +}; + +partial interface Window { + //[Throws, NewObject, NeedsCallerType] MediaQueryList matchMedia(DOMString query); + [Throws, NewObject, NeedsCallerType] MediaQueryList? matchMedia(UTF8String query); + + [SameObject, Replaceable] readonly attribute Screen screen; + + // browsing context + //[Throws] undefined moveTo(double x, double y); + //[Throws] undefined moveBy(double x, double y); + //[Throws] undefined resizeTo(double x, double y); + //[Throws] undefined resizeBy(double x, double y); + [Throws, NeedsCallerType] undefined moveTo(long x, long y); + [Throws, NeedsCallerType] undefined moveBy(long x, long y); + [Throws, NeedsCallerType] undefined resizeTo(long x, long y); + [Throws, NeedsCallerType] undefined resizeBy(long x, long y); + + // viewport + [Replaceable, Throws] readonly attribute double innerWidth; + [Replaceable, Throws] readonly attribute double innerHeight; + + // viewport scrolling + undefined scroll(unrestricted double x, unrestricted double y); + undefined scroll(optional ScrollToOptions options = {}); + undefined scrollTo(unrestricted double x, unrestricted double y); + undefined scrollTo(optional ScrollToOptions options = {}); + undefined scrollBy(unrestricted double x, unrestricted double y); + undefined scrollBy(optional ScrollToOptions options = {}); + // mozScrollSnap is used by chrome to perform scroll snapping after the + // user performs actions that may affect scroll position + // mozScrollSnap is deprecated, to be replaced by a web accessible API, such + // as an extension to the ScrollOptions dictionary. See bug 1137937. + [ChromeOnly] undefined mozScrollSnap(); + // The four properties below are double per spec at the moment, but whether + // that will continue is unclear. + [Replaceable, Throws] readonly attribute double scrollX; + [Replaceable, Throws] readonly attribute double pageXOffset; + [Replaceable, Throws] readonly attribute double scrollY; + [Replaceable, Throws] readonly attribute double pageYOffset; + + // Aliases for screenX / screenY. + [Replaceable, Throws, NeedsCallerType] readonly attribute double screenLeft; + [Replaceable, Throws, NeedsCallerType] readonly attribute double screenTop; + + // client + [Replaceable, Throws, NeedsCallerType] readonly attribute double screenX; + [Replaceable, Throws, NeedsCallerType] readonly attribute double screenY; + [Replaceable, Throws, NeedsCallerType] readonly attribute double outerWidth; + [Replaceable, Throws, NeedsCallerType] readonly attribute double outerHeight; +}; + +// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames +Window includes AnimationFrameProvider; + +// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html +partial interface Window { + [Replaceable, Pure, StoreInSlot] readonly attribute Performance? performance; +}; + +// https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html +Window includes GlobalCrypto; + +dictionary SizeToContentConstraints { + long maxWidth = 0; + long maxHeight = 0; + long prefWidth = 0; +}; + +#ifdef MOZ_WEBSPEECH +// http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html +interface mixin SpeechSynthesisGetter { + [Throws, Pref="media.webspeech.synth.enabled"] readonly attribute SpeechSynthesis speechSynthesis; +}; + +Window includes SpeechSynthesisGetter; +#endif + +// Mozilla-specific stuff +partial interface Window { + //[NewObject, Throws] CSSStyleDeclaration getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = ""); + [NewObject, Throws] CSSStyleDeclaration? getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = ""); + + // Mozilla extensions + /** + * Method for scrolling this window by a number of lines. + */ + undefined scrollByLines(long numLines, optional ScrollOptions options = {}); + + /** + * Method for scrolling this window by a number of pages. + */ + undefined scrollByPages(long numPages, optional ScrollOptions options = {}); + + // Gecko specific API that allows a web page to resize the browser window. + // Dropping support in bug 1600400. + [Throws, NeedsCallerType, + Deprecated="SizeToContent", + Func="nsGlobalWindowInner::IsSizeToContentEnabled"] + undefined sizeToContent(); + + /** + * Chrome-only method for sizing to content with a maximum-size constraint on + * either (or both) directions. + */ + [Throws, ChromeOnly] undefined sizeToContentConstrained(optional SizeToContentConstraints constraints = {}); + + [ChromeOnly, Replaceable, Throws] readonly attribute XULControllers controllers; + + [ChromeOnly, Throws] readonly attribute Element? realFrameElement; + + [ChromeOnly] readonly attribute nsIDocShell? docShell; + + [ChromeOnly, Constant, CrossOriginReadable, BinaryName="getBrowsingContext"] + readonly attribute BrowsingContext browsingContext; + + [Throws, NeedsCallerType] + readonly attribute float mozInnerScreenX; + [Throws, NeedsCallerType] + readonly attribute float mozInnerScreenY; + [Replaceable, Throws, NeedsCallerType] + readonly attribute double devicePixelRatio; + + // Allows chrome code to convert desktop pixels to device pixels and vice + // versa. Useful for interacting with the screen manager. + [ChromeOnly, Throws] + readonly attribute double desktopToDeviceScale; + + // Returns the amount of CSS pixels relative to this window we're allowed to + // go out of the screen. This is needed so that SessionRestore is able to + // position windows that use client-side decorations correctly, but still + // pull mispositioned windows into the screen. + [ChromeOnly] + readonly attribute double screenEdgeSlopX; + [ChromeOnly] + readonly attribute double screenEdgeSlopY; + + + /* The maximum offset that the window can be scrolled to + (i.e., the document width/height minus the scrollport width/height) */ + [ChromeOnly, Throws] readonly attribute long scrollMinX; + [ChromeOnly, Throws] readonly attribute long scrollMinY; + [Replaceable, Throws] readonly attribute long scrollMaxX; + [Replaceable, Throws] readonly attribute long scrollMaxY; + + [Throws] attribute boolean fullScreen; + + undefined updateCommands(DOMString action); + + /* Find in page. + * @param str: the search pattern + * @param caseSensitive: is the search caseSensitive + * @param backwards: should we search backwards + * @param wrapAround: should we wrap the search + * @param wholeWord: should we search only for whole words + * @param searchInFrames: should we search through all frames + * @param showDialog: should we show the Find dialog + */ + [Throws] boolean find(optional DOMString str = "", + optional boolean caseSensitive = false, + optional boolean backwards = false, + optional boolean wrapAround = false, + optional boolean wholeWord = false, + optional boolean searchInFrames = false, + optional boolean showDialog = false); + + attribute EventHandler ondevicemotion; + attribute EventHandler ondeviceorientation; + attribute EventHandler ondeviceorientationabsolute; + [Pref="device.sensors.proximity.enabled"] + attribute EventHandler onuserproximity; + [Pref="device.sensors.ambientLight.enabled"] + attribute EventHandler ondevicelight; + + undefined dump(DOMString str); + + /** + * This method is here for backwards compatibility with 4.x only, + * its implementation is a no-op + */ + undefined setResizable(boolean resizable); + + /** + * This is the scriptable version of + * nsPIDOMWindow::OpenDialog() that takes 3 optional + * arguments, plus any additional arguments are passed on as + * arguments on the dialog's window object (window.arguments). + */ + [Throws, ChromeOnly] WindowProxy? openDialog(optional DOMString url = "", + optional DOMString name = "", + optional DOMString options = "", + any... extraArguments); + + [ChromeOnly, + NonEnumerable, Replaceable, Throws, NeedsCallerType] + readonly attribute object? content; + + [Throws, ChromeOnly] any getInterface(any iid); + + /** + * Same as nsIDOMWindow.windowRoot, useful for event listener targeting. + */ + [ChromeOnly, Throws] + readonly attribute WindowRoot? windowRoot; + + /** + * ChromeOnly method to determine if a particular window should see console + * reports from service workers of the given scope. + */ + [ChromeOnly] + boolean shouldReportForServiceWorkerScope(USVString aScope); + + /** + * InstallTrigger is used for extension installs. Ideally it would + * be something like a WebIDL namespace, but we don't support + * JS-implemented static things yet. See bug 863952. + */ + [Replaceable, Deprecated="InstallTriggerDeprecated", Pref="extensions.InstallTrigger.enabled"] + readonly attribute InstallTriggerImpl? InstallTrigger; + + /** + * Get the nsIDOMWindowUtils for this window. + */ + [Constant, Throws, ChromeOnly] + readonly attribute nsIDOMWindowUtils windowUtils; + + [Pure, ChromeOnly] + readonly attribute WindowGlobalChild? windowGlobalChild; + + /** + * The principal of the client source of the window. This is supposed to be + * used for the service worker. + * + * This is used for APIs like https://w3c.github.io/push-api/ that extend + * ServiceWorkerRegistration and therefore need to operate consistently with + * ServiceWorkers and its Clients API. The client principal is the appropriate + * principal to pass to all nsIServiceWorkerManager APIs. + * + * Note that the client principal will be different from the node principal of + * the window's document if the window is in a third-party context when dFPI + * is enabled. In this case, the client principal will be the partitioned + * principal to support the service worker partitioning. + */ + [ChromeOnly] + readonly attribute Principal? clientPrincipal; + + /** + * Whether the chrome window is currently in a full screen transition. This + * flag is updated from FullscreenTransitionTask. + * Always set to false for non-chrome windows. + */ + [ChromeOnly] + readonly attribute boolean isInFullScreenTransition; +}; + +Window includes TouchEventHandlers; + +Window includes OnErrorEventHandlerForWindow; + +#if defined(MOZ_WIDGET_ANDROID) +// https://compat.spec.whatwg.org/#windoworientation-interface +partial interface Window { + [NeedsCallerType] + readonly attribute short orientation; + attribute EventHandler onorientationchange; +}; +#endif + +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback PromiseDocumentFlushedCallback = any (); + +// Mozilla extensions for Chrome windows. +partial interface Window { + // The STATE_* constants need to match the corresponding enum in nsGlobalWindow.cpp. + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + const unsigned short STATE_MAXIMIZED = 1; + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + const unsigned short STATE_MINIMIZED = 2; + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + const unsigned short STATE_NORMAL = 3; + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + const unsigned short STATE_FULLSCREEN = 4; + + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + readonly attribute unsigned short windowState; + + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + readonly attribute boolean isFullyOccluded; + + /** + * browserDOMWindow provides access to yet another layer of + * utility functions implemented by chrome script. It will be null + * for DOMWindows not corresponding to browsers. + */ + [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + attribute nsIBrowserDOMWindow? browserDOMWindow; + + [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + undefined getAttention(); + + [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + undefined getAttentionWithCycleCount(long aCycleCount); + + [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + undefined setCursor(UTF8String cursor); + + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + undefined maximize(); + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + undefined minimize(); + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + undefined restore(); + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + DOMString getWorkspaceID(); + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + undefined moveToWorkspace(DOMString workspaceID); + + /** + * Notify a default button is loaded on a dialog or a wizard. + * defaultButton is the default button. + */ + [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + undefined notifyDefaultButtonLoaded(Element defaultButton); + + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + readonly attribute ChromeMessageBroadcaster messageManager; + + /** + * Returns the message manager identified by the given group name that + * manages all frame loaders belonging to that group. + */ + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + ChromeMessageBroadcaster getGroupMessageManager(DOMString aGroup); + + /** + * Calls the given function as soon as a style or layout flush for the + * top-level document is not necessary, and returns a Promise which + * resolves to the callback's return value after it executes. + * + * In the event that the window goes away before a flush can occur, the + * callback will still be called and the Promise resolved as the window + * tears itself down. + * + * The callback _must not modify the DOM for any window in any way_. If it + * does, after finishing executing, the Promise returned by + * promiseDocumentFlushed will reject with + * NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR. + * + * Note that the callback can be called either synchronously or asynchronously + * depending on whether or not flushes are pending: + * + * The callback will be called synchronously when calling + * promiseDocumentFlushed when NO flushes are already pending. This is + * to ensure that no script has a chance to dirty the DOM before the callback + * is called. + * + * The callback will be called asynchronously if a flush is pending. + * + * The expected execution order is that all pending callbacks will + * be fired first (and in the order that they were queued) and then the + * Promise resolution handlers will all be invoked later on during the + * next microtask checkpoint. + * + * Using window.top.promiseDocumentFlushed in combination with a callback + * that is querying items in a window that might be swapped out via + * nsFrameLoader::SwapWithOtherLoader is highly discouraged. For example: + * + * let result = await window.top.promiseDocumentFlushed(() => { + * return window.document.body.getBoundingClientRect(); + * }); + * + * If "window" might get swapped out via nsFrameLoader::SwapWithOtherLoader + * at any time, then the callback might get called when the new host window + * will still incur layout flushes, since it's only the original host window + * that's being monitored via window.top.promiseDocumentFlushed. + * + * See bug 1519407 for further details. + * + * promiseDocumentFlushed does not support re-entrancy - so calling it from + * within a promiseDocumentFlushed callback will result in the inner call + * throwing an NS_ERROR_FAILURE exception, and the outer Promise rejecting + * with that exception. + * + * The callback function *must not make any changes which would require + * a style or layout flush*. + * + * Also throws NS_ERROR_FAILURE if the window is not in a state where flushes + * can be waited for (for example, the PresShell has not yet been created). + * + * @param {function} callback + * @returns {Promise} + */ + [NewObject, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + Promise<any> promiseDocumentFlushed(PromiseDocumentFlushedCallback callback); + + [Func="IsChromeOrUAWidget"] + readonly attribute boolean isChromeWindow; + + [Func="nsGlobalWindowInner::IsGleanNeeded"] + readonly attribute GleanImpl Glean; + [Func="nsGlobalWindowInner::IsGleanNeeded"] + readonly attribute GleanPingsImpl GleanPings; +}; + +partial interface Window { + [Pref="dom.vr.enabled"] + attribute EventHandler onvrdisplayconnect; + [Pref="dom.vr.enabled"] + attribute EventHandler onvrdisplaydisconnect; + [Pref="dom.vr.enabled"] + attribute EventHandler onvrdisplayactivate; + [Pref="dom.vr.enabled"] + attribute EventHandler onvrdisplaydeactivate; + [Pref="dom.vr.enabled"] + attribute EventHandler onvrdisplaypresentchange; +}; + +#ifndef RELEASE_OR_BETA +// https://drafts.css-houdini.org/css-paint-api-1/#dom-window-paintworklet +partial interface Window { + [Pref="dom.paintWorklet.enabled", Throws] + readonly attribute Worklet paintWorklet; +}; +#endif + +Window includes WindowOrWorkerGlobalScope; + +partial interface Window { + [Throws] + unsigned long requestIdleCallback(IdleRequestCallback callback, + optional IdleRequestOptions options = {}); + undefined cancelIdleCallback(unsigned long handle); +}; + +dictionary IdleRequestOptions { + unsigned long timeout; +}; + +callback IdleRequestCallback = undefined (IdleDeadline deadline); + +partial interface Window { + /** + * Returns a list of locales that the internationalization components + * should be localized to. + * + * The function name refers to Regional Preferences which can be either + * fetched from the internal internationalization database (CLDR), or + * from the host environment. + * + * The result is a sorted list of valid locale IDs and it should be + * used for all APIs that accept list of locales, like ECMA402 and L10n APIs. + * + * This API always returns at least one locale. + * + * Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"] + */ + [Func="IsChromeOrUAWidget"] + sequence<DOMString> getRegionalPrefsLocales(); + + /** + * Returns a list of locales that the web content would know from the user. + * + * One of the fingerprinting technique is to recognize users from their locales + * exposed to web content. For those components that would be fingerprintable + * from the locale should call this API instead of |getRegionalPrefsLocales()|. + * + * If the pref is set to spoof locale setting, this function will return the + * spoofed locale, otherwise it returns what |getRegionalPrefsLocales()| returns. + * + * This API always returns at least one locale. + * + * Example: ["en-US"] + */ + [Func="IsChromeOrUAWidget"] + sequence<DOMString> getWebExposedLocales(); + + /** + * Getter funcion for IntlUtils, which provides helper functions for + * localization. + */ + [Throws, Func="IsChromeOrUAWidget"] + readonly attribute IntlUtils intlUtils; +}; + +partial interface Window { + [SameObject, Replaceable] + readonly attribute VisualViewport visualViewport; +}; + +// Used to assign marks to appear on the scrollbar when +// finding on a page. +partial interface Window { + // The marks are values between 0 and scrollMax{X,Y} - scrollMin{X,Y}. + [ChromeOnly] + undefined setScrollMarks(sequence<unsigned long> marks, + optional boolean onHorizontalScrollbar = false); +}; + +dictionary WindowPostMessageOptions : StructuredSerializeOptions { + USVString targetOrigin = "/"; +}; diff --git a/dom/webidl/WindowOrWorkerGlobalScope.webidl b/dom/webidl/WindowOrWorkerGlobalScope.webidl new file mode 100644 index 0000000000..5b5f5c61f6 --- /dev/null +++ b/dom/webidl/WindowOrWorkerGlobalScope.webidl @@ -0,0 +1,87 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin + * https://fetch.spec.whatwg.org/#fetch-method + * https://w3c.github.io/webappsec-secure-contexts/#monkey-patching-global-object + * https://w3c.github.io/ServiceWorker/#self-caches + */ + +// https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin +[Exposed=(Window,Worker)] +interface mixin WindowOrWorkerGlobalScope { + [Replaceable] readonly attribute USVString origin; + readonly attribute boolean crossOriginIsolated; + + [Throws, NeedsCallerType] + undefined reportError(any e); + + // base64 utility methods + [Throws] + DOMString btoa(DOMString btoa); + [Throws] + DOMString atob(DOMString atob); + + // timers + // NOTE: We're using overloads where the spec uses a union. Should + // be black-box the same. + [Throws] + long setTimeout(Function handler, optional long timeout = 0, any... arguments); + [Throws] + long setTimeout(DOMString handler, optional long timeout = 0, any... unused); + undefined clearTimeout(optional long handle = 0); + [Throws] + long setInterval(Function handler, optional long timeout = 0, any... arguments); + [Throws] + long setInterval(DOMString handler, optional long timeout = 0, any... unused); + undefined clearInterval(optional long handle = 0); + + // microtask queuing + undefined queueMicrotask(VoidFunction callback); + + // ImageBitmap + [Throws] + Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage, + optional ImageBitmapOptions aOptions = {}); + [Throws] + Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage, + long aSx, long aSy, long aSw, long aSh, + optional ImageBitmapOptions aOptions = {}); + + // structured cloning + [Throws] + any structuredClone(any value, optional StructuredSerializeOptions options = {}); +}; + +// https://fetch.spec.whatwg.org/#fetch-method +partial interface mixin WindowOrWorkerGlobalScope { + [NewObject, NeedsCallerType] + Promise<Response> fetch(RequestInfo input, optional RequestInit init = {}); +}; + +// https://w3c.github.io/webappsec-secure-contexts/#monkey-patching-global-object +partial interface mixin WindowOrWorkerGlobalScope { + readonly attribute boolean isSecureContext; +}; + +// http://w3c.github.io/IndexedDB/#factory-interface +partial interface mixin WindowOrWorkerGlobalScope { + // readonly attribute IDBFactory indexedDB; // bug 1776789 + [Throws] + readonly attribute IDBFactory? indexedDB; +}; + +// https://w3c.github.io/ServiceWorker/#self-caches +partial interface mixin WindowOrWorkerGlobalScope { + [Throws, Func="nsGlobalWindowInner::CachesEnabled", SameObject] + readonly attribute CacheStorage caches; +}; + +// https://wicg.github.io/scheduling-apis/#ref-for-windoworworkerglobalscope-scheduler +partial interface mixin WindowOrWorkerGlobalScope { + [Replaceable, Pref="dom.enable_web_task_scheduling", SameObject] + readonly attribute Scheduler scheduler; +}; diff --git a/dom/webidl/Worker.webidl b/dom/webidl/Worker.webidl new file mode 100644 index 0000000000..155a21cb3a --- /dev/null +++ b/dom/webidl/Worker.webidl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/workers.html + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera + * Software ASA. + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +[Exposed=(Window,DedicatedWorker,SharedWorker)] +interface Worker : EventTarget { + [Throws] + constructor(USVString scriptURL, optional WorkerOptions options = {}); + + undefined terminate(); + + [Throws] + undefined postMessage(any message, sequence<object> transfer); + [Throws] + undefined postMessage(any message, optional StructuredSerializeOptions aOptions = {}); + + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; + +Worker includes AbstractWorker; + +dictionary WorkerOptions { + [Pref="dom.workers.modules.enabled"] + WorkerType type = "classic"; + [Pref="dom.workers.modules.enabled"] + RequestCredentials credentials = "same-origin"; // credentials is only used if type is "module" + DOMString name = ""; +}; + +enum WorkerType { "classic", "module" }; + +[Func="mozilla::dom::ChromeWorker::WorkerAvailable", + Exposed=(Window,DedicatedWorker,SharedWorker)] +interface ChromeWorker : Worker { + [Throws] + constructor(USVString scriptURL, optional WorkerOptions options = {}); +}; diff --git a/dom/webidl/WorkerDebuggerGlobalScope.webidl b/dom/webidl/WorkerDebuggerGlobalScope.webidl new file mode 100644 index 0000000000..bb6140be9f --- /dev/null +++ b/dom/webidl/WorkerDebuggerGlobalScope.webidl @@ -0,0 +1,51 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +[Global=(WorkerDebugger), Exposed=WorkerDebugger] +interface WorkerDebuggerGlobalScope : EventTarget { + [Throws] + readonly attribute object global; + + [Throws] + object createSandbox(DOMString name, object prototype); + + [Throws] + undefined loadSubScript(DOMString url, optional object sandbox); + + undefined enterEventLoop(); + + undefined leaveEventLoop(); + + undefined postMessage(DOMString message); + + attribute EventHandler onmessage; + + attribute EventHandler onmessageerror; + + [Throws] + undefined setImmediate(Function handler); + + undefined reportError(DOMString message); + + [Throws] + sequence<any> retrieveConsoleEvents(); + + [Throws] + undefined setConsoleEventHandler(AnyCallback? handler); + + [Throws] + undefined clearConsoleEvents(); + + // base64 utility methods + [Throws] + DOMString btoa(DOMString btoa); + [Throws] + DOMString atob(DOMString atob); +}; + +// So you can debug while you debug +partial interface WorkerDebuggerGlobalScope { + undefined dump(optional DOMString string); +}; diff --git a/dom/webidl/WorkerGlobalScope.webidl b/dom/webidl/WorkerGlobalScope.webidl new file mode 100644 index 0000000000..bb21cdb824 --- /dev/null +++ b/dom/webidl/WorkerGlobalScope.webidl @@ -0,0 +1,50 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#the-workerglobalscope-common-interface + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera + * Software ASA. + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +[Exposed=(Worker)] +interface WorkerGlobalScope : EventTarget { + [Constant, Cached] + readonly attribute WorkerGlobalScope self; + readonly attribute WorkerLocation location; + readonly attribute WorkerNavigator navigator; + + [Throws] + undefined importScripts(DOMString... urls); + + attribute OnErrorEventHandler onerror; + + attribute EventHandler onlanguagechange; + attribute EventHandler onoffline; + attribute EventHandler ononline; + attribute EventHandler onrejectionhandled; + attribute EventHandler onunhandledrejection; + // also has additional members in a partial interface +}; + +WorkerGlobalScope includes GlobalCrypto; +WorkerGlobalScope includes FontFaceSource; +WorkerGlobalScope includes WindowOrWorkerGlobalScope; + +// Mozilla extensions +partial interface WorkerGlobalScope { + + undefined dump(optional DOMString str); + + // https://w3c.github.io/hr-time/#the-performance-attribute + [Constant, Cached, Replaceable, BinaryName="getPerformance"] + readonly attribute Performance performance; + + [Func="WorkerGlobalScope::IsInAutomation", Throws] + object getJSTestingFunctions(); +}; diff --git a/dom/webidl/WorkerLocation.webidl b/dom/webidl/WorkerLocation.webidl new file mode 100644 index 0000000000..ce429244c5 --- /dev/null +++ b/dom/webidl/WorkerLocation.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://html.spec.whatwg.org/multipage/workers.html#worker-locations + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera + * Software ASA. + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +[Exposed=Worker] +interface WorkerLocation { + stringifier readonly attribute USVString href; + readonly attribute USVString origin; + readonly attribute USVString protocol; + readonly attribute USVString host; + readonly attribute USVString hostname; + readonly attribute USVString port; + readonly attribute USVString pathname; + readonly attribute USVString search; + readonly attribute USVString hash; +}; diff --git a/dom/webidl/WorkerNavigator.webidl b/dom/webidl/WorkerNavigator.webidl new file mode 100644 index 0000000000..0134df5d5b --- /dev/null +++ b/dom/webidl/WorkerNavigator.webidl @@ -0,0 +1,36 @@ +/* This Source Code Form is subject to the terms of 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/. */ + + +[Exposed=Worker, + InstrumentedProps=(permissions)] +interface WorkerNavigator { +}; + +WorkerNavigator includes NavigatorID; +WorkerNavigator includes NavigatorLanguage; +WorkerNavigator includes NavigatorOnLine; +WorkerNavigator includes NavigatorConcurrentHardware; +WorkerNavigator includes NavigatorStorage; +WorkerNavigator includes GlobalPrivacyControl; + +// http://wicg.github.io/netinfo/#extensions-to-the-navigator-interface +[Exposed=Worker] +partial interface WorkerNavigator { + [Pref="dom.netinfo.enabled", Throws] + readonly attribute NetworkInformation connection; +}; + +// https://wicg.github.io/media-capabilities/#idl-index +[Exposed=Worker] +partial interface WorkerNavigator { + [SameObject, Func="mozilla::dom::MediaCapabilities::Enabled"] + readonly attribute MediaCapabilities mediaCapabilities; +}; + +// https://w3c.github.io/web-locks/#navigator-mixins +WorkerNavigator includes NavigatorLocks; + +// https://gpuweb.github.io/gpuweb/#navigator-gpu +WorkerNavigator includes NavigatorGPU; diff --git a/dom/webidl/WorkerTestUtils.webidl b/dom/webidl/WorkerTestUtils.webidl new file mode 100644 index 0000000000..9c1ae31926 --- /dev/null +++ b/dom/webidl/WorkerTestUtils.webidl @@ -0,0 +1,9 @@ +/* This Source Code Form is subject to the terms of 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/. */ + +[Exposed=Worker, Pref="dom.workers.testing.enabled"] +namespace WorkerTestUtils { + [Throws] + unsigned long currentTimerNestingLevel(); +}; diff --git a/dom/webidl/Worklet.webidl b/dom/webidl/Worklet.webidl new file mode 100644 index 0000000000..ba5244e7fc --- /dev/null +++ b/dom/webidl/Worklet.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.css-houdini.org/worklets/#idl-index + */ + +[SecureContext, Exposed=Window] +interface Worklet { + [NewObject, Throws, NeedsCallerType] + Promise<undefined> addModule(USVString moduleURL, optional WorkletOptions options = {}); +}; + +dictionary WorkletOptions { + RequestCredentials credentials = "same-origin"; +}; diff --git a/dom/webidl/WorkletGlobalScope.webidl b/dom/webidl/WorkletGlobalScope.webidl new file mode 100644 index 0000000000..ba24066c38 --- /dev/null +++ b/dom/webidl/WorkletGlobalScope.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://drafts.css-houdini.org/worklets/#idl-index + */ + +[Exposed=Worklet] +interface WorkletGlobalScope { +}; + +// Mozilla extensions +partial interface WorkletGlobalScope { + undefined dump(optional DOMString str); +}; diff --git a/dom/webidl/WritableStream.webidl b/dom/webidl/WritableStream.webidl new file mode 100644 index 0000000000..b368de8057 --- /dev/null +++ b/dom/webidl/WritableStream.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#ws-class-definition + */ + +[Exposed=*] // [Transferable] - See Bug 1562065 +interface WritableStream { + [Throws] + constructor(optional object underlyingSink, optional QueuingStrategy strategy = {}); + + readonly attribute boolean locked; + + [Throws] + Promise<undefined> abort(optional any reason); + + [NewObject] + Promise<undefined> close(); + + [Throws] + WritableStreamDefaultWriter getWriter(); +}; diff --git a/dom/webidl/WritableStreamDefaultController.webidl b/dom/webidl/WritableStreamDefaultController.webidl new file mode 100644 index 0000000000..70a8812285 --- /dev/null +++ b/dom/webidl/WritableStreamDefaultController.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#ws-default-controller-class-definition + */ + +[Exposed=*] +interface WritableStreamDefaultController { + readonly attribute AbortSignal signal; + [Throws] + undefined error(optional any e); +}; diff --git a/dom/webidl/WritableStreamDefaultWriter.webidl b/dom/webidl/WritableStreamDefaultWriter.webidl new file mode 100644 index 0000000000..e033079f04 --- /dev/null +++ b/dom/webidl/WritableStreamDefaultWriter.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://streams.spec.whatwg.org/#default-writer-class-definition + */ + +[Exposed=*] +interface WritableStreamDefaultWriter { + [Throws] + constructor(WritableStream stream); + + readonly attribute Promise<undefined> closed; + [Throws] readonly attribute unrestricted double? desiredSize; + readonly attribute Promise<undefined> ready; + + [Throws] + Promise<undefined> abort(optional any reason); + + [NewObject] + Promise<undefined> close(); + + undefined releaseLock(); + + [NewObject] + Promise<undefined> write(optional any chunk); +}; diff --git a/dom/webidl/XMLDocument.webidl b/dom/webidl/XMLDocument.webidl new file mode 100644 index 0000000000..73a3b4476f --- /dev/null +++ b/dom/webidl/XMLDocument.webidl @@ -0,0 +1,12 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is: + * http://dom.spec.whatwg.org/#xmldocument + */ + +// http://dom.spec.whatwg.org/#xmldocument +[Exposed=Window] +interface XMLDocument : Document {}; diff --git a/dom/webidl/XMLHttpRequest.webidl b/dom/webidl/XMLHttpRequest.webidl new file mode 100644 index 0000000000..66cd6cc79d --- /dev/null +++ b/dom/webidl/XMLHttpRequest.webidl @@ -0,0 +1,144 @@ +/* -*- 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://xhr.spec.whatwg.org/#interface-xmlhttprequest + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface InputStream; +interface MozChannel; + +enum XMLHttpRequestResponseType { + "", + "arraybuffer", + "blob", + "document", + "json", + "text", +}; + +/** + * Parameters for instantiating an XMLHttpRequest. They are passed as an + * optional argument to the constructor: + * + * new XMLHttpRequest({anon: true, system: true}); + */ +dictionary MozXMLHttpRequestParameters +{ + /** + * If true, the request will be sent without cookie and authentication + * headers. + */ + boolean mozAnon = false; + + /** + * If true, the same origin policy will not be enforced on the request. + */ + boolean mozSystem = false; +}; + +[Exposed=(Window,DedicatedWorker,SharedWorker)] +interface XMLHttpRequest : XMLHttpRequestEventTarget { + [Throws] + constructor(optional MozXMLHttpRequestParameters params = {}); + // There are apparently callers, specifically CoffeeScript, who do + // things like this: + // c = new(window.ActiveXObject || XMLHttpRequest)("Microsoft.XMLHTTP") + // To handle that, we need a constructor that takes a string. + [Throws] + constructor(DOMString ignored); + + // event handler + attribute EventHandler onreadystatechange; + + // states + const unsigned short UNSENT = 0; + const unsigned short OPENED = 1; + const unsigned short HEADERS_RECEIVED = 2; + const unsigned short LOADING = 3; + const unsigned short DONE = 4; + + readonly attribute unsigned short readyState; + + // request + [Throws] + undefined open(ByteString method, USVString url); + [Throws] + undefined open(ByteString method, USVString url, boolean async, + optional USVString? user=null, optional USVString? password=null); + [Throws] + undefined setRequestHeader(ByteString header, ByteString value); + + [SetterThrows] + attribute unsigned long timeout; + + [SetterThrows] + attribute boolean withCredentials; + + [Throws] + readonly attribute XMLHttpRequestUpload upload; + + [Throws] + undefined send(optional (Document or XMLHttpRequestBodyInit)? body = null); + + [Throws] + undefined abort(); + + // response + readonly attribute USVString responseURL; + + [Throws] + readonly attribute unsigned short status; + + [Throws] + readonly attribute ByteString statusText; + + [Throws] + ByteString? getResponseHeader(ByteString header); + + [Throws] + ByteString getAllResponseHeaders(); + + [Throws] + undefined overrideMimeType(DOMString mime); + + [SetterThrows] + attribute XMLHttpRequestResponseType responseType; + [Throws] + readonly attribute any response; + [Cached, Pure, Throws] + readonly attribute USVString? responseText; + + [Throws, Exposed=Window] + readonly attribute Document? responseXML; + + // Mozilla-specific stuff + + [ChromeOnly, SetterThrows] + attribute boolean mozBackgroundRequest; + + [ChromeOnly, Exposed=Window] + readonly attribute MozChannel? channel; + + [Throws, ChromeOnly, Exposed=Window] + any getInterface(any iid); + + [ChromeOnly, Exposed=Window] + undefined setOriginAttributes(optional OriginAttributesDictionary originAttributes = {}); + + [ChromeOnly, Throws] + undefined sendInputStream(InputStream body); + + // Only works on MainThread. + // Its permanence is to be evaluated in bug 1368540 for Firefox 60. + [ChromeOnly] + readonly attribute unsigned short errorCode; + + readonly attribute boolean mozAnon; + readonly attribute boolean mozSystem; +}; diff --git a/dom/webidl/XMLHttpRequestEventTarget.webidl b/dom/webidl/XMLHttpRequestEventTarget.webidl new file mode 100644 index 0000000000..035da04ccd --- /dev/null +++ b/dom/webidl/XMLHttpRequestEventTarget.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * www.w3.org/TR/2012/WD-XMLHttpRequest-20120117/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,DedicatedWorker,SharedWorker)] +interface XMLHttpRequestEventTarget : EventTarget { + // event handlers + attribute EventHandler onloadstart; + + attribute EventHandler onprogress; + + attribute EventHandler onabort; + + attribute EventHandler onerror; + + attribute EventHandler onload; + + attribute EventHandler ontimeout; + + attribute EventHandler onloadend; +}; diff --git a/dom/webidl/XMLHttpRequestUpload.webidl b/dom/webidl/XMLHttpRequestUpload.webidl new file mode 100644 index 0000000000..cbb8728b7a --- /dev/null +++ b/dom/webidl/XMLHttpRequestUpload.webidl @@ -0,0 +1,16 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * www.w3.org/TR/2012/WD-XMLHttpRequest-20120117/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,DedicatedWorker,SharedWorker)] +interface XMLHttpRequestUpload : XMLHttpRequestEventTarget { + +}; diff --git a/dom/webidl/XMLSerializer.webidl b/dom/webidl/XMLSerializer.webidl new file mode 100644 index 0000000000..80da236c9c --- /dev/null +++ b/dom/webidl/XMLSerializer.webidl @@ -0,0 +1,39 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://domparsing.spec.whatwg.org/#the-xmlserializer-interface + */ + +interface OutputStream; + +[Exposed=Window] +interface XMLSerializer { + constructor(); + + /** + * The subtree rooted by the specified element is serialized to + * a string. + * + * @param root The root of the subtree to be serialized. This could + * be any node, including a Document. + * @returns The serialized subtree in the form of a Unicode string + */ + [Throws] + DOMString serializeToString(Node root); + + // Mozilla-specific stuff + /** + * The subtree rooted by the specified element is serialized to + * a byte stream using the character set specified. + * @param root The root of the subtree to be serialized. This could + * be any node, including a Document. + * @param stream The byte stream to which the subtree is serialized. + * @param charset The name of the character set to use for the encoding + * to a byte stream. If this string is empty and root is + * a document, the document's character set will be used. + */ + [Throws, ChromeOnly] + undefined serializeToStream(Node root, OutputStream stream, DOMString? charset); +}; diff --git a/dom/webidl/XPathEvaluator.webidl b/dom/webidl/XPathEvaluator.webidl new file mode 100644 index 0000000000..0d658c1a65 --- /dev/null +++ b/dom/webidl/XPathEvaluator.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface XPathEvaluator { + constructor(); +}; +XPathEvaluator includes XPathEvaluatorMixin; + +interface mixin XPathEvaluatorMixin { + [NewObject, Throws] + XPathExpression createExpression(DOMString expression, + optional XPathNSResolver? resolver = null); + [Pure] + Node createNSResolver(Node nodeResolver); + [Throws] + XPathResult evaluate(DOMString expression, + Node contextNode, + optional XPathNSResolver? resolver = null, + optional unsigned short type = 0 /* XPathResult.ANY_TYPE */, + optional object? result = null); +}; diff --git a/dom/webidl/XPathExpression.webidl b/dom/webidl/XPathExpression.webidl new file mode 100644 index 0000000000..4ccc76d6ad --- /dev/null +++ b/dom/webidl/XPathExpression.webidl @@ -0,0 +1,26 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +interface XPathExpression { + // The result specifies a specific result object which may be reused and + // returned by this method. If this is specified as null or it's not an + // XPathResult object, a new result object will be constructed and returned. + [Throws] + XPathResult evaluate(Node contextNode, + optional unsigned short type = 0 /* XPathResult.ANY_TYPE */, + optional object? result = null); + + // The result specifies a specific result object which may be reused and + // returned by this method. If this is specified as null or it's not an + // XPathResult object, a new result object will be constructed and returned. + [Throws, ChromeOnly] + XPathResult evaluateWithContext(Node contextNode, + unsigned long contextPosition, + unsigned long contextSize, + optional unsigned short type = 0 /* XPathResult.ANY_TYPE */, + optional object? result = null); +}; diff --git a/dom/webidl/XPathNSResolver.webidl b/dom/webidl/XPathNSResolver.webidl new file mode 100644 index 0000000000..1011f92e1f --- /dev/null +++ b/dom/webidl/XPathNSResolver.webidl @@ -0,0 +1,11 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Exposed=Window] +callback interface XPathNSResolver +{ + DOMString? lookupNamespaceURI(DOMString? prefix); +}; diff --git a/dom/webidl/XPathResult.webidl b/dom/webidl/XPathResult.webidl new file mode 100644 index 0000000000..dbd8402f2a --- /dev/null +++ b/dom/webidl/XPathResult.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208 + */ + +[Exposed=Window] +interface XPathResult { + // XPathResultType + const unsigned short ANY_TYPE = 0; + const unsigned short NUMBER_TYPE = 1; + const unsigned short STRING_TYPE = 2; + const unsigned short BOOLEAN_TYPE = 3; + const unsigned short UNORDERED_NODE_ITERATOR_TYPE = 4; + const unsigned short ORDERED_NODE_ITERATOR_TYPE = 5; + const unsigned short UNORDERED_NODE_SNAPSHOT_TYPE = 6; + const unsigned short ORDERED_NODE_SNAPSHOT_TYPE = 7; + const unsigned short ANY_UNORDERED_NODE_TYPE = 8; + const unsigned short FIRST_ORDERED_NODE_TYPE = 9; + + readonly attribute unsigned short resultType; + [Throws] + readonly attribute double numberValue; + [Throws] + readonly attribute DOMString stringValue; + [Throws] + readonly attribute boolean booleanValue; + [Throws] + readonly attribute Node? singleNodeValue; + readonly attribute boolean invalidIteratorState; + [Throws] + readonly attribute unsigned long snapshotLength; + [Throws] + Node? iterateNext(); + [Throws] + Node? snapshotItem(unsigned long index); +}; diff --git a/dom/webidl/XRInputSourceEvent.webidl b/dom/webidl/XRInputSourceEvent.webidl new file mode 100644 index 0000000000..488b1b958d --- /dev/null +++ b/dom/webidl/XRInputSourceEvent.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://immersive-web.github.io/webxr/#xrinputsourceevent-interface + */ + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRInputSourceEvent : Event { + constructor(DOMString type, XRInputSourceEventInit eventInitDict); + [SameObject] readonly attribute XRFrame frame; + [SameObject] readonly attribute XRInputSource inputSource; +}; + +dictionary XRInputSourceEventInit : EventInit { + required XRFrame frame; + required XRInputSource inputSource; +}; diff --git a/dom/webidl/XRInputSourcesChangeEvent.webidl b/dom/webidl/XRInputSourcesChangeEvent.webidl new file mode 100644 index 0000000000..83c2fa6f00 --- /dev/null +++ b/dom/webidl/XRInputSourcesChangeEvent.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://immersive-web.github.io/webxr/#xrinputsourceschangeevent-interface + */ + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRInputSourcesChangeEvent : Event { + constructor(DOMString type, XRInputSourcesChangeEventInit eventInitDict); + [SameObject] readonly attribute XRSession session; + // TODO: Use FrozenArray once available. (Bug 1236777) + [Constant, Cached, Frozen] + readonly attribute sequence<XRInputSource> added; + // TODO: Use FrozenArray once available. (Bug 1236777) + [Constant, Cached, Frozen] + readonly attribute sequence<XRInputSource> removed; +}; + +dictionary XRInputSourcesChangeEventInit : EventInit { + required XRSession session; + // TODO: Use FrozenArray once available. (Bug 1236777) + required sequence<XRInputSource> added; + // TODO: Use FrozenArray once available. (Bug 1236777) + required sequence<XRInputSource> removed; +}; diff --git a/dom/webidl/XRReferenceSpaceEvent.webidl b/dom/webidl/XRReferenceSpaceEvent.webidl new file mode 100644 index 0000000000..453872b1de --- /dev/null +++ b/dom/webidl/XRReferenceSpaceEvent.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://immersive-web.github.io/webxr/#xrreferencespaceevent-interface + */ + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRReferenceSpaceEvent : Event { + constructor(DOMString type, XRReferenceSpaceEventInit eventInitDict); + [SameObject] readonly attribute XRReferenceSpace referenceSpace; + [SameObject] readonly attribute XRRigidTransform? transform; +}; + +dictionary XRReferenceSpaceEventInit : EventInit { + required XRReferenceSpace referenceSpace; + /* + * Changed from "XRRigidTransform transform;" in order to work with the + * event code generation. + */ + XRRigidTransform? transform = null; +}; diff --git a/dom/webidl/XRSessionEvent.webidl b/dom/webidl/XRSessionEvent.webidl new file mode 100644 index 0000000000..ac9f60baed --- /dev/null +++ b/dom/webidl/XRSessionEvent.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://immersive-web.github.io/webxr/#xrsessionevent-interface + */ + +[Pref="dom.vr.webxr.enabled", SecureContext, Exposed=Window] +interface XRSessionEvent : Event { + constructor(DOMString type, XRSessionEventInit eventInitDict); + readonly attribute XRSession session; +}; + +dictionary XRSessionEventInit : EventInit { + required XRSession session; +}; diff --git a/dom/webidl/XSLTProcessor.webidl b/dom/webidl/XSLTProcessor.webidl new file mode 100644 index 0000000000..69b195ded7 --- /dev/null +++ b/dom/webidl/XSLTProcessor.webidl @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of 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/. */ + +typedef (unrestricted double or boolean or DOMString or Node or sequence<Node> or XPathResult) XSLTParameterValue; + +[Exposed=Window] +interface XSLTProcessor { + [UseCounter] + constructor(); + + /** + * Import the stylesheet into this XSLTProcessor for transformations. + * + * @param style The root-node of a XSLT stylesheet. This can be either + * a document node or an element node. If a document node + * then the document can contain either a XSLT stylesheet + * or a LRE stylesheet. + * If the argument is an element node it must be the + * xsl:stylesheet (or xsl:transform) element of an XSLT + * stylesheet. + */ + [Throws] + undefined importStylesheet(Node style); + + /** + * Transforms the node source applying the stylesheet given by + * the importStylesheet() function. The owner document of the output node + * owns the returned document fragment. + * + * @param source The node to be transformed + * @param output This document is used to generate the output + * @return DocumentFragment The result of the transformation + */ + [CEReactions, Throws] + DocumentFragment transformToFragment(Node source, + Document output); + + /** + * Transforms the node source applying the stylesheet given by the + * importStylesheet() function. + * + * @param source The node to be transformed + * @return Document The result of the transformation + */ + [CEReactions, Throws] + Document transformToDocument(Node source); + + /** + * Sets a parameter to be used in subsequent transformations with this + * XSLTProcessor. If the parameter doesn't exist in the stylesheet the + * parameter will be ignored. + * + * @param namespaceURI The namespaceURI of the XSLT parameter + * @param localName The local name of the XSLT parameter + * @param value The new value of the XSLT parameter + */ + [Throws] + undefined setParameter([LegacyNullToEmptyString] DOMString namespaceURI, + DOMString localName, + XSLTParameterValue value); + + /** + * Gets a parameter if previously set by setParameter. Returns null + * otherwise. + * + * @param namespaceURI The namespaceURI of the XSLT parameter + * @param localName The local name of the XSLT parameter + * @return ParameterValue The value of the XSLT parameter + */ + [Throws] + XSLTParameterValue? getParameter([LegacyNullToEmptyString] DOMString namespaceURI, + DOMString localName); + /** + * Removes a parameter, if set. This will make the processor use the + * default-value for the parameter as specified in the stylesheet. + * + * @param namespaceURI The namespaceURI of the XSLT parameter + * @param localName The local name of the XSLT parameter + */ + [Throws] + undefined removeParameter([LegacyNullToEmptyString] DOMString namespaceURI, + DOMString localName); + + /** + * Removes all set parameters from this XSLTProcessor. This will make + * the processor use the default-value for all parameters as specified in + * the stylesheet. + */ + undefined clearParameters(); + + /** + * Remove all parameters and stylesheets from this XSLTProcessor. + */ + undefined reset(); + + /** + * Disables all loading of external documents, such as from + * <xsl:import> and document() + * Defaults to off and is *not* reset by calls to reset() + */ + [ChromeOnly] + const unsigned long DISABLE_ALL_LOADS = 1; + + /** + * Flags for this processor. Defaults to 0. See individual flags above + * for documentation for effect of reset() + */ + [ChromeOnly, NeedsCallerType] + attribute unsigned long flags; +}; diff --git a/dom/webidl/components.conf b/dom/webidl/components.conf new file mode 100644 index 0000000000..c387a51f1a --- /dev/null +++ b/dom/webidl/components.conf @@ -0,0 +1,15 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of 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/. + +Classes = [ + { + 'cid': '{2ac4e026-cf25-47d5-b067-78d553c3cad8}', + 'contract_ids': ['@mozilla.org/dom/test-interface-js;1'], + 'esModule': 'resource://testing-common/TestInterfaceJS.sys.mjs', + 'constructor': 'TestInterfaceJS', + }, +] + diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build new file mode 100644 index 0000000000..68b42a9c54 --- /dev/null +++ b/dom/webidl/moz.build @@ -0,0 +1,1205 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of 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/. + +with Files("**"): + BUG_COMPONENT = ("Core", "DOM: Core & HTML") + +with Files("APZTestData.webidl"): + BUG_COMPONENT = ("Core", "Panning and Zooming") + +with Files("AccessibleNode.webidl"): + BUG_COMPONENT = ("Core", "Disability Access APIs") + +with Files("AccessibilityRole.webidl"): + BUG_COMPONENT = ("Core", "Disability Access APIs") + +with Files("AriaAttributes.webidl"): + BUG_COMPONENT = ("Core", "Disability Access APIs") + +with Files("Addon*"): + BUG_COMPONENT = ("Toolkit", "Add-ons Manager") + +with Files("AnalyserNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("Animat*"): + BUG_COMPONENT = ("Core", "DOM: Animation") + +with Files("*Audio*"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("Autocomplete*"): + BUG_COMPONENT = ("Toolkit", "Autocomplete") + +with Files("BaseKeyframeTypes.webidl"): + BUG_COMPONENT = ("Core", "DOM: Animation") + +with Files("BatteryManager.webidl"): + BUG_COMPONENT = ("Core", "DOM: Device Interfaces") + +with Files("BiquadFilterNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("Blob*"): + BUG_COMPONENT = ("Core", "DOM: File") + +with Files("BroadcastChannel.webidl"): + BUG_COMPONENT = ("Core", "DOM: postMessage") + +with Files("CSP*"): + BUG_COMPONENT = ("Core", "DOM: Security") + +with Files("CSS*"): + BUG_COMPONENT = ("Core", "CSS Parsing and Computation") + +with Files("Canvas*"): + BUG_COMPONENT = ("Core", "Graphics: Canvas2D") + +with Files("Caret*"): + BUG_COMPONENT = ("Core", "DOM: Editor") + +with Files("Channel*"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("Client*"): + BUG_COMPONENT = ("Core", "DOM: Service Workers") + +with Files("Clipboard.webidl"): + BUG_COMPONENT = ("Core", "DOM: Copy & Paste and Drag & Drop") + +with Files("ClipboardEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: Copy & Paste and Drag & Drop") + +with Files("ConstantSourceNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("ConvolverNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("GeolocationCoordinates.webidl"): + BUG_COMPONENT = ("Core", "DOM: Geolocation") + +with Files("CredentialManagement.webidl"): + BUG_COMPONENT = ("Core", "DOM: Credential Management") + +with Files("Crypto.webidl"): + BUG_COMPONENT = ("Core", "DOM: Security") + +with Files("Device*"): + BUG_COMPONENT = ("Core", "DOM: Device Interfaces") + +with Files("Directory.webidl"): + BUG_COMPONENT = ("Core", "DOM: Device Interfaces") + +with Files("DataTransfer*"): + BUG_COMPONENT = ("Core", "DOM: Copy & Paste and Drag & Drop") + +with Files("DragEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: Copy & Paste and Drag & Drop") + +with Files("DecoderDoctorNotification.webidl"): + BUG_COMPONENT = ("Core", "Audio/Video: Playback") + +with Files("DelayNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("DynamicsCompressorNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("FeaturePolicy.webidl"): + BUG_COMPONENT = ("Core", "DOM: Security") + +with Files("File*"): + BUG_COMPONENT = ("Core", "DOM: File") + +with Files("FocusEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +with Files("Font*"): + BUG_COMPONENT = ("Core", "CSS Parsing and Computation") + +with Files("FormData.webidl"): + BUG_COMPONENT = ("Core", "DOM: Forms") + +with Files("Geolocation.webidl"): + BUG_COMPONENT = ("Core", "DOM: Geolocation") + +with Files("GainNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("Gamepad*"): + BUG_COMPONENT = ("Core", "DOM: Device Interfaces") + +with Files("GeometryUtils.webidl"): + BUG_COMPONENT = ("Core", "Layout") + +with Files("GetUserMediaRequest.webidl"): + BUG_COMPONENT = ("Core", "WebRTC") + +with Files("Glean*.webidl"): + BUG_COMPONENT = ("Toolkit", "Telemetry") + +with Files("Grid.webidl"): + BUG_COMPONENT = ("Core", "CSS Parsing and Computation") + +with Files("HTML*"): + BUG_COMPONENT = ("Core", "DOM: Core & HTML") + +with Files("HashChangeEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: Navigation") + +with Files("IDB*"): + BUG_COMPONENT = ("Core", "Storage: IndexedDB") + +with Files("IdentityCredential.webidl"): + BUG_COMPONENT = ("Core", "DOM: Credential Management") + +with Files("IIRFilterNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("Image*"): + BUG_COMPONENT = ("Core", "DOM: Core & HTML") + +with Files("ImageBitmap*"): + BUG_COMPONENT = ("Core", "Graphics: Canvas2D") + +with Files("ImageCapture*"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("InputEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +with Files("InstallTrigger.webidl"): + BUG_COMPONENT = ("Toolkit", "Add-ons Manager") + +with Files("InvokerElement.webidl"): + BUG_COMPONENT = ("Core", "DOM: Core & HTML") + +with Files("KeyAlgorithm.webidl"): + BUG_COMPONENT = ("Core", "DOM: Security") + +with Files("Key*Event*"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +with Files("KeyIdsInitData.webidl"): + BUG_COMPONENT = ("Core", "Audio/Video: Playback") + +with Files("Keyframe*"): + BUG_COMPONENT = ("Core", "DOM: Animation") + +with Files("MathML*"): + BUG_COMPONENT = ("Core", "MathML") + +with Files("MediaDevice*"): + BUG_COMPONENT = ("Core", "WebRTC") + +with Files("Media*Source*"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("MediaStream*"): + BUG_COMPONENT = ("Core", "WebRTC") + +with Files("MediaStreamTrackAudio*"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("MediaStreamAudio*"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("MediaEncryptedEvent.webidl"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("MediaKey*"): + BUG_COMPONENT = ("Core", "Audio/Video: Playback") + +with Files("Media*List*"): + BUG_COMPONENT = ("Core", "CSS Parsing and Computation") + +with Files("Message*"): + BUG_COMPONENT = ("Core", "DOM: postMessage") + +with Files("*Record*"): + BUG_COMPONENT = ("Core", "Audio/Video: Recording") + +with Files("Media*Track*"): + BUG_COMPONENT = ("Core", "WebRTC: Audio/Video") + +with Files("MIDI*"): + BUG_COMPONENT = ("Core", "DOM: Device Interfaces") + +with Files("Mouse*"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +with Files("MutationEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: Events") + +with Files("NavigationPreloadManager.webidl"): + BUG_COMPONENT = ("Core", "DOM: Service Workers") + +with Files("Net*"): + BUG_COMPONENT = ("Core", "Networking") + +with Files("OfflineAudio*"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("OffscreenCanvas.webidl"): + BUG_COMPONENT = ("Core", "Graphics: Canvas2D") + +with Files("OffscreenCanvasRenderingContext2D.webidl"): + BUG_COMPONENT = ("Core", "Graphics: Canvas2D") + +with Files("OscillatorNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("PannerNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("Peer*"): + BUG_COMPONENT = ("Core", "WebRTC") + +with Files("PeriodicWave.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("PointerEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +with Files("PopStateEvent.webidl*"): + BUG_COMPONENT = ("Core", "DOM: Navigation") + +with Files("GeolocationPosition*"): + BUG_COMPONENT = ("Core", "DOM: Geolocation") + +with Files("PopoverInvokerElement.webidl"): + BUG_COMPONENT = ("Core", "DOM: Core & HTML") + +with Files("ProgressEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: Events") + +with Files("Push*"): + BUG_COMPONENT = ("Core", "DOM: Notifications") + +with Files("RTC*"): + BUG_COMPONENT = ("Core", "WebRTC") + +with Files("SVG*"): + BUG_COMPONENT = ("Core", "SVG") + +with Files("Sanitizer.webidl"): + BUG_COMPONENT = ("Core", "DOM: Security") + +with Files("ScriptProcessorNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("Selection.webidl"): + BUG_COMPONENT = ("Core", "DOM: Selection") + +with Files("ServiceWorker*"): + BUG_COMPONENT = ("Core", "DOM: Service Workers") + +with Files("SimpleGestureEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +with Files("SocketCommon.webidl"): + BUG_COMPONENT = ("Core", "DOM: Networking") + +with Files("SourceBuffer*"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("Speech*"): + BUG_COMPONENT = ("Core", "Web Speech") + +with Files("StereoPannerNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("StreamFilter*"): + BUG_COMPONENT = ("WebExtensions", "Request Handling") + +with Files("Style*"): + BUG_COMPONENT = ("Core", "DOM: CSS Object Model") + +with Files("SubtleCrypto.webidl"): + BUG_COMPONENT = ("Core", "DOM: Security") + +with Files("TCP*"): + BUG_COMPONENT = ("Core", "DOM: Networking") + +with Files("TextTrack*"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("TrackEvent.webidl"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("UDP*"): + BUG_COMPONENT = ("Core", "DOM: Networking") + +with Files("UIEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +with Files("URL.webidl"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("UserProximityEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +with Files("VTT*"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("VRDisplay.webidl"): + BUG_COMPONENT = ("Core", "Graphics") + +with Files("Video*"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("WaveShaperNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("WebAuthentication.webidl"): + BUG_COMPONENT = ("Core", "DOM: Web Authentication") + +with Files("WebGL*"): + BUG_COMPONENT = ("Core", "Graphics: CanvasWebGL") + +with Files("WebGPU*"): + BUG_COMPONENT = ("Core", "Graphics: WebGPU") + +with Files("Webrtc*"): + BUG_COMPONENT = ("Core", "WebRTC") + +with Files("WebXR.webidl"): + BUG_COMPONENT = ("Core", "WebVR") + +with Files("XR*"): + BUG_COMPONENT = ("Core", "WebVR") + +with Files("WheelEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +with Files("WindowOrWorkerGlobalScope.webidl"): + BUG_COMPONENT = ("Core", "DOM: Workers") + +with Files("Worker*"): + BUG_COMPONENT = ("Core", "DOM: Workers") + +with Files("Extension*"): + BUG_COMPONENT = ("WebExtensions", "General") + +with Files("WebTransport*"): + BUG_COMPONENT = ("Core", "Networking") + +GENERATED_WEBIDL_FILES = [ + "CSS2Properties.webidl", +] + +PREPROCESSED_WEBIDL_FILES = [ + "Node.webidl", + "Window.webidl", +] + +WEBIDL_FILES = [ + "AbortController.webidl", + "AbortSignal.webidl", + "AbstractRange.webidl", + "AbstractWorker.webidl", + "AccessibilityRole.webidl", + "AddonManager.webidl", + "AnalyserNode.webidl", + "Animatable.webidl", + "Animation.webidl", + "AnimationEffect.webidl", + "AnimationEvent.webidl", + "AnimationFrameProvider.webidl", + "AnimationTimeline.webidl", + "AnonymousContent.webidl", + "AppInfo.webidl", + "AppNotificationServiceOptions.webidl", + "APZTestData.webidl", + "AriaAttributes.webidl", + "Attr.webidl", + "AudioBuffer.webidl", + "AudioBufferSourceNode.webidl", + "AudioContext.webidl", + "AudioDestinationNode.webidl", + "AudioListener.webidl", + "AudioNode.webidl", + "AudioParam.webidl", + "AudioParamDescriptor.webidl", + "AudioParamMap.webidl", + "AudioProcessingEvent.webidl", + "AudioScheduledSourceNode.webidl", + "AudioTrack.webidl", + "AudioTrackList.webidl", + "AudioWorklet.webidl", + "AudioWorkletGlobalScope.webidl", + "AudioWorkletNode.webidl", + "AudioWorkletProcessor.webidl", + "AutocompleteInfo.webidl", + "BarProp.webidl", + "BaseAudioContext.webidl", + "BaseKeyframeTypes.webidl", + "BasicCardPayment.webidl", + "BatteryManager.webidl", + "BeforeUnloadEvent.webidl", + "BiquadFilterNode.webidl", + "Blob.webidl", + "BroadcastChannel.webidl", + "BrowserElementDictionaries.webidl", + "Cache.webidl", + "CacheStorage.webidl", + "CancelContentJSOptions.webidl", + "CanvasCaptureMediaStream.webidl", + "CanvasRenderingContext2D.webidl", + "CaretPosition.webidl", + "CDATASection.webidl", + "ChannelMergerNode.webidl", + "ChannelSplitterNode.webidl", + "CharacterData.webidl", + "CheckerboardReportService.webidl", + "ChildNode.webidl", + "Client.webidl", + "Clients.webidl", + "Clipboard.webidl", + "ClipboardEvent.webidl", + "Comment.webidl", + "CompositionEvent.webidl", + "CompressionStream.webidl", + "Console.webidl", + "ConstantSourceNode.webidl", + "ConvolverNode.webidl", + "CreateOfferRequest.webidl", + "CredentialManagement.webidl", + "Crypto.webidl", + "CSPDictionaries.webidl", + "CSPReport.webidl", + "CSS.webidl", + "CSSAnimation.webidl", + "CSSConditionRule.webidl", + "CSSContainerRule.webidl", + "CSSCounterStyleRule.webidl", + "CSSFontFaceRule.webidl", + "CSSFontFeatureValuesRule.webidl", + "CSSFontPaletteValuesRule.webidl", + "CSSGroupingRule.webidl", + "CSSImportRule.webidl", + "CSSKeyframeRule.webidl", + "CSSKeyframesRule.webidl", + "CSSLayerBlockRule.webidl", + "CSSLayerStatementRule.webidl", + "CSSMediaRule.webidl", + "CSSMozDocumentRule.webidl", + "CSSNamespaceRule.webidl", + "CSSPageRule.webidl", + "CSSPropertyRule.webidl", + "CSSPseudoElement.webidl", + "CSSRule.webidl", + "CSSRuleList.webidl", + "CSSStyleDeclaration.webidl", + "CSSStyleRule.webidl", + "CSSStyleSheet.webidl", + "CSSSupportsRule.webidl", + "CSSTransition.webidl", + "CustomElementRegistry.webidl", + "DataTransfer.webidl", + "DataTransferItem.webidl", + "DataTransferItemList.webidl", + "DecoderDoctorNotification.webidl", + "DecompressionStream.webidl", + "DedicatedWorkerGlobalScope.webidl", + "DelayNode.webidl", + "DeviceMotionEvent.webidl", + "Directory.webidl", + "Document.webidl", + "DocumentFragment.webidl", + "DocumentOrShadowRoot.webidl", + "DocumentTimeline.webidl", + "DocumentType.webidl", + "DOMException.webidl", + "DOMImplementation.webidl", + "DOMLocalization.webidl", + "DOMMatrix.webidl", + "DOMParser.webidl", + "DOMPoint.webidl", + "DOMQuad.webidl", + "DOMRect.webidl", + "DOMRectList.webidl", + "DOMRequest.webidl", + "DOMStringList.webidl", + "DOMStringMap.webidl", + "DOMTokenList.webidl", + "DragEvent.webidl", + "DynamicsCompressorNode.webidl", + "Element.webidl", + "ElementInternals.webidl", + "EncodedVideoChunk.webidl", + "Event.webidl", + "EventHandler.webidl", + "EventListener.webidl", + "EventSource.webidl", + "EventTarget.webidl", + "ExtendableEvent.webidl", + "ExtendableMessageEvent.webidl", + "External.webidl", + "FailedCertSecurityInfo.webidl", + "FakePluginTagInit.webidl", + "FeaturePolicy.webidl", + "Fetch.webidl", + "FetchEvent.webidl", + "FetchObserver.webidl", + "File.webidl", + "FileList.webidl", + "FileMode.webidl", + "FileReader.webidl", + "FileReaderSync.webidl", + "FileSystem.webidl", + "FileSystemDirectoryEntry.webidl", + "FileSystemDirectoryHandle.webidl", + "FileSystemDirectoryIterator.webidl", + "FileSystemDirectoryReader.webidl", + "FileSystemEntry.webidl", + "FileSystemFileEntry.webidl", + "FileSystemFileHandle.webidl", + "FileSystemHandle.webidl", + "FileSystemSyncAccessHandle.webidl", + "FileSystemWritableFileStream.webidl", + "FinalizationRegistry.webidl", + "FocusEvent.webidl", + "FontFace.webidl", + "FontFaceSet.webidl", + "FontFaceSource.webidl", + "FormData.webidl", + "Function.webidl", + "GainNode.webidl", + "Gamepad.webidl", + "GamepadHapticActuator.webidl", + "GamepadLightIndicator.webidl", + "GamepadPose.webidl", + "GamepadServiceTest.webidl", + "GamepadTouch.webidl", + "GenericTransformStream.webidl", + "Geolocation.webidl", + "GeolocationCoordinates.webidl", + "GeolocationPosition.webidl", + "GeolocationPositionError.webidl", + "GeometryUtils.webidl", + "GetUserMediaRequest.webidl", + "Glean.webidl", + "GleanMetrics.webidl", + "GleanPings.webidl", + "Headers.webidl", + "Highlight.webidl", + "History.webidl", + "HTMLAllCollection.webidl", + "HTMLAnchorElement.webidl", + "HTMLAreaElement.webidl", + "HTMLAudioElement.webidl", + "HTMLBaseElement.webidl", + "HTMLBodyElement.webidl", + "HTMLBRElement.webidl", + "HTMLButtonElement.webidl", + "HTMLCanvasElement.webidl", + "HTMLCollection.webidl", + "HTMLDataElement.webidl", + "HTMLDataListElement.webidl", + "HTMLDetailsElement.webidl", + "HTMLDialogElement.webidl", + "HTMLDirectoryElement.webidl", + "HTMLDivElement.webidl", + "HTMLDListElement.webidl", + "HTMLDocument.webidl", + "HTMLElement.webidl", + "HTMLEmbedElement.webidl", + "HTMLFieldSetElement.webidl", + "HTMLFontElement.webidl", + "HTMLFormControlsCollection.webidl", + "HTMLFormElement.webidl", + "HTMLFrameElement.webidl", + "HTMLFrameSetElement.webidl", + "HTMLHeadElement.webidl", + "HTMLHeadingElement.webidl", + "HTMLHRElement.webidl", + "HTMLHtmlElement.webidl", + "HTMLHyperlinkElementUtils.webidl", + "HTMLIFrameElement.webidl", + "HTMLImageElement.webidl", + "HTMLInputElement.webidl", + "HTMLLabelElement.webidl", + "HTMLLegendElement.webidl", + "HTMLLIElement.webidl", + "HTMLLinkElement.webidl", + "HTMLMapElement.webidl", + "HTMLMarqueeElement.webidl", + "HTMLMediaElement.webidl", + "HTMLMenuElement.webidl", + "HTMLMetaElement.webidl", + "HTMLMeterElement.webidl", + "HTMLModElement.webidl", + "HTMLObjectElement.webidl", + "HTMLOListElement.webidl", + "HTMLOptGroupElement.webidl", + "HTMLOptionElement.webidl", + "HTMLOptionsCollection.webidl", + "HTMLOutputElement.webidl", + "HTMLParagraphElement.webidl", + "HTMLParamElement.webidl", + "HTMLPictureElement.webidl", + "HTMLPreElement.webidl", + "HTMLProgressElement.webidl", + "HTMLQuoteElement.webidl", + "HTMLScriptElement.webidl", + "HTMLSelectElement.webidl", + "HTMLSlotElement.webidl", + "HTMLSourceElement.webidl", + "HTMLSpanElement.webidl", + "HTMLStyleElement.webidl", + "HTMLTableCaptionElement.webidl", + "HTMLTableCellElement.webidl", + "HTMLTableColElement.webidl", + "HTMLTableElement.webidl", + "HTMLTableRowElement.webidl", + "HTMLTableSectionElement.webidl", + "HTMLTemplateElement.webidl", + "HTMLTextAreaElement.webidl", + "HTMLTimeElement.webidl", + "HTMLTitleElement.webidl", + "HTMLTrackElement.webidl", + "HTMLUListElement.webidl", + "HTMLVideoElement.webidl", + "IDBCursor.webidl", + "IDBDatabase.webidl", + "IDBFactory.webidl", + "IDBIndex.webidl", + "IDBKeyRange.webidl", + "IDBObjectStore.webidl", + "IDBOpenDBRequest.webidl", + "IDBRequest.webidl", + "IDBTransaction.webidl", + "IDBVersionChangeEvent.webidl", + "IdentityCredential.webidl", + "IdleDeadline.webidl", + "IIRFilterNode.webidl", + "ImageBitmap.webidl", + "ImageBitmapRenderingContext.webidl", + "ImageCapture.webidl", + "ImageData.webidl", + "ImageDocument.webidl", + "InputEvent.webidl", + "IntersectionObserver.webidl", + "IntlUtils.webidl", + "InvokeEvent.webidl", + "InvokerElement.webidl", + "IterableIterator.webidl", + "KeyAlgorithm.webidl", + "KeyboardEvent.webidl", + "KeyEvent.webidl", + "KeyframeAnimationOptions.webidl", + "KeyframeEffect.webidl", + "KeyIdsInitData.webidl", + "LinkStyle.webidl", + "Localization.webidl", + "Location.webidl", + "Lock.webidl", + "LockManager.webidl", + "MathMLElement.webidl", + "MediaCapabilities.webidl", + "MediaDebugInfo.webidl", + "MediaDeviceInfo.webidl", + "MediaDevices.webidl", + "MediaElementAudioSourceNode.webidl", + "MediaEncryptedEvent.webidl", + "MediaError.webidl", + "MediaKeyError.webidl", + "MediaKeyMessageEvent.webidl", + "MediaKeys.webidl", + "MediaKeySession.webidl", + "MediaKeysRequestStatus.webidl", + "MediaKeyStatusMap.webidl", + "MediaKeySystemAccess.webidl", + "MediaList.webidl", + "MediaQueryList.webidl", + "MediaRecorder.webidl", + "MediaSession.webidl", + "MediaSource.webidl", + "MediaStream.webidl", + "MediaStreamAudioDestinationNode.webidl", + "MediaStreamAudioSourceNode.webidl", + "MediaStreamError.webidl", + "MediaStreamTrack.webidl", + "MediaStreamTrackAudioSourceNode.webidl", + "MediaTrackSettings.webidl", + "MediaTrackSupportedConstraints.webidl", + "MerchantValidationEvent.webidl", + "MessageChannel.webidl", + "MessageEvent.webidl", + "MessagePort.webidl", + "MIDIAccess.webidl", + "MIDIInput.webidl", + "MIDIInputMap.webidl", + "MIDIMessageEvent.webidl", + "MIDIOptions.webidl", + "MIDIOutput.webidl", + "MIDIOutputMap.webidl", + "MIDIPort.webidl", + "MimeType.webidl", + "MimeTypeArray.webidl", + "MouseEvent.webidl", + "MouseScrollEvent.webidl", + "MozFrameLoaderOwner.webidl", + "MutationEvent.webidl", + "MutationObserver.webidl", + "NamedNodeMap.webidl", + "NavigationPreloadManager.webidl", + "Navigator.webidl", + "NetErrorInfo.webidl", + "NetworkInformation.webidl", + "NetworkOptions.webidl", + "NodeFilter.webidl", + "NodeIterator.webidl", + "NodeList.webidl", + "Notification.webidl", + "NotificationEvent.webidl", + "NotifyPaintEvent.webidl", + "OfflineAudioContext.webidl", + "OffscreenCanvas.webidl", + "OffscreenCanvasRenderingContext2D.webidl", + "OscillatorNode.webidl", + "PaintRequest.webidl", + "PaintRequestList.webidl", + "PaintWorkletGlobalScope.webidl", + "PannerNode.webidl", + "ParentNode.webidl", + "PaymentAddress.webidl", + "PaymentMethodChangeEvent.webidl", + "PaymentRequest.webidl", + "PaymentRequestUpdateEvent.webidl", + "PaymentResponse.webidl", + "Performance.webidl", + "PerformanceEntry.webidl", + "PerformanceEventTiming.webidl", + "PerformanceLargestContentfulPaint.webidl", + "PerformanceMark.webidl", + "PerformanceMeasure.webidl", + "PerformanceNavigation.webidl", + "PerformanceNavigationTiming.webidl", + "PerformanceObserver.webidl", + "PerformanceObserverEntryList.webidl", + "PerformancePaintTiming.webidl", + "PerformanceResourceTiming.webidl", + "PerformanceServerTiming.webidl", + "PerformanceTiming.webidl", + "PeriodicWave.webidl", + "Permissions.webidl", + "PermissionStatus.webidl", + "Plugin.webidl", + "PluginArray.webidl", + "PointerEvent.webidl", + "PopoverInvokerElement.webidl", + "ProcessingInstruction.webidl", + "Promise.webidl", + "PushEvent.webidl", + "PushManager.webidl", + "PushManager.webidl", + "PushMessageData.webidl", + "PushSubscription.webidl", + "PushSubscriptionOptions.webidl", + "QueuingStrategy.webidl", + "RadioNodeList.webidl", + "Range.webidl", + "ReadableByteStreamController.webidl", + "ReadableStream.webidl", + "ReadableStreamBYOBReader.webidl", + "ReadableStreamBYOBRequest.webidl", + "ReadableStreamDefaultController.webidl", + "ReadableStreamDefaultReader.webidl", + "ReferrerPolicy.webidl", + "Reporting.webidl", + "Request.webidl", + "ResizeObserver.webidl", + "Response.webidl", + "Sanitizer.webidl", + "Screen.webidl", + "ScreenOrientation.webidl", + "ScriptProcessorNode.webidl", + "ScrollAreaEvent.webidl", + "Selection.webidl", + "ServiceWorker.webidl", + "ServiceWorkerContainer.webidl", + "ServiceWorkerGlobalScope.webidl", + "ServiceWorkerRegistration.webidl", + "ShadowRealmGlobalScope.webidl", + "ShadowRoot.webidl", + "SharedWorker.webidl", + "SharedWorkerGlobalScope.webidl", + "SimpleGestureEvent.webidl", + "SocketCommon.webidl", + "SourceBuffer.webidl", + "SourceBufferList.webidl", + "StaticRange.webidl", + "StereoPannerNode.webidl", + "Storage.webidl", + "StorageEvent.webidl", + "StorageManager.webidl", + "StreamFilter.webidl", + "StreamFilterDataEvent.webidl", + "StructuredCloneTester.webidl", + "StyleSheet.webidl", + "StyleSheetList.webidl", + "SubtleCrypto.webidl", + "SVGAElement.webidl", + "SVGAngle.webidl", + "SVGAnimatedAngle.webidl", + "SVGAnimatedBoolean.webidl", + "SVGAnimatedEnumeration.webidl", + "SVGAnimatedInteger.webidl", + "SVGAnimatedLength.webidl", + "SVGAnimatedLengthList.webidl", + "SVGAnimatedNumber.webidl", + "SVGAnimatedNumberList.webidl", + "SVGAnimatedPathData.webidl", + "SVGAnimatedPoints.webidl", + "SVGAnimatedPreserveAspectRatio.webidl", + "SVGAnimatedRect.webidl", + "SVGAnimatedString.webidl", + "SVGAnimatedTransformList.webidl", + "SVGAnimateElement.webidl", + "SVGAnimateMotionElement.webidl", + "SVGAnimateTransformElement.webidl", + "SVGAnimationElement.webidl", + "SVGCircleElement.webidl", + "SVGClipPathElement.webidl", + "SVGComponentTransferFunctionElement.webidl", + "SVGDefsElement.webidl", + "SVGDescElement.webidl", + "SVGElement.webidl", + "SVGEllipseElement.webidl", + "SVGFEBlendElement.webidl", + "SVGFEColorMatrixElement.webidl", + "SVGFEComponentTransferElement.webidl", + "SVGFECompositeElement.webidl", + "SVGFEConvolveMatrixElement.webidl", + "SVGFEDiffuseLightingElement.webidl", + "SVGFEDisplacementMapElement.webidl", + "SVGFEDistantLightElement.webidl", + "SVGFEDropShadowElement.webidl", + "SVGFEFloodElement.webidl", + "SVGFEFuncAElement.webidl", + "SVGFEFuncBElement.webidl", + "SVGFEFuncGElement.webidl", + "SVGFEFuncRElement.webidl", + "SVGFEGaussianBlurElement.webidl", + "SVGFEImageElement.webidl", + "SVGFEMergeElement.webidl", + "SVGFEMergeNodeElement.webidl", + "SVGFEMorphologyElement.webidl", + "SVGFEOffsetElement.webidl", + "SVGFEPointLightElement.webidl", + "SVGFESpecularLightingElement.webidl", + "SVGFESpotLightElement.webidl", + "SVGFETileElement.webidl", + "SVGFETurbulenceElement.webidl", + "SVGFilterElement.webidl", + "SVGFilterPrimitiveStandardAttributes.webidl", + "SVGFitToViewBox.webidl", + "SVGForeignObjectElement.webidl", + "SVGGElement.webidl", + "SVGGeometryElement.webidl", + "SVGGradientElement.webidl", + "SVGGraphicsElement.webidl", + "SVGImageElement.webidl", + "SVGLength.webidl", + "SVGLengthList.webidl", + "SVGLinearGradientElement.webidl", + "SVGLineElement.webidl", + "SVGMarkerElement.webidl", + "SVGMaskElement.webidl", + "SVGMatrix.webidl", + "SVGMetadataElement.webidl", + "SVGMPathElement.webidl", + "SVGNumber.webidl", + "SVGNumberList.webidl", + "SVGPathElement.webidl", + "SVGPathSeg.webidl", + "SVGPathSegList.webidl", + "SVGPatternElement.webidl", + "SVGPoint.webidl", + "SVGPointList.webidl", + "SVGPolygonElement.webidl", + "SVGPolylineElement.webidl", + "SVGPreserveAspectRatio.webidl", + "SVGRadialGradientElement.webidl", + "SVGRect.webidl", + "SVGRectElement.webidl", + "SVGScriptElement.webidl", + "SVGSetElement.webidl", + "SVGStopElement.webidl", + "SVGStringList.webidl", + "SVGStyleElement.webidl", + "SVGSVGElement.webidl", + "SVGSwitchElement.webidl", + "SVGSymbolElement.webidl", + "SVGTests.webidl", + "SVGTextContentElement.webidl", + "SVGTextElement.webidl", + "SVGTextPathElement.webidl", + "SVGTextPositioningElement.webidl", + "SVGTitleElement.webidl", + "SVGTransform.webidl", + "SVGTransformList.webidl", + "SVGTSpanElement.webidl", + "SVGUnitTypes.webidl", + "SVGURIReference.webidl", + "SVGUseElement.webidl", + "SVGViewElement.webidl", + "SVGZoomAndPan.webidl", + "TCPServerSocket.webidl", + "TCPServerSocketEvent.webidl", + "TCPSocket.webidl", + "TCPSocketErrorEvent.webidl", + "TCPSocketEvent.webidl", + "TestUtils.webidl", + "Text.webidl", + "TextClause.webidl", + "TextDecoder.webidl", + "TextDecoderStream.webidl", + "TextEncoder.webidl", + "TextEncoderStream.webidl", + "TextTrack.webidl", + "TextTrackCue.webidl", + "TextTrackCueList.webidl", + "TextTrackList.webidl", + "TimeEvent.webidl", + "TimeRanges.webidl", + "ToggleEvent.webidl", + "Touch.webidl", + "TouchEvent.webidl", + "TouchList.webidl", + "Transformer.webidl", + "TransformStream.webidl", + "TransformStreamDefaultController.webidl", + "TransitionEvent.webidl", + "TreeWalker.webidl", + "UDPMessageEvent.webidl", + "UDPSocket.webidl", + "UIEvent.webidl", + "UnderlyingSink.webidl", + "UnderlyingSource.webidl", + "URL.webidl", + "URLSearchParams.webidl", + "UserActivation.webidl", + "ValidityState.webidl", + "VideoColorSpace.webidl", + "VideoDecoder.webidl", + "VideoEncoder.webidl", + "VideoFrame.webidl", + "VideoPlaybackQuality.webidl", + "VideoTrack.webidl", + "VideoTrackList.webidl", + "VisualViewport.webidl", + "VRDisplay.webidl", + "VRDisplayEvent.webidl", + "VRServiceTest.webidl", + "VTTCue.webidl", + "VTTRegion.webidl", + "WakeLock.webidl", + "WakeLockSentinel.webidl", + "WaveShaperNode.webidl", + "WebAuthentication.webidl", + "WebGL2RenderingContext.webidl", + "WebGLRenderingContext.webidl", + "WebGPU.webidl", + "WebSocket.webidl", + "WebTaskScheduling.webidl", + "WebTransport.webidl", + "WebTransportDatagramDuplexStream.webidl", + "WebTransportError.webidl", + "WebTransportSendReceiveStream.webidl", + "WebXR.webidl", + "WheelEvent.webidl", + "WindowOrWorkerGlobalScope.webidl", + "Worker.webidl", + "WorkerDebuggerGlobalScope.webidl", + "WorkerGlobalScope.webidl", + "WorkerLocation.webidl", + "WorkerNavigator.webidl", + "WorkerTestUtils.webidl", + "Worklet.webidl", + "WorkletGlobalScope.webidl", + "WritableStream.webidl", + "WritableStreamDefaultController.webidl", + "WritableStreamDefaultWriter.webidl", + "XMLDocument.webidl", + "XMLHttpRequest.webidl", + "XMLHttpRequestEventTarget.webidl", + "XMLHttpRequestUpload.webidl", + "XMLSerializer.webidl", + "XPathEvaluator.webidl", + "XPathExpression.webidl", + "XPathNSResolver.webidl", + "XPathResult.webidl", + "XSLTProcessor.webidl", +] + +if CONFIG["MOZ_WEBRTC"]: + WEBIDL_FILES += [ + "PeerConnectionImpl.webidl", + "PeerConnectionObserver.webidl", + "PeerConnectionObserverEnums.webidl", + "RTCCertificate.webidl", + "RTCConfiguration.webidl", + "RTCDataChannel.webidl", + "RTCDtlsTransport.webidl", + "RTCDTMFSender.webidl", + "RTCEncodedAudioFrame.webidl", + "RTCEncodedVideoFrame.webidl", + "RTCIceCandidate.webidl", + "RTCIdentityAssertion.webidl", + "RTCIdentityProvider.webidl", + "RTCPeerConnection.webidl", + "RTCPeerConnectionStatic.webidl", + "RTCRtpCapabilities.webidl", + "RTCRtpParameters.webidl", + "RTCRtpReceiver.webidl", + "RTCRtpScriptTransform.webidl", + "RTCRtpScriptTransformer.webidl", + "RTCRtpSender.webidl", + "RTCRtpSources.webidl", + "RTCRtpTransceiver.webidl", + "RTCSctpTransport.webidl", + "RTCSessionDescription.webidl", + "RTCStatsReport.webidl", + "RTCTransformEvent.webidl", + "WebrtcGlobalInformation.webidl", + ] + +if CONFIG["MOZ_WEBSPEECH"]: + WEBIDL_FILES += [ + "SpeechGrammar.webidl", + "SpeechGrammarList.webidl", + "SpeechRecognition.webidl", + "SpeechRecognitionAlternative.webidl", + "SpeechRecognitionError.webidl", + "SpeechRecognitionEvent.webidl", + "SpeechRecognitionResult.webidl", + "SpeechRecognitionResultList.webidl", + "SpeechSynthesis.webidl", + "SpeechSynthesisErrorEvent.webidl", + "SpeechSynthesisEvent.webidl", + "SpeechSynthesisUtterance.webidl", + "SpeechSynthesisVoice.webidl", + ] + +WEBIDL_FILES += [ + "CustomEvent.webidl", +] + +# WebExtensions API. +WEBIDL_FILES += [ + "ExtensionAlarms.webidl", + "ExtensionBrowser.webidl", + "ExtensionBrowserSettings.webidl", + "ExtensionBrowserSettingsColorManagement.webidl", + "ExtensionDns.webidl", + "ExtensionEventManager.webidl", + # ExtensionMockAPI is not a real WebExtensions API, and it is only enabled in tests. + "ExtensionMockAPI.webidl", + "ExtensionPort.webidl", + "ExtensionProxy.webidl", + "ExtensionRuntime.webidl", + "ExtensionScripting.webidl", + "ExtensionSetting.webidl", + "ExtensionTest.webidl", +] + +# We only expose our prefable test interfaces in debug builds, just to be on +# the safe side. +if CONFIG["MOZ_DEBUG"] and CONFIG["ENABLE_TESTS"]: + WEBIDL_FILES += [ + "TestFunctions.webidl", + "TestInterfaceJS.webidl", + "TestInterfaceJSDictionaries.webidl", + "TestInterfaceJSMaplikeSetlikeIterable.webidl", + "TestInterfaceObservableArray.webidl", + ] + XPCOM_MANIFESTS += [ + "components.conf", + ] + +WEBIDL_FILES += [ + "InstallTrigger.webidl", +] + +if CONFIG["FUZZING"]: + WEBIDL_FILES += [ + "FuzzingFunctions.webidl", + ] + +GENERATED_EVENTS_WEBIDL_FILES = [ + "AddonEvent.webidl", + "AnimationPlaybackEvent.webidl", + "BlobEvent.webidl", + "CaretStateChangedEvent.webidl", + "CloseEvent.webidl", + "ContentVisibilityAutoStateChangeEvent.webidl", + "DeviceLightEvent.webidl", + "DeviceOrientationEvent.webidl", + "ErrorEvent.webidl", + "FontFaceSetLoadEvent.webidl", + "FormDataEvent.webidl", + "FrameCrashedEvent.webidl", + "GamepadAxisMoveEvent.webidl", + "GamepadButtonEvent.webidl", + "GamepadEvent.webidl", + "GPUUncapturedErrorEvent.webidl", + "HashChangeEvent.webidl", + "ImageCaptureErrorEvent.webidl", + "MediaQueryListEvent.webidl", + "MediaRecorderErrorEvent.webidl", + "MediaStreamEvent.webidl", + "MediaStreamTrackEvent.webidl", + "MIDIConnectionEvent.webidl", + "OfflineAudioCompletionEvent.webidl", + "PageTransitionEvent.webidl", + "PerformanceEntryEvent.webidl", + "PopStateEvent.webidl", + "PopupBlockedEvent.webidl", + "PositionStateEvent.webidl", + "ProgressEvent.webidl", + "PromiseRejectionEvent.webidl", + "ScrollViewChangeEvent.webidl", + "SecurityPolicyViolationEvent.webidl", + "SubmitEvent.webidl", + "TaskPriorityChangeEvent.webidl", + "TCPServerSocketEvent.webidl", + "TCPSocketErrorEvent.webidl", + "TCPSocketEvent.webidl", + "ToggleEvent.webidl", + "TrackEvent.webidl", + "UDPMessageEvent.webidl", + "UserProximityEvent.webidl", + "WebGLContextEvent.webidl", + "XRInputSourceEvent.webidl", + "XRInputSourcesChangeEvent.webidl", + "XRReferenceSpaceEvent.webidl", + "XRSessionEvent.webidl", +] + +if CONFIG["MOZ_WEBRTC"]: + GENERATED_EVENTS_WEBIDL_FILES += [ + "RTCDataChannelEvent.webidl", + "RTCDTMFToneChangeEvent.webidl", + "RTCPeerConnectionIceEvent.webidl", + "RTCTrackEvent.webidl", + "RTCTransformEvent.webidl", + ] + +if CONFIG["MOZ_WEBSPEECH"]: + GENERATED_EVENTS_WEBIDL_FILES += [ + "SpeechRecognitionEvent.webidl", + "SpeechSynthesisErrorEvent.webidl", + "SpeechSynthesisEvent.webidl", + ] + +if CONFIG["ACCESSIBILITY"]: + WEBIDL_FILES += [ + "AccessibleNode.webidl", + ] |