diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/webidl | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
704 files changed, 35631 insertions, 0 deletions
diff --git a/dom/webidl/APZTestData.webidl b/dom/webidl/APZTestData.webidl new file mode 100644 index 0000000000..1b4034056d --- /dev/null +++ b/dom/webidl/APZTestData.webidl @@ -0,0 +1,83 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 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<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..be3659cfd2 --- /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(); + + readonly attribute AbortSignal signal; + + void abort(); +}; diff --git a/dom/webidl/AbortSignal.webidl b/dom/webidl/AbortSignal.webidl new file mode 100644 index 0000000000..be8adc70b4 --- /dev/null +++ b/dom/webidl/AbortSignal.webidl @@ -0,0 +1,15 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dom.spec.whatwg.org/#abortsignal + */ + +[Exposed=(Window,Worker)] +interface AbortSignal : EventTarget { + readonly attribute boolean aborted; + + 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..e7da79d6be --- /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..8f3bd61c0c --- /dev/null +++ b/dom/webidl/AddonEvent.webidl @@ -0,0 +1,12 @@ +[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..0c4c6ae557 --- /dev/null +++ b/dom/webidl/AddonManager.webidl @@ -0,0 +1,110 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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<void> 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<void> install(); + Promise<void> 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 permissions prompts are enabled + readonly attribute boolean permissionPromptsEnabled; + + // 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..441e879342 --- /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 + void getFloatFrequencyData(Float32Array array); + void getByteFrequencyData(Uint8Array array); + + // Real-time waveform data + void getFloatTimeDomainData(Float32Array array); + void getByteTimeDomainData(Uint8Array array); + + [SetterThrows, Pure] + attribute unsigned long fftSize; + [Pure] + readonly attribute unsigned long frequencyBinCount; + + [SetterThrows, Pure] + attribute double minDecibels; + [SetterThrows, Pure] + attribute double maxDecibels; + + [SetterThrows, Pure] + attribute double smoothingTimeConstant; + +}; + +// Mozilla extension +AnalyserNode includes AudioNodePassThrough; diff --git a/dom/webidl/Animatable.webidl b/dom/webidl/Animatable.webidl new file mode 100644 index 0000000000..432c9ca856 --- /dev/null +++ b/dom/webidl/Animatable.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/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 = {}); + [Func="Document::IsWebAnimationsGetAnimationsEnabled"] + sequence<Animation> getAnimations(optional GetAnimationsOptions options = {}); +}; diff --git a/dom/webidl/Animation.webidl b/dom/webidl/Animation.webidl new file mode 100644 index 0000000000..ae481cadf6 --- /dev/null +++ b/dom/webidl/Animation.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 + * 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; + [Func="Document::IsWebAnimationsEnabled", Pure] + attribute AnimationEffect? effect; + [Func="Document::AreWebAnimationsTimelinesEnabled"] +#ifdef NIGHTLY_BUILD + // Animation.timeline setter is supported only on Nightly. + attribute AnimationTimeline? timeline; +#else + readonly attribute AnimationTimeline? timeline; +#endif + + [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; + [Pref="dom.animations-api.autoremove.enabled"] + readonly attribute AnimationReplaceState replaceState; + [Func="Document::IsWebAnimationsEnabled", Throws] + readonly attribute Promise<Animation> ready; + [Func="Document::IsWebAnimationsEnabled", Throws] + readonly attribute Promise<Animation> finished; + attribute EventHandler onfinish; + attribute EventHandler oncancel; + [Pref="dom.animations-api.autoremove.enabled"] + attribute EventHandler onremove; + void cancel(); + [Throws] + void finish(); + [Throws, BinaryName="playFromJS"] + void play(); + [Throws, BinaryName="pauseFromJS"] + void pause(); + void updatePlaybackRate (double playbackRate); + [Throws] + void reverse(); + [Pref="dom.animations-api.autoremove.enabled"] + void persist(); + [Pref="dom.animations-api.autoremove.enabled", Throws] + void 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..2a20f941d7 --- /dev/null +++ b/dom/webidl/AnimationEffect.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/. + * + * 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; +}; + +[Func="Document::IsWebAnimationsEnabled", + Exposed=Window] +interface AnimationEffect { + EffectTiming getTiming(); + [BinaryName="getComputedTimingAsDict"] + ComputedEffectTiming getComputedTiming(); + [Throws] + void 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/AnimationPlaybackEvent.webidl b/dom/webidl/AnimationPlaybackEvent.webidl new file mode 100644 index 0000000000..c88aea7b98 --- /dev/null +++ b/dom/webidl/AnimationPlaybackEvent.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/web-animations/#animationplaybackevent + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Func="Document::IsWebAnimationsEnabled", + 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..afada1091a --- /dev/null +++ b/dom/webidl/AnonymousContent.webidl @@ -0,0 +1,100 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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. + * + * This API never returns a reference to the actual inserted DOM node on + * purpose. This is to make sure the content cannot be randomly changed and the + * DOM cannot be traversed from the node, so that Gecko can remain in control of + * the inserted content. + */ + +[ChromeOnly, Exposed=Window] +interface AnonymousContent { + /** + * Get the text content of an element inside this custom anonymous content. + */ + [Throws] + DOMString getTextContentForElement(DOMString elementId); + + /** + * Set the text content of an element inside this custom anonymous content. + */ + [Throws] + void setTextContentForElement(DOMString elementId, DOMString text); + + /** + * Get the value of an attribute of an element inside this custom anonymous + * content. + */ + [Throws] + DOMString? getAttributeForElement(DOMString elementId, + DOMString attributeName); + + /** + * Set the value of an attribute of an element inside this custom anonymous + * content. + */ + [NeedsSubjectPrincipal=NonSystem, Throws] + void setAttributeForElement(DOMString elementId, + DOMString attributeName, + DOMString value); + + /** + * Remove an attribute from an element inside this custom anonymous content. + */ + [Throws] + void removeAttributeForElement(DOMString elementId, + DOMString attributeName); + + /** + * Get the canvas' context for the element specified if it's a <canvas> + * node, `null` otherwise. + */ + [Throws] + nsISupports? getCanvasContext(DOMString elementId, + DOMString contextId); + + [Throws] + Animation setAnimationForElement(DOMString elementId, + object? keyframes, + optional UnrestrictedDoubleOrKeyframeAnimationOptions + options = {}); + + /** + * Accepts a list of (possibly overlapping) DOMRects which describe a shape + * in CSS pixels relative to the element's border box. This shape will be + * excluded from the element's background color rendering. The element will + * not render any background images once this method has been called. + */ + [Throws] + void setCutoutRectsForElement(DOMString elementId, + sequence<DOMRect> rects); + + /** + * Get the computed value of a property on an element inside this custom + * anonymous content. + */ + [Throws] + UTF8String? getComputedStylePropertyValue(DOMString elementId, + UTF8String propertyName); + + /** + * If event's original target is in the anonymous content, this returns the id + * attribute value of the target. + */ + DOMString? getTargetIdForEvent(Event event); + + /** + * Set given style to this AnonymousContent. + */ + [Throws] + void setStyle(UTF8String property, UTF8String value); +}; 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..6121002bb3 --- /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..34deeddbdc --- /dev/null +++ b/dom/webidl/Attr.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/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 { + [GetterThrows] + readonly attribute Element? ownerElement; +}; diff --git a/dom/webidl/AudioBuffer.webidl b/dom/webidl/AudioBuffer.webidl new file mode 100644 index 0000000000..abf083157f --- /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] + void copyFromChannel(Float32Array destination, unsigned long channelNumber, optional unsigned long startInChannel = 0); + [Throws] + void 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..2953dc0c54 --- /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] + void 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..c991e66fcd --- /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(); + + [Throws] + Promise<void> suspend(); + [Throws] + Promise<void> 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..3a02b3d45f --- /dev/null +++ b/dom/webidl/AudioDestinationNode.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[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..374f6e8436 --- /dev/null +++ b/dom/webidl/AudioListener.webidl @@ -0,0 +1,20 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface AudioListener { + // Uses a 3D cartesian coordinate system + void setPosition(double x, double y, double z); + void setOrientation(double x, double y, double z, double xUp, double yUp, double zUp); +}; + diff --git a/dom/webidl/AudioNode.webidl b/dom/webidl/AudioNode.webidl new file mode 100644 index 0000000000..7e96a50706 --- /dev/null +++ b/dom/webidl/AudioNode.webidl @@ -0,0 +1,76 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +enum ChannelCountMode { + "max", + "clamped-max", + "explicit" +}; + +enum ChannelInterpretation { + "speakers", + "discrete" +}; + +dictionary AudioNodeOptions { + unsigned long channelCount; + ChannelCountMode channelCountMode; + ChannelInterpretation channelInterpretation; +}; + +[Pref="dom.webaudio.enabled", + Exposed=Window] +interface AudioNode : EventTarget { + + [Throws] + AudioNode connect(AudioNode destination, optional unsigned long output = 0, optional unsigned long input = 0); + [Throws] + void connect(AudioParam destination, optional unsigned long output = 0); + [Throws] + void disconnect(); + [Throws] + void disconnect(unsigned long output); + [Throws] + void disconnect(AudioNode destination); + [Throws] + void disconnect(AudioNode destination, unsigned long output); + [Throws] + void disconnect(AudioNode destination, unsigned long output, unsigned long input); + [Throws] + void disconnect(AudioParam destination); + [Throws] + void disconnect(AudioParam destination, unsigned long output); + + readonly attribute BaseAudioContext context; + readonly attribute unsigned long numberOfInputs; + readonly attribute unsigned long numberOfOutputs; + + // Channel up-mixing and down-mixing rules for all inputs. + [SetterThrows] + attribute unsigned long channelCount; + [SetterThrows, 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..86f559bffa --- /dev/null +++ b/dom/webidl/AudioParam.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://webaudio.github.io/web-audio-api/ + * + * 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 { + + 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..9f1559a9ed --- /dev/null +++ b/dom/webidl/AudioParamDescriptor.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/#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..d2e1821329 --- /dev/null +++ b/dom/webidl/AudioParamMap.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-audio-api/#audioparammap + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[SecureContext, Pref="dom.audioworklet.enabled", + 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..e7011d201c --- /dev/null +++ b/dom/webidl/AudioProcessingEvent.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. + */ + +[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..eecec85f3c --- /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] + void start (optional double when = 0); + + [Throws] + void 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..32e48facb3 --- /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, Pref="dom.audioworklet.enabled"] +interface AudioWorklet : Worklet { +}; diff --git a/dom/webidl/AudioWorkletGlobalScope.webidl b/dom/webidl/AudioWorkletGlobalScope.webidl new file mode 100644 index 0000000000..00fb234148 --- /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] + void 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..929d4f9281 --- /dev/null +++ b/dom/webidl/AudioWorkletNode.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://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, Pref="dom.audioworklet.enabled", + 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..ebf2a3292c --- /dev/null +++ b/dom/webidl/AutocompleteInfo.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/. + */ + +/** + * This dictionary is used for the input, textarea and select element's + * getAutocompleteInfo method. + */ + +dictionary AutocompleteInfo { + DOMString section = ""; + DOMString addressType = ""; + DOMString contactType = ""; + DOMString fieldName = ""; + 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..96eb898813 --- /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 = void (AudioBuffer decodedData); +callback DecodeErrorCallback = void (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, Pref="dom.audioworklet.enabled"] + readonly attribute AudioWorklet audioWorklet; + + [Throws] + Promise<void> resume(); + + attribute EventHandler onstatechange; + + [NewObject, Throws] + AudioBuffer createBuffer (unsigned long numberOfChannels, + unsigned long length, + float sampleRate); + + [Throws] + Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, + optional DecodeSuccessCallback successCallback, + optional DecodeErrorCallback errorCallback); + + // AudioNode creation + [NewObject] + 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(Float32Array real, + Float32Array 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..73eca0e8df --- /dev/null +++ b/dom/webidl/BiquadFilterNode.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://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] + void 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..0acbcc2a64 --- /dev/null +++ b/dom/webidl/Blob.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/FileAPI/#blob + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +typedef (BufferSource or Blob or USVString) BlobPart; + +[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..f435892670 --- /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] + void postMessage(any message); + + void 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..db705396c6 --- /dev/null +++ b/dom/webidl/CSPDictionaries.webidl @@ -0,0 +1,38 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * Dictionary used to display CSP info. + */ + +dictionary CSP { + boolean report-only = false; + + sequence<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; +}; + +[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..9ca57dbef3 --- /dev/null +++ b/dom/webidl/CSPReport.webidl @@ -0,0 +1,27 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * This dictionary holds the parameters used to send + * CSP reports in JSON format. + */ + +dictionary CSPReportProperties { + DOMString document-uri = ""; + DOMString referrer = ""; + DOMString blocked-uri = ""; + DOMString violated-directive = ""; + DOMString original-policy= ""; + DOMString source-file; + DOMString script-sample; + long line-number; + long column-number; +}; + +[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..5b29700253 --- /dev/null +++ b/dom/webidl/CSS.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/css3-conditional/ + * http://dev.w3.org/csswg/cssom/#the-css.escape%28%29-method + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[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); +}; 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..f60b9ed0c8 --- /dev/null +++ b/dom/webidl/CSSAnimation.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-animations-2/#the-CSSAnimation-interface + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Func="Document::IsWebAnimationsGetAnimationsEnabled", + 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..5ab3ae1dcd --- /dev/null +++ b/dom/webidl/CSSConditionRule.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-conditional/#the-cssconditionrule-interface + */ + +// https://drafts.csswg.org/css-conditional/#the-cssconditionrule-interface +[Exposed=Window] +interface CSSConditionRule : CSSGroupingRule { + [SetterThrows] + attribute UTF8String conditionText; +}; 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/CSSGroupingRule.webidl b/dom/webidl/CSSGroupingRule.webidl new file mode 100644 index 0000000000..5cf1d068e9 --- /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] + void deleteRule(unsigned long index); +}; diff --git a/dom/webidl/CSSImportRule.webidl b/dom/webidl/CSSImportRule.webidl new file mode 100644 index 0000000000..f54faf7ce1 --- /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; + // Per spec, the .styleSheet is never null, but in our implementation it can + // be. See <https://bugzilla.mozilla.org/show_bug.cgi?id=1326509>. + [SameObject] readonly attribute CSSStyleSheet? styleSheet; +}; 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..b79b531e63 --- /dev/null +++ b/dom/webidl/CSSKeyframesRule.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://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; + + void appendRule(DOMString rule); + void deleteRule(DOMString select); + CSSKeyframeRule? findRule(DOMString select); +}; 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..db7f7568b2 --- /dev/null +++ b/dom/webidl/CSSPageRule.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-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 { + // selectorText not implemented yet + // attribute DOMString selectorText; + [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; +}; 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..57713c43bf --- /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; + 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..39d988c174 --- /dev/null +++ b/dom/webidl/CSSStyleDeclaration.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://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); + + [Throws] + UTF8String getPropertyValue(UTF8String property); + UTF8String getPropertyPriority(UTF8String property); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + void setProperty(UTF8String property, [TreatNullAs=EmptyString] UTF8String value, optional [TreatNullAs=EmptyString] 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..739bd958bb --- /dev/null +++ b/dom/webidl/CSSStyleRule.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/#the-cssstylerule-interface + */ + +// https://drafts.csswg.org/cssom/#the-cssstylerule-interface +[Exposed=Window] +interface CSSStyleRule : CSSRule { + attribute UTF8String selectorText; + [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; +}; diff --git a/dom/webidl/CSSStyleSheet.webidl b/dom/webidl/CSSStyleSheet.webidl new file mode 100644 index 0000000000..b93589be48 --- /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, Pref="layout.css.constructable-stylesheets.enabled"] + 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] + void deleteRule(unsigned long index); + [Throws, Pref="layout.css.constructable-stylesheets.enabled"] + Promise<CSSStyleSheet> replace(UTF8String text); + [Throws, Pref="layout.css.constructable-stylesheets.enabled"] + void replaceSync(UTF8String text); + + // Non-standard WebKit things. + [Throws, NeedsSubjectPrincipal, BinaryName="cssRules"] + readonly attribute CSSRuleList rules; + [Throws, NeedsSubjectPrincipal, BinaryName="deleteRule"] + void 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..5c2f74173e --- /dev/null +++ b/dom/webidl/CSSTransition.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-transitions-2/#the-CSSTransition-interface + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Func="Document::IsWebAnimationsGetAnimationsEnabled", + 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..92aaf2d79c --- /dev/null +++ b/dom/webidl/Cache.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://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * + */ + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache + +[Exposed=(Window,Worker), + Pref="dom.caches.enabled"] +interface Cache { + [NewObject] + Promise<Response> match(RequestInfo request, optional CacheQueryOptions options = {}); + [NewObject] + Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options = {}); + [NewObject, NeedsCallerType] + Promise<void> add(RequestInfo request); + [NewObject, NeedsCallerType] + Promise<void> addAll(sequence<RequestInfo> requests); + [NewObject] + Promise<void> put(RequestInfo request, Response response); + [NewObject] + Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options = {}); + [NewObject] + Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options = {}); +}; + +dictionary CacheQueryOptions { + boolean ignoreSearch = false; + boolean ignoreMethod = false; + boolean ignoreVary = false; +}; + +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..e1100bdfed --- /dev/null +++ b/dom/webidl/CacheStorage.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://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * + */ + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache-storage + +interface Principal; + +[Exposed=(Window,Worker), + Pref="dom.caches.enabled"] +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..6851377cdc --- /dev/null +++ b/dom/webidl/CanvasCaptureMediaStream.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://w3c.github.io/mediacapture-fromelement/index.html + * + * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. + * W3C liability, trademark and document use rules apply. + */ + +[Pref="canvas.capturestream.enabled", + Exposed=Window] +interface CanvasCaptureMediaStream : MediaStream { + readonly attribute HTMLCanvasElement canvas; + void requestFrame(); +}; diff --git a/dom/webidl/CanvasRenderingContext2D.webidl b/dom/webidl/CanvasRenderingContext2D.webidl new file mode 100644 index 0000000000..c1622d8c28 --- /dev/null +++ b/dom/webidl/CanvasRenderingContext2D.webidl @@ -0,0 +1,408 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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" }; + +[GenerateInit] +dictionary ContextAttributes2D { + // whether or not we're planning to do a lot of readback operations + boolean willReadFrequently = false; + // signal if the canvas contains an alpha channel + boolean alpha = true; +}; + +dictionary HitRegionOptions { + Path2D? path = null; + DOMString id = ""; + Element? control = null; +}; + +typedef (HTMLImageElement or + SVGImageElement) HTMLOrSVGImageElement; + +typedef (HTMLOrSVGImageElement or + HTMLCanvasElement or + HTMLVideoElement or + ImageBitmap) CanvasImageSource; + +[Exposed=Window] +interface CanvasRenderingContext2D { + + // back-reference to the canvas. Might be null if we're not + // associated with a canvas. + readonly attribute HTMLCanvasElement? canvas; + + // Mozilla-specific stuff + // FIXME Bug 768048 mozCurrentTransform/mozCurrentTransformInverse should return a WebIDL array. + [Throws] + attribute object mozCurrentTransform; // [ m11, m12, m21, m22, dx, dy ], i.e. row major + [Throws] + attribute object mozCurrentTransformInverse; + + [SetterThrows] + attribute UTF8String mozTextStyle; + + // image smoothing mode -- if disabled, images won't be smoothed + // if scaled. + [Deprecated="PrefixedImageSmoothingEnabled", + BinaryName="imageSmoothingEnabled"] + attribute boolean mozImageSmoothingEnabled; + + // Show the caret if appropriate when drawing + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_DRAW_CARET = 0x01; + // Don't flush pending layout notifications that could otherwise + // be batched up + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_DO_NOT_FLUSH = 0x02; + // Draw scrollbars and scroll the viewport if they are present + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_DRAW_VIEW = 0x04; + // Use the widget layer manager if available. This means hardware + // acceleration may be used, but it might actually be slower or + // lower quality than normal. It will however more accurately reflect + // the pixels rendered to the screen. + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_USE_WIDGET_LAYERS = 0x08; + // Don't synchronously decode images - draw what we have + [Func="CanvasUtils::HasDrawWindowPrivilege"] + const unsigned long DRAWWINDOW_ASYNC_DECODE_IMAGES = 0x10; + + /** + * Renders a region of a window into the canvas. The contents of + * the window's viewport are rendered, ignoring viewport clipping + * and scrolling. + * + * @param x + * @param y + * @param w + * @param h specify the area of the window to render, in CSS + * pixels. + * + * @param backgroundColor the canvas is filled with this color + * before we render the window into it. This color may be + * transparent/translucent. It is given as a CSS color string + * (e.g., rgb() or rgba()). + * + * @param flags Used to better control the drawWindow call. + * Flags can be ORed together. + * + * Of course, the rendering obeys the current scale, transform and + * globalAlpha values. + * + * Hints: + * -- If 'rgba(0,0,0,0)' is used for the background color, the + * drawing will be transparent wherever the window is transparent. + * -- Top-level browsed documents are usually not transparent + * because the user's background-color preference is applied, + * but IFRAMEs are transparent if the page doesn't set a background. + * -- If an opaque color is used for the background color, rendering + * will be faster because we won't have to compute the window's + * transparency. + * + * This API cannot currently be used by Web content. It is chrome + * and Web Extensions (with a permission) only. + */ + [Throws, Func="CanvasUtils::HasDrawWindowPrivilege"] + void drawWindow(Window window, double x, double y, double w, double h, + 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] + void 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; +CanvasRenderingContext2D includes CanvasHitRegions; + + +interface mixin CanvasState { + // state + void save(); // push state on state stack + void restore(); // pop state stack and restore state +}; + +interface mixin CanvasTransform { + // transformations (default transform is the identity matrix) + [Throws, LenientFloat] + void scale(double x, double y); + [Throws, LenientFloat] + void rotate(double angle); + [Throws, LenientFloat] + void translate(double x, double y); + [Throws, LenientFloat] + void transform(double a, double b, double c, double d, double e, double f); + + [NewObject, Throws] DOMMatrix getTransform(); + [Throws, LenientFloat] + void setTransform(double a, double b, double c, double d, double e, double f); + [Throws] + void setTransform(optional DOMMatrix2DInit transform = {}); + [Throws] + void 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); + [Pref="canvas.createConicGradient.enabled", NewObject] + CanvasGradient createConicGradient(double angle, double cx, double cy); + [NewObject, Throws] + CanvasPattern? createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] 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 { + [Pref="canvas.filters.enabled", SetterThrows] + attribute UTF8String filter; // (default empty string = no filter) +}; + +interface mixin CanvasRect { + [LenientFloat] + void clearRect(double x, double y, double w, double h); + [LenientFloat] + void fillRect(double x, double y, double w, double h); + [LenientFloat] + void strokeRect(double x, double y, double w, double h); +}; + +interface mixin CanvasDrawPath { + // path API (see also CanvasPathMethods) + void beginPath(); + void fill(optional CanvasWindingRule winding = "nonzero"); + void fill(Path2D path, optional CanvasWindingRule winding = "nonzero"); + void stroke(); + void stroke(Path2D path); + void clip(optional CanvasWindingRule winding = "nonzero"); + void clip(Path2D path, optional CanvasWindingRule winding = "nonzero"); +// NOT IMPLEMENTED void resetClip(); + [NeedsSubjectPrincipal] + boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasWindingRule winding = "nonzero"); + [NeedsSubjectPrincipal] // Only required because overloads can't have different extended attributes. + boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y, optional CanvasWindingRule winding = "nonzero"); + [NeedsSubjectPrincipal] + boolean isPointInStroke(double x, double y); + [NeedsSubjectPrincipal] // Only required because overloads can't have different extended attributes. + boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y); +}; + +interface mixin CanvasUserInterface { + [Pref="canvas.focusring.enabled", Throws] void drawFocusIfNeeded(Element element); +// NOT IMPLEMENTED void scrollPathIntoView(); +// NOT IMPLEMENTED void scrollPathIntoView(Path path); +}; + +interface mixin CanvasText { + // text (see also the CanvasPathDrawingStyles interface) + [Throws, LenientFloat] + void fillText(DOMString text, double x, double y, optional double maxWidth); + [Throws, LenientFloat] + void strokeText(DOMString text, double x, double y, optional double maxWidth); + [NewObject, Throws] + TextMetrics measureText(DOMString text); +}; + +interface mixin CanvasDrawImage { + [Throws, LenientFloat] + void drawImage(CanvasImageSource image, double dx, double dy); + [Throws, LenientFloat] + void drawImage(CanvasImageSource image, double dx, double dy, double dw, double dh); + [Throws, LenientFloat] + void drawImage(CanvasImageSource image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh); +}; + +// 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] + void putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy); + [Throws] + void 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 DOMString lineCap; // "butt", "round", "square" (default "butt") + [GetterThrows] + attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") + [LenientFloat] + attribute double miterLimit; // (default 10) + + // dashed lines + [LenientFloat, Throws] void setLineDash(sequence<double> segments); // default empty + sequence<double> getLineDash(); + [LenientFloat] attribute double lineDashOffset; +}; + +interface mixin CanvasTextDrawingStyles { + // text + [SetterThrows] + attribute UTF8String font; // (default 10px sans-serif) + attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start") + attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic") +}; + +interface mixin CanvasPathMethods { + // shared path API methods + void closePath(); + [LenientFloat] + void moveTo(double x, double y); + [LenientFloat] + void lineTo(double x, double y); + [LenientFloat] + void quadraticCurveTo(double cpx, double cpy, double x, double y); + + [LenientFloat] + void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); + + [Throws, LenientFloat] + void arcTo(double x1, double y1, double x2, double y2, double radius); +// NOT IMPLEMENTED [LenientFloat] void arcTo(double x1, double y1, double x2, double y2, double radiusX, double radiusY, double rotation); + + [LenientFloat] + void rect(double x, double y, double w, double h); + + [Throws, LenientFloat] + void arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise = false); + + [Throws, LenientFloat] + void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, optional boolean anticlockwise = false); +}; + +interface mixin CanvasHitRegions { + // hit regions + [Pref="canvas.hitregions.enabled", Throws] void addHitRegion(optional HitRegionOptions options = {}); + [Pref="canvas.hitregions.enabled"] void removeHitRegion(DOMString id); + [Pref="canvas.hitregions.enabled"] void clearHitRegions(); +}; + +[Exposed=Window] +interface CanvasGradient { + // opaque object + [Throws] + // addColorStop should take a double + void addColorStop(float offset, UTF8String color); +}; + +[Exposed=Window] +interface CanvasPattern { + // opaque object + // [Throws, LenientFloat] - could not do this overload because of bug 1020975 + // void setTransform(double a, double b, double c, double d, double e, double f); + + [Throws] + void setTransform(optional DOMMatrix2DInit matrix = {}); +}; + +[Exposed=Window] +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; +}; + +[Pref="canvas.path.enabled", + Exposed=Window] +interface Path2D +{ + constructor(); + constructor(Path2D other); + constructor(DOMString pathString); + + [Throws] void 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..5fdb9f34b3 --- /dev/null +++ b/dom/webidl/CaretStateChangedEvent.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/. + */ + +enum CaretChangedReason { + "visibilitychange", + "updateposition", + "longpressonemptycontent", + "taponcaret", + "presscaret", + "releasecaret", + "scroll" +}; + +dictionary CaretStateChangedEventInit : EventInit { + boolean collapsed = true; + DOMRectReadOnly? boundingClientRect = null; + CaretChangedReason reason = "visibilitychange"; + boolean caretVisible = false; + boolean caretVisuallyVisible = false; + boolean selectionVisible = false; + boolean selectionEditable = false; + DOMString selectedTextContent = ""; +}; + +[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; +}; 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..ebd4e8fdc5 --- /dev/null +++ b/dom/webidl/ChannelSplitterNode.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 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..ca9b5248fc --- /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 [TreatNullAs=EmptyString] DOMString data; + [Pure] + readonly attribute unsigned long length; + [Throws] + DOMString substringData(unsigned long offset, unsigned long count); + [Throws] + void appendData(DOMString data); + [Throws] + void insertData(unsigned long offset, DOMString data); + [Throws] + void deleteData(unsigned long offset, unsigned long count); + [Throws] + void replaceData(unsigned long offset, unsigned long count, DOMString data); +}; + +CharacterData includes ChildNode; +CharacterData includes NonDocumentTypeChildNode; diff --git a/dom/webidl/CheckerboardReportService.webidl b/dom/webidl/CheckerboardReportService.webidl new file mode 100644 index 0000000000..f8dbd8dbd5 --- /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. + */ + void setRecordingEnabled(boolean aEnabled); + + /** + * Flush any in-progress checkerboard reports. Since this happens + * asynchronously, the caller may register an observer with the observer + * service to be notified when this operation is complete. The observer should + * listen for the topic "APZ:FlushActiveCheckerboard:Done". Upon receiving + * this notification, the caller may call getReports() to obtain the flushed + * reports, along with any other reports that are available. + */ + void flushActiveReports(); +}; diff --git a/dom/webidl/ChildNode.webidl b/dom/webidl/ChildNode.webidl new file mode 100644 index 0000000000..3b1254638d --- /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] + void before((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + void after((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + void replaceWith((Node or DOMString)... nodes); + [CEReactions, Unscopable] + void remove(); +}; + +interface mixin NonDocumentTypeChildNode { + [Pure] + readonly attribute Element? previousElementSibling; + [Pure] + readonly attribute Element? nextElementSibling; +}; diff --git a/dom/webidl/ChildSHistory.webidl b/dom/webidl/ChildSHistory.webidl new file mode 100644 index 0000000000..e83e01e11f --- /dev/null +++ b/dom/webidl/ChildSHistory.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/. + */ + +interface nsISHistory; + +/** + * The ChildSHistory interface represents the child side of a browsing + * context's session history. + */ +[ChromeOnly, + Exposed=Window] +interface ChildSHistory { + [Pure] + readonly attribute long count; + [Pure] + readonly attribute long index; + + boolean canGo(long aOffset); + [Throws] void go(long aOffset, optional boolean aRequireUserInteraction = false); + + /** + * Reload the current entry. The flags which should be passed to this + * function are documented and defined in nsIWebNavigation.idl + */ + [Throws] + void reload(unsigned long aReloadFlags); + + /** + * Getter for the legacy nsISHistory implementation. + * + * legacySHistory has been deprecated. Don't use it, but instead handle + * the interaction with nsISHistory in the parent process. + */ + [Throws] + readonly attribute nsISHistory legacySHistory; + + /** + * asyncHistoryLength can be enabled to test Fission-like asynchronous + * history.length handling with non-Fission session history implementation. + * Throws if session history is running in the parent process. + */ + [SetterThrows] + attribute boolean asyncHistoryLength; +}; diff --git a/dom/webidl/ChromeNodeList.webidl b/dom/webidl/ChromeNodeList.webidl new file mode 100644 index 0000000000..89a263f842 --- /dev/null +++ b/dom/webidl/ChromeNodeList.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/. + */ + +[ChromeOnly, + Exposed=Window] +interface ChromeNodeList : NodeList { + constructor(); + + [Throws] + void append(Node aNode); + [Throws] + void remove(Node aNode); +}; diff --git a/dom/webidl/Client.webidl b/dom/webidl/Client.webidl new file mode 100644 index 0000000000..a832d4d23f --- /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] + void postMessage(any message, sequence<object> transfer); + [Throws] + void postMessage(any message, optional PostMessageOptions 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..ebf336a648 --- /dev/null +++ b/dom/webidl/Clients.webidl @@ -0,0 +1,37 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * + */ + +[Exposed=ServiceWorker] +interface Clients { + // The objects returned will be new instances every time + [NewObject] + Promise<any> get(DOMString id); + [NewObject] + Promise<sequence<Client>> matchAll(optional ClientQueryOptions options = {}); + [NewObject] + Promise<WindowClient?> openWindow(USVString url); + [NewObject] + Promise<void> claim(); +}; + +dictionary ClientQueryOptions { + boolean includeUncontrolled = false; + ClientType type = "window"; +}; + +enum ClientType { + "window", + "worker", + "sharedworker", + // https://github.com/w3c/ServiceWorker/issues/1036 + "serviceworker", + "all" +}; + diff --git a/dom/webidl/Clipboard.webidl b/dom/webidl/Clipboard.webidl new file mode 100644 index 0000000000..3fcd2d1765 --- /dev/null +++ b/dom/webidl/Clipboard.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/clipboard-apis/ + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + + +[SecureContext, Exposed=Window, Pref="dom.events.asyncClipboard"] +interface Clipboard : EventTarget { + [Pref="dom.events.asyncClipboard.dataTransfer", Throws, NeedsSubjectPrincipal] + Promise<DataTransfer> read(); + [Func="Clipboard::ReadTextEnabled", Throws, NeedsSubjectPrincipal] + Promise<DOMString> readText(); + + [Pref="dom.events.asyncClipboard.dataTransfer", Throws, NeedsSubjectPrincipal] + Promise<void> write(DataTransfer data); + [Throws, NeedsSubjectPrincipal] + Promise<void> writeText(DOMString data); +}; 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/CommandEvent.webidl b/dom/webidl/CommandEvent.webidl new file mode 100644 index 0000000000..da18f0dede --- /dev/null +++ b/dom/webidl/CommandEvent.webidl @@ -0,0 +1,10 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[ChromeOnly, Exposed=Window] +interface CommandEvent : Event { + readonly attribute DOMString? command; +}; 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..fa8ed8498c --- /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 +{ + void initCompositionEvent(DOMString typeArg, + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional Window? viewArg = null, + optional DOMString? dataArg = null, + optional DOMString localeArg = ""); +}; diff --git a/dom/webidl/Console.webidl b/dom/webidl/Console.webidl new file mode 100644 index 0000000000..fbec19a870 --- /dev/null +++ b/dom/webidl/Console.webidl @@ -0,0 +1,245 @@ +/* -*- 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] + void assert(optional boolean condition = false, any... data); + [UseCounter] + void clear(); + [UseCounter] + void count(optional DOMString label = "default"); + [UseCounter] + void countReset(optional DOMString label = "default"); + [UseCounter] + void debug(any... data); + [UseCounter] + void error(any... data); + [UseCounter] + void info(any... data); + [UseCounter] + void log(any... data); + [UseCounter] + void table(any... data); // FIXME: The spec is still unclear about this. + [UseCounter] + void trace(any... data); + [UseCounter] + void warn(any... data); + [UseCounter] + void dir(any... data); // FIXME: This doesn't follow the spec yet. + [UseCounter] + void dirxml(any... data); + + // Grouping + [UseCounter] + void group(any... data); + [UseCounter] + void groupCollapsed(any... data); + [UseCounter] + void groupEnd(); + + // Timing + [UseCounter] + void time(optional DOMString label = "default"); + [UseCounter] + void timeLog(optional DOMString label = "default", any... data); + [UseCounter] + void timeEnd(optional DOMString label = "default"); + + // Mozilla only or Webcompat methods + + [UseCounter] + void _exception(any... data); + [UseCounter] + void timeStamp(optional any data); + + [UseCounter] + void profile(any... data); + [UseCounter] + void profileEnd(any... data); + + [ChromeOnly] + const boolean IS_NATIVE_CONSOLE = true; + + [ChromeOnly, NewObject] + ConsoleInstance createInstance(optional ConsoleInstanceOptions options = {}); +}; + +// This is used to propagate console events to the observers. +[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; + 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 + void assert(optional boolean condition = false, any... data); + void clear(); + void count(optional DOMString label = "default"); + void countReset(optional DOMString label = "default"); + void debug(any... data); + void error(any... data); + void info(any... data); + void log(any... data); + void table(any... data); // FIXME: The spec is still unclear about this. + void trace(any... data); + void warn(any... data); + void dir(any... data); // FIXME: This doesn't follow the spec yet. + void dirxml(any... data); + + // Grouping + void group(any... data); + void groupCollapsed(any... data); + void groupEnd(); + + // Timing + void time(optional DOMString label = "default"); + void timeLog(optional DOMString label = "default", any... data); + void timeEnd(optional DOMString label = "default"); + + // Mozilla only or Webcompat methods + + void _exception(any... data); + void timeStamp(optional any data); + + void profile(any... data); + void profileEnd(any... data); +}; + +callback ConsoleInstanceDumpCallback = void (DOMString message); + +enum ConsoleLogLevel { + "All", "Debug", "Log", "Info", "Clear", "Trace", "TimeLog", "TimeEnd", "Time", + "Group", "GroupEnd", "Profile", "ProfileEnd", "Dir", "Dirxml", "Warn", "Error", + "Off" +}; + +dictionary ConsoleInstanceOptions { + // An optional function to intercept all strings written to stdout. + ConsoleInstanceDumpCallback dump; + + // An optional prefix string to be printed before the actual logged message. + DOMString prefix = ""; + + // An ID representing the source of the message. Normally the inner ID of a + // DOM window. + DOMString innerID = ""; + + // String identified for the console, this will be passed through the console + // notifications. + DOMString consoleID = ""; + + // Identifier that allows to filter which messages are logged based on their + // log level. + ConsoleLogLevel maxLogLevel; + + // String pref name which contains the level to use for maxLogLevel. If the + // pref doesn't exist, gets removed or it is used in workers, the maxLogLevel + // will default to the value passed to this constructor (or "all" if it wasn't + // specified). + DOMString maxLogLevelPref = ""; +}; + +enum ConsoleLevel { "log", "warning", "error" }; + +// this interface is just for testing +partial interface ConsoleInstance { + [ChromeOnly] + void reportForServiceWorkerScope(DOMString scope, DOMString message, + DOMString filename, unsigned long lineNumber, + unsigned long columnNumber, + ConsoleLevel level); +}; diff --git a/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/ConvolverNode.webidl b/dom/webidl/ConvolverNode.webidl new file mode 100644 index 0000000000..c6f55587fd --- /dev/null +++ b/dom/webidl/ConvolverNode.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://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..8ce5c5986a --- /dev/null +++ b/dom/webidl/CredentialManagement.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://www.w3.org/TR/credential-management-1/ + */ + +[Exposed=Window, SecureContext, Pref="security.webauth.webauthn"] +interface Credential { + readonly attribute USVString id; + readonly attribute DOMString type; +}; + +[Exposed=Window, SecureContext, Pref="security.webauth.webauthn"] +interface CredentialsContainer { + [Throws] + Promise<Credential?> get(optional CredentialRequestOptions options = {}); + [Throws] + Promise<Credential?> create(optional CredentialCreationOptions options = {}); + [Throws] + Promise<Credential> store(Credential credential); + [Throws] + Promise<void> preventSilentAccess(); +}; + +dictionary CredentialRequestOptions { + // FIXME: bug 1493860: should this "= {}" be here? + PublicKeyCredentialRequestOptions publicKey = {}; + AbortSignal signal; +}; + +dictionary CredentialCreationOptions { + // FIXME: bug 1493860: should this "= {}" be here? + PublicKeyCredentialCreationOptions publicKey = {}; + AbortSignal signal; +}; diff --git a/dom/webidl/Crypto.webidl b/dom/webidl/Crypto.webidl new file mode 100644 index 0000000000..7e11462bb0 --- /dev/null +++ b/dom/webidl/Crypto.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://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); +}; diff --git a/dom/webidl/CustomElementRegistry.webidl b/dom/webidl/CustomElementRegistry.webidl new file mode 100644 index 0000000000..aea345d647 --- /dev/null +++ b/dom/webidl/CustomElementRegistry.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/. */ + +// https://html.spec.whatwg.org/#dom-window-customelements +[Exposed=Window] +interface CustomElementRegistry { + [CEReactions, Throws, UseCounter] + void define(DOMString name, CustomElementConstructor constructor, + optional ElementDefinitionOptions options = {}); + [ChromeOnly, Throws] + void setElementCreationCallback(DOMString name, CustomElementCreationCallback callback); + any get(DOMString name); + [Throws] + Promise<CustomElementConstructor> whenDefined(DOMString name); + [CEReactions] void upgrade(Node root); +}; + +dictionary ElementDefinitionOptions { + DOMString extends; +}; + +callback constructor CustomElementConstructor = any (); + +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback CustomElementCreationCallback = void (DOMString name); diff --git a/dom/webidl/CustomEvent.webidl b/dom/webidl/CustomEvent.webidl new file mode 100644 index 0000000000..31296afd7b --- /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. + void initCustomEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional any detail = null); +}; + +dictionary CustomEventInit : EventInit +{ + any detail = null; +}; diff --git a/dom/webidl/DOMException.webidl b/dom/webidl/DOMException.webidl new file mode 100644 index 0000000000..eb07a951bf --- /dev/null +++ b/dom/webidl/DOMException.webidl @@ -0,0 +1,108 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#exception-domexception + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + + +// This is the WebIDL version of nsIException. This is mostly legacy stuff. + +interface StackFrame; + +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; +}; + +[NoInterfaceObject, Exposed=(Window,Worker)] +interface Exception { + // The name of the error code (ie, a string repr of |result|). + readonly attribute DOMString name; + // A custom message set by the thrower. + [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)] +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..814e616a2d --- /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, + [TreatNullAs=EmptyString] 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..b31ba847d9 --- /dev/null +++ b/dom/webidl/DOMLocalization.webidl @@ -0,0 +1,148 @@ +/* -*- 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. + * - aBundleGenerator - an object with two methods - `generateBundles` and + * `generateBundlesSync` allowing consumers to overload the + * default generators provided by Gecko. + */ + [Throws] + constructor(sequence<DOMString> aResourceIds, + optional boolean aSync = false, + optional BundleGenerator aBundleGenerator = {}); + + /** + * Adds a node to nodes observed for localization + * related changes. + */ + [Throws] void connectRoot(Node aElement); + + /** + * Removes a node from nodes observed for localization + * related changes. + */ + [Throws] void disconnectRoot(Node aElement); + + /** + * Pauses the MutationObserver set to observe + * localization related DOM mutations. + */ + [Throws] void pauseObserving(); + + /** + * Resumes the MutationObserver set to observe + * localization related DOM mutations. + */ + [Throws] void 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] void 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); + + /** + * 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<void> 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<void> translateRoots(); +}; diff --git a/dom/webidl/DOMMatrix.webidl b/dom/webidl/DOMMatrix.webidl new file mode 100644 index 0000000000..056fad85b1 --- /dev/null +++ b/dom/webidl/DOMMatrix.webidl @@ -0,0 +1,188 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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. + */ + +[Pref="layout.css.DOMMatrix.enabled", + 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(); +}; + +[Pref="layout.css.DOMMatrix.enabled", + 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..cce5c13236 --- /dev/null +++ b/dom/webidl/DOMParser.webidl @@ -0,0 +1,50 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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] + 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] + void 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"] + void forceEnableDTD(); +}; + diff --git a/dom/webidl/DOMPoint.webidl b/dom/webidl/DOMPoint.webidl new file mode 100644 index 0000000000..b7fdaa4344 --- /dev/null +++ b/dom/webidl/DOMPoint.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/. + * + * 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. + */ + +[Pref="layout.css.DOMPoint.enabled", + 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(); +}; + +[Pref="layout.css.DOMPoint.enabled", + 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..362a2b40d3 --- /dev/null +++ b/dom/webidl/DOMQuad.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://drafts.fxtf.org/geometry/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Pref="layout.css.DOMQuad.enabled", + 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..cbb3365bd9 --- /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; +}; + +[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] + void 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..9e27adc8fd --- /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. + */ + +[OverrideBuiltins, + Exposed=Window] +interface DOMStringMap { + getter DOMString (DOMString name); + [CEReactions, Throws] + setter void (DOMString name, DOMString value); + [CEReactions] + deleter void (DOMString name); +}; diff --git a/dom/webidl/DOMTokenList.webidl b/dom/webidl/DOMTokenList.webidl new file mode 100644 index 0000000000..70dda92dd2 --- /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] + void add(DOMString... tokens); + [CEReactions, Throws] + void remove(DOMString... tokens); + [CEReactions, Throws] + boolean replace(DOMString token, DOMString newToken); + [CEReactions, Throws] + boolean toggle(DOMString token, optional boolean force); + [Throws] + boolean supports(DOMString token); + [CEReactions, SetterThrows, 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..7f7528d9c0 --- /dev/null +++ b/dom/webidl/DataTransfer.webidl @@ -0,0 +1,184 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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; + + void setDragImage(Element image, long x, long y); + + // ReturnValueNeedsContainsHack on .types because lots of extension + // code was expecting .contains() back when it was a DOMStringList. + [Pure, Cached, Frozen, NeedsCallerType, ReturnValueNeedsContainsHack] + readonly attribute sequence<DOMString> types; + [Throws, NeedsSubjectPrincipal] + DOMString getData(DOMString format); + [Throws, NeedsSubjectPrincipal] + void setData(DOMString format, DOMString data); + [Throws, NeedsSubjectPrincipal] + void clearData(optional DOMString format); + [NeedsSubjectPrincipal] + readonly attribute FileList? files; +}; + +partial interface DataTransfer { + [Throws, Pref="dom.input.dirpicker", NeedsSubjectPrincipal] + Promise<sequence<(File or Directory)>> getFilesAndDirectories(); + + [Throws, Pref="dom.input.dirpicker", NeedsSubjectPrincipal] + Promise<sequence<File>> getFiles(optional boolean recursiveFlag = false); +}; + +// Mozilla specific stuff +partial interface DataTransfer { + /* + * Set the drag source. Usually you would not change this, but it will + * affect which node the drag and dragend events are fired at. The + * default target is the node that was dragged. + * + * @param element drag source to use + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + [Throws, UseCounter] + void addElement(Element element); + + /** + * The number of items being dragged. + */ + [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, NeedsCallerType, 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, NeedsSubjectPrincipal, ChromeOnly] + void mozClearDataAt(DOMString format, unsigned long index); + + /* + * A data transfer may store multiple items, each at a given zero-based + * index. setDataAt may only be called with an index argument less than + * itemCount in which case an existing item is modified, or equal to + * itemCount in which case a new item is added, and the itemCount is + * incremented by one. + * + * Data should be added in order of preference, with the most specific + * format added first and the least specific format added last. If data of + * the given format already exists, it is replaced in the same position as + * the old data. + * + * The data should be either a string, a primitive boolean or number type + * (which will be converted into a string) or an nsISupports. + * + * @param format the format to add + * @param data the data to add + * @throws NS_ERROR_NULL_POINTER if the data is null + * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater than itemCount + * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified + */ + [Throws, NeedsSubjectPrincipal, ChromeOnly] + void mozSetDataAt(DOMString format, any data, unsigned long index); + + /** + * Retrieve the data associated with the given format for an item at the + * specified index, or null if it does not exist. The index should be in the + * range from zero to itemCount - 1. + * + * @param format the format of the data to look up + * @returns the data of the given format, or null if it doesn't exist. + * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount + */ + [Throws, NeedsSubjectPrincipal, 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] + void updateDragImage(Element image, long x, long y); + + /** + * Will be true when the user has cancelled the drag (typically by pressing + * Escape) and when the drag has been cancelled unexpectedly. This will be + * false otherwise, including when the drop has been rejected by its target. + * This property is only relevant for the dragend event. + */ + [UseCounter] + readonly attribute boolean mozUserCancelled; + + /** + * The node that the mouse was pressed over to begin the drag. For external + * drags, or if the caller cannot access this node, this will be null. + */ + [UseCounter] + readonly attribute Node? mozSourceNode; + + /** + * The URI spec of the triggering principal. This may be different than + * sourceNode's principal when sourceNode is xul:browser and the drag is + * triggered in a browsing context inside it. + */ + [ChromeOnly] + readonly attribute DOMString mozTriggeringPrincipalURISpec; + + [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); +}; diff --git a/dom/webidl/DataTransferItem.webidl b/dom/webidl/DataTransferItem.webidl new file mode 100644 index 0000000000..dded448bbf --- /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 + */ + +[Exposed=Window] +interface DataTransferItem { + readonly attribute DOMString kind; + readonly attribute DOMString type; + [Throws, NeedsSubjectPrincipal] + void getAsString(FunctionStringCallback? callback); + [Throws, NeedsSubjectPrincipal] + File? getAsFile(); +}; + +callback FunctionStringCallback = void (DOMString data); + +// 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..ced0bbc074 --- /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] + void remove(unsigned long index); + [Throws, NeedsSubjectPrincipal] + void clear(); +}; diff --git a/dom/webidl/DecoderDoctorNotification.webidl b/dom/webidl/DecoderDoctorNotification.webidl new file mode 100644 index 0000000000..911531c992 --- /dev/null +++ b/dom/webidl/DecoderDoctorNotification.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 DecoderDoctorNotificationType { + "cannot-play", + "platform-decoder-not-found", + "can-play-but-some-missing-decoders", + "cannot-initialize-pulseaudio", + "unsupported-libavcodec", + "decode-error", + "decode-warning", +}; + +[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/DedicatedWorkerGlobalScope.webidl b/dom/webidl/DedicatedWorkerGlobalScope.webidl new file mode 100644 index 0000000000..05a73be2b5 --- /dev/null +++ b/dom/webidl/DedicatedWorkerGlobalScope.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.whatwg.org/specs/web-apps/current-work/multipage/workers.html#the-workerglobalscope-common-interface + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera + * Software ASA. + * You are granted a license to use, reproduce and create derivative works of + * this document. + */ + +[Global=(Worker,DedicatedWorker), + Exposed=DedicatedWorker] +interface DedicatedWorkerGlobalScope : WorkerGlobalScope { + [Replaceable] + readonly attribute DOMString name; + + [Throws] + void postMessage(any message, sequence<object> transfer); + [Throws] + void postMessage(any message, optional PostMessageOptions options = {}); + + void close(); + + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; diff --git a/dom/webidl/DelayNode.webidl b/dom/webidl/DelayNode.webidl new file mode 100644 index 0000000000..f71ad6f651 --- /dev/null +++ b/dom/webidl/DelayNode.webidl @@ -0,0 +1,30 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://webaudio.github.io/web-audio-api/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary 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..c46cf6730a --- /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/ + */ + +[NoInterfaceObject, + Exposed=Window] +interface DeviceAcceleration { + readonly attribute double? x; + readonly attribute double? y; + readonly attribute double? z; +}; + +[NoInterfaceObject, + 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 { + void initDeviceMotionEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional DeviceAccelerationInit acceleration = {}, + optional DeviceAccelerationInit accelerationIncludingGravity = {}, + optional DeviceRotationRateInit rotationRate = {}, + optional double? interval = null); +}; diff --git a/dom/webidl/DeviceOrientationEvent.webidl b/dom/webidl/DeviceOrientationEvent.webidl new file mode 100644 index 0000000000..5acbbaa6ce --- /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. + void initDeviceOrientationEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional double? alpha = null, + optional double? beta = null, + optional double? gamma = null, + optional boolean absolute = false); +}; + +dictionary DeviceOrientationEventInit : EventInit +{ + double? alpha = null; + double? beta = null; + double? gamma = null; + boolean absolute = false; +}; diff --git a/dom/webidl/DeviceProximityEvent.webidl b/dom/webidl/DeviceProximityEvent.webidl new file mode 100644 index 0000000000..26ae0ce11c --- /dev/null +++ b/dom/webidl/DeviceProximityEvent.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/. + */ + +[Pref="device.sensors.proximity.enabled", Func="nsGlobalWindowInner::DeviceSensorsEnabled", + Exposed=Window] +interface DeviceProximityEvent : Event +{ + constructor(DOMString type, + optional DeviceProximityEventInit eventInitDict = {}); + + readonly attribute double value; + readonly attribute double min; + readonly attribute double max; +}; + +dictionary DeviceProximityEventInit : EventInit +{ + unrestricted double value = Infinity; + unrestricted double min = -Infinity; + unrestricted double max = Infinity; +}; diff --git a/dom/webidl/Directory.webidl b/dom/webidl/Directory.webidl new file mode 100644 index 0000000000..80d3a626c1 --- /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. + */ + [Throws] + Promise<sequence<(File or Directory)>> getFilesAndDirectories(); + + [Throws] + 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..4a24d666bb --- /dev/null +++ b/dom/webidl/Document.webidl @@ -0,0 +1,698 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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] +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 + // void prepend((Node or DOMString)... nodes); + // void append((Node or DOMString)... nodes); + + // These are not in the spec, but leave them for now for backwards compat. + // So sort of like Gecko extensions + [NewObject, Throws] + CDATASection createCDATASection(DOMString data); + [NewObject, Throws] + Attr createAttribute(DOMString name); + [NewObject, Throws] + Attr createAttributeNS(DOMString? namespace, DOMString name); +}; + +// https://html.spec.whatwg.org/multipage/dom.html#the-document-object +partial interface Document { + [PutForwards=href, Unforgeable] readonly attribute Location? location; + [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] + void close(); + [CEReactions, Throws] + void write(DOMString... text); + [CEReactions, Throws] + void 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 + [LenientThis] attribute EventHandler onreadystatechange; + + // Gecko extensions? + attribute EventHandler onbeforescriptexecute; + attribute EventHandler onafterscriptexecute; + + [Pref="dom.select_events.enabled"] + attribute EventHandler onselectionchange; + + /** + * True if this document is synthetic : stand alone image, video, audio file, + * etc. + */ + [Func="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> + */ + void releaseCapture(); + /** + * Use the given DOM element as the source image of target |-moz-element()|. + * + * This function introduces a new special ID (called "image element ID"), + * which is only used by |-moz-element()|, and associates it with the given + * DOM element. Image elements ID's have the higher precedence than general + * HTML id's, so if |document.mozSetImageElement(<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] + void 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 [TreatNullAs=EmptyString] DOMString fgColor; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString linkColor; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString vlinkColor; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString alinkColor; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor; + + [SameObject] readonly attribute HTMLCollection anchors; + [SameObject] readonly attribute HTMLCollection applets; + + void clear(); + // @deprecated These are old Netscape 4 methods. Do not use, + // the implementation is no-op. + // XXXbz do we actually need these anymore? + void captureEvents(); + void 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. + [LenientSetter, Unscopable] + readonly attribute boolean fullscreen; + [BinaryName="fullscreen"] + readonly attribute boolean mozFullScreen; + [LenientSetter, NeedsCallerType] + readonly attribute boolean fullscreenEnabled; + [BinaryName="fullscreenEnabled", NeedsCallerType] + readonly attribute boolean mozFullScreenEnabled; + + [Throws] + Promise<void> exitFullscreen(); + [Throws, BinaryName="exitFullscreen"] + Promise<void> 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 { + void exitPointerLock(); + + // Event handlers + attribute EventHandler onpointerlockchange; + attribute EventHandler onpointerlockerror; +}; + +// Mozilla-internal document extensions specific to error pages. +partial interface Document { + [Func="Document::CallerIsTrustedAboutCertError"] + Promise<any> addCertException(boolean isTemporary); + + [Func="Document::CallerIsTrustedAboutCertError", Throws] + FailedCertSecurityInfo getFailedCertSecurityInfo(); + + [Func="Document::CallerIsTrustedAboutNetError", Throws] + NetErrorInfo getNetErrorInfo(); + + [Func="Document::CallerIsTrustedAboutNetError"] + attribute boolean allowDeprecatedTls; +}; + +// https://w3c.github.io/page-visibility/#extensions-to-the-document-interface +partial interface Document { + readonly attribute boolean hidden; + readonly attribute VisibilityState visibilityState; + attribute EventHandler onvisibilitychange; +}; + +// https://drafts.csswg.org/cssom/#extensions-to-the-document-interface +partial interface Document { + attribute DOMString? selectedStyleSheetSet; + readonly attribute DOMString? lastStyleSheetSet; + readonly attribute DOMString? preferredStyleSheetSet; + [Constant] + readonly attribute DOMStringList styleSheetSets; + void enableStyleSheetsForSet (DOMString? name); +}; + +// https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface +partial interface Document { + CaretPosition? caretPositionFromPoint (float x, float y); + + readonly attribute Element? scrollingElement; +}; + +// http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions +partial interface Document { + [Throws, Pure] + Element? querySelector(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] readonly attribute DOMString contentLanguage; + + [ChromeOnly] readonly attribute nsILoadGroup? documentLoadGroup; + + // Blocks the initial document parser until the given promise is settled. + [ChromeOnly, Throws] + Promise<any> blockParsing(Promise<any> promise, + optional BlockParsingOptions options = {}); + + // like documentURI, except that for error pages, it returns the URI we were + // trying to load when we hit an error, rather than the error page's own URI. + [ChromeOnly] readonly attribute URI? mozDocumentURIIfNotForErrorPages; + + // A promise that is resolved, with this document itself, when we have both + // fired DOMContentLoaded and are ready to start layout. This is used for the + // "document_idle" webextension script injection point. + [ChromeOnly, Throws] + readonly attribute Promise<Document> documentReadyForIdle; + + // Lazily created command dispatcher, returns null if the document is not + // chrome privileged. + [ChromeOnly] + readonly attribute XULCommandDispatcher? commandDispatcher; + + [ChromeOnly] + attribute Node? popupNode; + + // The JS debugger uses DOM mutation events to implement DOM mutation + // breakpoints. This is used to avoid logging a warning that the user + // cannot address and have no control over. + [ChromeOnly] + attribute boolean dontWarnAboutMutationEventsAndAllowSlowDOMMutations; + + /** + * These attributes correspond to rangeParent and rangeOffset. They will help + * you find where in the DOM the popup is happening. Can be accessed only + * during a popup event. Accessing any other time will be an error. + */ + [Throws, ChromeOnly] + readonly attribute Node? popupRangeParent; + [Throws, ChromeOnly] + readonly attribute long popupRangeOffset; + [ChromeOnly] + attribute Node? tooltipNode; + + /** + * 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. + * The supplied content is cloned and inserted into the document's CanvasFrame. + * Note that this only works for HTML documents. + */ +partial interface Document { + /** + * Deep-clones the provided element and inserts it into the CanvasFrame. + * Returns an AnonymousContent instance that can be used to manipulate the + * inserted element. + */ + [ChromeOnly, NewObject, Throws] + AnonymousContent insertAnonymousContent(Element aElement); + + /** + * Removes the element inserted into the CanvasFrame given an AnonymousContent + * instance. + */ + [ChromeOnly, Throws] + void removeAnonymousContent(AnonymousContent aContent); +}; + +// http://w3c.github.io/selection-api/#extensions-to-document-interface +partial interface Document { + [Throws] + Selection? getSelection(); +}; + +// https://github.com/whatwg/html/issues/3338 +partial interface Document { + [Pref="dom.storage_access.enabled", Throws] + Promise<boolean> hasStorageAccess(); + [Pref="dom.storage_access.enabled", Throws] + Promise<void> requestStorageAccess(); +}; + +enum DocumentAutoplayPolicy { + "allowed", // autoplay is currently allowed + "allowed-muted", // muted video autoplay is currently allowed + "disallowed" // autoplay is not current allowed +}; + +// https://github.com/WICG/autoplay/issues/1 +partial interface Document { + [Pref="dom.media.autoplay.autoplay-policy-api"] + readonly attribute DocumentAutoplayPolicy autoplayPolicy; +}; + +// 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] + void notifyUserGestureActivation(); + // For testing only. + [ChromeOnly] + void clearUserGestureActivation(); + [ChromeOnly] + readonly attribute boolean hasBeenUserGestureActivated; + [ChromeOnly] + readonly attribute boolean hasValidTransientUserGestureActivation; + [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] + void 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; +}; + +// For more information on Flash classification, see +// toolkit/components/url-classifier/flash-block-lists.rst +enum FlashClassification { + "unknown", // Site is not on the whitelist or blacklist + "allowed", // Site is on the Flash whitelist + "denied" // Site is on the Flash blacklist +}; +partial interface Document { + [ChromeOnly] + readonly attribute FlashClassification documentFlashClassification; +}; + +partial interface Document { + [Func="Document::DocumentSupportsL10n"] readonly attribute DocumentL10n? l10n; +}; + +Document includes XPathEvaluatorMixin; +Document includes GlobalEventHandlers; +Document includes DocumentAndElementEventHandlers; +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] + void 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"] + void userInteractionForTesting(); +}; + +// Extension for permission delegation. +partial interface Document { + [ChromeOnly, Pure] + readonly attribute nsIPermissionDelegateHandler permDelegateHandler; +}; 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..dd4177c86f --- /dev/null +++ b/dom/webidl/DocumentOrShadowRoot.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://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; + [LenientSetter] + 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 { + [Func="Document::IsWebAnimationsGetAnimationsEnabled"] + 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. + [Pure, Cached, Frozen, SetterThrows, Pref="layout.css.constructable-stylesheets.enabled"] + attribute sequence<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..79909bef37 --- /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; + + void initDragEvent(DOMString type, + optional boolean canBubble = false, + optional boolean cancelable = false, + optional Window? aView = null, + optional long aDetail = 0, + optional long aScreenX = 0, + optional long aScreenY = 0, + optional long aClientX = 0, + optional long aClientY = 0, + optional boolean aCtrlKey = false, + optional boolean aAltKey = false, + optional boolean aShiftKey = false, + optional boolean aMetaKey = false, + optional unsigned short aButton = 0, + optional EventTarget? aRelatedTarget = null, + optional DataTransfer? aDataTransfer = null); +}; + +dictionary DragEventInit : MouseEventInit +{ + DataTransfer? dataTransfer = null; +}; diff --git a/dom/webidl/DynamicsCompressorNode.webidl b/dom/webidl/DynamicsCompressorNode.webidl new file mode 100644 index 0000000000..153094b353 --- /dev/null +++ b/dom/webidl/DynamicsCompressorNode.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 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..ea305f4bb2 --- /dev/null +++ b/dom/webidl/Element.webidl @@ -0,0 +1,378 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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. + */ + +[Exposed=Window] +interface Element : Node { + [Constant] + readonly attribute DOMString? namespaceURI; + [Constant] + readonly attribute DOMString? prefix; + [Constant] + readonly attribute DOMString localName; + + // Not [Constant] because it depends on which document we're in + [Pure] + readonly attribute DOMString tagName; + + [CEReactions, Pure] + attribute DOMString id; + [CEReactions, Pure] + attribute DOMString className; + [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] + void setAttribute(DOMString name, DOMString value); + [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws] + void setAttributeNS(DOMString? namespace, DOMString name, DOMString value); + [CEReactions, Throws] + void removeAttribute(DOMString name); + [CEReactions, Throws] + void removeAttributeNS(DOMString? namespace, DOMString localName); + [Pure] + boolean hasAttribute(DOMString name); + [Pure] + boolean hasAttributeNS(DOMString? namespace, DOMString localName); + [Pure] + boolean hasAttributes(); + + [Throws, Pure] + Element? closest(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] + void insertAdjacentText(DOMString where, DOMString data); // historical + + /** + * The ratio of font-size-inflated text font size to computed font + * size for this element. This will query the element for its primary frame, + * and then use this to get font size inflation information about the frame. + * This will be 1.0 if font size inflation is not enabled, and -1.0 if an + * error occurred during the retrieval of the font size inflation. + * + * @note The font size inflation ratio that is returned is actually the + * font size inflation data for the element's _primary frame_, not the + * element itself, but for most purposes, this should be sufficient. + */ + [ChromeOnly] + readonly attribute float fontSizeInflation; + + /** + * 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. + [Throws, Pref="dom.w3c_pointer_events.enabled"] + void setPointerCapture(long pointerId); + + [Throws, Pref="dom.w3c_pointer_events.enabled"] + void releasePointerCapture(long pointerId); + + [Pref="dom.w3c_pointer_events.enabled"] + boolean hasPointerCapture(long pointerId); + + // Proprietary extensions + /** + * Set this during a mousedown event to grab and retarget all mouse events + * to this element until the mouse button is released or releaseCapture is + * called. If retargetToElement is true, then all events are targetted at + * this element. If false, events can also fire at descendants of this + * element. + * + */ + [UseCounter] + void setCapture(optional boolean retargetToElement = false); + + /** + * If this element has captured the mouse, release the capture. If another + * element has captured the mouse, this method has no effect. + */ + [UseCounter] + void releaseCapture(); + + /* + * Chrome-only version of setCapture that works outside of a mousedown event. + */ + [ChromeOnly] + void setCaptureAlways(optional boolean retargetToElement = false); + + // Mozilla extensions + + // Obsolete methods. + Attr? getAttributeNode(DOMString name); + [CEReactions, Throws] + Attr? setAttributeNode(Attr newAttr); + [CEReactions, Throws] + Attr? removeAttributeNode(Attr oldAttr); + Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName); + [CEReactions, Throws] + Attr? setAttributeNodeNS(Attr newAttr); + + [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; +}; + +interface mixin HTMLOrForeignElement { + [SameObject] readonly attribute DOMStringMap dataset; + // See bug 1389421 + // attribute DOMString nonce; // intentionally no [CEReactions] + + // See bug 1575154 + // [CEReactions] attribute boolean autofocus; + [CEReactions, SetterThrows, Pure] attribute long tabIndex; + [Throws, NeedsCallerType] void focus(optional FocusOptions options = {}); + [Throws] void 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"; +}; + +// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface +partial interface Element { + DOMRectList getClientRects(); + DOMRect getBoundingClientRect(); + + // scrolling + void scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg = {}); + // None of the CSSOM attributes are [Pure], because they flush + attribute long scrollTop; // scroll on setting + attribute long scrollLeft; // scroll on setting + readonly attribute long scrollWidth; + readonly attribute long scrollHeight; + + void scroll(unrestricted double x, unrestricted double y); + void scroll(optional ScrollToOptions options = {}); + void scrollTo(unrestricted double x, unrestricted double y); + void scrollTo(optional ScrollToOptions options = {}); + void scrollBy(unrestricted double x, unrestricted double y); + void scrollBy(optional ScrollToOptions options = {}); + // mozScrollSnap is used by chrome to perform scroll snapping after the + // user performs actions that may affect scroll position + // mozScrollSnap is deprecated, to be replaced by a web accessible API, such + // as an extension to the ScrollOptions dictionary. See bug 1137937. + [ChromeOnly] void mozScrollSnap(); + + readonly attribute long clientTop; + readonly attribute long clientLeft; + readonly attribute long clientWidth; + readonly attribute long clientHeight; + + // Mozilla specific stuff + /* The minimum/maximum offset that the element can be scrolled to + (i.e., the value that scrollLeft/scrollTop would be clamped to if they were + set to arbitrarily large values. */ + [ChromeOnly] readonly attribute long scrollTopMin; + readonly attribute long scrollTopMax; + [ChromeOnly] readonly attribute long scrollLeftMin; + readonly attribute long scrollLeftMax; +}; + +// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface +partial interface Element { + [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, Pure, SetterThrows, GetterCanOOM] + attribute [TreatNullAs=EmptyString] DOMString innerHTML; + [CEReactions, Pure, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString outerHTML; + [CEReactions, Throws] + void insertAdjacentHTML(DOMString position, DOMString text); +}; + +// http://www.w3.org/TR/selectors-api/#interface-definitions +partial interface Element { + [Throws, Pure] + Element? querySelector(UTF8String selectors); + [Throws, Pure] + NodeList querySelectorAll(UTF8String selectors); +}; + +// https://dom.spec.whatwg.org/#dictdef-shadowrootinit +dictionary ShadowRootInit { + required ShadowRootMode mode; +}; + +// https://dom.spec.whatwg.org/#element +partial interface Element { + // Shadow DOM v1 + [Throws, 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 { + [Throws, NeedsCallerType] + Promise<void> requestFullscreen(); + [Throws, BinaryName="requestFullscreen", NeedsCallerType, Deprecated="MozRequestFullScreenDeprecatedPrefix"] + Promise<void> 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"] + void 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] + void setAttributeDevtools(DOMString name, DOMString value); + [ChromeOnly, CEReactions, Throws] + void 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; +}; diff --git a/dom/webidl/ElementInternals.webidl b/dom/webidl/ElementInternals.webidl new file mode 100644 index 0000000000..c63c46d186 --- /dev/null +++ b/dom/webidl/ElementInternals.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/#elementinternals + */ + +[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Exposed=Window] +interface ElementInternals { +}; + diff --git a/dom/webidl/ErrorEvent.webidl b/dom/webidl/ErrorEvent.webidl new file mode 100644 index 0000000000..729f59be26 --- /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 = null; +}; diff --git a/dom/webidl/Event.webidl b/dom/webidl/Event.webidl new file mode 100644 index 0000000000..da551094cf --- /dev/null +++ b/dom/webidl/Event.webidl @@ -0,0 +1,94 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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), 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; + + void stopPropagation(); + void stopImmediatePropagation(); + + [Pure] + readonly attribute boolean bubbles; + [Pure] + readonly attribute boolean cancelable; + [NeedsCallerType] + attribute boolean returnValue; + [NeedsCallerType] + void preventDefault(); + [Pure, NeedsCallerType] + readonly attribute boolean defaultPrevented; + [ChromeOnly, Pure] + readonly attribute boolean defaultPreventedByChrome; + [ChromeOnly, Pure] + readonly attribute boolean defaultPreventedByContent; + [Pure] + readonly attribute boolean composed; + + [Unforgeable, Pure] + readonly attribute boolean isTrusted; + [Pure] + readonly attribute DOMHighResTimeStamp timeStamp; + + void 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] void preventMultipleActions(); + [ChromeOnly] readonly attribute boolean multipleActionsPrevented; + [ChromeOnly] readonly attribute boolean isSynthesized; +}; + +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..b7b658e28e --- /dev/null +++ b/dom/webidl/EventHandler.webidl @@ -0,0 +1,188 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/#eventhandler + * + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and + * Opera Software ASA. You are granted a license to use, reproduce + * and create derivative works of this document. + */ +[TreatNonObjectAsNull] +callback EventHandlerNonNull = any (Event event); +typedef EventHandlerNonNull? EventHandler; + +[TreatNonObjectAsNull] +callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event); +typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler; + +[TreatNonObjectAsNull] +callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error); +typedef OnErrorEventHandlerNonNull? OnErrorEventHandler; + +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; + //(Not implemented)attribute EventHandler oncancel; + attribute EventHandler onauxclick; + [Pref="dom.input_events.beforeinput.enabled"] + attribute EventHandler onbeforeinput; + attribute EventHandler oncanplay; + attribute EventHandler oncanplaythrough; + attribute EventHandler onchange; + attribute EventHandler onclick; + attribute EventHandler onclose; + attribute EventHandler oncontextmenu; + attribute EventHandler oncuechange; + attribute EventHandler ondblclick; + attribute EventHandler ondrag; + attribute EventHandler ondragend; + attribute EventHandler ondragenter; + attribute EventHandler ondragexit; + attribute EventHandler ondragleave; + attribute EventHandler ondragover; + attribute EventHandler ondragstart; + attribute EventHandler ondrop; + attribute EventHandler ondurationchange; + attribute EventHandler onemptied; + attribute EventHandler onended; + [Pref="dom.formdata.event.enabled"] + 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 onloadend; + attribute EventHandler onloadstart; + attribute EventHandler onmousedown; + [LenientThis] attribute EventHandler onmouseenter; + [LenientThis] attribute EventHandler onmouseleave; + attribute EventHandler onmousemove; + attribute EventHandler onmouseout; + attribute EventHandler onmouseover; + attribute EventHandler onmouseup; + attribute EventHandler onwheel; + attribute EventHandler onpause; + attribute EventHandler onplay; + attribute EventHandler onplaying; + attribute EventHandler onprogress; + attribute EventHandler onratechange; + attribute EventHandler onreset; + attribute EventHandler onresize; + attribute EventHandler onscroll; + attribute EventHandler onseeked; + attribute EventHandler onseeking; + attribute EventHandler onselect; + [Pref="dom.menuitem.enabled"] + attribute EventHandler onshow; + //(Not implemented)attribute EventHandler onsort; + attribute EventHandler onstalled; + attribute EventHandler onsubmit; + attribute EventHandler onsuspend; + attribute EventHandler ontimeupdate; + attribute EventHandler onvolumechange; + attribute EventHandler onwaiting; + + [Pref="dom.select_events.enabled"] + attribute EventHandler onselectstart; + + attribute EventHandler ontoggle; + + // Pointer events handlers + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointercancel; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerdown; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerup; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointermove; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerout; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerover; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerenter; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onpointerleave; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler ongotpointercapture; + [Pref="dom.w3c_pointer_events.enabled"] + attribute EventHandler onlostpointercapture; + + // Mozilla-specific handlers. Unprefixed handlers live in + // Document rather than here. + [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; +}; + +interface mixin DocumentAndElementEventHandlers { + attribute EventHandler oncopy; + attribute EventHandler oncut; + attribute EventHandler onpaste; +}; + +// The spec has |attribute OnErrorEventHandler onerror;| on +// GlobalEventHandlers, and calls the handler differently depending on +// whether an ErrorEvent was fired. We don't do that, and until we do we'll +// need to distinguish between onerror on Window or on nodes. + +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..679b8fbdf0 --- /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 { + void handleEvent(Event event); +}; diff --git a/dom/webidl/EventSource.webidl b/dom/webidl/EventSource.webidl new file mode 100644 index 0000000000..8af87b595f --- /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; + void close(); +}; + +dictionary EventSourceInit { + boolean withCredentials = false; +}; diff --git a/dom/webidl/EventTarget.webidl b/dom/webidl/EventTarget.webidl new file mode 100644 index 0000000000..9adf74c2c4 --- /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; //XXX Spec PR is unclear whether this should be nullable. + [ChromeOnly] + boolean wantUntrusted; +}; + +[Exposed=(Window,Worker,WorkerDebugger,AudioWorklet)] +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] + void addEventListener(DOMString type, + EventListener? listener, + optional (AddEventListenerOptions or boolean) options = {}, + optional boolean? wantsUntrusted = null); + [Throws] + void removeEventListener(DOMString type, + EventListener? listener, + optional (EventListenerOptions or boolean) options = {}); + [Throws, NeedsCallerType] + boolean dispatchEvent(Event event); +}; + +// Mozilla extensions for use by JS-implemented event targets to +// implement on* properties. +partial interface EventTarget { + // The use of [TreatNonCallableAsNull] here is a bit of a hack: it just makes + // the codegen check whether the type involved is either + // [TreatNonCallableAsNull] or [TreatNonObjectAsNull] and if it is handle it + // accordingly. In particular, it will NOT actually treat a non-null + // non-callable object as null here. + [ChromeOnly, Throws] + void setEventHandler(DOMString type, + [TreatNonCallableAsNull] EventHandler handler); + + [ChromeOnly] + EventHandler getEventHandler(DOMString type); +}; + +// Mozilla extension to make firing events on event targets from +// chrome easier. This returns the window which can be used to create +// events to fire at this EventTarget, or null if there isn't one. +partial interface EventTarget { + [ChromeOnly, Exposed=Window, BinaryName="ownerGlobalForBindings"] + readonly attribute WindowProxy? ownerGlobal; +}; diff --git a/dom/webidl/ExtendableEvent.webidl b/dom/webidl/ExtendableEvent.webidl new file mode 100644 index 0000000000..c311b53641 --- /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] + void 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/External.webidl b/dom/webidl/External.webidl new file mode 100644 index 0000000000..753d4b1193 --- /dev/null +++ b/dom/webidl/External.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/. + */ + +[NoInterfaceObject, JSImplementation="@mozilla.org/sidebar;1", + Exposed=Window] +interface External +{ + [Deprecated="External_AddSearchProvider"] + void AddSearchProvider(DOMString aDescriptionURL); + void IsSearchProviderInstalled(); +}; diff --git a/dom/webidl/FailedCertSecurityInfo.webidl b/dom/webidl/FailedCertSecurityInfo.webidl new file mode 100644 index 0000000000..669839325b --- /dev/null +++ b/dom/webidl/FailedCertSecurityInfo.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/. + */ + +/** + * This dictionary is used for exposing failed channel certificate information + * to about:certerror to display information. + */ + +dictionary FailedCertSecurityInfo { + DOMString errorCodeString = ""; + boolean isUntrusted = false; + boolean isDomainMismatch = false; + boolean isNotValidAtThisTime = false; + 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..f118a89b26 --- /dev/null +++ b/dom/webidl/FakePluginTagInit.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/. + */ + +/** + * 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..3669e715a7 --- /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 + */ + +[NoInterfaceObject, + 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..b26d690dd6 --- /dev/null +++ b/dom/webidl/Fetch.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://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 { + [Throws] + readonly attribute boolean bodyUsed; + [Throws] + Promise<ArrayBuffer> arrayBuffer(); + [Throws] + Promise<Blob> blob(); + [Throws] + Promise<FormData> formData(); + [Throws] + Promise<JSON> json(); + [Throws] + 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..6cbcd9903e --- /dev/null +++ b/dom/webidl/FetchEvent.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 + * 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; + readonly attribute DOMString clientId; + readonly attribute DOMString resultingClientId; + readonly attribute Promise<void> handled; + + [Throws] + void 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..064903c490 --- /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 { + void 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..9a1d4f3b42 --- /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, Throws, NeedsCallerType] + static Promise<File> createFromNsIFile(nsIFile file, + optional ChromeFilePropertyBag options = {}); + + [ChromeOnly, Throws, 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..e1f7dc8c6a --- /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] + void readAsArrayBuffer(Blob blob); + [Throws] + void readAsBinaryString(Blob filedata); + [Throws] + void readAsText(Blob blob, optional DOMString label); + [Throws] + void readAsDataURL(Blob blob); + + void abort(); + + // states + const unsigned short EMPTY = 0; + const unsigned short LOADING = 1; + const unsigned short DONE = 2; + + + readonly attribute unsigned short readyState; + + 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..d1300ffaf7 --- /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..65f2ae47ba --- /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 = void (FileSystemEntry entry); + +callback ErrorCallback = void (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..b73309e579 --- /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(); + + void getFile(optional USVString? path, + optional FileSystemFlags options = {}, + optional FileSystemEntryCallback successCallback, + optional ErrorCallback errorCallback); + + void getDirectory(optional USVString? path, + optional FileSystemFlags options = {}, + optional FileSystemEntryCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/dom/webidl/FileSystemDirectoryReader.webidl b/dom/webidl/FileSystemDirectoryReader.webidl new file mode 100644 index 0000000000..fc82e7e01d --- /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 = void (sequence<FileSystemEntry> entries); + +[Exposed=Window] +interface FileSystemDirectoryReader { + + // readEntries can be called just once. The second time it returns no data. + + [Throws] + void readEntries(FileSystemEntriesCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/dom/webidl/FileSystemEntry.webidl b/dom/webidl/FileSystemEntry.webidl new file mode 100644 index 0000000000..5e341bca83 --- /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; + + void 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..0e0f0f7123 --- /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 = void (File file); + +[Exposed=Window] +interface FileSystemFileEntry : FileSystemEntry { + [BinaryName="GetFile"] + void file (FileCallback successCallback, + optional ErrorCallback errorCallback); +}; diff --git a/dom/webidl/FinalizationRegistry.webidl b/dom/webidl/FinalizationRegistry.webidl new file mode 100644 index 0000000000..2ab545023a --- /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 = void(); 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..a8ba31014e --- /dev/null +++ b/dom/webidl/FontFace.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://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"; + UTF8String variationSettings = "normal"; + UTF8String display = "auto"; +}; + +enum FontFaceLoadStatus { "unloaded", "loading", "loaded", "error" }; + +// Bug 1072107 is for exposing this in workers. +// [Exposed=(Window,Worker)] +[Pref="layout.css.font-loading-api.enabled", + Exposed=Window] +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, Pref="layout.css.font-display.enabled"] attribute UTF8String display; + + 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..0d702437fe --- /dev/null +++ b/dom/webidl/FontFaceSet.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/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-font-loading/#FontFaceSet-interface + * + * Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +// To implement FontFaceSet's iterator until we can use setlike. +dictionary FontFaceSetIteratorResult +{ + required any value; + required boolean done; +}; + +// To implement FontFaceSet's iterator until we can use setlike. +[NoInterfaceObject, + Exposed=Window] +interface FontFaceSetIterator { + [Throws] FontFaceSetIteratorResult next(); +}; + +callback FontFaceSetForEachCallback = void (FontFace value, FontFace key, FontFaceSet set); + +enum FontFaceSetLoadStatus { "loading", "loaded" }; + +[Pref="layout.css.font-loading-api.enabled", + Exposed=Window] +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] void add(FontFace font); + boolean has(FontFace font); + boolean delete(FontFace font); + void clear(); + [NewObject] FontFaceSetIterator entries(); + // Iterator keys(); + [NewObject, Alias=keys, Alias="@@iterator"] FontFaceSetIterator values(); + [Throws] void forEach(FontFaceSetForEachCallback cb, optional any thisArg); + + // -- events for when loading state changes + attribute EventHandler onloading; + attribute EventHandler onloadingdone; + attribute EventHandler onloadingerror; + + // check and start loads if appropriate + // and fulfill promise when all loads complete + [NewObject] Promise<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<void> 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..761cf17a8c --- /dev/null +++ b/dom/webidl/FontFaceSetLoadEvent.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://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 = []; +}; + +[Pref="layout.css.font-loading-api.enabled", + Exposed=Window] +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..0c5c299043 --- /dev/null +++ b/dom/webidl/FontFaceSource.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/css-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 { + + [Pref="layout.css.font-loading-api.enabled"] + readonly attribute FontFaceSet fonts; +}; diff --git a/dom/webidl/FormData.webidl b/dom/webidl/FormData.webidl new file mode 100644 index 0000000000..0a7246c8a2 --- /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); + + [Throws] + void append(USVString name, Blob value, optional USVString filename); + [Throws] + void append(USVString name, USVString value); + void delete(USVString name); + FormDataEntryValue? get(USVString name); + sequence<FormDataEntryValue> getAll(USVString name); + boolean has(USVString name); + [Throws] + void set(USVString name, Blob value, optional USVString filename); + [Throws] + void set(USVString name, USVString value); + iterable<USVString, FormDataEntryValue>; +}; diff --git a/dom/webidl/FormDataEvent.webidl b/dom/webidl/FormDataEvent.webidl new file mode 100644 index 0000000000..14a52eb465 --- /dev/null +++ b/dom/webidl/FormDataEvent.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/form-control-infrastructure.html#the-formdataevent-interface + */ + +[Exposed=Window, + Pref="dom.formdata.event.enabled"] +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..4312c24d39 --- /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 = void (); diff --git a/dom/webidl/FuzzingFunctions.webidl b/dom/webidl/FuzzingFunctions.webidl new file mode 100644 index 0000000000..ddc001386a --- /dev/null +++ b/dom/webidl/FuzzingFunctions.webidl @@ -0,0 +1,124 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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] +interface FuzzingFunctions { + /** + * Synchronously perform a garbage collection. + */ + static void garbageCollect(); + + /** + * Synchronously perform a compacting garbage collection. + */ + static void garbageCollectCompacting(); + + /** + * Synchronously perform a cycle collection. + */ + static void cycleCollect(); + + /** + * Send a memory pressure event, causes shrinking GC, cycle collection and + * other actions. + */ + static void memoryPressure(); + + /** + * Enable accessibility. + */ + [Throws] + static void enableAccessibility(); + + /** + * synthesizeKeyboardEvents() synthesizes a set of "keydown", + * "keypress" (only when it's necessary) and "keyup" events on focused + * widget. This is currently not aware of APZ since this dispatches the + * events into focused PresShell in current process. I.e., dispatched + * events won't be handled by some default action handlers which are only + * in the main process. 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] + static void synthesizeKeyboardEvents(DOMString aKeyValue, + optional KeyboardEventInit aDictionary = {}); +}; diff --git a/dom/webidl/GPUUncapturedErrorEvent.webidl b/dom/webidl/GPUUncapturedErrorEvent.webidl new file mode 100644 index 0000000000..7362441129 --- /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; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +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..3b4dc440b7 --- /dev/null +++ b/dom/webidl/GainNode.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 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..e730d070ee --- /dev/null +++ b/dom/webidl/Gamepad.webidl @@ -0,0 +1,112 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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] +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] +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..24f16568f2 --- /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] +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..47d71107f0 --- /dev/null +++ b/dom/webidl/GamepadButtonEvent.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="dom.gamepad.non_standard_events.enabled", + Exposed=Window] +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..0189050093 --- /dev/null +++ b/dom/webidl/GamepadEvent.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/gamepad/#gamepadevent-interface + */ + +[Pref="dom.gamepad.enabled", + Exposed=Window] +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..0f3c8e0553 --- /dev/null +++ b/dom/webidl/GamepadHapticActuator.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/gamepad/extensions.html#gamepadhapticactuator-interface + */ + +enum GamepadHapticActuatorType { + "vibration" +}; + +[Pref="dom.gamepad.extensions.enabled", + HeaderFile="mozilla/dom/GamepadHapticActuator.h", + Exposed=Window] +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..055df15930 --- /dev/null +++ b/dom/webidl/GamepadPose.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/gamepad/extensions.html#gamepadpose-interface + */ + +[Pref="dom.gamepad.extensions.enabled", + Exposed=Window] +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..fa21b88b73 --- /dev/null +++ b/dom/webidl/GamepadServiceTest.webidl @@ -0,0 +1,52 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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; + + [Throws] + 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); + + void removeGamepad(unsigned long index); + + void newButtonEvent(unsigned long index, + unsigned long button, + boolean pressed, + boolean touched); + + void newButtonValueEvent(unsigned long index, + unsigned long button, + boolean pressed, + boolean touched, + double value); + + void newAxisMoveEvent(unsigned long index, + unsigned long axis, + double value); + void newPoseMove(unsigned long index, + Float32Array? orient, + Float32Array? pos, + Float32Array? angVelocity, + Float32Array? angAcceleration, + Float32Array? linVelocity, + Float32Array? linAcceleration); + + void newTouch(unsigned long index, unsigned long aTouchArrayIndex, + unsigned long touchId, octet surfaceId, + Float32Array position, Float32Array? surfaceDimension); +};
\ No newline at end of file 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/Geolocation.webidl b/dom/webidl/Geolocation.webidl new file mode 100644 index 0000000000..a811195e1a --- /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] + void getCurrentPosition(PositionCallback successCallback, + optional PositionErrorCallback? errorCallback = null, + optional PositionOptions options = {}); + + [Throws, NeedsCallerType] + long watchPosition(PositionCallback successCallback, + optional PositionErrorCallback? errorCallback = null, + optional PositionOptions options = {}); + + void clearWatch(long watchId); +}; + +callback PositionCallback = void (GeolocationPosition position); + +callback PositionErrorCallback = void (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..16998c5d84 --- /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 DOMTimeStamp 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..6762f571a6 --- /dev/null +++ b/dom/webidl/GetUserMediaRequest.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/. + * + * This is an internal IDL file + */ + +// for gUM request start (getUserMedia:request) notification, +// rawID and mediaSource 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 windowID, rawID and mediaSource will be set + +[NoInterfaceObject, + Exposed=Window] +interface GetUserMediaRequest { + readonly attribute unsigned long long windowID; + readonly attribute unsigned long long innerWindowID; + readonly attribute DOMString callID; + readonly attribute DOMString rawID; + readonly attribute DOMString mediaSource; + MediaStreamConstraints getConstraints(); + readonly attribute boolean isSecure; + readonly attribute boolean isHandlingUserInput; +}; diff --git a/dom/webidl/Grid.webidl b/dom/webidl/Grid.webidl new file mode 100644 index 0000000000..0bd5525b03 --- /dev/null +++ b/dom/webidl/Grid.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/. + */ + +/* These objects support visualization of a css-grid by the dev tools. */ + +/** + * Explicit and implicit types apply to tracks, lines, and areas. + * https://drafts.csswg.org/css-grid/#explicit-grids + * https://drafts.csswg.org/css-grid/#implicit-grids + */ +enum GridDeclaration { "explicit", "implicit" }; + +/** + * Tracks expanded from auto-fill are repeat , auto-fits with elements are + * also repeat, auto-fits with no elements are removed, other tracks are static. + */ +enum GridTrackState { "static", "repeat", "removed" }; + +[ChromeOnly, + Exposed=Window] +interface Grid +{ + readonly attribute GridDimension rows; + readonly attribute GridDimension cols; + [Cached, Constant] + readonly attribute sequence<GridArea> areas; +}; + +[ChromeOnly, + Exposed=Window] +interface GridDimension +{ + readonly attribute GridLines lines; + readonly attribute GridTracks tracks; +}; + +[ChromeOnly, + Exposed=Window] +interface GridLines +{ + readonly attribute unsigned long length; + + /** + * This accessor method allows array-like access to lines. + * @param index A 0-indexed value. + */ + getter GridLine? item(unsigned long index); +}; + +[ChromeOnly, + Exposed=Window] +interface GridLine +{ + /** + * Names include both explicit names and implicit names, which will be + * assigned if the line contributes to a named area. + * https://drafts.csswg.org/css-grid/#implicit-named-lines + */ + [Cached, Constant] + readonly attribute sequence<DOMString> names; + + readonly attribute double start; + + /** + * Breadth is the gap between the start of this line and the start of the + * next track in flow direction. It primarily is set by use of the -gap + * properties. + * https://drafts.csswg.org/css-grid/#gutters + */ + readonly attribute double breadth; + + readonly attribute GridDeclaration type; + + /** + * Number is the 1-indexed index of the line in flow order. The + * first explicit line has number 1, and numbers increment by 1 for + * each line after that. Lines before the first explicit line + * have number 0, which is not a valid addressable line number, and + * should be filtered out by callers. + */ + readonly attribute unsigned long number; + + /** + * NegativeNumber is the 1-indexed index of the line in reverse + * flow order. The last explicit line has negativeNumber -1, and + * negativeNumbers decrement by 1 for each line before that. + * Lines after the last explicit line have negativeNumber 0, which + * is not a valid addressable line number, and should be filtered + * out by callers. + */ + readonly attribute long negativeNumber; +}; + +[ChromeOnly, + Exposed=Window] +interface GridTracks +{ + readonly attribute unsigned long length; + + /** + * This accessor method allows array-like access to tracks. + * @param index A 0-indexed value. + */ + getter GridTrack? item(unsigned long index); +}; + +[ChromeOnly, + Exposed=Window] +interface GridTrack +{ + readonly attribute double start; + readonly attribute double breadth; + readonly attribute GridDeclaration type; + readonly attribute GridTrackState state; +}; + +[ChromeOnly, + Exposed=Window] +interface GridArea +{ + readonly attribute DOMString name; + readonly attribute GridDeclaration type; + + /** + * These values are 1-indexed line numbers bounding the area. + */ + readonly attribute unsigned long rowStart; + readonly attribute unsigned long rowEnd; + readonly attribute unsigned long columnStart; + readonly attribute unsigned long columnEnd; +}; 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..54142f317c --- /dev/null +++ b/dom/webidl/HTMLAudioElement.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/#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. + */ + +[NamedConstructor=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..17b67bad38 --- /dev/null +++ b/dom/webidl/HTMLBaseElement.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-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..1038adb45f --- /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 [TreatNullAs=EmptyString] DOMString text; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString link; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString vLink; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString aLink; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] 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..b76d8cc73f --- /dev/null +++ b/dom/webidl/HTMLButtonElement.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/#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] +interface HTMLButtonElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pure] + attribute boolean autofocus; + [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(); + void setCustomValidity(DOMString error); + + readonly attribute NodeList labels; +}; diff --git a/dom/webidl/HTMLCanvasElement.webidl b/dom/webidl/HTMLCanvasElement.webidl new file mode 100644 index 0000000000..dbb23168b8 --- /dev/null +++ b/dom/webidl/HTMLCanvasElement.webidl @@ -0,0 +1,74 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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; +interface Variant; + +[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] + void toBlob(BlobCallback callback, + optional DOMString type = "", + optional any encoderOptions); +}; + +// Mozilla specific bits +partial interface HTMLCanvasElement { + [Pure, SetterThrows] + attribute boolean mozOpaque; + [Throws, NeedsSubjectPrincipal, Pref="canvas.mozgetasfile.enabled"] + File mozGetAsFile(DOMString name, optional DOMString? type = null); + // A Mozilla-only extension to get a canvas context backed by double-buffered + // shared memory. Only privileged callers can call this. + [ChromeOnly, Throws] + nsISupports? MozGetIPCContext(DOMString contextId); + + attribute PrintCallback? mozPrintCallback; + + [Throws, Pref="canvas.capturestream.enabled", 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. + void done(); +}; + +callback PrintCallback = void(MozCanvasPrintState ctx); + +callback BlobCallback = void(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..3eb80634ec --- /dev/null +++ b/dom/webidl/HTMLDialogElement.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/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. + */ + +[Func="mozilla::dom::HTMLDialogElement::IsDialogEnabled", + Exposed=Window] +interface HTMLDialogElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute boolean open; + attribute DOMString returnValue; + [CEReactions] + void show(); + [CEReactions, Throws] + void showModal(); + [CEReactions] + void close(optional DOMString returnValue); +}; diff --git a/dom/webidl/HTMLDirectoryElement.webidl b/dom/webidl/HTMLDirectoryElement.webidl new file mode 100644 index 0000000000..69624d541e --- /dev/null +++ b/dom/webidl/HTMLDirectoryElement.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/#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..c61b82df97 --- /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] +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..f89d5eec71 --- /dev/null +++ b/dom/webidl/HTMLDocument.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/. + */ + +[OverrideBuiltins, + Exposed=Window, + InstrumentedProps=(adoptedStyleSheets, + caretRangeFromPoint, + clear, + exitPictureInPicture, + featurePolicy, + onbeforecopy, + onbeforecut, + onbeforepaste, + oncancel, + onfreeze, + onmousewheel, + onresume, + onsearch, + onsecuritypolicyviolation, + onwebkitfullscreenchange, + onwebkitfullscreenerror, + pictureInPictureElement, + pictureInPictureEnabled, + registerElement, + wasDiscarded, + webkitCancelFullScreen, + webkitCurrentFullScreenElement, + webkitExitFullscreen, + webkitFullscreenElement, + webkitFullscreenEnabled, + webkitHidden, + webkitIsFullScreen, + webkitVisibilityState, + xmlEncoding, + xmlStandalone, + xmlVersion)] +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..9eedd8d97d --- /dev/null +++ b/dom/webidl/HTMLElement.webidl @@ -0,0 +1,104 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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] +interface HTMLElement : Element { + [HTMLConstructor] constructor(); + + // metadata attributes + [CEReactions] + attribute DOMString title; + [CEReactions] + attribute DOMString lang; + // attribute boolean translate; + [CEReactions, SetterThrows, Pure] + attribute DOMString dir; + + [CEReactions, GetterThrows, Pure] + attribute [TreatNullAs=EmptyString] DOMString innerText; + + // user interaction + [CEReactions, SetterThrows, Pure] + attribute boolean hidden; + [CEReactions, SetterThrows, Pure, Pref="html5.inert.enabled"] + attribute boolean inert; + [NeedsCallerType] + void 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; + [Pure, Pref="dom.menuitem.enabled"] + readonly attribute HTMLMenuElement? contextMenu; + [CEReactions, SetterThrows, Pure] + attribute boolean spellcheck; + [CEReactions, Pure, SetterThrows, Pref="dom.forms.inputmode"] + attribute DOMString inputMode; + [CEReactions, Pure, SetterThrows, Pref="dom.forms.enterkeyhint"] + attribute DOMString enterKeyHint; + [CEReactions, Pure, SetterThrows, Pref="dom.forms.autocapitalize"] + 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 + [Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws] + ElementInternals attachInternals(); +}; + +// 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; +}; + +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 DocumentAndElementEventHandlers; +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..01ebced015 --- /dev/null +++ b/dom/webidl/HTMLEmbedElement.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 + * 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 +[NeedResolve, + 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 MozImageLoadingContent; +HTMLEmbedElement includes MozFrameLoaderOwner; +HTMLEmbedElement includes MozObjectLoadingContent; diff --git a/dom/webidl/HTMLFieldSetElement.webidl b/dom/webidl/HTMLFieldSetElement.webidl new file mode 100644 index 0000000000..cc53202b80 --- /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(); + + void setCustomValidity(DOMString error); +}; diff --git a/dom/webidl/HTMLFontElement.webidl b/dom/webidl/HTMLFontElement.webidl new file mode 100644 index 0000000000..f400b5d11f --- /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 [TreatNullAs=EmptyString] 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..04e41c9dab --- /dev/null +++ b/dom/webidl/HTMLFormElement.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/#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. + */ + +[OverrideBuiltins, 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; + + [Constant] + readonly attribute HTMLCollection 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] + void submit(); + [Pref="dom.forms.requestsubmit.enabled", Throws] + void requestSubmit(optional HTMLElement? submitter = null); + [CEReactions] + void reset(); + boolean checkValidity(); + boolean reportValidity(); +}; diff --git a/dom/webidl/HTMLFrameElement.webidl b/dom/webidl/HTMLFrameElement.webidl new file mode 100644 index 0000000000..2409298f41 --- /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 [TreatNullAs=EmptyString] DOMString marginHeight; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] 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..0524a6d8f1 --- /dev/null +++ b/dom/webidl/HTMLHeadElement.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/#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..78a66d2674 --- /dev/null +++ b/dom/webidl/HTMLIFrameElement.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.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; + [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 [TreatNullAs=EmptyString] DOMString marginHeight; + [CEReactions, SetterThrows, Pure] + attribute [TreatNullAs=EmptyString] 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..5c8586419e --- /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; + +[NamedConstructor=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, Pref="dom.image-lazy-loading.enabled"] + attribute DOMString loading; + readonly attribute unsigned long naturalWidth; + readonly attribute unsigned long naturalHeight; + readonly attribute boolean complete; + [NewObject] + Promise<void> decode(); +}; + +// 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 [TreatNullAs=EmptyString] 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] + void addObserver(imgINotificationObserver aObserver); + /** + * Same as removeNativeObserver but intended for scripted observers or + * observers from another or without a document. + */ + [ChromeOnly] + void 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] + void forceReload(optional boolean aNotify = true); + [ChromeOnly] + void forceImageState(boolean aForce, unsigned long long aState); +}; + +HTMLImageElement includes MozImageLoadingContent; diff --git a/dom/webidl/HTMLInputElement.webidl b/dom/webidl/HTMLInputElement.webidl new file mode 100644 index 0000000000..4818b0ffc8 --- /dev/null +++ b/dom/webidl/HTMLInputElement.webidl @@ -0,0 +1,283 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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] +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] + attribute boolean autofocus; + [CEReactions, Pure, SetterThrows, Pref="dom.capture.enabled"] + attribute DOMString capture; + [CEReactions, Pure, SetterThrows] + attribute boolean defaultChecked; + [Pure] + attribute boolean checked; + // Bug 850337 - 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 HTMLElement? 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 [TreatNullAs=EmptyString] DOMString value; + [Throws] + attribute object? valueAsDate; + [Pure, SetterThrows] + attribute unrestricted double valueAsNumber; + [CEReactions, SetterThrows] + attribute unsigned long width; + + [Throws] + void stepUp(optional long n = 1); + [Throws] + void stepDown(optional long n = 1); + + [Pure] + readonly attribute boolean willValidate; + [Pure] + readonly attribute ValidityState validity; + [Throws] + readonly attribute DOMString validationMessage; + boolean checkValidity(); + boolean reportValidity(); + void setCustomValidity(DOMString error); + + readonly attribute NodeList? labels; + + void select(); + + [Throws] + attribute unsigned long? selectionStart; + [Throws] + attribute unsigned long? selectionEnd; + [Throws] + attribute DOMString? selectionDirection; + [Throws] + void setRangeText(DOMString replacement); + [Throws] + void setRangeText(DOMString replacement, unsigned long start, + unsigned long end, optional SelectionMode selectionMode = "preserve"); + [Throws] + void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); + + // 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] + void mozSetFileNameArray(sequence<DOMString> fileNames); + + [ChromeOnly] + void mozSetFileArray(sequence<File> files); + + // This method is meant to use for testing only. + [ChromeOnly, Throws] + void mozSetDirectory(DOMString directoryPath); + + // This method is meant to use for testing only. + [ChromeOnly] + void mozSetDndFilesAndDirectories(sequence<(File or Directory)> list); + + boolean mozIsTextField(boolean aExcludePassword); + + [ChromeOnly] + readonly attribute boolean hasBeenTypePassword; + + [ChromeOnly] + attribute DOMString previewValue; + + [ChromeOnly] + // This function will return null if @autocomplete is not defined for the + // current @type + AutocompleteInfo? getAutocompleteInfo(); +}; + +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] + void setUserInput(DOMString input); +}; + +HTMLInputElement includes MozEditableElement; + +partial interface HTMLInputElement { + [Pref="dom.input.dirpicker", SetterThrows] + attribute boolean allowdirs; + + [Pref="dom.input.dirpicker"] + readonly attribute boolean isFilesAndDirectoriesSupported; + + [Throws, Pref="dom.input.dirpicker"] + Promise<sequence<(File or Directory)>> getFilesAndDirectories(); + + [Throws, Pref="dom.input.dirpicker"] + Promise<sequence<File>> getFiles(optional boolean recursiveFlag = false); + + [Throws, Pref="dom.input.dirpicker"] + void chooseDirectory(); +}; + +HTMLInputElement includes MozImageLoadingContent; + +// 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"] + void openDateTimePicker(optional DateTimeValue initialValue = {}); + + [Func="IsChromeOrUAWidget"] + void updateDateTimePicker(optional DateTimeValue value = {}); + + [Func="IsChromeOrUAWidget"] + void closeDateTimePicker(); + + [Func="IsChromeOrUAWidget"] + void setFocusState(boolean aIsFocused); + + [Func="IsChromeOrUAWidget"] + void 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..7f0ecb4f16 --- /dev/null +++ b/dom/webidl/HTMLLinkElement.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://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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#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; +}; +HTMLLinkElement includes LinkStyle; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-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://w3c.github.io/webappsec/specs/subresourceintegrity/#htmllinkelement-1 +partial interface HTMLLinkElement { + [CEReactions, SetterThrows] + attribute DOMString integrity; +}; + +//https://w3c.github.io/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..a755dc6c48 --- /dev/null +++ b/dom/webidl/HTMLMarqueeElement.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/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; + + void start(); + void stop(); +}; + diff --git a/dom/webidl/HTMLMediaElement.webidl b/dom/webidl/HTMLMediaElement.webidl new file mode 100644 index 0000000000..3bb8583998 --- /dev/null +++ b/dom/webidl/HTMLMediaElement.webidl @@ -0,0 +1,260 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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] +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; + void 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] + void 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; + [Throws] + Promise<void> play(); + [Throws] + void 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 void mozEnableDebugLog(); + [Func="HasDebuggerOrTabsPrivilege", NewObject] + Promise<DOMString> mozRequestDebugLog(); + + attribute MediaStream? srcObject; + attribute boolean mozPreservesPitch; + + // 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; + + [ChromeOnly] + void reportCanPlayTelemetry(); +}; + +// Encrypted Media Extensions +partial interface HTMLMediaElement { + readonly attribute MediaKeys? mediaKeys; + + // void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457 + [NewObject] + Promise<void> 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 { + [Throws, Pref="media.seekToNextFrame.enabled"] + Promise<void> seekToNextFrame(); +}; + +/* + * These APIs are testing only, they 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(). + * - isVisible is a boolean value which indicate whether media element is visible. + * - isVideoDecodingSuspended() is used to know whether video decoding has suspended. + */ +partial interface HTMLMediaElement { + [Pref="media.test.video-suspend"] + void setVisible(boolean aVisible); + + [Pref="media.test.video-suspend"] + boolean hasSuspendTaint(); + + [ChromeOnly] + readonly attribute boolean isInViewPort; + + [ChromeOnly] + readonly attribute boolean isVideoDecodingSuspended; + + [ChromeOnly] + readonly attribute double totalPlayTime; + + [ChromeOnly] + readonly attribute double invisiblePlayTime; + + [ChromeOnly] + readonly attribute double videoDecodeSuspendedTime; +}; + +/* Audio Output Devices API */ +partial interface HTMLMediaElement { + [Pref="media.setsinkid.enabled"] + readonly attribute DOMString sinkId; + [Throws, Pref="media.setsinkid.enabled"] + Promise<void> 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..ce952e1070 --- /dev/null +++ b/dom/webidl/HTMLMenuElement.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://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. + */ + +interface MenuBuilder; + +// https://html.spec.whatwg.org/multipage/grouping-content.html#the-menu-element +[Exposed=Window] +interface HTMLMenuElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows, Pref="dom.menuitem.enabled"] + attribute DOMString type; + [CEReactions, SetterThrows, Pref="dom.menuitem.enabled"] + attribute DOMString label; +}; + +// https://html.spec.whatwg.org/multipage/obsolete.html#HTMLMenuElement-partial +partial interface HTMLMenuElement { + [CEReactions, SetterThrows] + attribute boolean compact; +}; + +// Mozilla specific stuff +partial interface HTMLMenuElement { + /** + * Creates and dispatches a trusted event named "show". + * The event is not cancelable and does not bubble. + * See http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus + */ + [ChromeOnly] + void sendShowEvent(); + + /** + * Creates a native menu builder. The builder type is dependent on menu type. + * Currently, it returns the @mozilla.org/content/html-menu-builder;1 + * component. Toolbar menus are not yet supported (the method returns null). + */ + [ChromeOnly] + MenuBuilder? createBuilder(); + + /* + * Builds a menu by iterating over menu children. + * See http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#building-menus-and-toolbars + * The caller can use a native builder by calling createBuilder() or provide + * a custom builder that implements the nsIMenuBuilder interface. + * A custom builder can be used for example to build native context menus + * that are not defined using <menupopup>. + */ + [ChromeOnly] + void build(MenuBuilder aBuilder); +}; diff --git a/dom/webidl/HTMLMenuItemElement.webidl b/dom/webidl/HTMLMenuItemElement.webidl new file mode 100644 index 0000000000..acc355761e --- /dev/null +++ b/dom/webidl/HTMLMenuItemElement.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-menuitem-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-menuitem-element +[Exposed=Window, Pref="dom.menuitem.enabled"] +interface HTMLMenuItemElement : HTMLElement { + [HTMLConstructor] constructor(); + + [CEReactions, SetterThrows] + attribute DOMString type; + [CEReactions, SetterThrows] + attribute DOMString label; + [CEReactions, SetterThrows] + attribute DOMString icon; + [CEReactions, SetterThrows] + attribute boolean disabled; + [CEReactions] + attribute boolean checked; + [CEReactions, SetterThrows] + attribute DOMString radiogroup; + + // This should be 'default' but in the IDL implementation + // this has been renamed 'defaultChecked'. + [CEReactions, SetterThrows] + attribute boolean defaultChecked; + + // Currently not implemented. +// readonly attribute HTMLElement? command; +}; diff --git a/dom/webidl/HTMLMetaElement.webidl b/dom/webidl/HTMLMetaElement.webidl new file mode 100644 index 0000000000..148203f5d8 --- /dev/null +++ b/dom/webidl/HTMLMetaElement.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.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. + */ + +// http://www.whatwg.org/specs/web-apps/current-work/#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; +}; + +// 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..36a6a1d8f5 --- /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..3365d633f3 --- /dev/null +++ b/dom/webidl/HTMLObjectElement.webidl @@ -0,0 +1,225 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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 +[NeedResolve, + 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(); + void 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 [TreatNullAs=EmptyString] 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_IMAGE = 1; + [ChromeOnly] + const unsigned long TYPE_PLUGIN = 2; + [ChromeOnly] + const unsigned long TYPE_FAKE_PLUGIN = 3; + [ChromeOnly] + const unsigned long TYPE_DOCUMENT = 4; + [ChromeOnly] + const unsigned long TYPE_NULL = 5; + + // The content type is not supported (e.g. plugin not installed) + [ChromeOnly] + const unsigned long PLUGIN_UNSUPPORTED = 0; + // Showing alternate content + [ChromeOnly] + const unsigned long PLUGIN_ALTERNATE = 1; + // The plugin exists, but is disabled + [ChromeOnly] + const unsigned long PLUGIN_DISABLED = 2; + // The plugin is blocklisted and disabled + [ChromeOnly] + const unsigned long PLUGIN_BLOCKLISTED = 3; + // The plugin is considered outdated, but not disabled + [ChromeOnly] + const unsigned long PLUGIN_OUTDATED = 4; + // The plugin has crashed + [ChromeOnly] + const unsigned long PLUGIN_CRASHED = 5; + /// ** All values >= PLUGIN_CLICK_TO_PLAY are plugin placeholder types that + /// would be replaced by a real plugin if activated (playPlugin()) + /// ** Furthermore, values >= PLUGIN_CLICK_TO_PLAY and + /// <= PLUGIN_VULNERABLE_NO_UPDATE are click-to-play types. + // The plugin is disabled until the user clicks on it + [ChromeOnly] + const unsigned long PLUGIN_CLICK_TO_PLAY = 8; + // The plugin is vulnerable (update available) + [ChromeOnly] + const unsigned long PLUGIN_VULNERABLE_UPDATABLE = 9; + // The plugin is vulnerable (no update available) + [ChromeOnly] + const unsigned long PLUGIN_VULNERABLE_NO_UPDATE = 10; + + /** + * 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; + + /** + * Gets the content type that corresponds to the give MIME type. See the + * constants above for the list of possible values. If nothing else fits, + * TYPE_NULL will be returned. + */ + [ChromeOnly] + unsigned long getContentTypeForMIMEType(DOMString aMimeType); + + + [ChromeOnly] + sequence<MozPluginParameter> getPluginAttributes(); + + [ChromeOnly] + sequence<MozPluginParameter> getPluginParameters(); + + /** + * This method will play a plugin that has been stopped by the click-to-play + * feature. + */ + [ChromeOnly, Throws, NeedsCallerType] + void playPlugin(); + + /** + * Forces a re-evaluation and reload of the tag, optionally invalidating its + * click-to-play state. This can be used when the MIME type that provides a + * type has changed, for instance, to force the tag to re-evalulate the + * handler to use. + */ + [ChromeOnly, Throws] + void reload(boolean aClearActivation); + + /** + * This attribute will return true if the current content type has been + * activated, either explicitly or by passing checks that would have it be + * click-to-play. + */ + [ChromeOnly] + readonly attribute boolean activated; + + /** + * 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; + + [ChromeOnly] + readonly attribute unsigned long defaultFallbackType; + + [ChromeOnly] + readonly attribute unsigned long pluginFallbackType; + + /** + * If this object currently owns a running plugin, regardless of whether or + * not one is pending spawn/despawn. + */ + [ChromeOnly] + readonly attribute boolean hasRunningPlugin; + + /** + * Disable the use of fake plugins and reload the tag if necessary + */ + [ChromeOnly, Throws] + void skipFakePlugins(); + + [ChromeOnly, Throws, NeedsCallerType] + readonly attribute unsigned long runID; +}; + +/** + * Name:Value pair type used for passing parameters to NPAPI or javascript + * plugins. + */ +dictionary MozPluginParameter { + DOMString name = ""; + DOMString value = ""; +}; + +HTMLObjectElement includes MozImageLoadingContent; +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..9b04a517ee --- /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. + */ + +[NamedConstructor=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..61cb14d941 --- /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 void (unsigned long index, HTMLOptionElement? option); + [CEReactions, Throws] + void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null); + [CEReactions] + void remove(long index); + attribute long selectedIndex; +}; diff --git a/dom/webidl/HTMLOutputElement.webidl b/dom/webidl/HTMLOutputElement.webidl new file mode 100644 index 0000000000..732ef5548a --- /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(); + void 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..aaf3f38985 --- /dev/null +++ b/dom/webidl/HTMLQuoteElement.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-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..a31e07b7b6 --- /dev/null +++ b/dom/webidl/HTMLScriptElement.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 + * 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, Pref="dom.moduleScripts.enabled"] + 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; +}; + +// 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..0dd3d86224 --- /dev/null +++ b/dom/webidl/HTMLSelectElement.webidl @@ -0,0 +1,77 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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 boolean autofocus; + [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] + void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null); + [CEReactions] + void remove(long index); + [CEReactions, Throws] + setter void (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(); + void setCustomValidity(DOMString error); + + readonly attribute NodeList labels; + + // https://www.w3.org/Bugs/Public/show_bug.cgi?id=20720 + [CEReactions] + void remove(); +}; + +// Chrome only interface + +partial interface HTMLSelectElement { + [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..7488e398b9 --- /dev/null +++ b/dom/webidl/HTMLSlotElement.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/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 = {}); +}; + +dictionary AssignedNodesOptions { + boolean flatten = false; +}; diff --git a/dom/webidl/HTMLSourceElement.webidl b/dom/webidl/HTMLSourceElement.webidl new file mode 100644 index 0000000000..e0fcdc4f52 --- /dev/null +++ b/dom/webidl/HTMLSourceElement.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.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; +}; diff --git a/dom/webidl/HTMLSpanElement.webidl b/dom/webidl/HTMLSpanElement.webidl new file mode 100644 index 0000000000..b8c723bd3f --- /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] +interface HTMLSpanElement : HTMLElement { + [HTMLConstructor] constructor(); +}; diff --git a/dom/webidl/HTMLStyleElement.webidl b/dom/webidl/HTMLStyleElement.webidl new file mode 100644 index 0000000000..d4fce647c8 --- /dev/null +++ b/dom/webidl/HTMLStyleElement.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-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; +}; +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] + void 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..041e798b83 --- /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 [TreatNullAs=EmptyString] 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..343f0f7018 --- /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] + void deleteCaption(); + [CEReactions, SetterThrows] + attribute HTMLTableSectionElement? tHead; + HTMLElement createTHead(); + [CEReactions] + void deleteTHead(); + [CEReactions, SetterThrows] + attribute HTMLTableSectionElement? tFoot; + HTMLElement createTFoot(); + [CEReactions] + void deleteTFoot(); + readonly attribute HTMLCollection tBodies; + HTMLElement createTBody(); + readonly attribute HTMLCollection rows; + [Throws] + HTMLElement insertRow(optional long index = -1); + [CEReactions, Throws] + void deleteRow(long index); + // attribute boolean sortable; + //void 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 [TreatNullAs=EmptyString] DOMString bgColor; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString cellPadding; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString cellSpacing; +}; diff --git a/dom/webidl/HTMLTableRowElement.webidl b/dom/webidl/HTMLTableRowElement.webidl new file mode 100644 index 0000000000..a8f455c7fd --- /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] + void 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 [TreatNullAs=EmptyString] DOMString bgColor; +}; diff --git a/dom/webidl/HTMLTableSectionElement.webidl b/dom/webidl/HTMLTableSectionElement.webidl new file mode 100644 index 0000000000..0724492926 --- /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] + void 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..3728e986e5 --- /dev/null +++ b/dom/webidl/HTMLTemplateElement.webidl @@ -0,0 +1,18 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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/templates/index.html + * + * 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; +}; + diff --git a/dom/webidl/HTMLTextAreaElement.webidl b/dom/webidl/HTMLTextAreaElement.webidl new file mode 100644 index 0000000000..f66818c372 --- /dev/null +++ b/dom/webidl/HTMLTextAreaElement.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://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 boolean autofocus; + [CEReactions, SetterThrows, Pure] + attribute unsigned long cols; + // 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 [TreatNullAs=EmptyString] 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(); + void setCustomValidity(DOMString error); + + readonly attribute NodeList labels; + + void select(); + [Throws] + attribute unsigned long? selectionStart; + [Throws] + attribute unsigned long? selectionEnd; + [Throws] + attribute DOMString? selectionDirection; + [Throws] + void setRangeText(DOMString replacement); + [Throws] + void setRangeText(DOMString replacement, unsigned long start, + unsigned long end, optional SelectionMode selectionMode = "preserve"); + [Throws] + void 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..7512ad40f4 --- /dev/null +++ b/dom/webidl/HTMLVideoElement.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 + * 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] +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; + + // Attributes for builtin video controls to lock screen orientation. + // True if video controls should lock orientation when fullscreen. + [Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrUAWidget"] + readonly attribute boolean mozOrientationLockEnabled; + // True if screen orientation is locked by video controls. + [Pref="media.videocontrols.lock-video-orientation", Func="IsChromeOrUAWidget"] + attribute boolean mozIsOrientationLocked; + + // 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. + [Throws, Func="IsChromeOrUAWidget"] + Promise<void> cloneElementVisually(HTMLVideoElement target); + + // Stops a <video> from cloning visually. Does nothing if the <video> + // wasn't cloning in the first place. + [Func="IsChromeOrUAWidget"] + void 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(); +}; diff --git a/dom/webidl/HashChangeEvent.webidl b/dom/webidl/HashChangeEvent.webidl new file mode 100644 index 0000000000..8ee3d3685e --- /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; + + void 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..c492cb3c35 --- /dev/null +++ b/dom/webidl/Headers.webidl @@ -0,0 +1,36 @@ +/* -*- 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] void append(ByteString name, ByteString value); + [Throws] void delete(ByteString name); + [Throws] ByteString? get(ByteString name); + [Throws] boolean has(ByteString name); + [Throws] void 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/HiddenPluginEvent.webidl b/dom/webidl/HiddenPluginEvent.webidl new file mode 100644 index 0000000000..bd722df198 --- /dev/null +++ b/dom/webidl/HiddenPluginEvent.webidl @@ -0,0 +1,15 @@ +interface PluginTag; + +[ChromeOnly, + Exposed=Window] +interface HiddenPluginEvent : Event +{ + constructor(DOMString type, optional HiddenPluginEventInit eventInit = {}); + + readonly attribute PluginTag? tag; +}; + +dictionary HiddenPluginEventInit : EventInit +{ + PluginTag? tag = null; +}; diff --git a/dom/webidl/History.webidl b/dom/webidl/History.webidl new file mode 100644 index 0000000000..7a2646082c --- /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, NeedsCallerType] + void go(optional long delta = 0); + [Throws, NeedsCallerType] + void back(); + [Throws, NeedsCallerType] + void forward(); + [Throws, NeedsCallerType] + void pushState(any data, DOMString title, optional DOMString? url = null); + [Throws, NeedsCallerType] + void 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..0784ac1440 --- /dev/null +++ b/dom/webidl/IDBCursor.webidl @@ -0,0 +1,52 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBCursorDirection + */ + +enum IDBCursorDirection { + "next", + "nextunique", + "prev", + "prevunique" +}; + +[Exposed=(Window,Worker)] +interface IDBCursor { + readonly attribute (IDBObjectStore or IDBIndex) source; + + [BinaryName="getDirection"] + readonly attribute IDBCursorDirection direction; + + [Throws] + readonly attribute any key; + + [Throws] + readonly attribute any primaryKey; + + readonly attribute IDBRequest request; + + [Throws] + IDBRequest update (any value); + + [Throws] + void advance ([EnforceRange] unsigned long count); + + [Throws] + void continue (optional any key); + + [Throws] + void continuePrimaryKey(any key, any primaryKey); + + [Throws] + IDBRequest delete (); +}; + +[Exposed=(Window,Worker)] +interface IDBCursorWithValue : IDBCursor { + [Throws] + readonly attribute any value; +}; diff --git a/dom/webidl/IDBDatabase.webidl b/dom/webidl/IDBDatabase.webidl new file mode 100644 index 0000000000..9db4a3c77f --- /dev/null +++ b/dom/webidl/IDBDatabase.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://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStoreParameters + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker)] +interface IDBDatabase : EventTarget { + readonly attribute DOMString name; + readonly attribute unsigned long long version; + + readonly attribute DOMStringList objectStoreNames; + + [Throws] + IDBObjectStore createObjectStore (DOMString name, optional IDBObjectStoreParameters optionalParameters = {}); + + [Throws] + void deleteObjectStore (DOMString name); + + [Throws] + IDBTransaction transaction ((DOMString or sequence<DOMString>) storeNames, + optional IDBTransactionMode mode = "readonly"); + + void close (); + + attribute EventHandler onabort; + attribute EventHandler onclose; + attribute EventHandler onerror; + attribute EventHandler onversionchange; +}; + +partial interface IDBDatabase { + [Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"] + readonly attribute StorageType storage; + + [Exposed=Window, Throws, UseCounter] + IDBRequest createMutableFile (DOMString name, optional DOMString type); +}; diff --git a/dom/webidl/IDBFactory.webidl b/dom/webidl/IDBFactory.webidl new file mode 100644 index 0000000000..57826b2317 --- /dev/null +++ b/dom/webidl/IDBFactory.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://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBFactory + * + * 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; + StorageType storage; +}; + +/** + * Interface that defines the indexedDB property on a window. See + * http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBFactory + * for more information. + */ +[Exposed=(Window,Worker)] +interface IDBFactory { + [Throws, NeedsCallerType] + IDBOpenDBRequest + open(DOMString name, + [EnforceRange] unsigned long long version); + + [Throws, NeedsCallerType] + IDBOpenDBRequest + open(DOMString name, + optional IDBOpenDBOptions options = {}); + + [Throws, NeedsCallerType] + IDBOpenDBRequest + deleteDatabase(DOMString name, + optional IDBOpenDBOptions options = {}); + + [Throws] + short + cmp(any first, + any second); + + [Throws, ChromeOnly, NeedsCallerType] + IDBOpenDBRequest + openForPrincipal(Principal principal, + DOMString name, + [EnforceRange] unsigned long long version); + + [Throws, ChromeOnly, NeedsCallerType] + IDBOpenDBRequest + openForPrincipal(Principal principal, + DOMString name, + optional IDBOpenDBOptions options = {}); + + [Throws, ChromeOnly, NeedsCallerType] + IDBOpenDBRequest + deleteForPrincipal(Principal principal, + DOMString name, + optional IDBOpenDBOptions options = {}); +}; diff --git a/dom/webidl/IDBFileHandle.webidl b/dom/webidl/IDBFileHandle.webidl new file mode 100644 index 0000000000..54639b828b --- /dev/null +++ b/dom/webidl/IDBFileHandle.webidl @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtaone at http://mozilla.org/MPL/2.0/. */ + +dictionary IDBFileMetadataParameters +{ + boolean size = true; + boolean lastModified = true; +}; + +[Exposed=Window] +interface IDBFileHandle : EventTarget +{ + readonly attribute IDBMutableFile? mutableFile; + // this is deprecated due to renaming in the spec + readonly attribute IDBMutableFile? fileHandle; // now mutableFile + readonly attribute FileMode mode; + readonly attribute boolean active; + attribute unsigned long long? location; + + [Throws] + IDBFileRequest? getMetadata(optional IDBFileMetadataParameters parameters = {}); + [Throws] + IDBFileRequest? readAsArrayBuffer(unsigned long long size); + [Throws] + IDBFileRequest? readAsText(unsigned long long size, + optional DOMString? encoding = null); + + [Throws] + IDBFileRequest? write((DOMString or ArrayBuffer or ArrayBufferView or Blob) value); + [Throws] + IDBFileRequest? append((DOMString or ArrayBuffer or ArrayBufferView or Blob) value); + [Throws] + IDBFileRequest? truncate(optional unsigned long long size); + [Throws] + IDBFileRequest? flush(); + [Throws] + void abort(); + + attribute EventHandler oncomplete; + attribute EventHandler onabort; + attribute EventHandler onerror; +}; diff --git a/dom/webidl/IDBFileRequest.webidl b/dom/webidl/IDBFileRequest.webidl new file mode 100644 index 0000000000..7e9bae27a7 --- /dev/null +++ b/dom/webidl/IDBFileRequest.webidl @@ -0,0 +1,14 @@ +/* -*- 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/. */ + +[Exposed=Window] +interface IDBFileRequest : DOMRequest { + readonly attribute IDBFileHandle? fileHandle; + // this is deprecated due to renaming in the spec + readonly attribute IDBFileHandle? lockedFile; // now fileHandle + + attribute EventHandler onprogress; +}; diff --git a/dom/webidl/IDBIndex.webidl b/dom/webidl/IDBIndex.webidl new file mode 100644 index 0000000000..ff2f215d83 --- /dev/null +++ b/dom/webidl/IDBIndex.webidl @@ -0,0 +1,68 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBIndexParameters + */ + +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; + + 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. + [Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"] + readonly attribute DOMString? locale; + + [Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"] + readonly attribute boolean isAutoLocale; + + [Throws] + IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next"); + + [Throws] + IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next"); + + [Throws] + IDBRequest get (any key); + + [Throws] + IDBRequest getKey (any key); + + [Throws] + IDBRequest count (optional any key); +}; + +partial interface IDBIndex { + // 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. + [Throws, Alias="mozGetAll"] + IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit); + + [Throws, Alias="mozGetAllKeys"] + IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit); +}; diff --git a/dom/webidl/IDBKeyRange.webidl b/dom/webidl/IDBKeyRange.webidl new file mode 100644 index 0000000000..92469aeb04 --- /dev/null +++ b/dom/webidl/IDBKeyRange.webidl @@ -0,0 +1,41 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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/IndexedDB/raw-file/tip/Overview.html + * + * 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); +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"] +interface IDBLocaleAwareKeyRange : IDBKeyRange { + [NewObject, Throws] + static IDBLocaleAwareKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false); +}; diff --git a/dom/webidl/IDBMutableFile.webidl b/dom/webidl/IDBMutableFile.webidl new file mode 100644 index 0000000000..e7d037066a --- /dev/null +++ b/dom/webidl/IDBMutableFile.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 IDBMutableFile : EventTarget { + readonly attribute DOMString name; + readonly attribute DOMString type; + + readonly attribute IDBDatabase database; + + [Throws, UseCounter] + IDBFileHandle open(optional FileMode mode = "readonly"); + + attribute EventHandler onabort; + attribute EventHandler onerror; +}; diff --git a/dom/webidl/IDBObjectStore.webidl b/dom/webidl/IDBObjectStore.webidl new file mode 100644 index 0000000000..105f3501f2 --- /dev/null +++ b/dom/webidl/IDBObjectStore.webidl @@ -0,0 +1,74 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStore + */ + +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; + readonly attribute IDBTransaction transaction; + readonly attribute boolean autoIncrement; + + [Throws] + IDBRequest put (any value, optional any key); + + [Throws] + IDBRequest add (any value, optional any key); + + [Throws] + IDBRequest delete (any key); + + [Throws] + IDBRequest get (any key); + + [Throws] + IDBRequest getKey (any key); + + [Throws] + IDBRequest clear (); + + [Throws] + IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next"); + + [Throws] + IDBIndex createIndex (DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters optionalParameters = {}); + + [Throws] + IDBIndex index (DOMString name); + + [Throws] + void deleteIndex (DOMString indexName); + + [Throws] + IDBRequest count (optional any key); +}; + +partial interface IDBObjectStore { + // 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. + [Throws, Alias="mozGetAll"] + IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit); + + [Throws] + IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit); + + [Throws] + IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next"); +}; diff --git a/dom/webidl/IDBOpenDBRequest.webidl b/dom/webidl/IDBOpenDBRequest.webidl new file mode 100644 index 0000000000..8668009a6b --- /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://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-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..029368bc7d --- /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://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBRequest + * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-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..3b832427b1 --- /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://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransaction + * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransactionMode + */ + +enum IDBTransactionMode { + "readonly", + "readwrite", + // The "readwriteflush" mode is only available when the + // |IndexedDatabaseManager::ExperimentalFeaturesEnabled()| function 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; + readonly attribute IDBDatabase db; + + readonly attribute DOMException? error; + + [Throws] + IDBObjectStore objectStore (DOMString name); + + [Throws] + void commit(); + + [Throws] + void 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..d35030164f --- /dev/null +++ b/dom/webidl/IDBVersionChangeEvent.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://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-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 = {}); + + readonly attribute unsigned long long oldVersion; + readonly attribute unsigned long long? newVersion; +}; + diff --git a/dom/webidl/IIRFilterNode.webidl b/dom/webidl/IIRFilterNode.webidl new file mode 100644 index 0000000000..d6fce619d4 --- /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); + + void getFrequencyResponse(Float32Array frequencyHz, Float32Array magResponse, Float32Array phaseResponse); +}; + +// Mozilla extension +IIRFilterNode includes AudioNodePassThrough; diff --git a/dom/webidl/IdleDeadline.webidl b/dom/webidl/IdleDeadline.webidl new file mode 100644 index 0000000000..17e150102c --- /dev/null +++ b/dom/webidl/IdleDeadline.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/requestidlecallback/ + */ + +[Exposed=Window, + Func="nsGlobalWindowInner::IsRequestIdleCallbackEnabled"] +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..8c27ed1a25 --- /dev/null +++ b/dom/webidl/ImageBitmap.webidl @@ -0,0 +1,388 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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. + void 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; diff --git a/dom/webidl/ImageBitmapRenderingContext.webidl b/dom/webidl/ImageBitmapRenderingContext.webidl new file mode 100644 index 0000000000..b94447cd96 --- /dev/null +++ b/dom/webidl/ImageBitmapRenderingContext.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://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 { + // 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. + void transferFromImageBitmap(ImageBitmap bitmap); + + // Deprecated version of transferFromImageBitmap + [Deprecated="ImageBitmapRenderingContext_TransferImageBitmap"] + void transferImageBitmap(ImageBitmap bitmap); +}; diff --git a/dom/webidl/ImageCapture.webidl b/dom/webidl/ImageCapture.webidl new file mode 100644 index 0000000000..2ddaea4921 --- /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] + // void setOptions (PhotoSettings? photoSettings); + [Throws] + void takePhoto(); + // [Throws] + // void getFrame(); +}; diff --git a/dom/webidl/ImageCaptureErrorEvent.webidl b/dom/webidl/ImageCaptureErrorEvent.webidl new file mode 100644 index 0000000000..5c49e33871 --- /dev/null +++ b/dom/webidl/ImageCaptureErrorEvent.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://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; +}; + +[NoInterfaceObject, + 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..8e5c882860 --- /dev/null +++ b/dom/webidl/ImageData.webidl @@ -0,0 +1,28 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.whatwg.org/specs/web-apps/current-work/multipage/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] +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..b03fbba940 --- /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, OverrideBuiltins, + 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. */ + void shrinkToFit(); + + /* Restore image original size. */ + void restoreImage(); +}; diff --git a/dom/webidl/InputEvent.webidl b/dom/webidl/InputEvent.webidl new file mode 100644 index 0000000000..c2e027219f --- /dev/null +++ b/dom/webidl/InputEvent.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/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). + [Pref="dom.input_events.beforeinput.enabled"] + sequence<StaticRange> getTargetRanges(); +}; + +partial dictionary InputEventInit +{ + DataTransfer? dataTransfer = null; + [Pref="dom.input_events.beforeinput.enabled"] + sequence<StaticRange> targetRanges = []; +}; diff --git a/dom/webidl/InstallTrigger.webidl b/dom/webidl/InstallTrigger.webidl new file mode 100644 index 0000000000..f8655164fb --- /dev/null +++ b/dom/webidl/InstallTrigger.webidl @@ -0,0 +1,91 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 = void(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 + */ + 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 + */ + 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 + */ + 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..0a64ee74a9 --- /dev/null +++ b/dom/webidl/IntersectionObserver.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/IntersectionObserver/ + */ + +[ProbablyShortLivingWrapper, Pref="dom.IntersectionObserver.enabled", + 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; +}; + +[Pref="dom.IntersectionObserver.enabled", + 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; + void observe(Element target); + void unobserve(Element target); + void disconnect(); + sequence<IntersectionObserverEntry> takeRecords(); +}; + +callback IntersectionCallback = + void (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..722988b5e1 --- /dev/null +++ b/dom/webidl/IntlUtils.webidl @@ -0,0 +1,85 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 style; + sequence<DOMString> keys; +}; + +[GenerateInit] +dictionary DisplayNameResult { + DOMString locale; + DOMString style; + record<DOMString, DOMString> values; +}; + +[GenerateInit] +dictionary LocaleInfo { + DOMString locale; + DOMString direction; +}; + +/** + * The IntlUtils interface provides helper functions for localization. + */ +[NoInterfaceObject, + 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 two optional properties: + * + * keys: + * an Array of string values that are paths to individual terms + * + * style: + * a String with a value "long", "short" or "narrow" + * + * It returns an object with properties: + * + * locale: + * a negotiated locale string + * + * style: + * negotiated style + * + * values: + * a key-value pair list of requested keys and corresponding translated + * values + * + */ + [Throws] + DisplayNameResult getDisplayNames(sequence<DOMString> locales, + optional DisplayNameOptions options = {}); + + /** + * Helper function to retrieve useful information about a locale. + * + * The function takes one argument - locales which is a list of locale + * strings. + * + * It returns an object with properties: + * + * locale: + * a negotiated locale string + * + * direction: + * text direction, "ltr" or "rtl" + * + */ + [Throws] + LocaleInfo getLocaleInfo(sequence<DOMString> locales); + + /** + * 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/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..c5842f013e --- /dev/null +++ b/dom/webidl/KeyAlgorithm.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/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..c9149c7eee --- /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"] + void 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..27d3c1fd78 --- /dev/null +++ b/dom/webidl/KeyboardEvent.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/. + */ + +[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"] + void 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 +{ + DOMString key = ""; + 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..d31aa74c17 --- /dev/null +++ b/dom/webidl/KeyframeEffect.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/. + * + * 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. +[Func="Document::IsWebAnimationsEnabled", + 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] void 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..27e9a4357c --- /dev/null +++ b/dom/webidl/LinkStyle.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://dev.w3.org/csswg/cssom/#the-linkstyle-interface + */ + +interface mixin LinkStyle { + [BinaryName="sheetForBindings"] readonly attribute StyleSheet? sheet; +}; + diff --git a/dom/webidl/LoadURIOptions.webidl b/dom/webidl/LoadURIOptions.webidl new file mode 100644 index 0000000000..734256ce9c --- /dev/null +++ b/dom/webidl/LoadURIOptions.webidl @@ -0,0 +1,82 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 ContentSecurityPolicy; +interface Principal; +interface URI; +interface InputStream; +interface ReferrerInfo; + +/** + * This dictionary holds load arguments for docshell loads. + */ +[GenerateInit] +dictionary LoadURIOptions { + /** + * The principal that initiated the load. + */ + Principal? triggeringPrincipal = null; + + /** + * The CSP to be used for the load. That is *not* the CSP that will + * be applied to subresource loads within that document but the CSP + * for the document load itself. E.g. if that CSP includes + * upgrade-insecure-requests, then the new top-level load will + * be upgraded to HTTPS. + */ + ContentSecurityPolicy? csp = null; + + /** + * Flags modifying load behaviour. This parameter is a bitwise + * combination of the load flags defined in nsIWebNavigation.idl. + */ + long loadFlags = 0; + + /** + * The referring info of the load. If this argument is null, then the + * referrer URI and referrer policy will be inferred internally. + */ + ReferrerInfo? referrerInfo = null; + + /** + * If the URI to be loaded corresponds to a HTTP request, then this stream is + * appended directly to the HTTP request headers. It may be prefixed + * with additional HTTP headers. This stream must contain a "\r\n" + * sequence separating any HTTP headers from the HTTP request body. + */ + InputStream? postData = null; + + /** + * If the URI corresponds to a HTTP request, then any HTTP headers + * contained in this stream are set on the HTTP request. The HTTP + * header stream is formatted as: + * ( HEADER "\r\n" )* + */ + InputStream? headers = null; + + /** + * Set to indicate a base URI to be associated with the load. Note + * that at present this argument is only used with view-source aURIs + * and cannot be used to resolve aURI. + */ + URI? baseURI = null; + + /** + * Set to indicate that the URI to be loaded was triggered by a user + * action. (Mostly used in the context of Sec-Fetch-User). + */ + boolean hasValidUserGestureActivation = false; + + + /** + * The SandboxFlags of the entity thats + * responsible for causing the load. + */ + unsigned long triggeringSandboxFlags = 0; + /** + * If non-0, a value to pass to nsIDocShell::setCancelContentJSEpoch + * when initiating the load. + */ + long cancelContentJSEpoch = 0; +}; diff --git a/dom/webidl/Localization.webidl b/dom/webidl/Localization.webidl new file mode 100644 index 0000000000..8874798bdd --- /dev/null +++ b/dom/webidl/Localization.webidl @@ -0,0 +1,178 @@ +/* -*- 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; +}; + +/** + * A callback function which takes a list of localization resources + * and produces an iterator over FluentBundle objects used for + * localization with fallbacks. + */ +callback GenerateBundles = Promise<any> (sequence<DOMString> aResourceIds); +callback GenerateBundlesSync = any (sequence<DOMString> aResourceIds); + +/** + * The structure provides custom methods for the Localization API that + * will be used to generate the `FluentBundle` iterator. + * This allows the consumer to overload the default Gecko generator. + */ +dictionary BundleGenerator { + GenerateBundles generateBundles; + GenerateBundlesSync generateBundlesSync; +}; + +/** + * 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. + * - aBundleGenerator - an object with two methods - `generateBundles` and + * `generateBundlesSync` allowing consumers to overload the + * default generators provided by Gecko. + */ + [Throws] + constructor(sequence<DOMString> aResourceIds, + optional boolean aSync = false, + optional BundleGenerator aBundleGenerator = {}); + + /** + * A method for adding resources to the localization context. + * + * Returns a new count of resources used by the context. + */ + unsigned long addResourceIds(sequence<DOMString> aResourceIds); + + /** + * A method for removing resources from the localization context. + * + * Returns a new count of resources used by the context. + */ + unsigned long removeResourceIds(sequence<DOMString> 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); + + void setIsSync(boolean aIsSync); + + [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..88797e2da4 --- /dev/null +++ b/dom/webidl/Location.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://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. + */ + +[Unforgeable, + Exposed=Window] +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] + void assign(USVString url); + + [Throws, CrossOriginCallable, NeedsSubjectPrincipal] + void replace(USVString url); + + // XXXbz there is no forceget argument in the spec! See bug 1037721. + [Throws, NeedsSubjectPrincipal] + void reload(optional boolean forceget = false); + + // Bug 1085214 [SameObject] readonly attribute USVString[] ancestorOrigins; +}; 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..35045f2aae --- /dev/null +++ b/dom/webidl/MIDIInput.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-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..0468c22afb --- /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..1660cc07da --- /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] + void send(sequence<octet> data, optional DOMHighResTimeStamp timestamp); + void 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..c698ed470d --- /dev/null +++ b/dom/webidl/MIDIPort.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-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; + Promise<MIDIPort> open(); + Promise<MIDIPort> close(); +}; + diff --git a/dom/webidl/MathMLElement.webidl b/dom/webidl/MathMLElement.webidl new file mode 100644 index 0000000000..1b9ae4d1fc --- /dev/null +++ b/dom/webidl/MathMLElement.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://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 DocumentAndElementEventHandlers; +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..4c8001aa24 --- /dev/null +++ b/dom/webidl/MediaCapabilities.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://wicg.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 DOMString framerate; +}; + +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..2b0737dca7 --- /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; + 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 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 { + 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..3f20817c64 --- /dev/null +++ b/dom/webidl/MediaDevices.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://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(); + + [Throws, NeedsCallerType, UseCounter] + Promise<sequence<MediaDeviceInfo>> enumerateDevices(); + + [Throws, 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", Throws, NeedsCallerType, UseCounter] + Promise<MediaStream> getDisplayMedia(optional DisplayMediaStreamConstraints constraints = {}); +}; diff --git a/dom/webidl/MediaElementAudioSourceNode.webidl b/dom/webidl/MediaElementAudioSourceNode.webidl new file mode 100644 index 0000000000..ca5909c311 --- /dev/null +++ b/dom/webidl/MediaElementAudioSourceNode.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 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..9977a98b77 --- /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<void> closed; + + readonly attribute MediaKeyStatusMap keyStatuses; + + attribute EventHandler onkeystatuseschange; + + attribute EventHandler onmessage; + + [NewObject] + Promise<void> generateRequest(DOMString initDataType, BufferSource initData); + + [NewObject] + Promise<boolean> load(DOMString sessionId); + + // session operations + [NewObject] + Promise<void> update(BufferSource response); + + [NewObject] + Promise<void> close(); + + [NewObject] + Promise<void> remove(); +}; diff --git a/dom/webidl/MediaKeyStatusMap.webidl b/dom/webidl/MediaKeyStatusMap.webidl new file mode 100644 index 0000000000..7e664895ca --- /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] + any 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..aede099cc3 --- /dev/null +++ b/dom/webidl/MediaKeys.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://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://github.com/WICG/media-capabilities/blob/master/eme-extension-policy-check.md +dictionary MediaKeysPolicy { + DOMString minHdcpVersion = ""; +}; + +[Exposed=Window] +interface MediaKeys { + readonly attribute DOMString keySystem; + + [NewObject, Throws] + MediaKeySession createSession(optional MediaKeySessionType sessionType = "temporary"); + + [NewObject] + Promise<void> 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..af307b5d83 --- /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 [TreatNullAs=EmptyString] UTF8String mediaText; + + readonly attribute unsigned long length; + getter UTF8String? item(unsigned long index); + [Throws] + void deleteMedium(UTF8String oldMedium); + [Throws] + void appendMedium(UTF8String newMedium); +}; diff --git a/dom/webidl/MediaQueryList.webidl b/dom/webidl/MediaQueryList.webidl new file mode 100644 index 0000000000..5132cb6ca7 --- /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] + void addListener(EventListener? listener); + + [Throws] + void 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..248c06eff0 --- /dev/null +++ b/dom/webidl/MediaRecorder.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://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 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] + void start(optional unsigned long timeslice); + [Throws] + void stop(); + [Throws] + void pause(); + [Throws] + void resume(); + [Throws] + void 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..47ba97fb54 --- /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 = void(MediaSessionActionDetails details); + +[Exposed=Window, Pref="dom.media.mediasession.enabled"] +interface MediaSession { + attribute MediaMetadata? metadata; + + attribute MediaSessionPlaybackState playbackState; + + void setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler); + + [Throws] + void setPositionState(optional MediaPositionState state = {}); + + // Fire the action handler. It's test-only for now. + [ChromeOnly] + void notifyHandler(MediaSessionActionDetails details); +}; + +[Exposed=Window, Pref="dom.media.mediasession.enabled"] +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..29448c9498 --- /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 onsourceclosed; + [NewObject, Throws] + SourceBuffer addSourceBuffer(DOMString type); + [Throws] + void removeSourceBuffer(SourceBuffer sourceBuffer); + [Throws] + void endOfStream(optional MediaSourceEndOfStreamError error); + [Throws] + void setLiveSeekableRange(double start, double end); + [Throws] + void clearLiveSeekableRange(); + static boolean isTypeSupported(DOMString type); + [Throws, ChromeOnly] + Promise<MediaSourceDecoderDebugInfo> mozDebugReaderData(); +}; diff --git a/dom/webidl/MediaStream.webidl b/dom/webidl/MediaStream.webidl new file mode 100644 index 0000000000..ea269895b9 --- /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); + void addTrack (MediaStreamTrack track); + void removeTrack (MediaStreamTrack track); + MediaStream clone (); + readonly attribute boolean active; + attribute EventHandler onaddtrack; + attribute EventHandler onremovetrack; + + [ChromeOnly, Throws] + 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] + void 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..d63026730d --- /dev/null +++ b/dom/webidl/MediaStreamAudioSourceNode.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 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..3a85293740 --- /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, NoInterfaceObject, + 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..ba60166358 --- /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 (); + void stop (); +// MediaTrackCapabilities getCapabilities (); + MediaTrackConstraints getConstraints (); + [NeedsCallerType] + MediaTrackSettings getSettings (); + + [Throws, NeedsCallerType] + Promise<void> 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..4e9f7b1174 --- /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] + void 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..5b8925b6f1 --- /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)] +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. + */ + void 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..d5a54e124b --- /dev/null +++ b/dom/webidl/MessagePort.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 + * http://www.whatwg.org/specs/web-apps/current-work/#channel-messaging + */ + +[Exposed=(Window,Worker,AudioWorklet)] +interface MessagePort : EventTarget { + [Throws] + void postMessage(any message, sequence<object> transferable); + [Throws] + void postMessage(any message, optional PostMessageOptions options = {}); + + void start(); + void close(); + + // event handlers + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; + +dictionary PostMessageOptions { + sequence<object> transfer = []; +}; diff --git a/dom/webidl/MimeType.webidl b/dom/webidl/MimeType.webidl new file mode 100644 index 0000000000..bccf7db7d8 --- /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 description; + readonly attribute Plugin? enabledPlugin; + readonly attribute DOMString suffixes; + readonly attribute DOMString type; +}; diff --git a/dom/webidl/MimeTypeArray.webidl b/dom/webidl/MimeTypeArray.webidl new file mode 100644 index 0000000000..913f69a06e --- /dev/null +++ b/dom/webidl/MimeTypeArray.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 MimeTypeArray { + [NeedsCallerType] + readonly attribute unsigned long length; + + [NeedsCallerType] + getter MimeType? item(unsigned long index); + [NeedsCallerType] + getter MimeType? namedItem(DOMString name); +}; diff --git a/dom/webidl/MouseEvent.webidl b/dom/webidl/MouseEvent.webidl new file mode 100644 index 0000000000..1998089d43 --- /dev/null +++ b/dom/webidl/MouseEvent.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/. + * + * 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. + */ + +[Exposed=Window] +interface MouseEvent : UIEvent { + constructor(DOMString typeArg, + optional MouseEventInit mouseEventInitDict = {}); + + [NeedsCallerType] + readonly attribute long screenX; + [NeedsCallerType] + readonly attribute long screenY; + 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; + readonly attribute DOMString? region; + + // Pointer Lock + readonly attribute long movementX; + readonly attribute long movementY; + + // Deprecated in DOM Level 3: +void 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 + [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; + + readonly attribute unsigned short mozInputSource; + + void 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); + +}; + diff --git a/dom/webidl/MouseScrollEvent.webidl b/dom/webidl/MouseScrollEvent.webidl new file mode 100644 index 0000000000..a70498ddba --- /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; + + void 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..865f436fd0 --- /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] + void swapFrameLoaders(XULFrameElement aOtherLoaderOwner); + + [ChromeOnly, Throws] + void swapFrameLoaders(HTMLIFrameElement aOtherLoaderOwner); + + [ChromeOnly, Throws] + void changeRemoteness(RemotenessOptions aOptions); +}; diff --git a/dom/webidl/MutationEvent.webidl b/dom/webidl/MutationEvent.webidl new file mode 100644 index 0000000000..d49334119b --- /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] + void 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..832237e81c --- /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] + void observe(Node target, optional MutationObserverInit options = {}); + void disconnect(); + sequence<MutationRecord> takeRecords(); + + [ChromeOnly, Throws] + sequence<MutationObservingInfo?> getObservingInfo(); + [ChromeOnly] + readonly attribute MutationCallback mutationCallback; + [ChromeOnly] + attribute boolean mergeAttributeRecords; +}; + +callback MutationCallback = void (sequence<MutationRecord> mutations, MutationObserver observer); + +dictionary MutationObserverInit { + boolean childList = false; + boolean attributes; + boolean characterData; + boolean subtree = false; + boolean attributeOldValue; + boolean characterDataOldValue; + [ChromeOnly] + boolean nativeAnonymousChildList = 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/NativeOSFileInternals.webidl b/dom/webidl/NativeOSFileInternals.webidl new file mode 100644 index 0000000000..27522a366c --- /dev/null +++ b/dom/webidl/NativeOSFileInternals.webidl @@ -0,0 +1,60 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtaone at http://mozilla.org/MPL/2.0/. */ + +/** + * Options for nsINativeOSFileInternals::Read + */ +[GenerateInit] +dictionary NativeOSFileReadOptions +{ + /** + * If specified, convert the raw bytes to a String + * with the specified encoding. Otherwise, return + * the raw bytes as a TypedArray. + */ + DOMString? encoding; + + /** + * If specified, limit the number of bytes to read. + */ + unsigned long long? bytes; +}; + +/** + * Options for nsINativeOSFileInternals::WriteAtomic + */ +[GenerateInit] +dictionary NativeOSFileWriteAtomicOptions +{ + /** + * If specified, specify the number of bytes to write. + * NOTE: This takes (and should take) a uint64 here but the actual + * value is limited to int32. This needs to be fixed, see Bug 1063635. + */ + unsigned long long? bytes; + + /** + * If specified, write all data to a temporary file in the + * |tmpPath|. Else, write to the given path directly. + */ + DOMString? tmpPath = null; + + /** + * If specified and true, a failure will occur if the file + * already exists in the given path. + */ + boolean noOverwrite = false; + + /** + * If specified and true, this will sync any buffered data + * for the file to disk. This might be slower, but safer. + */ + boolean flush = false; + + /** + * If specified, this will backup the destination file as + * specified. + */ + DOMString? backupTo = null; +}; diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl new file mode 100644 index 0000000000..5382bc56c8 --- /dev/null +++ b/dom/webidl/Navigator.webidl @@ -0,0 +1,346 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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-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; + +// http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object +[HeaderFile="Navigator.h", + Exposed=Window] +interface Navigator { + // objects implementing this interface also implement the interfaces given below +}; +Navigator includes NavigatorID; +Navigator includes NavigatorLanguage; +Navigator includes NavigatorOnLine; +Navigator includes NavigatorContentUtils; +Navigator includes NavigatorStorageUtils; +Navigator includes NavigatorConcurrentHardware; +Navigator includes NavigatorStorage; +Navigator includes NavigatorAutomationInformation; +Navigator includes GPUProvider; + +interface mixin NavigatorID { + // WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla"). + [Constant, Cached, Throws] + readonly attribute DOMString appCodeName; // constant "Mozilla" + [Constant, Cached, NeedsCallerType] + readonly attribute DOMString appName; + [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] + void checkProtocolHandlerAllowed(DOMString scheme, URI handlerURI, URI documentURI); + [Throws, SecureContext] + void registerProtocolHandler(DOMString scheme, DOMString url); + // NOT IMPLEMENTED + //void unregisterProtocolHandler(DOMString scheme, DOMString url); +}; + +[SecureContext] +interface mixin NavigatorStorage { + [Pref="dom.storageManager.enabled"] + readonly attribute StorageManager storage; +}; + +interface mixin NavigatorStorageUtils { + // NOT IMPLEMENTED + //void yieldForStorageUpdates(); +}; + +partial interface Navigator { + [Throws] + readonly attribute Permissions permissions; +}; + +// Things that definitely need to be in the spec and and are not for some +// reason. See https://www.w3.org/Bugs/Public/show_bug.cgi?id=22406 +partial interface Navigator { + [Throws] + readonly attribute MimeTypeArray mimeTypes; + [Throws] + readonly attribute PluginArray plugins; +}; + +// http://www.w3.org/TR/tracking-dnt/ sort of +partial interface Navigator { + readonly attribute DOMString doNotTrack; +}; + +// 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 { + [Pref="dom.w3c_pointer_events.enabled", 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] + void 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"] + sequence<Gamepad?> getGamepads(); +}; +partial interface Navigator { + [Pref="dom.gamepad.test.enabled"] + GamepadServiceTest requestGamepadServiceTest(); +}; + +// https://immersive-web.github.io/webvr/spec/1.1/#interface-navigator +partial interface Navigator { + [Throws, 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"] + void requestVRPresentation(VRDisplay display); +}; +partial interface Navigator { + [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 { + [Throws, Pref="dom.webmidi.enabled"] + Promise<MIDIAccess> requestMIDIAccess(optional MIDIOptions options = {}); +}; + +callback NavigatorUserMediaSuccessCallback = void (MediaStream stream); +callback NavigatorUserMediaErrorCallback = void (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] + void mozGetUserMedia(MediaStreamConstraints constraints, + NavigatorUserMediaSuccessCallback successCallback, + NavigatorUserMediaErrorCallback errorCallback); +}; + +// nsINavigatorUserMedia +callback MozGetUserMediaDevicesSuccessCallback = void (nsIVariant? devices); +partial interface Navigator { + [Throws, ChromeOnly] + void mozGetUserMediaDevices(MediaStreamConstraints constraints, + MozGetUserMediaDevicesSuccessCallback onsuccess, + NavigatorUserMediaErrorCallback onerror, + // The originating innerWindowID is needed to + // avoid calling the callbacks if the window has + // navigated away. It is optional only as legacy. + optional unsigned long long innerWindowID = 0, + // The callID is needed in case of multiple + // concurrent requests to find the right one. + // It is optional only as legacy. + // TODO: Rewrite to not need this method anymore, + // now that devices are enumerated earlier. + optional DOMString callID = ""); +}; + +// Service Workers/Navigation Controllers +partial interface Navigator { + [Func="ServiceWorkerContainer::IsEnabled", SameObject] + readonly attribute ServiceWorkerContainer serviceWorker; +}; + +partial interface Navigator { + [Throws, Pref="beacon.enabled"] + boolean sendBeacon(DOMString url, + optional BodyInit? data = null); +}; + +partial interface Navigator { + [Throws, Pref="dom.presentation.enabled", SameObject] + readonly attribute Presentation? presentation; +}; + +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 { + [Pref="dom.webdriver.enabled"] + readonly attribute boolean webdriver; +}; + +// https://www.w3.org/TR/clipboard-apis/#navigator-interface +partial interface Navigator { + [Pref="dom.events.asyncClipboard", SecureContext, SameObject] + readonly attribute Clipboard clipboard; +}; + +// https://wicg.github.io/web-share/#navigator-interface +partial interface Navigator { + [SecureContext, Throws, Func="Navigator::HasShareSupport"] + Promise<void> share(optional ShareData data = {}); +}; +// https://wicg.github.io/web-share/#sharedata-dictionary +dictionary ShareData { + USVString title; + USVString text; + USVString url; +}; + +// https://w3c.github.io/mediasession/#idl-index +[Exposed=Window] +partial interface Navigator { + [Pref="dom.media.mediasession.enabled", SameObject] + readonly attribute MediaSession mediaSession; +}; 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..bd3edf1b45 --- /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] + void 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..bc645df2e0 --- /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(); + + void 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..73a3cddfe9 --- /dev/null +++ b/dom/webidl/Notification.webidl @@ -0,0 +1,100 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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; + + [Throws, Func="mozilla::dom::Notification::RequestPermissionEnabledForScope"] + static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback permissionCallback); + + [Throws, Func="mozilla::dom::Notification::IsGetEnabled"] + static Promise<sequence<Notification>> get(optional GetNotificationOptions filter = {}); + + 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] + readonly attribute any data; + + void close(); +}; + +dictionary NotificationOptions { + NotificationDirection dir = "auto"; + DOMString lang = ""; + DOMString body = ""; + DOMString tag = ""; + DOMString icon = ""; + boolean requireInteraction = false; + 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 = void (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..cd9ce1f211 --- /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); + + [Throws] + Promise<AudioBuffer> startRendering(); + + // TODO: Promise<void> suspend (double suspendTime); + + readonly attribute unsigned long length; + attribute EventHandler oncomplete; +}; diff --git a/dom/webidl/OfflineResourceList.webidl b/dom/webidl/OfflineResourceList.webidl new file mode 100644 index 0000000000..35a017d78f --- /dev/null +++ b/dom/webidl/OfflineResourceList.webidl @@ -0,0 +1,124 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +[SecureContext, Pref="browser.cache.offline.enable", +Exposed=Window] +interface OfflineResourceList : EventTarget { + /** + * State of the application cache this object is associated with. + */ + + /* This object is not associated with an application cache. */ + const unsigned short UNCACHED = 0; + + /* The application cache is not being updated. */ + const unsigned short IDLE = 1; + + /* The manifest is being fetched and checked for updates */ + const unsigned short CHECKING = 2; + + /* Resources are being downloaded to be added to the cache */ + const unsigned short DOWNLOADING = 3; + + /* There is a new version of the application cache available */ + const unsigned short UPDATEREADY = 4; + + /* The application cache group is now obsolete. */ + const unsigned short OBSOLETE = 5; + + [Throws, UseCounter] + readonly attribute unsigned short status; + + /** + * Begin the application update process on the associated application cache. + */ + [Throws, UseCounter] + void update(); + + /** + * Swap in the newest version of the application cache, or disassociate + * from the cache if the cache group is obsolete. + */ + [Throws, UseCounter] + void swapCache(); + + /* Events */ + [UseCounter] + attribute EventHandler onchecking; + [UseCounter] + attribute EventHandler onerror; + [UseCounter] + attribute EventHandler onnoupdate; + [UseCounter] + attribute EventHandler ondownloading; + [UseCounter] + attribute EventHandler onprogress; + [UseCounter] + attribute EventHandler onupdateready; + [UseCounter] + attribute EventHandler oncached; + [UseCounter] + attribute EventHandler onobsolete; +}; + +// Mozilla extensions. +partial interface OfflineResourceList { + /** + * Get the list of dynamically-managed entries. + */ + [Throws] + readonly attribute DOMStringList mozItems; + + /** + * Check that an entry exists in the list of dynamically-managed entries. + * + * @param uri + * The resource to check. + */ + [Throws] + boolean mozHasItem(DOMString uri); + + /** + * Get the number of dynamically-managed entries. + * @status DEPRECATED + * Clients should use the "items" attribute. + */ + [Throws] + readonly attribute unsigned long mozLength; + + /** + * Get the URI of a dynamically-managed entry. + * @status DEPRECATED + * Clients should use the "items" attribute. + */ + [Throws] + getter DOMString mozItem(unsigned long index); + + /** + * We need a "length" to actually be valid Web IDL, given that we have an + * indexed getter. + */ + readonly attribute unsigned long length; + + /** + * Add an item to the list of dynamically-managed entries. The resource + * will be fetched into the application cache. + * + * @param uri + * The resource to add. + */ + [Throws] + void mozAdd(DOMString uri); + + /** + * Remove an item from the list of dynamically-managed entries. If this + * was the last reference to a URI in the application cache, the cache + * entry will be removed. + * + * @param uri + * The resource to remove. + */ + [Throws] + void mozRemove(DOMString uri); +}; diff --git a/dom/webidl/OffscreenCanvas.webidl b/dom/webidl/OffscreenCanvas.webidl new file mode 100644 index 0000000000..d9e946a246 --- /dev/null +++ b/dom/webidl/OffscreenCanvas.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 + * https://wiki.whatwg.org/wiki/OffscreenCanvas + */ + +[Exposed=(Window,Worker), + Pref="gfx.offscreencanvas.enabled"] +interface OffscreenCanvas : EventTarget { + constructor(unsigned long width, unsigned long height); + + [Pure, SetterThrows] + attribute unsigned long width; + [Pure, SetterThrows] + attribute unsigned long height; + + [Throws] + nsISupports? getContext(DOMString contextId, + optional any contextOptions = null); + + [Throws] + ImageBitmap transferToImageBitmap(); + [Throws] + Promise<Blob> toBlob(optional DOMString type = "", + optional any encoderOptions); +}; + diff --git a/dom/webidl/OscillatorNode.webidl b/dom/webidl/OscillatorNode.webidl new file mode 100644 index 0000000000..dbb4242e43 --- /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 + + void 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..19a1fdd42c --- /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 { + void registerPaint(DOMString name, VoidFunction paintCtor); +}; diff --git a/dom/webidl/PannerNode.webidl b/dom/webidl/PannerNode.webidl new file mode 100644 index 0000000000..94d6a8bf54 --- /dev/null +++ b/dom/webidl/PannerNode.webidl @@ -0,0 +1,83 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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 + void setPosition(double x, double y, double z); + void 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..a2c43daa2a --- /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, + [TreatNullAs=EmptyString] DOMString value); + [ChromeOnly, Throws] + HTMLCollection getElementsByAttributeNS(DOMString? namespaceURI, DOMString name, + [TreatNullAs=EmptyString] DOMString value); + + [CEReactions, Throws, Unscopable] + void prepend((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + void append((Node or DOMString)... nodes); + [CEReactions, Throws, Unscopable] + void 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..4014f9f92b --- /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<void> 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..1b7d0f1520 --- /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] + void 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..50a2009ee4 --- /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<void> complete(optional PaymentComplete result = "unknown"); + + // If the dictionary argument has no required members, it must be optional. + [NewObject] + Promise<void> 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..3065953314 --- /dev/null +++ b/dom/webidl/PeerConnectionImpl.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/. + * + * 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; + +/* 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] + void initialize(PeerConnectionObserver observer, Window window, + RTCConfiguration iceServers, + nsISupports thread); + + /* JSEP calls */ + [Throws] + void createOffer(optional RTCOfferOptions options = {}); + [Throws] + void createAnswer(); + [Throws] + void setLocalDescription(long action, DOMString sdp); + [Throws] + void setRemoteDescription(long action, DOMString sdp); + + Promise<RTCStatsReport> getStats(MediaStreamTrack? selector); + + sequence<MediaStream> getRemoteStreams(); + + /* Adds the tracks created by GetUserMedia */ + [Throws] + TransceiverImpl createTransceiverImpl(DOMString kind, + MediaStreamTrack? track); + [Throws] + boolean checkNegotiationNeeded(); + + [Throws] + void replaceTrackNoRenegotiation(TransceiverImpl transceiverImpl, + MediaStreamTrack? withTrack); + [Throws] + void closeStreams(); + + [Throws] + void enablePacketDump(unsigned long level, + mozPacketDumpType type, + boolean sending); + + [Throws] + void 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] + void addIceCandidate(DOMString candidate, + DOMString mid, + DOMString ufrag, + unsigned short? level); + + /* Shuts down threads, deletes state */ + [Throws] + void close(); + + /* Notify DOM window if this plugin crash is ours. */ + boolean pluginCrash(unsigned long long pluginId, DOMString name); + + /* 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 RTCSignalingState signalingState; + attribute DOMString id; + + [SetterThrows] + attribute DOMString peerIdentity; + readonly attribute boolean privacyRequested; + + /* 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); +}; diff --git a/dom/webidl/PeerConnectionObserver.webidl b/dom/webidl/PeerConnectionObserver.webidl new file mode 100644 index 0000000000..aadaf1aacb --- /dev/null +++ b/dom/webidl/PeerConnectionObserver.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/. + */ + +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 */ + void onCreateOfferSuccess(DOMString offer); + void onCreateOfferError(PCErrorData error); + void onCreateAnswerSuccess(DOMString answer); + void onCreateAnswerError(PCErrorData error); + void onSetDescriptionSuccess(); + void onSetDescriptionError(PCErrorData error); + void onAddIceCandidateSuccess(); + void onAddIceCandidateError(PCErrorData error); + void onIceCandidate(unsigned short level, DOMString mid, DOMString candidate, DOMString ufrag); + + /* Data channel callbacks */ + void notifyDataChannel(RTCDataChannel channel); + + /* Notification of one of several types of state changed */ + void onStateChange(PCObserverStateType state); + + /* Transceiver management; called when setRemoteDescription causes a + transceiver to be created on the C++ side */ + void onTransceiverNeeded(DOMString kind, TransceiverImpl transceiverImpl); + + /* + Lets PeerConnectionImpl fire track events on the RTCPeerConnection + */ + void fireTrackEvent(RTCRtpReceiver receiver, sequence<MediaStream> streams); + + /* + Lets PeerConnectionImpl fire addstream events on the RTCPeerConnection + */ + void fireStreamEvent(MediaStream stream); + + /* Packet dump callback */ + void onPacket(unsigned long level, mozPacketDumpType type, boolean sending, + ArrayBuffer packet); + + /* Transceiver sync */ + void syncTransceivers(); +}; diff --git a/dom/webidl/PeerConnectionObserverEnums.webidl b/dom/webidl/PeerConnectionObserverEnums.webidl new file mode 100644 index 0000000000..734eda1f43 --- /dev/null +++ b/dom/webidl/PeerConnectionObserverEnums.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/. + * + * This is in a separate file so it can be shared with unittests. + */ + +enum PCObserverStateType { + "None", + "IceConnectionState", + "IceGatheringState", + "SignalingState" +}; + +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..1d113b68a0 --- /dev/null +++ b/dom/webidl/Performance.webidl @@ -0,0 +1,74 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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. + */ + +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 { + void clearResourceTimings(); + void 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 +[Exposed=(Window,Worker)] +partial interface Performance { + [Throws] + void mark(DOMString markName); + void clearMarks(optional DOMString markName); + [Throws] + void measure(DOMString measureName, optional DOMString startMark, optional DOMString endMark); + void clearMeasures(optional DOMString measureName); +}; 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/PerformanceMark.webidl b/dom/webidl/PerformanceMark.webidl new file mode 100644 index 0000000000..20e9e92c02 --- /dev/null +++ b/dom/webidl/PerformanceMark.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://www.w3.org/TR/user-timing/#performancemark + */ + +[Exposed=(Window,Worker)] +interface PerformanceMark : PerformanceEntry +{ +}; diff --git a/dom/webidl/PerformanceMeasure.webidl b/dom/webidl/PerformanceMeasure.webidl new file mode 100644 index 0000000000..aa4e8cd256 --- /dev/null +++ b/dom/webidl/PerformanceMeasure.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://www.w3.org/TR/user-timing/#performancemeasure + */ + +[Exposed=(Window,Worker)] +interface PerformanceMeasure : PerformanceEntry +{ +}; 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..4da98a8237 --- /dev/null +++ b/dom/webidl/PerformanceObserver.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/performance-timeline/#the-performanceobserver-interface + */ + +dictionary PerformanceObserverInit { + sequence<DOMString> entryTypes; + DOMString type; + boolean buffered; +}; + +callback PerformanceObserverCallback = void (PerformanceObserverEntryList entries, + PerformanceObserver observer); + +[Pref="dom.enable_performance_observer", + Exposed=(Window,Worker)] +interface PerformanceObserver { + [Throws] + constructor(PerformanceObserverCallback callback); + + [Throws] void observe(optional PerformanceObserverInit options = {}); + void 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..cc7b36eee1 --- /dev/null +++ b/dom/webidl/PerformanceObserverEntryList.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/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..7fa8ba5308 --- /dev/null +++ b/dom/webidl/PermissionStatus.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/permissions/#status-of-a-permission + */ + +enum PermissionState { + "granted", + "denied", + "prompt" +}; + +[Exposed=Window] +interface PermissionStatus : EventTarget { + readonly attribute PermissionState state; + attribute EventHandler onchange; +}; diff --git a/dom/webidl/Permissions.webidl b/dom/webidl/Permissions.webidl new file mode 100644 index 0000000000..8d674a9de1 --- /dev/null +++ b/dom/webidl/Permissions.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/permissions/#permissions-interface + */ + +enum PermissionName { + "geolocation", + "notifications", + "push", + "persistent-storage" + // Unsupported: "midi" +}; + +[GenerateInit] +dictionary PermissionDescriptor { + required PermissionName name; +}; + +// We don't implement `PushPermissionDescriptor` because we use a background +// message quota instead of `userVisibleOnly`. + +[Exposed=Window] +interface Permissions { + [Throws] + Promise<PermissionStatus> query(object permission); + [Throws, Pref="dom.permissions.revoke.enable"] + Promise<PermissionStatus> revoke(object permission); +}; diff --git a/dom/webidl/Plugin.webidl b/dom/webidl/Plugin.webidl new file mode 100644 index 0000000000..7bc1fa97dc --- /dev/null +++ b/dom/webidl/Plugin.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/. + */ + +[LegacyUnenumerableNamedProperties, + Exposed=Window] +interface Plugin { + readonly attribute DOMString description; + readonly attribute DOMString filename; + readonly attribute DOMString version; + 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..f7841322ad --- /dev/null +++ b/dom/webidl/PluginArray.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/. + */ + +[LegacyUnenumerableNamedProperties, + Exposed=Window] +interface PluginArray { + [NeedsCallerType] + readonly attribute unsigned long length; + + [NeedsCallerType] + getter Plugin? item(unsigned long index); + [NeedsCallerType] + getter Plugin? namedItem(DOMString name); + + void refresh(optional boolean reloadDocuments = false); +}; diff --git a/dom/webidl/PluginCrashedEvent.webidl b/dom/webidl/PluginCrashedEvent.webidl new file mode 100644 index 0000000000..d683d74e0d --- /dev/null +++ b/dom/webidl/PluginCrashedEvent.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/. + */ + +[ChromeOnly, + Exposed=Window] +interface PluginCrashedEvent : Event +{ + constructor(DOMString type, + optional PluginCrashedEventInit eventInitDict = {}); + + readonly attribute unsigned long pluginID; + readonly attribute DOMString pluginDumpID; + readonly attribute DOMString pluginName; + readonly attribute DOMString? pluginFilename; + readonly attribute boolean submittedCrashReport; + readonly attribute boolean gmpPlugin; +}; + +dictionary PluginCrashedEventInit : EventInit +{ + unsigned long pluginID = 0; + DOMString pluginDumpID = ""; + DOMString pluginName = ""; + DOMString? pluginFilename = null; + boolean submittedCrashReport = false; + boolean gmpPlugin = false; +}; diff --git a/dom/webidl/PointerEvent.webidl b/dom/webidl/PointerEvent.webidl new file mode 100644 index 0000000000..7c3ff8ad35 --- /dev/null +++ b/dom/webidl/PointerEvent.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/. + * + * For more information see nsIPointerEvent.idl. + * + * Portions Copyright 2013 Microsoft Open Technologies, Inc. */ + +interface WindowProxy; + +[Pref="dom.w3c_pointer_events.enabled", + Exposed=Window] +interface PointerEvent : MouseEvent +{ + constructor(DOMString type, optional PointerEventInit eventInitDict = {}); + + [NeedsCallerType] + readonly attribute long pointerId; + + [NeedsCallerType] + readonly attribute long width; + [NeedsCallerType] + readonly attribute long height; + [NeedsCallerType] + readonly attribute float pressure; + [NeedsCallerType] + readonly attribute float tangentialPressure; + [NeedsCallerType] + readonly attribute long tiltX; + [NeedsCallerType] + readonly attribute long tiltY; + [NeedsCallerType] + readonly attribute long twist; + + [NeedsCallerType] + readonly attribute DOMString pointerType; + readonly attribute boolean isPrimary; + sequence<PointerEvent> getCoalescedEvents(); +}; + +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 = []; +}; 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/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/PopupPositionedEvent.webidl b/dom/webidl/PopupPositionedEvent.webidl new file mode 100644 index 0000000000..9aa35a8ddc --- /dev/null +++ b/dom/webidl/PopupPositionedEvent.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/. + */ + +dictionary PopupPositionedEventInit : EventInit { + /** + * Returns the alignment position where the popup has appeared relative to its + * anchor node or point, accounting for any flipping that occurred. + */ + DOMString alignmentPosition = ""; + long alignmentOffset = 0; +}; + +[ChromeOnly, Exposed=Window] +interface PopupPositionedEvent : Event { + constructor(DOMString type, optional PopupPositionedEventInit init = {}); + + readonly attribute DOMString alignmentPosition; + readonly attribute long alignmentOffset; +}; 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/Presentation.webidl b/dom/webidl/Presentation.webidl new file mode 100644 index 0000000000..883e6c285f --- /dev/null +++ b/dom/webidl/Presentation.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/presentation-api/#interface-presentation + */ + +[Pref="dom.presentation.enabled", + Exposed=Window] +interface Presentation { + /* + * This should be used by the UA as the default presentation request for the + * controller. When the UA wishes to initiate a PresentationConnection on the + * controller's behalf, it MUST start a presentation connection using the default + * presentation request (as if the controller had called |defaultRequest.start()|). + * + * Only used by controlling browsing context (senders). + */ + [Pref="dom.presentation.controller.enabled"] + attribute PresentationRequest? defaultRequest; + + /* + * This should be available on the receiving browsing context in order to + * access the controlling browsing context and communicate with them. + */ + [SameObject, + Pref="dom.presentation.receiver.enabled"] + readonly attribute PresentationReceiver? receiver; +}; diff --git a/dom/webidl/PresentationAvailability.webidl b/dom/webidl/PresentationAvailability.webidl new file mode 100644 index 0000000000..d95dfafcc9 --- /dev/null +++ b/dom/webidl/PresentationAvailability.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/presentation-api/#interface-presentationavailability + */ + +[Pref="dom.presentation.controller.enabled", + Exposed=Window] +interface PresentationAvailability : EventTarget { + /* + * If there is at least one device discovered by UA, the value is |true|. + * Otherwise, its value should be |false|. + */ + readonly attribute boolean value; + + /* + * It is called when device availability changes. + */ + attribute EventHandler onchange; +}; diff --git a/dom/webidl/PresentationConnection.webidl b/dom/webidl/PresentationConnection.webidl new file mode 100644 index 0000000000..204af6462b --- /dev/null +++ b/dom/webidl/PresentationConnection.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/presentation-api/#interface-presentationconnection + */ + +enum PresentationConnectionState +{ + // The initial state when a PresentationConnection is ceated. + "connecting", + + // Existing presentation, and the communication channel is active. + "connected", + + // Existing presentation, but the communication channel is inactive. + "closed", + + // The presentation is nonexistent anymore. It could be terminated manually, + // or either controlling or receiving browsing context is no longer available. + "terminated" +}; + +enum PresentationConnectionBinaryType +{ + "blob", + "arraybuffer" +}; + +[Pref="dom.presentation.enabled", + Exposed=Window] +interface PresentationConnection : EventTarget { + /* + * Unique id for all existing connections. + */ + [Constant] + readonly attribute DOMString id; + + /* + * Specifies the connection's presentation URL. + */ + readonly attribute DOMString url; + + /* + * @value "connected", "closed", or "terminated". + */ + readonly attribute PresentationConnectionState state; + + attribute EventHandler onconnect; + attribute EventHandler onclose; + attribute EventHandler onterminate; + attribute PresentationConnectionBinaryType binaryType; + + /* + * After a communication channel has been established between the controlling + * and receiving context, this function is called to send message out, and the + * event handler "onmessage" will be invoked at the remote side. + * + * This function only works when the state is "connected". + */ + [Throws] + void send(DOMString data); + + [Throws] + void send(Blob data); + + [Throws] + void send(ArrayBuffer data); + + [Throws] + void send(ArrayBufferView data); + + /* + * It is triggered when receiving messages. + */ + attribute EventHandler onmessage; + + /* + * Both the controlling and receiving browsing context can close the + * connection. Then the connection state should turn into "closed". + * + * This function only works when the state is "connected" or "connecting". + */ + [Throws] + void close(); + + /* + * Both the controlling and receiving browsing context can terminate the + * connection. Then the connection state should turn into "terminated". + * + * This function only works when the state is not "connected". + */ + [Throws] + void terminate(); +}; diff --git a/dom/webidl/PresentationConnectionAvailableEvent.webidl b/dom/webidl/PresentationConnectionAvailableEvent.webidl new file mode 100644 index 0000000000..c20ea10d5f --- /dev/null +++ b/dom/webidl/PresentationConnectionAvailableEvent.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/presentation-api/#interface-presentationconnectionavailableevent + */ + +[Pref="dom.presentation.enabled", + Exposed=Window] +interface PresentationConnectionAvailableEvent : Event +{ + constructor(DOMString type, + PresentationConnectionAvailableEventInit eventInitDict); + + [SameObject] + readonly attribute PresentationConnection connection; +}; + +dictionary PresentationConnectionAvailableEventInit : EventInit +{ + required PresentationConnection connection; +}; diff --git a/dom/webidl/PresentationConnectionCloseEvent.webidl b/dom/webidl/PresentationConnectionCloseEvent.webidl new file mode 100644 index 0000000000..69fce5514c --- /dev/null +++ b/dom/webidl/PresentationConnectionCloseEvent.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://w3c.github.io/presentation-api/#interface-presentationconnectioncloseevent + */ + +enum PresentationConnectionClosedReason +{ + // The communication encountered an unrecoverable error. + "error", + + // |PresentationConnection.close()| is called by controlling browsing context + // or the receiving browsing context. + "closed", + + // The connection is closed because the destination browsing context + // that owned the connection navigated or was discarded. + "wentaway" +}; + +[Pref="dom.presentation.enabled", + Exposed=Window] +interface PresentationConnectionCloseEvent : Event +{ + constructor(DOMString type, + PresentationConnectionCloseEventInit eventInitDict); + + readonly attribute PresentationConnectionClosedReason reason; + + // The message is a human readable description of + // how the communication channel encountered an error. + // It is empty when the closed reason is closed or wentaway. + readonly attribute DOMString message; +}; + +dictionary PresentationConnectionCloseEventInit : EventInit +{ + required PresentationConnectionClosedReason reason; + DOMString message = ""; +}; diff --git a/dom/webidl/PresentationConnectionList.webidl b/dom/webidl/PresentationConnectionList.webidl new file mode 100644 index 0000000000..875582eb2a --- /dev/null +++ b/dom/webidl/PresentationConnectionList.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/presentation-api/#interface-presentationconnectionlist + */ + +[Pref="dom.presentation.receiver.enabled", + Exposed=Window] +interface PresentationConnectionList : EventTarget { + /* + * Return the non-terminated set of presentation connections in the + * set of presentation controllers. + * TODO: Use FrozenArray once available. (Bug 1236777) + * readonly attribute FrozenArray<PresentationConnection> connections; + */ + [Frozen, Cached, Pure] + readonly attribute sequence<PresentationConnection> connections; + + /* + * It is called when an incoming connection is connected. + */ + attribute EventHandler onconnectionavailable; +}; diff --git a/dom/webidl/PresentationReceiver.webidl b/dom/webidl/PresentationReceiver.webidl new file mode 100644 index 0000000000..944860bd10 --- /dev/null +++ b/dom/webidl/PresentationReceiver.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://w3c.github.io/presentation-api/#interface-presentationreceiver + */ + +[Pref="dom.presentation.receiver.enabled", + Exposed=Window] +interface PresentationReceiver { + /* + * Get a list which contains all connected presentation connections + * in a receiving browsing context. + */ + [Throws] + readonly attribute Promise<PresentationConnectionList> connectionList; +}; diff --git a/dom/webidl/PresentationRequest.webidl b/dom/webidl/PresentationRequest.webidl new file mode 100644 index 0000000000..2a114cc3ba --- /dev/null +++ b/dom/webidl/PresentationRequest.webidl @@ -0,0 +1,90 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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/presentation-api/#interface-presentationrequest + */ + +[Pref="dom.presentation.controller.enabled", + Exposed=Window] +interface PresentationRequest : EventTarget { + [Throws] + constructor(DOMString url); + [Throws] + constructor(sequence<DOMString> urls); + + /* + * A requesting page use start() to start a new connection, and it will be + * returned with the promise. UA may show a prompt box with a list of + * available devices and ask the user to grant permission, choose a device, or + * cancel the operation. + * + * The promise is resolved when the presenting page is successfully loaded and + * the communication channel is established, i.e., the connection state is + * "connected". + * + * The promise may be rejected duo to one of the following reasons: + * - "OperationError": Unexpected error occurs. + * - "NotFoundError": No available device. + * - "AbortError": User dismiss/cancel the device prompt box. + * - "NetworkError": Failed to establish the control channel or data channel. + * - "TimeoutError": Presenting page takes too long to load. + * - "SecurityError": This operation is insecure. + */ + [Throws] + Promise<PresentationConnection> start(); + + /* + * A requesting page can use reconnect(presentationId) to reopen a + * non-terminated presentation connection. + * + * The promise is resolved when a new presentation connection is created. + * The connection state is "connecting". + * + * The promise may be rejected duo to one of the following reasons: + * - "OperationError": Unexpected error occurs. + * - "NotFoundError": Can not find a presentation connection with the presentationId. + * - "SecurityError": This operation is insecure. + */ + [Throws] + Promise<PresentationConnection> reconnect(DOMString presentationId); + + /* + * UA triggers device discovery mechanism periodically and monitor device + * availability. + * + * The promise may be rejected duo to one of the following reasons: + * - "NotSupportedError": Unable to continuously monitor the availability. + * - "SecurityError": This operation is insecure. + */ + [Throws] + Promise<PresentationAvailability> getAvailability(); + + /* + * It is called when a connection associated with a PresentationRequest is created. + * The event is fired for all connections that are created for the controller. + */ + attribute EventHandler onconnectionavailable; + + /* + * A chrome page, or page which has presentation-device-manage permissiongs, + * uses startWithDevice() to start a new connection with specified device, + * and it will be returned with the promise. UA may show a prompt box with a + * list of available devices and ask the user to grant permission, choose a + * device, or cancel the operation. + * + * The promise is resolved when the presenting page is successfully loaded and + * the communication channel is established, i.e., the connection state is + * "connected". + * + * The promise may be rejected duo to one of the following reasons: + * - "OperationError": Unexpected error occurs. + * - "NotFoundError": No available device. + * - "NetworkError": Failed to establish the control channel or data channel. + * - "TimeoutError": Presenting page takes too long to load. + */ + [ChromeOnly, Throws] + Promise<PresentationConnection> startWithDevice(DOMString deviceId); +}; 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/ProfileTimelineMarker.webidl b/dom/webidl/ProfileTimelineMarker.webidl new file mode 100644 index 0000000000..b9e614e6a6 --- /dev/null +++ b/dom/webidl/ProfileTimelineMarker.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/. + */ + +// For Javascript markers, the |stack| of a ProfileTimelineMarker +// holds an object of this type. It intentionally looks like a +// SavedStack object and is a representation of the frame that is +// about to be constructed at the entry point. +[GenerateConversionToJS] +dictionary ProfileTimelineStackFrame { + long line; + long column = 0; + DOMString source; + DOMString functionDisplayName; + object? parent = null; + object? asyncParent = null; + DOMString asyncCause; +}; + +dictionary ProfileTimelineLayerRect { + long x = 0; + long y = 0; + long width = 0; + long height = 0; +}; + +enum ProfileTimelineMessagePortOperationType { + "serializeData", + "deserializeData", +}; + +enum ProfileTimelineWorkerOperationType { + "serializeDataOffMainThread", + "serializeDataOnMainThread", + "deserializeDataOffMainThread", + "deserializeDataOnMainThread", +}; + +[GenerateConversionToJS] +dictionary ProfileTimelineMarker { + DOMString name = ""; + DOMHighResTimeStamp start = 0; + DOMHighResTimeStamp end = 0; + object? stack = null; + + unsigned short processType; + boolean isOffMainThread; + + /* For ConsoleTime, Timestamp and Javascript markers. */ + DOMString causeName; + + /* For ConsoleTime markers. */ + object? endStack = null; + + /* For DOMEvent markers. */ + DOMString type; + unsigned short eventPhase; + + /* For document::DOMContentLoaded and document::Load markers. Using this + * instead of the `start` and `end` timestamps is strongly discouraged. */ + unsigned long long unixTime; // in microseconds + + /* For Paint markers. */ + sequence<ProfileTimelineLayerRect> rectangles; + + /* For Style markers. */ + boolean isAnimationOnly; + + /* For MessagePort markers. */ + ProfileTimelineMessagePortOperationType messagePortOperation; + + /* For Worker markers. */ + ProfileTimelineWorkerOperationType workerOperation; +}; 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..e251cbbeb2 --- /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 = void(); + +[TreatNonCallableAsNull] +callback AnyCallback = any (any value); + +// Hack to allow us to have JS owning and properly tracing/CCing/etc a +// PromiseNativeHandler. +[NoInterfaceObject, 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..72190a838d --- /dev/null +++ b/dom/webidl/PushManager.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/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<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options = {}); +}; + +[Exposed=(Window,Worker), Pref="dom.push.enabled"] +interface PushManager { + [Throws, ChromeOnly] + constructor(DOMString scope); + + [Throws, UseCounter] + Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {}); + [Throws] + Promise<PushSubscription?> getSubscription(); + [Throws] + Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options = {}); +}; + +enum PushPermissionState +{ + "granted", + "denied", + "prompt" +}; 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..f47a18b2f4 --- /dev/null +++ b/dom/webidl/PushSubscription.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/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 = {}; +}; + +dictionary PushSubscriptionInit +{ + required USVString endpoint; + required USVString scope; + ArrayBuffer? p256dhKey; + ArrayBuffer? authSecret; + BufferSource? appServerKey; +}; + +[Exposed=(Window,Worker), Pref="dom.push.enabled"] +interface PushSubscription +{ + [Throws, ChromeOnly] + constructor(PushSubscriptionInit initDict); + + readonly attribute USVString endpoint; + readonly attribute PushSubscriptionOptions options; + [Throws] + ArrayBuffer? getKey(PushEncryptionKeyName name); + [Throws, 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..07b36aa011 --- /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), Pref="dom.push.enabled"] +interface PushSubscriptionOptions +{ + [SameObject, Throws] + readonly attribute ArrayBuffer? applicationServerKey; +}; 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..c5783f5562 --- /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..0c399af918 --- /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] + void 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..80a45f2bf4 --- /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; + void close(); + attribute EventHandler onmessage; + attribute EventHandler onbufferedamountlow; + attribute RTCDataChannelType binaryType; + [Throws] + void send(DOMString data); + [Throws] + void send(Blob data); + [Throws] + void send(ArrayBuffer data); + [Throws] + void 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/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..614c356758 --- /dev/null +++ b/dom/webidl/RTCIdentityProvider.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/. + * + * http://w3c.github.io/webrtc-pc/ (with https://github.com/w3c/webrtc-pc/pull/178) + */ + +[NoInterfaceObject, + Exposed=Window] +interface RTCIdentityProviderRegistrar { + void 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..437e445781 --- /dev/null +++ b/dom/webidl/RTCPeerConnection.webidl @@ -0,0 +1,191 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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 = void (RTCSessionDescriptionInit description); +callback RTCPeerConnectionErrorCallback = void (DOMException error); +callback RTCStatsCallback = void (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 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 = void (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); + + [Pref="media.peerconnection.identity.enabled"] + void setIdentityProvider (DOMString provider, + optional RTCIdentityProviderOptions options = {}); + [Pref="media.peerconnection.identity.enabled"] + Promise<DOMString> getIdentityAssertion(); + Promise<RTCSessionDescriptionInit> createOffer (optional RTCOfferOptions options = {}); + Promise<RTCSessionDescriptionInit> createAnswer (optional RTCAnswerOptions options = {}); + Promise<void> setLocalDescription (optional RTCSessionDescriptionInit description = {}); + Promise<void> 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<void> addIceCandidate (optional (RTCIceCandidateInit or RTCIceCandidate) candidate = {}); + readonly attribute boolean? canTrickleIceCandidates; + readonly attribute RTCIceGatheringState iceGatheringState; + readonly attribute RTCIceConnectionState iceConnectionState; + void restartIce (); + [Pref="media.peerconnection.identity.enabled"] + readonly attribute Promise<RTCIdentityAssertion> peerIdentity; + [Pref="media.peerconnection.identity.enabled"] + readonly attribute DOMString? idpLoginUrl; + + [ChromeOnly] + attribute DOMString id; + + RTCConfiguration getConfiguration (); + [Deprecated="RTCPeerConnectionGetStreams"] + sequence<MediaStream> getLocalStreams (); + [Deprecated="RTCPeerConnectionGetStreams"] + sequence<MediaStream> getRemoteStreams (); + void 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); + void removeTrack(RTCRtpSender sender); + + RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind, + optional RTCRtpTransceiverInit init = {}); + + sequence<RTCRtpSender> getSenders(); + sequence<RTCRtpReceiver> getReceivers(); + sequence<RTCRtpTransceiver> getTransceivers(); + + [ChromeOnly] + void mozSetPacketCallback(mozPacketCallback callback); + [ChromeOnly] + void mozEnablePacketDump(unsigned long level, + mozPacketDumpType type, + boolean sending); + [ChromeOnly] + void mozDisablePacketDump(unsigned long level, + mozPacketDumpType type, + boolean sending); + + void 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; + + Promise<RTCStatsReport> getStats (optional MediaStreamTrack? selector = null); + + // Data channel. + RTCDataChannel createDataChannel (DOMString label, + optional RTCDataChannelInit dataChannelDict = {}); + attribute EventHandler ondatachannel; +}; + +// Legacy callback API + +partial interface RTCPeerConnection { + + // Dummy Promise<void> return values avoid "WebIDL.WebIDLError: error: + // We have overloads with both Promise and non-Promise return types" + + Promise<void> createOffer (RTCSessionDescriptionCallback successCallback, + RTCPeerConnectionErrorCallback failureCallback, + optional RTCOfferOptions options = {}); + Promise<void> createAnswer (RTCSessionDescriptionCallback successCallback, + RTCPeerConnectionErrorCallback failureCallback); + Promise<void> setLocalDescription (RTCSessionDescriptionInit description, + VoidFunction successCallback, + RTCPeerConnectionErrorCallback failureCallback); + Promise<void> setRemoteDescription (RTCSessionDescriptionInit description, + VoidFunction successCallback, + RTCPeerConnectionErrorCallback failureCallback); + Promise<void> 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..606a5c3c2a --- /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" +}; + +callback PeerConnectionLifecycleCallback = void (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. */ + void registerPeerConnectionLifecycleCallback( + PeerConnectionLifecycleCallback cb); +}; + diff --git a/dom/webidl/RTCRtpReceiver.webidl b/dom/webidl/RTCRtpReceiver.webidl new file mode 100644 index 0000000000..16b14e908a --- /dev/null +++ b/dom/webidl/RTCRtpReceiver.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://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; + Promise<RTCStatsReport> getStats(); + [Pref="media.peerconnection.rtpsourcesapi.enabled"] + sequence<RTCRtpContributingSource> getContributingSources(); + [Pref="media.peerconnection.rtpsourcesapi.enabled"] + sequence<RTCRtpSynchronizationSource> getSynchronizationSources(); + + [ChromeOnly] + void mozAddRIDExtension(unsigned short extensionId); + [ChromeOnly] + void mozAddRIDFilter(DOMString rid); + // test-only: for testing getContributingSources + [ChromeOnly] + void mozInsertAudioLevelForContributingSource(unsigned long source, + DOMHighResTimeStamp timestamp, + unsigned long rtpTimestamp, + boolean hasLevel, + byte level); +}; diff --git a/dom/webidl/RTCRtpSender.webidl b/dom/webidl/RTCRtpSender.webidl new file mode 100644 index 0000000000..99df1f2260 --- /dev/null +++ b/dom/webidl/RTCRtpSender.webidl @@ -0,0 +1,90 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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 RTCRtxParameters { + unsigned long ssrc; +}; + +dictionary RTCFecParameters { + unsigned long ssrc; +}; + +dictionary RTCRtpEncodingParameters { + unsigned long ssrc; + RTCRtxParameters rtx; + RTCFecParameters fec; + boolean active; + RTCPriorityType priority; + unsigned long maxBitrate; + RTCDegradationPreference degradationPreference = "balanced"; + DOMString rid; + float scaleResolutionDownBy = 1.0; +}; + +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 { + sequence<RTCRtpEncodingParameters> encodings; + sequence<RTCRtpHeaderExtensionParameters> headerExtensions; + RTCRtcpParameters rtcp; + sequence<RTCRtpCodecParameters> codecs; +}; + +[Pref="media.peerconnection.enabled", + JSImplementation="@mozilla.org/dom/rtpsender;1", + Exposed=Window] +interface RTCRtpSender { + readonly attribute MediaStreamTrack? track; + readonly attribute RTCDtlsTransport? transport; + Promise<void> setParameters (optional RTCRtpParameters parameters = {}); + RTCRtpParameters getParameters(); + Promise<void> replaceTrack(MediaStreamTrack? withTrack); + Promise<RTCStatsReport> getStats(); + [Pref="media.peerconnection.dtmf.enabled"] + readonly attribute RTCDTMFSender? dtmf; + // Ugh, can't use a ChromeOnly attibute sequence<MediaStream>... + [ChromeOnly] + sequence<MediaStream> getStreams(); + [ChromeOnly] + void setStreams(sequence<MediaStream> streams); + [ChromeOnly] + void setTrack(MediaStreamTrack? track); + [ChromeOnly] + void checkWasCreatedByPc(RTCPeerConnection pc); +}; 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..b7a0c6cf58 --- /dev/null +++ b/dom/webidl/RTCRtpTransceiver.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/#rtcrtptransceiver-interface + */ + +enum RTCRtpTransceiverDirection { + "sendrecv", + "sendonly", + "recvonly", + "inactive" +}; + +dictionary RTCRtpTransceiverInit { + RTCRtpTransceiverDirection direction = "sendrecv"; + sequence<MediaStream> streams = []; + // TODO: bug 1396918 + // sequence<RTCRtpEncodingParameters> sendEncodings; +}; + +[Pref="media.peerconnection.enabled", + JSImplementation="@mozilla.org/dom/rtptransceiver;1", + Exposed=Window] +interface RTCRtpTransceiver { + readonly attribute DOMString? mid; + [SameObject] + readonly attribute RTCRtpSender sender; + [SameObject] + readonly attribute RTCRtpReceiver receiver; + readonly attribute boolean stopped; + attribute RTCRtpTransceiverDirection direction; + readonly attribute RTCRtpTransceiverDirection? currentDirection; + + void stop(); + // TODO: bug 1396922 + // void setCodecPreferences(sequence<RTCRtpCodecCapability> codecs); + + [ChromeOnly] + void setAddTrackMagic(); + [ChromeOnly] + readonly attribute boolean addTrackMagic; + [ChromeOnly] + attribute boolean shouldRemove; + [ChromeOnly] + void setCurrentDirection(RTCRtpTransceiverDirection direction); + [ChromeOnly] + void setDirectionInternal(RTCRtpTransceiverDirection direction); + [ChromeOnly] + void setMid(DOMString mid); + [ChromeOnly] + void unsetMid(); + [ChromeOnly] + void setStopped(); + + [ChromeOnly] + DOMString getKind(); + [ChromeOnly] + boolean hasBeenUsedToSend(); + [ChromeOnly] + void sync(); +}; + 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..74d14801a8 --- /dev/null +++ b/dom/webidl/RTCStatsReport.webidl @@ -0,0 +1,266 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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 + */ + +enum RTCStatsType { + "inbound-rtp", + "outbound-rtp", + "remote-inbound-rtp", + "remote-outbound-rtp", + "csrc", + "data-channel", + "session", + "track", + "transport", + "candidate-pair", + "local-candidate", + "remote-candidate" +}; + +dictionary RTCStats { + DOMHighResTimeStamp timestamp; + RTCStatsType type; + DOMString id; +}; + +dictionary RTCRtpStreamStats : RTCStats { + unsigned long ssrc; + DOMString mediaType; + DOMString kind; + DOMString transportId; +}; + +dictionary RTCReceivedRtpStreamStats: RTCRtpStreamStats { + unsigned long packetsReceived; + unsigned long packetsLost; + double jitter; + unsigned long discardedPackets; // non-standard alias for packetsDiscarded + unsigned long packetsDiscarded; +}; + +dictionary RTCInboundRtpStreamStats : RTCReceivedRtpStreamStats { + DOMString remoteId; + unsigned long framesDecoded; + unsigned long long bytesReceived; + unsigned long nackCount; + unsigned long firCount; + unsigned long pliCount; + double bitrateMean; // deprecated, to be removed in Bug 1367562 + double bitrateStdDev; // deprecated, to be removed in Bug 1367562 + double framerateMean; // deprecated, to be removed in Bug 1367562 + double framerateStdDev; // deprecated, to be removed in Bug 1367562 +}; + +dictionary RTCRemoteInboundRtpStreamStats : RTCReceivedRtpStreamStats { + DOMString localId; + long long bytesReceived; // Deprecated, to be removed in Bug 1529405 + double roundTripTime; +}; + +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; + double bitrateMean; // deprecated, to be removed in Bug 1367562 + double bitrateStdDev; // deprecated, to be removed in Bug 1367562 + double framerateMean; // deprecated, to be removed in Bug 1367562 + double framerateStdDev; // deprecated, to be removed in Bug 1367562 + unsigned long droppedFrames; // non-spec alias for framesDropped + // to be deprecated in Bug 1225720 +}; + +dictionary RTCRemoteOutboundRtpStreamStats : RTCSentRtpStreamStats { + DOMString localId; + DOMHighResTimeStamp remoteTimestamp; +}; + +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<RTCRTPContributingSourceStats> rtpContributingSourceStats = []; + sequence<RTCIceCandidatePairStats> iceCandidatePairStats = []; + sequence<RTCIceCandidateStats> iceCandidateStats = []; + sequence<RTCIceCandidateStats> trickledIceCandidateStats = []; + sequence<DOMString> rawLocalCandidates = []; + sequence<DOMString> rawRemoteCandidates = []; + sequence<RTCDataChannelStats> dataChannelStats = []; + 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; +}; + +// 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; + DOMString localSdp; + DOMString remoteSdp; + 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..91b768a3e1 --- /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/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..281cd72350 --- /dev/null +++ b/dom/webidl/Range.webidl @@ -0,0 +1,94 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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. + */ + +[Exposed=Window] +interface Range : AbstractRange { + [Throws] + constructor(); + + [Throws] + readonly attribute Node commonAncestorContainer; + + [Throws, BinaryName="setStartJS"] + void setStart(Node refNode, unsigned long offset); + [Throws, BinaryName="setEndJS"] + void setEnd(Node refNode, unsigned long offset); + [Throws, BinaryName="setStartBeforeJS"] + void setStartBefore(Node refNode); + [Throws, BinaryName="setStartAfterJS"] + void setStartAfter(Node refNode); + [Throws, BinaryName="setEndBeforeJS"] + void setEndBefore(Node refNode); + [Throws, BinaryName="setEndAfterJS"] + void setEndAfter(Node refNode); + [BinaryName="collapseJS"] + void collapse(optional boolean toStart = false); + [Throws, BinaryName="selectNodeJS"] + void selectNode(Node refNode); + [Throws, BinaryName="selectNodeContentsJS"] + void 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] + void deleteContents(); + [CEReactions, Throws] + DocumentFragment extractContents(); + [CEReactions, Throws] + DocumentFragment cloneContents(); + [CEReactions, Throws] + void insertNode(Node node); + [CEReactions, Throws] + void surroundContents(Node newParent); + + Range cloneRange(); + void 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] + 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/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..b55656c824 --- /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 = {}); + void observe(); + void disconnect(); + ReportList takeRecords(); +}; + +callback ReportingObserverCallback = void (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"] + void 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..e79b0a3bb4 --- /dev/null +++ b/dom/webidl/Request.webidl @@ -0,0 +1,80 @@ +/* -*- 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] + void overrideContentPolicyType(nsContentPolicyType context); +}; +Request includes Body; + +dictionary RequestInit { + ByteString method; + HeadersInit headers; + BodyInit? body; + USVString referrer; + ReferrerPolicy referrerPolicy; + RequestMode mode; + RequestCredentials credentials; + RequestCache cache; + RequestRedirect redirect; + DOMString integrity; + + [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" }; diff --git a/dom/webidl/ResizeObserver.webidl b/dom/webidl/ResizeObserver.webidl new file mode 100644 index 0000000000..0a186c0a18 --- /dev/null +++ b/dom/webidl/ResizeObserver.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://drafts.csswg.org/resize-observer/ + */ + +enum ResizeObserverBoxOptions { + "border-box", + "content-box" +}; + +dictionary ResizeObserverOptions { + ResizeObserverBoxOptions box = "content-box"; +}; + +[Exposed=Window, + Pref="layout.css.resizeobserver.enabled"] +interface ResizeObserver { + [Throws] + constructor(ResizeObserverCallback callback); + + [Throws] + void observe(Element target, optional ResizeObserverOptions options = {}); + [Throws] + void unobserve(Element target); + void disconnect(); +}; + +callback ResizeObserverCallback = void (sequence<ResizeObserverEntry> entries, ResizeObserver observer); + +[Pref="layout.css.resizeobserver.enabled", + Exposed=Window] +interface ResizeObserverEntry { + readonly attribute Element target; + readonly attribute DOMRectReadOnly contentRect; + readonly attribute ResizeObserverSize borderBoxSize; + readonly attribute ResizeObserverSize contentBoxSize; +}; + +[Pref="layout.css.resizeobserver.enabled", + 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..05505f455a --- /dev/null +++ b/dom/webidl/Response.webidl @@ -0,0 +1,55 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://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); + + 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, Pref="javascript.options.streams"] + 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..c63d8c6349 --- /dev/null +++ b/dom/webidl/SVGAElement.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. + */ + +[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..11946bb5af --- /dev/null +++ b/dom/webidl/SVGAngle.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 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] + void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits); + [Throws] + void convertToSpecifiedUnits(unsigned short unitType); +}; + diff --git a/dom/webidl/SVGAnimateElement.webidl b/dom/webidl/SVGAnimateElement.webidl new file mode 100644 index 0000000000..cedb16fbbd --- /dev/null +++ b/dom/webidl/SVGAnimateElement.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. + */ + +[Exposed=Window] +interface SVGAnimateElement : SVGAnimationElement { +}; + diff --git a/dom/webidl/SVGAnimateMotionElement.webidl b/dom/webidl/SVGAnimateMotionElement.webidl new file mode 100644 index 0000000000..a04cece9b2 --- /dev/null +++ b/dom/webidl/SVGAnimateMotionElement.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. + */ + +[Exposed=Window] +interface SVGAnimateMotionElement : SVGAnimationElement { +}; + diff --git a/dom/webidl/SVGAnimateTransformElement.webidl b/dom/webidl/SVGAnimateTransformElement.webidl new file mode 100644 index 0000000000..de5a247278 --- /dev/null +++ b/dom/webidl/SVGAnimateTransformElement.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. + */ + +[Exposed=Window] +interface SVGAnimateTransformElement : SVGAnimationElement { +}; + diff --git a/dom/webidl/SVGAnimatedAngle.webidl b/dom/webidl/SVGAnimatedAngle.webidl new file mode 100644 index 0000000000..6821e2c185 --- /dev/null +++ b/dom/webidl/SVGAnimatedAngle.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/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..7d0969a906 --- /dev/null +++ b/dom/webidl/SVGAnimatedBoolean.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 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..a684480519 --- /dev/null +++ b/dom/webidl/SVGAnimatedLength.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/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..7b0a36bfc7 --- /dev/null +++ b/dom/webidl/SVGAnimatedLengthList.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/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..a967ee8766 --- /dev/null +++ b/dom/webidl/SVGAnimatedNumberList.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/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..e1db92b0fc --- /dev/null +++ b/dom/webidl/SVGAnimatedPathData.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. + */ + +interface mixin SVGAnimatedPathData { + readonly attribute SVGPathSegList pathSegList; + //readonly attribute SVGPathSegList normalizedPathSegList; + readonly attribute SVGPathSegList animatedPathSegList; + //readonly attribute SVGPathSegList animatedNormalizedPathSegList; +}; + diff --git a/dom/webidl/SVGAnimatedPoints.webidl b/dom/webidl/SVGAnimatedPoints.webidl new file mode 100644 index 0000000000..1ce8fe4164 --- /dev/null +++ b/dom/webidl/SVGAnimatedPoints.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. + */ + +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..9a5a9f645e --- /dev/null +++ b/dom/webidl/SVGAnimatedPreserveAspectRatio.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/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..032e2a7c0e --- /dev/null +++ b/dom/webidl/SVGAnimatedTransformList.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/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..b75b45316f --- /dev/null +++ b/dom/webidl/SVGAnimationElement.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 SVGAnimationElement : SVGElement { + + readonly attribute SVGElement? targetElement; + + [Throws] + float getStartTime(); + [BinaryName="getCurrentTimeAsFloat"] + float getCurrentTime(); + [Throws] + float getSimpleDuration(); + + [Throws] + void beginElement(); + [Throws] + void beginElementAt(float offset); + [Throws] + void endElement(); + [Throws] + void endElementAt(float offset); +}; + +SVGAnimationElement includes SVGTests; + diff --git a/dom/webidl/SVGCircleElement.webidl b/dom/webidl/SVGCircleElement.webidl new file mode 100644 index 0000000000..0aed71b96e --- /dev/null +++ b/dom/webidl/SVGCircleElement.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 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..74cb438b13 --- /dev/null +++ b/dom/webidl/SVGClipPathElement.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/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..29f03ac023 --- /dev/null +++ b/dom/webidl/SVGDefsElement.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. + */ + +[Exposed=Window] +interface SVGDefsElement : SVGGraphicsElement { +}; + diff --git a/dom/webidl/SVGDescElement.webidl b/dom/webidl/SVGDescElement.webidl new file mode 100644 index 0000000000..50bf1b7e91 --- /dev/null +++ b/dom/webidl/SVGDescElement.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. + */ + +[Exposed=Window] +interface SVGDescElement : SVGElement { +}; + diff --git a/dom/webidl/SVGElement.webidl b/dom/webidl/SVGElement.webidl new file mode 100644 index 0000000000..27d918c48c --- /dev/null +++ b/dom/webidl/SVGElement.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 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 DocumentAndElementEventHandlers; +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..306baf14c1 --- /dev/null +++ b/dom/webidl/SVGEllipseElement.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 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..81cbabefd8 --- /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; + + void 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..8e6ba06f40 --- /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; + + void 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..17d9701df4 --- /dev/null +++ b/dom/webidl/SVGFEImageElement.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/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; +}; + +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..e063aaca93 --- /dev/null +++ b/dom/webidl/SVGFilterElement.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 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..dc92a36eee --- /dev/null +++ b/dom/webidl/SVGFitToViewBox.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. + */ + +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..15de9a4861 --- /dev/null +++ b/dom/webidl/SVGForeignObjectElement.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 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..477495454f --- /dev/null +++ b/dom/webidl/SVGGElement.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. + */ + +[Exposed=Window] +interface SVGGElement : SVGGraphicsElement { +}; + diff --git a/dom/webidl/SVGGeometryElement.webidl b/dom/webidl/SVGGeometryElement.webidl new file mode 100644 index 0000000000..f2ca9411e4 --- /dev/null +++ b/dom/webidl/SVGGeometryElement.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 SVGGeometryElement : SVGGraphicsElement { + [SameObject] + readonly attribute SVGAnimatedNumber pathLength; + + boolean isPointInFill(optional DOMPointInit point = {}); + boolean isPointInStroke(optional DOMPointInit point = {}); + + 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..610fd3089a --- /dev/null +++ b/dom/webidl/SVGGraphicsElement.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. + */ + +dictionary SVGBoundingBoxOptions { + boolean fill = true; + boolean stroke = false; + boolean markers = false; + boolean clipped = false; +}; + +[Exposed=Window] +interface SVGGraphicsElement : SVGElement { + [Pure] + attribute boolean autofocus; + + readonly attribute SVGAnimatedTransformList transform; + + readonly attribute SVGElement? nearestViewportElement; + readonly attribute SVGElement? farthestViewportElement; + + [NewObject] + SVGRect getBBox(optional SVGBoundingBoxOptions aOptions = {}); + // Not implemented + // SVGRect getStrokeBBox(); + SVGMatrix? getCTM(); + SVGMatrix? getScreenCTM(); + [Throws] + SVGMatrix getTransformToElement(SVGGraphicsElement element); +}; + +SVGGraphicsElement includes SVGTests; diff --git a/dom/webidl/SVGImageElement.webidl b/dom/webidl/SVGImageElement.webidl new file mode 100644 index 0000000000..1785e97661 --- /dev/null +++ b/dom/webidl/SVGImageElement.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/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; + [CEReactions, SetterThrows] + attribute DOMString decoding; + [NewObject] + Promise<void> 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..07936cdafa --- /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] + void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits); + [Throws] + void convertToSpecifiedUnits(unsigned short unitType); +}; diff --git a/dom/webidl/SVGLengthList.webidl b/dom/webidl/SVGLengthList.webidl new file mode 100644 index 0000000000..4bce9ec085 --- /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] + void 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 void (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..f37cad9dc2 --- /dev/null +++ b/dom/webidl/SVGLineElement.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 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..e9287b22bb --- /dev/null +++ b/dom/webidl/SVGMPathElement.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 SVGMPathElement : SVGElement { +}; + +SVGMPathElement includes SVGURIReference; + diff --git a/dom/webidl/SVGMarkerElement.webidl b/dom/webidl/SVGMarkerElement.webidl new file mode 100644 index 0000000000..4c5aef38a9 --- /dev/null +++ b/dom/webidl/SVGMarkerElement.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 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; + + void setOrientToAuto(); + [Throws] + void setOrientToAngle(SVGAngle angle); +}; + +SVGMarkerElement includes SVGFitToViewBox; + diff --git a/dom/webidl/SVGMaskElement.webidl b/dom/webidl/SVGMaskElement.webidl new file mode 100644 index 0000000000..0ace0fa216 --- /dev/null +++ b/dom/webidl/SVGMaskElement.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/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..f1f3a244a5 --- /dev/null +++ b/dom/webidl/SVGMatrix.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://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..370b7b0296 --- /dev/null +++ b/dom/webidl/SVGMetadataElement.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. + */ + +[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..3739954a0b --- /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] + void 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..2cc8706cbf --- /dev/null +++ b/dom/webidl/SVGPathElement.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 SVGPathElement : SVGGeometryElement { + + 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..073defada9 --- /dev/null +++ b/dom/webidl/SVGPathSeg.webidl @@ -0,0 +1,255 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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. + */ + +[NoInterfaceObject, + 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; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegClosePath : SVGPathSeg { +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegMovetoAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegMovetoRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[NoInterfaceObject, + 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; +}; + +[NoInterfaceObject, + 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; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoQuadraticAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x1; + [SetterThrows] + attribute float y1; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoQuadraticRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x1; + [SetterThrows] + attribute float y1; +}; + +[NoInterfaceObject, + 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; +}; + +[NoInterfaceObject, + 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; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoHorizontalAbs : SVGPathSeg { + [SetterThrows] + attribute float x; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoHorizontalRel : SVGPathSeg { + [SetterThrows] + attribute float x; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoVerticalAbs : SVGPathSeg { + [SetterThrows] + attribute float y; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegLinetoVerticalRel : SVGPathSeg { + [SetterThrows] + attribute float y; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoCubicSmoothAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x2; + [SetterThrows] + attribute float y2; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoCubicSmoothRel : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; + [SetterThrows] + attribute float x2; + [SetterThrows] + attribute float y2; +}; + +[NoInterfaceObject, + Exposed=Window] +interface SVGPathSegCurvetoQuadraticSmoothAbs : SVGPathSeg { + [SetterThrows] + attribute float x; + [SetterThrows] + attribute float y; +}; + +[NoInterfaceObject, + 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..66cc22a7a7 --- /dev/null +++ b/dom/webidl/SVGPathSegList.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/SVG11/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=Window] +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..283d72a450 --- /dev/null +++ b/dom/webidl/SVGPoint.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 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..301e5238a2 --- /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] + void 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..89b55bc1af --- /dev/null +++ b/dom/webidl/SVGPolygonElement.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 SVGPolygonElement : SVGGeometryElement { +}; + +SVGPolygonElement includes SVGAnimatedPoints; + diff --git a/dom/webidl/SVGPolylineElement.webidl b/dom/webidl/SVGPolylineElement.webidl new file mode 100644 index 0000000000..fa554e5f6b --- /dev/null +++ b/dom/webidl/SVGPolylineElement.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 SVGPolylineElement : SVGGeometryElement { +}; + +SVGPolylineElement includes SVGAnimatedPoints; + diff --git a/dom/webidl/SVGPreserveAspectRatio.webidl b/dom/webidl/SVGPreserveAspectRatio.webidl new file mode 100644 index 0000000000..5ef01f28c7 --- /dev/null +++ b/dom/webidl/SVGPreserveAspectRatio.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 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..1fdc72b86e --- /dev/null +++ b/dom/webidl/SVGRectElement.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.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..8c2d548f2f --- /dev/null +++ b/dom/webidl/SVGSVGElement.webidl @@ -0,0 +1,74 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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 SVGViewSpec; + +[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; + // readonly attribute SVGRect viewport; + readonly attribute boolean useCurrentView; + // readonly attribute SVGViewSpec currentView; + [UseCounter] + attribute float currentScale; + readonly attribute SVGPoint currentTranslate; + + [DependsOn=Nothing, Affects=Nothing] + unsigned long suspendRedraw(unsigned long maxWaitMilliseconds); + [DependsOn=Nothing, Affects=Nothing] + void unsuspendRedraw(unsigned long suspendHandleID); + [DependsOn=Nothing, Affects=Nothing] + void unsuspendRedrawAll(); + [DependsOn=Nothing, Affects=Nothing] + void forceRedraw(); + void pauseAnimations(); + void unpauseAnimations(); + boolean animationsPaused(); + [BinaryName="getCurrentTimeAsFloat"] + float getCurrentTime(); + void 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); + void 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..676a396144 --- /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; + + // CORS attribute + [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..7db9d32257 --- /dev/null +++ b/dom/webidl/SVGSetElement.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. + */ + +[Exposed=Window] +interface SVGSetElement : SVGAnimationElement { +}; + diff --git a/dom/webidl/SVGStopElement.webidl b/dom/webidl/SVGStopElement.webidl new file mode 100644 index 0000000000..f8c2b17066 --- /dev/null +++ b/dom/webidl/SVGStopElement.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 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..97fe3d912a --- /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; + + void 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 void (unsigned long index, DOMString newItem); +}; diff --git a/dom/webidl/SVGStyleElement.webidl b/dom/webidl/SVGStyleElement.webidl new file mode 100644 index 0000000000..f684ef022b --- /dev/null +++ b/dom/webidl/SVGStyleElement.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 SVGStyleElement : SVGElement { + [SetterThrows] + attribute DOMString xmlspace; // Spec claims this should be on SVGElement + [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..11dd327493 --- /dev/null +++ b/dom/webidl/SVGSwitchElement.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. + */ + +[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..69ab6a0fee --- /dev/null +++ b/dom/webidl/SVGTSpanElement.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. + */ + +[Exposed=Window] +interface SVGTSpanElement : SVGTextPositioningElement { +}; + diff --git a/dom/webidl/SVGTests.webidl b/dom/webidl/SVGTests.webidl new file mode 100644 index 0000000000..8681286329 --- /dev/null +++ b/dom/webidl/SVGTests.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 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..8e9fe253df --- /dev/null +++ b/dom/webidl/SVGTextContentElement.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/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] + void 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..0fe7cfb492 --- /dev/null +++ b/dom/webidl/SVGTextElement.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. + */ + +[Exposed=Window] +interface SVGTextElement : SVGTextPositioningElement { +}; + diff --git a/dom/webidl/SVGTextPathElement.webidl b/dom/webidl/SVGTextPathElement.webidl new file mode 100644 index 0000000000..d364a366fd --- /dev/null +++ b/dom/webidl/SVGTextPathElement.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 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..4b4476d777 --- /dev/null +++ b/dom/webidl/SVGTextPositioningElement.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.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..3d2677d462 --- /dev/null +++ b/dom/webidl/SVGTitleElement.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. + */ + +[Exposed=Window] +interface SVGTitleElement : SVGElement { +}; + diff --git a/dom/webidl/SVGTransform.webidl b/dom/webidl/SVGTransform.webidl new file mode 100644 index 0000000000..464fcc2a24 --- /dev/null +++ b/dom/webidl/SVGTransform.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/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] + void setMatrix(optional DOMMatrix2DInit matrix = {}); + [Throws] + void setTranslate(float tx, float ty); + [Throws] + void setScale(float sx, float sy); + [Throws] + void setRotate(float angle, float cx, float cy); + [Throws] + void setSkewX(float angle); + [Throws] + void setSkewY(float angle); +}; + diff --git a/dom/webidl/SVGTransformList.webidl b/dom/webidl/SVGTransformList.webidl new file mode 100644 index 0000000000..ceb1ffc3d8 --- /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] + void 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..b1f33c4073 --- /dev/null +++ b/dom/webidl/SVGURIReference.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 SVGURIReference { + [Constant] + readonly attribute SVGAnimatedString href; +}; + diff --git a/dom/webidl/SVGUnitTypes.webidl b/dom/webidl/SVGUnitTypes.webidl new file mode 100644 index 0000000000..6cfc2ef376 --- /dev/null +++ b/dom/webidl/SVGUnitTypes.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://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..6128aab077 --- /dev/null +++ b/dom/webidl/SVGViewElement.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 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..103adbc066 --- /dev/null +++ b/dom/webidl/Sanitizer.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://wicg.github.io/purification/ + * + * * 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). + */ + + +typedef (DOMString or DocumentFragment or Document) SanitizerInput; + +// unimplemented during prototyping +dictionary SanitizerOptions { + sequence<DOMString> allowed; + sequence<DOMString> removed; +}; + +[Exposed=Window, SecureContext, Pref="dom.security.sanitizer.enabled"] +interface Sanitizer { + [Throws] + constructor(optional SanitizerOptions options = {}); // optionality still discussed in spec + [Throws] + DocumentFragment sanitize(optional SanitizerInput input); + [Throws] + DOMString sanitizeToString(optional SanitizerInput input); +}; diff --git a/dom/webidl/Screen.webidl b/dom/webidl/Screen.webidl new file mode 100644 index 0000000000..74db942702 --- /dev/null +++ b/dom/webidl/Screen.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/. */ + +[Exposed=Window] +interface Screen : EventTarget { + // CSSOM-View + // http://dev.w3.org/csswg/cssom-view/#the-screen-interface + [Throws] + readonly attribute long availWidth; + [Throws] + readonly attribute long availHeight; + [Throws] + readonly attribute long width; + [Throws] + readonly attribute long height; + [Throws] + readonly attribute long colorDepth; + [Throws] + readonly attribute long pixelDepth; + + [Throws] + readonly attribute long top; + [Throws] + readonly attribute long left; + [Throws] + readonly attribute long availTop; + [Throws] + 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 screen orientation to the specified type. + */ + [Throws] + boolean mozLockOrientation(DOMString orientation); + [Throws] + boolean mozLockOrientation(sequence<DOMString> orientation); + + /** + * DEPRECATED, use ScreenOrientation API instead. + * Unlock the screen orientation. + */ + void 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..dab5c84df1 --- /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 { + [Throws] + Promise<void> lock(OrientationLockType orientation); + [Throws] + void 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..6b0ef2b619 --- /dev/null +++ b/dom/webidl/ScriptProcessorNode.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. + */ + +[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..46ed3d9cd2 --- /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; + + void 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..45d64f7f5c --- /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..9f7f3d6e4e --- /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"] + void addRange(Range range); + /** + * Removes a range from the current selection. + */ + [Throws, BinaryName="removeRangeAndUnselectFramesAndNotifyListeners"] + void removeRange(Range range); + /** + * Removes all ranges from the current selection. + */ + [Throws] + void removeAllRanges(); + [Throws, BinaryName="RemoveAllRanges"] + void empty(); + [Throws, BinaryName="collapseJS"] + void collapse(Node? node, optional unsigned long offset = 0); + [Throws, BinaryName="collapseJS"] + void setPosition(Node? node, optional unsigned long offset = 0); + [Throws, BinaryName="collapseToStartJS"] + void collapseToStart(); + [Throws, BinaryName="collapseToEndJS"] + void collapseToEnd(); + [Throws, BinaryName="extendJS"] + void extend(Node node, optional unsigned long offset = 0); + [Throws, BinaryName="setBaseAndExtentJS"] + void setBaseAndExtent(Node anchorNode, + unsigned long anchorOffset, + Node focusNode, + unsigned long focusOffset); + [Throws, BinaryName="selectAllChildrenJS"] + void selectAllChildren(Node node); + [CEReactions, Throws] + void deleteFromDocument(); + [Throws] + boolean containsNode(Node node, + optional boolean allowPartialContainment = false); + stringifier DOMString (); +}; + +// Additional methods not currently in the spec +partial interface Selection { + [Throws] + void 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] + attribute boolean interlinePosition; + + [Throws] + attribute short? caretBidiLevel; + + [ChromeOnly,Throws] + DOMString toStringWithFormat(DOMString formatType, unsigned long flags, long wrapColumn); + [ChromeOnly] + void addSelectionListener(nsISelectionListener newListener); + [ChromeOnly] + void 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] + void 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] + void setColors(DOMString aForegroundColor, DOMString aBackgroundColor, + DOMString aAltForegroundColor, DOMString aAltBackgroundColor); + + /** + * resetColors() forget the customized colors which were set by setColors(). + */ + [ChromeOnly,Throws] + void resetColors(); +}; diff --git a/dom/webidl/ServiceWorker.webidl b/dom/webidl/ServiceWorker.webidl new file mode 100644 index 0000000000..0aaf531210 --- /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] + void postMessage(any message, sequence<object> transferable); + [Throws] + void postMessage(any message, optional PostMessageOptions 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..3b03b4fde8 --- /dev/null +++ b/dom/webidl/ServiceWorkerContainer.webidl @@ -0,0 +1,49 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * https://w3c.github.io/ServiceWorker/#serviceworkercontainer + * + */ + +[Func="ServiceWorkerContainer::IsEnabled", + 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<any> getRegistration(optional USVString documentURL = ""); + + [NewObject] + Promise<sequence<ServiceWorkerRegistration>> getRegistrations(); + + void startMessages(); + + attribute EventHandler oncontrollerchange; + attribute EventHandler onerror; + 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..f6976bbe3f --- /dev/null +++ b/dom/webidl/ServiceWorkerGlobalScope.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://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<void> 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; +}; diff --git a/dom/webidl/ServiceWorkerRegistration.webidl b/dom/webidl/ServiceWorkerRegistration.webidl new file mode 100644 index 0000000000..3e3fc70cd7 --- /dev/null +++ b/dom/webidl/ServiceWorkerRegistration.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://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * https://w3c.github.io/push-api/ + * https://notifications.spec.whatwg.org/ + */ + +[Pref="dom.serviceWorkers.enabled", + Exposed=(Window,Worker)] +interface ServiceWorkerRegistration : EventTarget { + readonly attribute ServiceWorker? installing; + readonly attribute ServiceWorker? waiting; + readonly attribute ServiceWorker? active; + + readonly attribute USVString scope; + [Throws] + readonly attribute ServiceWorkerUpdateViaCache updateViaCache; + + [Throws, NewObject] + Promise<void> 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 { + [Throws, Pref="dom.webnotifications.serviceworker.enabled"] + Promise<void> showNotification(DOMString title, optional NotificationOptions options = {}); + [Throws, Pref="dom.webnotifications.serviceworker.enabled"] + Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter = {}); +}; diff --git a/dom/webidl/ShadowRoot.webidl b/dom/webidl/ShadowRoot.webidl new file mode 100644 index 0000000000..691c775e67 --- /dev/null +++ b/dom/webidl/ShadowRoot.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://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" +}; + +// https://dom.spec.whatwg.org/#shadowroot +[Exposed=Window] +interface ShadowRoot : DocumentFragment +{ + // Shadow DOM v1 + readonly attribute ShadowRootMode mode; + readonly attribute Element host; + + Element? getElementById(DOMString elementId); + + // https://w3c.github.io/DOM-Parsing/#the-innerhtml-mixin + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] 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] + void setIsUAWidget(); + [ChromeOnly] + boolean isUAWidget(); +}; + +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..7c9483bf6a --- /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; + + void close(); + + attribute EventHandler onconnect; +}; diff --git a/dom/webidl/SimpleGestureEvent.webidl b/dom/webidl/SimpleGestureEvent.webidl new file mode 100644 index 0000000000..c2c2906ec1 --- /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; + + void 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..912204f2b2 --- /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] + void appendBuffer(ArrayBuffer data); + [Throws] + void appendBuffer(ArrayBufferView data); + //[Throws] + //void appendStream(Stream stream, [EnforceRange] optional unsigned long long maxSize); + [Throws] + void abort(); + [Throws] + void 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. + [Throws, Pref="media.mediasource.experimental.enabled"] + Promise<void> appendBufferAsync(ArrayBuffer data); + [Throws, Pref="media.mediasource.experimental.enabled"] + Promise<void> appendBufferAsync(ArrayBufferView data); + [Throws, Pref="media.mediasource.experimental.enabled"] + Promise<void> removeAsync(double start, unrestricted double end); + + // Experimental function as proposed in: + // https://github.com/w3c/media-source/issues/155 + [Throws] + void 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..1d57bf3cf8 --- /dev/null +++ b/dom/webidl/SpeechGrammar.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://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", + NamedConstructor=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..ee48859284 --- /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", + NamedConstructor=webkitSpeechGrammarList, + Func="SpeechRecognition::IsAuthorized", + Exposed=Window] +interface SpeechGrammarList { + constructor(); + + readonly attribute unsigned long length; + [Throws] + getter SpeechGrammar item(unsigned long index); + [Throws] + void addFromURI(DOMString src, optional float weight); + [Throws] + void addFromString(DOMString string, optional float weight); +}; diff --git a/dom/webidl/SpeechRecognition.webidl b/dom/webidl/SpeechRecognition.webidl new file mode 100644 index 0000000000..dcd153c1b6 --- /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", + NamedConstructor=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] + void start(optional MediaStream stream); + void stop(); + void 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..6353317ffe --- /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; + + void speak(SpeechSynthesisUtterance utterance); + void cancel(); + void pause(); + void resume(); + sequence<SpeechSynthesisVoice> getVoices(); + + attribute EventHandler onvoiceschanged; + + [ChromeOnly] + // Force an utterance to end. Circumvents bad speech service implementations. + void 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..d631f2379f --- /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; +};
\ No newline at end of file diff --git a/dom/webidl/StereoPannerNode.webidl b/dom/webidl/StereoPannerNode.webidl new file mode 100644 index 0000000000..d1e8f17c35 --- /dev/null +++ b/dom/webidl/StereoPannerNode.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 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..56e76ff38a --- /dev/null +++ b/dom/webidl/Storage.webidl @@ -0,0 +1,81 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was 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 void setItem(DOMString key, DOMString value); + + [Throws, NeedsSubjectPrincipal] + deleter void removeItem(DOMString key); + + [Throws, NeedsSubjectPrincipal] + void 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"] + void 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"] + void 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"] + void beginExplicitSnapshot(); + + /** + * 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"] + void endExplicitSnapshot(); + + /** + * Returns true if the underlying database has been opened and it has an + * active snapshot (initialized implicitly or explicitly). + */ + [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"] + readonly attribute boolean hasActiveSnapshot; +}; diff --git a/dom/webidl/StorageEvent.webidl b/dom/webidl/StorageEvent.webidl new file mode 100644 index 0000000000..7cab2e5f4b --- /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. + void 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..06e5a97947 --- /dev/null +++ b/dom/webidl/StorageManager.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://storage.spec.whatwg.org/#storagemanager + * + */ + +[SecureContext, + Exposed=(Window,Worker), + Pref="dom.storageManager.enabled"] +interface StorageManager { + [Throws] + Promise<boolean> persisted(); + + [Exposed=Window, Throws] + Promise<boolean> persist(); + + [Throws] + Promise<StorageEstimate> estimate(); +}; + +dictionary StorageEstimate { + unsigned long long usage; + unsigned long long quota; +}; diff --git a/dom/webidl/StorageType.webidl b/dom/webidl/StorageType.webidl new file mode 100644 index 0000000000..cb0702d2a8 --- /dev/null +++ b/dom/webidl/StorageType.webidl @@ -0,0 +1,7 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 StorageType { "persistent", "temporary", "default" }; diff --git a/dom/webidl/StreamFilter.webidl b/dom/webidl/StreamFilter.webidl new file mode 100644 index 0000000000..8574b86610 --- /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] + void suspend(); + + /** + * Resumes delivery of data for a suspended request. + */ + [Throws] + void 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] + void 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] + void disconnect(); + + /** + * Writes a chunk of data to the output stream. This may not be called + * before the "start" event has been received. + */ + [Throws] + void 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..06a28f5061 --- /dev/null +++ b/dom/webidl/StreamFilterDataEvent.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/. */ + +/** + * 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..513b80f56d --- /dev/null +++ b/dom/webidl/StyleSheet.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/ + */ + +[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 DOMString 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 DOMString sourceURL; +}; diff --git a/dom/webidl/StyleSheetApplicableStateChangeEvent.webidl b/dom/webidl/StyleSheetApplicableStateChangeEvent.webidl new file mode 100644 index 0000000000..82714bad00 --- /dev/null +++ b/dom/webidl/StyleSheetApplicableStateChangeEvent.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 StyleSheetApplicableStateChangeEvent : Event +{ + constructor(DOMString type, + optional StyleSheetApplicableStateChangeEventInit eventInitDict = {}); + + readonly attribute CSSStyleSheet? stylesheet; + readonly attribute boolean applicable; +}; + +dictionary StyleSheetApplicableStateChangeEventInit : EventInit +{ + CSSStyleSheet? stylesheet = null; + boolean applicable = false; +}; diff --git a/dom/webidl/StyleSheetList.webidl b/dom/webidl/StyleSheetList.webidl new file mode 100644 index 0000000000..b9a9740938 --- /dev/null +++ b/dom/webidl/StyleSheetList.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=Window] +interface StyleSheetList { + readonly attribute unsigned long length; + getter StyleSheet? item(unsigned long index); +}; 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..82c866c08a --- /dev/null +++ b/dom/webidl/SubtleCrypto.webidl @@ -0,0 +1,246 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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] +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 { + [Throws] + Promise<any> encrypt(AlgorithmIdentifier algorithm, + CryptoKey key, + BufferSource data); + [Throws] + Promise<any> decrypt(AlgorithmIdentifier algorithm, + CryptoKey key, + BufferSource data); + [Throws] + Promise<any> sign(AlgorithmIdentifier algorithm, + CryptoKey key, + BufferSource data); + [Throws] + Promise<any> verify(AlgorithmIdentifier algorithm, + CryptoKey key, + BufferSource signature, + BufferSource data); + [Throws] + Promise<any> digest(AlgorithmIdentifier algorithm, + BufferSource data); + + [Throws] + Promise<any> generateKey(AlgorithmIdentifier algorithm, + boolean extractable, + sequence<KeyUsage> keyUsages ); + [Throws] + Promise<any> deriveKey(AlgorithmIdentifier algorithm, + CryptoKey baseKey, + AlgorithmIdentifier derivedKeyType, + boolean extractable, + sequence<KeyUsage> keyUsages ); + [Throws] + Promise<any> deriveBits(AlgorithmIdentifier algorithm, + CryptoKey baseKey, + unsigned long length); + + [Throws] + Promise<any> importKey(KeyFormat format, + object keyData, + AlgorithmIdentifier algorithm, + boolean extractable, + sequence<KeyUsage> keyUsages ); + [Throws] + Promise<any> exportKey(KeyFormat format, CryptoKey key); + + [Throws] + Promise<any> wrapKey(KeyFormat format, + CryptoKey key, + CryptoKey wrappingKey, + AlgorithmIdentifier wrapAlgorithm); + + [Throws] + 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..62c97ac8d1 --- /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. + */ + void 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..9fbae485c6 --- /dev/null +++ b/dom/webidl/TCPSocket.webidl @@ -0,0 +1,214 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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. + */ + +enum TCPSocketBinaryType { + "arraybuffer", + "string" +}; + +dictionary SocketOptions { + boolean useSecureTransport = false; + TCPSocketBinaryType binaryType = "string"; +}; + +enum TCPReadyState { + "connecting", + "open", + "closing", + "closed", +}; + +[NoInterfaceObject, + 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] void upgradeToSecure(); + + /** + * 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. + */ + void 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] + void resume(); + + /** + * Close the socket. + */ + void close(); + + /** + * Close the socket immediately without waiting for unsent data. + */ + [ChromeOnly] void 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..d47656cd6c --- /dev/null +++ b/dom/webidl/TCPSocketErrorEvent.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/. */ + +/* 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; +}; + +dictionary TCPSocketErrorEventInit : EventInit +{ + DOMString name = ""; + DOMString message = ""; +}; 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/TestFunctions.webidl b/dom/webidl/TestFunctions.webidl new file mode 100644 index 0000000000..c794fca857 --- /dev/null +++ b/dom/webidl/TestFunctions.webidl @@ -0,0 +1,138 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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>(); + +[Pref="dom.expose_test_interfaces", + Exposed=Window] +interface WrapperCachedNonISupportsTestInterface { + [Pref="dom.webidl.test1"] constructor(); +}; + +// 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 void 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. + void 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] + void testThrowNsresult(); + [Throws] + void 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; + void testNotAllowShared(ArrayBufferView buffer); + void testNotAllowShared(ArrayBuffer buffer); + void testNotAllowShared(DOMString buffer); + void testAllowShared([AllowShared] ArrayBufferView buffer); + void testAllowShared([AllowShared] ArrayBuffer buffer); + void testDictWithAllowShared(optional DictWithAllowSharedBufferSource buffer = {}); + void testUnionOfBuffferSource((ArrayBuffer or ArrayBufferView or DOMString) foo); + void testUnionOfAllowSharedBuffferSource(([AllowShared] ArrayBuffer or [AllowShared] ArrayBufferView) 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..7bbb7f4e8d --- /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(); + void 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 + void testSequenceOverload(sequence<DOMString> arg); + void testSequenceOverload(DOMString arg); + + void testSequenceUnion((sequence<DOMString> or DOMString) arg); + + // Tests for exception-throwing behavior + [Throws] + void testThrowError(); + + [Throws] + void testThrowDOMException(); + + [Throws] + void testThrowTypeError(); + + [Throws] + void testThrowCallbackError(Function callback); + + [Throws] + void testThrowXraySelfHosted(); + + [Throws] + void testThrowSelfHosted(); + + // Tests for promise-rejection behavior + Promise<void> testPromiseWithThrowingChromePromiseInit(); + Promise<void> testPromiseWithThrowingContentPromiseInit(Function func); + Promise<void> testPromiseWithDOMExceptionThrowingPromiseInit(); + Promise<void> testPromiseWithThrowingChromeThenFunction(); + Promise<void> testPromiseWithThrowingContentThenFunction(AnyCallback func); + Promise<void> testPromiseWithDOMExceptionThrowingThenFunction(); + Promise<void> testPromiseWithThrowingChromeThenable(); + Promise<void> testPromiseWithThrowingContentThenable(object thenable); + Promise<void> 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..b23b9d8a35 --- /dev/null +++ b/dom/webidl/TestInterfaceJSDictionaries.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/. + */ + +// +// 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..8a89b81874 --- /dev/null +++ b/dom/webidl/TestInterfaceJSMaplikeSetlikeIterable.webidl @@ -0,0 +1,111 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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>; + void setInternal(DOMString aKey, long aValue); + void 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>; + void setInternal(DOMString aKey); + void 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>; + void setInternal(DOMString aKey, object aObject); + void clearInternal(); + boolean deleteInternal(DOMString aKey); + boolean hasInternal(DOMString aKey); + [Throws] + object? getInternal(DOMString aKey); +}; + +[Pref="dom.expose_test_interfaces", + JSImplementation="@mozilla.org/dom/test-interface-js-maplike;1", + Exposed=Window] +interface TestInterfaceJSMaplike { + [Throws] + constructor(); + + readonly maplike<DOMString, long>; + void setInternal(DOMString aKey, long aValue); + void clearInternal(); + boolean deleteInternal(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)>; +}; + diff --git a/dom/webidl/Text.webidl b/dom/webidl/Text.webidl new file mode 100644 index 0000000000..3235857370 --- /dev/null +++ b/dom/webidl/Text.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 Text : CharacterData { + [Throws] + constructor(optional DOMString data = ""); + + [Throws] + Text splitText(unsigned long offset); + [Throws] + 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..6b00c962c4 --- /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 + * + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +[Exposed=(Window,Worker)] +interface TextDecoder { + [Throws] + constructor(optional DOMString label = "utf-8", + optional TextDecoderOptions options = {}); + + [Constant] + readonly attribute DOMString encoding; + [Constant] + readonly attribute boolean fatal; + [Constant] + readonly attribute boolean ignoreBOM; + [Throws] + USVString decode(optional BufferSource input, optional TextDecodeOptions options = {}); +}; + +dictionary TextDecoderOptions { + boolean fatal = false; + boolean ignoreBOM = false; +}; + +dictionary TextDecodeOptions { + boolean stream = false; +}; + diff --git a/dom/webidl/TextEncoder.webidl b/dom/webidl/TextEncoder.webidl new file mode 100644 index 0000000000..697faf0dcd --- /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 + * + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +dictionary TextEncoderEncodeIntoResult { + unsigned long long read; + unsigned long long written; +}; + +[Exposed=(Window,Worker)] +interface TextEncoder { + constructor(); + + /* + * 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; + + /* + * 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] + 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); +}; diff --git a/dom/webidl/TextTrack.webidl b/dom/webidl/TextTrack.webidl new file mode 100644 index 0000000000..13d468bd8c --- /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; + + void addCue(VTTCue cue); + [Throws] + void 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..9e97d4b668 --- /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; + void 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/Touch.webidl b/dom/webidl/Touch.webidl new file mode 100644 index 0000000000..91ea3b1990 --- /dev/null +++ b/dom/webidl/Touch.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/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..9e8cd11546 --- /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; + + void 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/TransceiverImpl.webidl b/dom/webidl/TransceiverImpl.webidl new file mode 100644 index 0000000000..359297bdfb --- /dev/null +++ b/dom/webidl/TransceiverImpl.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/. + * + * PeerConnection.js' interface to the C++ TransceiverImpl. + * + * Do not confuse with RTCRtpTransceiver. This interface is purely for + * communication between the PeerConnection JS DOM binding and the C++ + * implementation. + * + * See media/webrtc/peerconnection/TransceiverImpl.h + * + */ + +// Constructed by PeerConnectionImpl::CreateTransceiverImpl. +[ChromeOnly, + Exposed=Window] +interface TransceiverImpl { + [Throws] + void syncWithJS(RTCRtpTransceiver transceiver); + readonly attribute RTCRtpReceiver receiver; + // TODO(bug 1616937): We won't need this once we implement RTCRtpSender in c++ + [ChromeOnly] + readonly attribute RTCDTMFSender? dtmf; + [ChromeOnly] + readonly attribute RTCDtlsTransport? dtlsTransport; +}; + 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/TreeColumn.webidl b/dom/webidl/TreeColumn.webidl new file mode 100644 index 0000000000..6e0c0c4ec8 --- /dev/null +++ b/dom/webidl/TreeColumn.webidl @@ -0,0 +1,38 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +[ChromeOnly, Exposed=Window] +interface TreeColumn { + readonly attribute Element element; + + readonly attribute TreeColumns? columns; + + [Throws] + readonly attribute long x; + [Throws] + readonly attribute long width; + + readonly attribute DOMString id; + readonly attribute long index; + + readonly attribute boolean primary; + readonly attribute boolean cycler; + readonly attribute boolean editable; + + const short TYPE_TEXT = 1; + const short TYPE_CHECKBOX = 2; + readonly attribute short type; + + TreeColumn? getNext(); + TreeColumn? getPrevious(); + + /** + * Returns the previous displayed column, if any, accounting for + * the ordinals set on the columns. + */ + readonly attribute TreeColumn? previousColumn; + + [Throws] + void invalidate(); +}; diff --git a/dom/webidl/TreeColumns.webidl b/dom/webidl/TreeColumns.webidl new file mode 100644 index 0000000000..23ea5dcb1f --- /dev/null +++ b/dom/webidl/TreeColumns.webidl @@ -0,0 +1,53 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 TreeColumns { + /** + * The tree widget for these columns. + */ + readonly attribute XULTreeElement? tree; + + /** + * The number of columns. + */ + readonly attribute unsigned long count; + + /** + * An alias for count (for the benefit of scripts which treat this as an + * array). + */ + readonly attribute unsigned long length; + + /** + * Get the first/last column. + */ + TreeColumn? getFirstColumn(); + TreeColumn? getLastColumn(); + + /** + * Attribute based column getters. + */ + TreeColumn? getPrimaryColumn(); + TreeColumn? getSortedColumn(); + TreeColumn? getKeyColumn(); + + /** + * Get the column for the given element. + */ + TreeColumn? getColumnFor(Element? element); + + /** + * Parametric column getters. + */ + getter TreeColumn? getNamedColumn(DOMString name); + getter TreeColumn? getColumnAt(unsigned long index); + + /** + * This method is called whenever a treecol is added or removed and + * the column cache needs to be rebuilt. + */ + void invalidateColumns(); +}; diff --git a/dom/webidl/TreeContentView.webidl b/dom/webidl/TreeContentView.webidl new file mode 100644 index 0000000000..c7ab0cb96f --- /dev/null +++ b/dom/webidl/TreeContentView.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, + Exposed=Window] +interface TreeContentView +{ + /** + * Retrieve the content item associated with the specified row. + */ + [Throws] + Element? getItemAtIndex(long row); + + /** + * Retrieve the index associated with the specified content item. + */ + long getIndexOfItem(Element? item); +}; +TreeContentView includes TreeView; diff --git a/dom/webidl/TreeView.webidl b/dom/webidl/TreeView.webidl new file mode 100644 index 0000000000..cf9b22fe18 --- /dev/null +++ b/dom/webidl/TreeView.webidl @@ -0,0 +1,186 @@ +/* -*- 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/. */ + +interface nsITreeSelection; + +interface mixin TreeView +{ + /** + * The total number of rows in the tree (including the offscreen rows). + */ + readonly attribute long rowCount; + + /** + * The selection for this view. + */ + [SetterThrows] + attribute nsITreeSelection? selection; + + /** + * A whitespace delimited list of properties. For each property X the view + * gives back will cause the pseudoclasses ::-moz-tree-cell(x), + * ::-moz-tree-row(x), ::-moz-tree-twisty(x), ::-moz-tree-image(x), + * ::-moz-tree-cell-text(x). to be matched on the pseudoelement + * ::moz-tree-row. + */ + [Throws] + DOMString getRowProperties(long row); + + /** + * A whitespace delimited list of properties for a given cell. Each + * property, x, that the view gives back will cause the pseudoclasses + * ::-moz-tree-cell(x), ::-moz-tree-row(x), ::-moz-tree-twisty(x), + * ::-moz-tree-image(x), ::-moz-tree-cell-text(x). to be matched on the + * cell. + */ + [Throws] + DOMString getCellProperties(long row, TreeColumn column); + + /** + * Called to get properties to paint a column background. For shading the sort + * column, etc. + */ + DOMString getColumnProperties(TreeColumn column); + + /** + * Methods that can be used to test whether or not a twisty should be drawn, + * and if so, whether an open or closed twisty should be used. + */ + [Throws] + boolean isContainer(long row); + [Throws] + boolean isContainerOpen(long row); + [Throws] + boolean isContainerEmpty(long row); + + /** + * isSeparator is used to determine if the row is a separator. + * A value of true will result in the tree drawing a horizontal separator. + * The tree uses the ::moz-tree-separator pseudoclass to draw the separator. + */ + [Throws] + boolean isSeparator(long row); + + /** + * Specifies if there is currently a sort on any column. Used mostly by dragdrop + * to affect drop feedback. + */ + boolean isSorted(); + + const short DROP_BEFORE = -1; + const short DROP_ON = 0; + const short DROP_AFTER = 1; + /** + * Methods used by the drag feedback code to determine if a drag is allowable at + * the current location. To get the behavior where drops are only allowed on + * items, such as the mailNews folder pane, always return false when + * the orientation is not DROP_ON. + */ + [Throws] + boolean canDrop(long row, long orientation, DataTransfer? dataTransfer); + + /** + * Called when the user drops something on this view. The |orientation| param + * specifies before/on/after the given |row|. + */ + [Throws] + void drop(long row, long orientation, DataTransfer? dataTransfer); + + /** + * Methods used by the tree to draw thread lines in the tree. + * getParentIndex is used to obtain the index of a parent row. + * If there is no parent row, getParentIndex returns -1. + */ + [Throws] + long getParentIndex(long row); + + /** + * hasNextSibling is used to determine if the row at rowIndex has a nextSibling + * that occurs *after* the index specified by afterIndex. Code that is forced + * to march down the view looking at levels can optimize the march by starting + * at afterIndex+1. + */ + [Throws] + boolean hasNextSibling(long row, long afterIndex); + + /** + * The level is an integer value that represents + * the level of indentation. It is multiplied by the width specified in the + * :moz-tree-indentation pseudoelement to compute the exact indendation. + */ + [Throws] + long getLevel(long row); + + /** + * The image path for a given cell. For defining an icon for a cell. + * If the empty string is returned, the :moz-tree-image pseudoelement + * will be used. + */ + [Throws] + DOMString getImageSrc(long row, TreeColumn column); + + /** + * The value for a given cell. This method is only called for columns + * of type other than |text|. + */ + [Throws] + DOMString getCellValue(long row, TreeColumn column); + + /** + * The text for a given cell. If a column consists only of an image, then + * the empty string is returned. + */ + [Throws] + DOMString getCellText(long row, TreeColumn column); + + /** + * Called during initialization to link the view to the front end box object. + */ + [Throws] + void setTree(XULTreeElement? tree); + + /** + * Called on the view when an item is opened or closed. + */ + [Throws] + void toggleOpenState(long row); + + /** + * Called on the view when a header is clicked. + */ + [Throws] + void cycleHeader(TreeColumn column); + + /** + * Should be called from a XUL onselect handler whenever the selection changes. + */ + void selectionChanged(); + + /** + * Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked. + */ + void cycleCell(long row, TreeColumn column); + + /** + * isEditable is called to ask the view if the cell contents are editable. + * A value of true will result in the tree popping up a text field when + * the user tries to inline edit the cell. + */ + [Throws] + boolean isEditable(long row, TreeColumn column); + + /** + * setCellValue is called when the value of the cell has been set by the user. + * This method is only called for columns of type other than |text|. + */ + [Throws] + void setCellValue(long row, TreeColumn column, DOMString value); + + /** + * setCellText is called when the contents of the cell have been edited by the user. + */ + [Throws] + void setCellText(long row, TreeColumn column, DOMString value); +}; 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/U2F.webidl b/dom/webidl/U2F.webidl new file mode 100644 index 0000000000..81d122921b --- /dev/null +++ b/dom/webidl/U2F.webidl @@ -0,0 +1,108 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is a combination of the FIDO U2F Raw Message Formats: + * https://www.fidoalliance.org/specs/fido-u2f-v1.1-id-20160915/fido-u2f-raw-message-formats-v1.1-id-20160915.html + * and the U2F JavaScript API v1.1: + * https://www.fidoalliance.org/specs/fido-u2f-v1.1-id-20160915/fido-u2f-javascript-api-v1.1-id-20160915.html + */ + +interface mixin GlobalU2F { + [SecureContext, Throws, Pref="security.webauth.u2f", Replaceable] + readonly attribute U2F u2f; +}; + +typedef unsigned short ErrorCode; +typedef sequence<Transport> Transports; + +enum Transport { + "bt", + "ble", + "nfc", + "usb" +}; + +[GenerateToJSON] +dictionary U2FClientData { + DOMString typ; // Spelling is from the specification + DOMString challenge; + DOMString origin; + // cid_pubkey for Token Binding is not implemented +}; + +dictionary RegisterRequest { + DOMString version; + DOMString challenge; +}; + +dictionary RegisterResponse { + DOMString version; + DOMString registrationData; + DOMString clientData; + + // From Error + ErrorCode? errorCode; + DOMString? errorMessage; +}; + +dictionary RegisteredKey { + DOMString version; + DOMString keyHandle; + Transports? transports; + DOMString? appId; +}; + +dictionary SignResponse { + DOMString keyHandle; + DOMString signatureData; + DOMString clientData; + + // From Error + ErrorCode? errorCode; + DOMString? errorMessage; +}; + +callback U2FRegisterCallback = void(RegisterResponse response); +callback U2FSignCallback = void(SignResponse response); + +[SecureContext, Pref="security.webauth.u2f", + Exposed=Window] +interface U2F { + // These enumerations are defined in the FIDO U2F Javascript API under the + // interface "ErrorCode" as constant integers, and also in the U2F.cpp file. + // Any changes to these must occur in both locations. + const unsigned short OK = 0; + const unsigned short OTHER_ERROR = 1; + const unsigned short BAD_REQUEST = 2; + const unsigned short CONFIGURATION_UNSUPPORTED = 3; + const unsigned short DEVICE_INELIGIBLE = 4; + const unsigned short TIMEOUT = 5; + + // Returns a Function. It's readonly + [LenientSetter] to keep the Google + // U2F polyfill from stomping on the value. + [LenientSetter, Pure, Cached, Throws] + readonly attribute object register; + + // A way to generate the actual implementation of register() + [Unexposed, Throws, BinaryName="Register"] + void register_impl(DOMString appId, + sequence<RegisterRequest> registerRequests, + sequence<RegisteredKey> registeredKeys, + U2FRegisterCallback callback, + optional long? opt_timeoutSeconds); + + // Returns a Function. It's readonly + [LenientSetter] to keep the Google + // U2F polyfill from stomping on the value. + [LenientSetter, Pure, Cached, Throws] + readonly attribute object sign; + + // A way to generate the actual implementation of sign() + [Unexposed, Throws, BinaryName="Sign"] + void sign_impl (DOMString appId, + DOMString challenge, + sequence<RegisteredKey> registeredKeys, + U2FSignCallback callback, + optional long? opt_timeoutSeconds); +}; 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..4d6119b1d5 --- /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<void> opened; + readonly attribute Promise<void> 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<void> close (); + [Throws] void joinMulticastGroup (DOMString multicastGroupAddress); + [Throws] void 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..a52f9a09c9 --- /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; + void 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..9b74f7dcdb --- /dev/null +++ b/dom/webidl/URL.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 origins of this IDL file are + * http://url.spec.whatwg.org/#api + * http://dev.w3.org/2006/webapi/FileAPI/#creating-revoking + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Exposed=(Window,Worker,WorkerDebugger), + LegacyWindowAlias=webkitURL] +interface URL { + [Throws] + constructor(USVString url, optional USVString base); + + [SetterThrows] + stringifier attribute USVString href; + [GetterThrows] + readonly attribute USVString origin; + [SetterThrows] + 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; + + USVString toJSON(); +}; + +[Exposed=(Window,DedicatedWorker,SharedWorker)] +partial interface URL { + [Throws] + static DOMString createObjectURL(Blob blob); + [Throws] + static void revokeObjectURL(DOMString url); + [ChromeOnly, Throws] + static boolean isValidURL(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..bf98b9a650 --- /dev/null +++ b/dom/webidl/URLSearchParams.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://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), + Serializable] +interface URLSearchParams { + [Throws] + constructor(optional (sequence<sequence<USVString>> or + record<USVString, USVString> or USVString) init = ""); + + void append(USVString name, USVString value); + void delete(USVString name); + USVString? get(USVString name); + sequence<USVString> getAll(USVString name); + boolean has(USVString name); + void set(USVString name, USVString value); + + [Throws] + void sort(); + + iterable<USVString, USVString>; + stringifier; +}; 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..52b1b66f9c --- /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. + */ + void 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] void 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. + */ + [Throws, NeedsCallerType] Promise<void> requestPresent(sequence<VRLayer> layers); + + /** + * Stops presenting to the VRDisplay. + */ + [Throws] Promise<void> 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. + */ + void 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..f27f072e6b --- /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 { + void 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; + void setEyeFOV(VREye eye, + double upDegree, double rightDegree, + double downDegree, double leftDegree); + void setEyeOffset(VREye eye, double offsetX, + double offsetY, double offsetZ); + void setEyeResolution(unsigned long renderWidth, + unsigned long renderHeight); + void setConnected(boolean connected); + void setMounted(boolean mounted); + void setStageSize(double width, double height); + [Throws] void setSittingToStandingTransform(Float32Array sittingToStandingTransform); + [Throws] void 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 { + void create(); + void 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] void setPose(Float32Array? position, Float32Array? linearVelocity, + Float32Array? linearAcceleration, Float32Array? orientation, + Float32Array? angularVelocity, Float32Array? angularAcceleration); + void setButtonPressed(unsigned long buttonIdx, boolean pressed); + void setButtonTouched(unsigned long buttonIdx, boolean touched); + void setButtonTrigger(unsigned long buttonIdx, double trigger); + void 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); + [Throws] Promise<void> run(); + [Throws] Promise<void> reset(); + void commit(); + void end(); + void clearAll(); + void timeout(unsigned long duration); + void wait(unsigned long duration); + void waitSubmit(); + void waitPresentationStart(); + void waitPresentationEnd(); + [Throws] + void waitHapticIntensity(unsigned long controllerIdx, unsigned long hapticIdx, double intensity); + void captureFrame(); + void acknowledgeFrame(); + void rejectFrame(); + void startTimer(); + void stopTimer(); +}; diff --git a/dom/webidl/VTTCue.webidl b/dom/webidl/VTTCue.webidl new file mode 100644 index 0000000000..92855ac778 --- /dev/null +++ b/dom/webidl/VTTCue.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://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); + + [Pref="media.webvtt.regions.enabled"] + 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..359e5d9a8b --- /dev/null +++ b/dom/webidl/VTTRegion.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/webvtt/#the-vttregion-interface + */ + +enum ScrollSetting { + "", + "up" +}; + +[Pref="media.webvtt.regions.enabled", + 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..d9ca079e3a --- /dev/null +++ b/dom/webidl/ValidityState.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/#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/VideoPlaybackQuality.webidl b/dom/webidl/VideoPlaybackQuality.webidl new file mode 100644 index 0000000000..bb17773851 --- /dev/null +++ b/dom/webidl/VideoPlaybackQuality.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/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..3506af5779 --- /dev/null +++ b/dom/webidl/VideoTrackList.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/#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/WaveShaperNode.webidl b/dom/webidl/WaveShaperNode.webidl new file mode 100644 index 0000000000..20198ffe68 --- /dev/null +++ b/dom/webidl/WaveShaperNode.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. + */ + +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, SetterThrows] + 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..baae04cf4b --- /dev/null +++ b/dom/webidl/WebAuthentication.webidl @@ -0,0 +1,187 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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] readonly attribute ArrayBuffer rawId; + [SameObject] readonly attribute AuthenticatorResponse response; + AuthenticationExtensionsClientOutputs getClientExtensionResults(); +}; + +[SecureContext] +partial interface PublicKeyCredential { + static Promise<boolean> isUserVerifyingPlatformAuthenticatorAvailable(); + // isExternalCTAP2SecurityKeySupported is non-standard; see Bug 1526023 + static Promise<boolean> isExternalCTAP2SecurityKeySupported(); +}; + +[SecureContext, Pref="security.webauth.webauthn", + Exposed=Window] +interface AuthenticatorResponse { + [SameObject] readonly attribute ArrayBuffer clientDataJSON; +}; + +[SecureContext, Pref="security.webauth.webauthn", + Exposed=Window] +interface AuthenticatorAttestationResponse : AuthenticatorResponse { + [SameObject] readonly attribute ArrayBuffer attestationObject; +}; + +[SecureContext, Pref="security.webauth.webauthn", + Exposed=Window] +interface AuthenticatorAssertionResponse : AuthenticatorResponse { + [SameObject] readonly attribute ArrayBuffer authenticatorData; + [SameObject] readonly attribute ArrayBuffer signature; + [SameObject] readonly attribute ArrayBuffer? userHandle; +}; + +dictionary PublicKeyCredentialParameters { + required PublicKeyCredentialType 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 = {}; + AttestationConveyancePreference attestation = "none"; + // FIXME: bug 1493860: should this "= {}" be here? + AuthenticationExtensionsClientInputs extensions = {}; +}; + +dictionary PublicKeyCredentialEntity { + required DOMString name; + USVString icon; +}; + +dictionary PublicKeyCredentialRpEntity : PublicKeyCredentialEntity { + DOMString id; +}; + +dictionary PublicKeyCredentialUserEntity : PublicKeyCredentialEntity { + required BufferSource id; + required DOMString displayName; +}; + +dictionary AuthenticatorSelectionCriteria { + AuthenticatorAttachment authenticatorAttachment; + boolean requireResidentKey = false; + UserVerificationRequirement userVerification = "preferred"; +}; + +enum AuthenticatorAttachment { + "platform", // Platform attachment + "cross-platform" // Cross-platform attachment +}; + +enum AttestationConveyancePreference { + "none", + "indirect", + "direct" +}; + +enum UserVerificationRequirement { + "required", + "preferred", + "discouraged" +}; + +dictionary PublicKeyCredentialRequestOptions { + required BufferSource challenge; + unsigned long timeout; + USVString rpId; + sequence<PublicKeyCredentialDescriptor> allowCredentials = []; + UserVerificationRequirement userVerification = "preferred"; + // FIXME: bug 1493860: should this "= {}" be here? + AuthenticationExtensionsClientInputs extensions = {}; +}; + +// TODO - Use partial dictionaries when bug 1436329 is fixed. +dictionary AuthenticationExtensionsClientInputs { + // FIDO AppID Extension (appid) + // <https://w3c.github.io/webauthn/#sctn-appid-extension> + USVString appid; + + // hmac-secret + // <https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#sctn-hmac-secret-extension> + boolean hmacCreateSecret; +}; + +// TODO - Use partial dictionaries when bug 1436329 is fixed. +dictionary AuthenticationExtensionsClientOutputs { + // FIDO AppID Extension (appid) + // <https://w3c.github.io/webauthn/#sctn-appid-extension> + boolean appid; + + // <https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#sctn-hmac-secret-extension> + boolean hmacCreateSecret; +}; + +typedef record<DOMString, DOMString> AuthenticationExtensionsAuthenticatorInputs; + +[GenerateToJSON] +dictionary CollectedClientData { + required DOMString type; + required DOMString challenge; + required DOMString origin; + required DOMString hashAlgorithm; + DOMString tokenBindingId; + // FIXME: bug 1493860: should this "= {}" be here? + AuthenticationExtensionsClientInputs clientExtensions = {}; + AuthenticationExtensionsAuthenticatorInputs authenticatorExtensions; +}; + +enum PublicKeyCredentialType { + "public-key" +}; + +dictionary PublicKeyCredentialDescriptor { + required PublicKeyCredentialType 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; +}; + +enum AuthenticatorTransport { + "usb", + "nfc", + "ble", + "internal" +}; + +typedef long COSEAlgorithmIdentifier; + +typedef sequence<AAGUID> AuthenticatorSelectionList; + +typedef BufferSource AAGUID; + +/* +// FIDO AppID Extension (appid) +// <https://w3c.github.io/webauthn/#sctn-appid-extension> +partial dictionary AuthenticationExtensionsClientInputs { + USVString appid; +}; + +// FIDO AppID Extension (appid) +// <https://w3c.github.io/webauthn/#sctn-appid-extension> +partial dictionary AuthenticationExtensionsClientOutputs { + boolean appid; +}; +*/ diff --git a/dom/webidl/WebComponents.webidl b/dom/webidl/WebComponents.webidl new file mode 100644 index 0000000000..d63a305d18 --- /dev/null +++ b/dom/webidl/WebComponents.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://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleConnectedCallback = void(); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleDisconnectedCallback = void(); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleAdoptedCallback = void(Document? oldDocument, + Document? newDocment); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleAttributeChangedCallback = void(DOMString attrName, + DOMString? oldValue, + DOMString? newValue, + DOMString? namespaceURI); +[MOZ_CAN_RUN_SCRIPT_BOUNDARY] +callback LifecycleGetCustomInterfaceCallback = object?(any iid); + +[GenerateInit] +dictionary LifecycleCallbacks { + LifecycleConnectedCallback connectedCallback; + LifecycleDisconnectedCallback disconnectedCallback; + LifecycleAdoptedCallback adoptedCallback; + LifecycleAttributeChangedCallback attributeChangedCallback; + [ChromeOnly] LifecycleGetCustomInterfaceCallback getCustomInterfaceCallback; +}; diff --git a/dom/webidl/WebGL2RenderingContext.webidl b/dom/webidl/WebGL2RenderingContext.webidl new file mode 100644 index 0000000000..039a5fe9ea --- /dev/null +++ b/dom/webidl/WebGL2RenderingContext.webidl @@ -0,0 +1,716 @@ +/* -*- 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", + Exposed=Window] +interface WebGLSampler { +}; + +[Pref="webgl.enable-webgl2", + Exposed=Window] +interface WebGLSync { +}; + +[Pref="webgl.enable-webgl2", + Exposed=Window] +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", + Exposed=Window] +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: + void bufferData(GLenum target, GLsizeiptr size, GLenum usage); + void bufferData(GLenum target, [AllowShared] ArrayBuffer? srcData, GLenum usage); + void bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage); + void bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBuffer srcData); + void bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBufferView srcData); + // WebGL2: + void bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage, + GLuint srcOffset, optional GLuint length = 0); + void bufferSubData(GLenum target, GLintptr dstByteOffset, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset, optional GLuint length = 0); + + void 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. + void getBufferSubData(GLenum target, GLintptr srcByteOffset, [AllowShared] ArrayBufferView dstData, + optional GLuint dstOffset = 0, optional GLuint length = 0); + + /* Framebuffer objects */ + void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, + GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + void framebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, + GLint layer); + + [Throws] + void invalidateFramebuffer(GLenum target, sequence<GLenum> attachments); + + [Throws] + void invalidateSubFramebuffer(GLenum target, sequence<GLenum> attachments, + GLint x, GLint y, GLsizei width, GLsizei height); + + void readBuffer(GLenum src); + + /* Renderbuffer objects */ + [Throws] + any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname); + void renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, + GLsizei width, GLsizei height); + + /* Texture objects */ + void texStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, + GLsizei height); + void texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth); + + // WebGL1 legacy entrypoints: + [Throws] // Another overhead throws. + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLsizei width, GLsizei height, GLint border, GLenum format, + GLenum type, [AllowShared] ArrayBufferView? pixels); + [Throws] + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLCanvasElement source); // May throw DOMException + [Throws] + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLImageElement source); // May throw DOMException + [Throws] + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, ImageBitmap source); + [Throws] // Another overhead throws. + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, ImageData source); + + [Throws] // Another overhead throws. + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); + [Throws] + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLCanvasElement source); // May throw DOMException + [Throws] + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLImageElement source); // May throw DOMException + [Throws] + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageBitmap source); + [Throws] // Another overhead throws. + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageData source); + + // WebGL2 entrypoints: + [Throws] // Another overhead throws. + void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, GLintptr pboOffset); + [Throws] + void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + HTMLCanvasElement source); // May throw DOMException + [Throws] + void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + HTMLImageElement source); // May throw DOMException + [Throws] + void 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. + void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + ImageBitmap source); + [Throws] // Another overhead throws. + void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + ImageData source); + [Throws] // Another overhead throws. + void 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. + void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset); + [Throws] + void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + HTMLCanvasElement source); // May throw DOMException + [Throws] + void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + HTMLImageElement source); // May throw DOMException + [Throws] + void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, + HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + void 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. + void 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. + void 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. + void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, + GLuint srcOffset); + + [Throws] // Another overhead throws. + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, GLintptr pboOffset); + [Throws] + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + HTMLCanvasElement source); // May throw DOMException + [Throws] + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + HTMLImageElement source); // May throw DOMException + [Throws] + void 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. + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + ImageBitmap source); + [Throws] // Another overhead throws. + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, + ImageData source); + [Throws] // Another overhead throws. + void 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. + void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + GLintptr pboOffset); + [Throws] + void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + HTMLCanvasElement source); // May throw DOMException + [Throws] + void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + HTMLImageElement source); // May throw DOMException + [Throws] + void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + HTMLVideoElement source); // May throw DOMException + [Throws] // Another overhead throws. + void 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. + void 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. + void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, + [AllowShared] ArrayBufferView? srcData, optional GLuint srcOffset = 0); + + void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, GLsizei width, GLsizei height); + + void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, GLintptr offset); + void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLint border, [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); + + void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset); + void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); + + void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset); + void 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); + + void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLsizei imageSize, GLintptr offset); + void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, + GLenum format, [AllowShared] ArrayBufferView srcData, + optional GLuint srcOffset = 0, + optional GLuint srcLengthOverride = 0); + + /* Programs and shaders */ + [WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name); + + /* Uniforms */ + void uniform1ui(WebGLUniformLocation? location, GLuint v0); + void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1); + void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2); + void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); + + void uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + + void uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform4iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + + void uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + void uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, + optional GLuint srcLength = 0); + + void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + + void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + + void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, + optional GLuint srcOffset = 0, optional GLuint srcLength = 0); + + /* Vertex attribs */ + void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w); + void vertexAttribI4iv(GLuint index, Int32List values); + void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); + void vertexAttribI4uiv(GLuint index, Uint32List values); + void vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); + + /* Writing to the drawing buffer */ + void vertexAttribDivisor(GLuint index, GLuint divisor); + void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); + void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount); + void 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. + void 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. + void 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. + void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, + [AllowShared] ArrayBufferView dstData, GLuint dstOffset); + + /* Multiple Render Targets */ + void drawBuffers(sequence<GLenum> buffers); + + void clearBufferfv(GLenum buffer, GLint drawbuffer, Float32List values, + optional GLuint srcOffset = 0); + void clearBufferiv(GLenum buffer, GLint drawbuffer, Int32List values, + optional GLuint srcOffset = 0); + void clearBufferuiv(GLenum buffer, GLint drawbuffer, Uint32List values, + optional GLuint srcOffset = 0); + + void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); + + /* Query Objects */ + WebGLQuery? createQuery(); + void deleteQuery(WebGLQuery? query); + [WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? query); + void beginQuery(GLenum target, WebGLQuery query); + void endQuery(GLenum target); + any getQuery(GLenum target, GLenum pname); + any getQueryParameter(WebGLQuery query, GLenum pname); + + /* Sampler Objects */ + WebGLSampler? createSampler(); + void deleteSampler(WebGLSampler? sampler); + [WebGLHandlesContextLoss] GLboolean isSampler(WebGLSampler? sampler); + void bindSampler(GLuint unit, WebGLSampler? sampler); + void samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param); + void 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); + void deleteSync(WebGLSync? sync); + GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout); + void waitSync(WebGLSync sync, GLbitfield flags, GLint64 timeout); + any getSyncParameter(WebGLSync sync, GLenum pname); + + /* Transform Feedback */ + WebGLTransformFeedback? createTransformFeedback(); + void deleteTransformFeedback(WebGLTransformFeedback? tf); + [WebGLHandlesContextLoss] GLboolean isTransformFeedback(WebGLTransformFeedback? tf); + void bindTransformFeedback(GLenum target, WebGLTransformFeedback? tf); + void beginTransformFeedback(GLenum primitiveMode); + void endTransformFeedback(); + void transformFeedbackVaryings(WebGLProgram program, sequence<DOMString> varyings, GLenum bufferMode); + [NewObject] + WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram program, GLuint index); + void pauseTransformFeedback(); + void resumeTransformFeedback(); + + /* Uniform Buffer Objects and Transform Feedback Buffers */ + void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer); + void 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); + void uniformBlockBinding(WebGLProgram program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); + + /* Vertex Array Objects */ + WebGLVertexArrayObject? createVertexArray(); + void deleteVertexArray(WebGLVertexArrayObject? vertexArray); + [WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray); + void bindVertexArray(WebGLVertexArrayObject? array); +}; + +WebGL2RenderingContext includes WebGLRenderingContextBase; +WebGL2RenderingContext includes WebGL2RenderingContextBase; + +[NoInterfaceObject, + Exposed=Window] +interface EXT_color_buffer_float { +}; + +[NoInterfaceObject, + Exposed=Window] +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; + + void 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..7331f8db7a --- /dev/null +++ b/dom/webidl/WebGLRenderingContext.webidl @@ -0,0 +1,1195 @@ +/* -*- 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" }; + +[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"; +}; + +[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] +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 (HTMLCanvasElement or OffscreenCanvas)? 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); + + void activeTexture(GLenum texture); + void attachShader(WebGLProgram program, WebGLShader shader); + void bindAttribLocation(WebGLProgram program, GLuint index, DOMString name); + void bindBuffer(GLenum target, WebGLBuffer? buffer); + void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer); + void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer); + void bindTexture(GLenum target, WebGLTexture? texture); + void blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void blendEquation(GLenum mode); + void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + void blendFunc(GLenum sfactor, GLenum dfactor); + void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, + GLenum srcAlpha, GLenum dstAlpha); + + [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target); + void clear(GLbitfield mask); + void clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void clearDepth(GLclampf depth); + void clearStencil(GLint s); + void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void compileShader(WebGLShader shader); + + void copyTexImage2D(GLenum target, GLint level, GLenum internalformat, + GLint x, GLint y, GLsizei width, GLsizei height, + GLint border); + void 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(); + + void cullFace(GLenum mode); + + void deleteBuffer(WebGLBuffer? buffer); + void deleteFramebuffer(WebGLFramebuffer? framebuffer); + void deleteProgram(WebGLProgram? program); + void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer); + void deleteShader(WebGLShader? shader); + void deleteTexture(WebGLTexture? texture); + + void depthFunc(GLenum func); + void depthMask(GLboolean flag); + void depthRange(GLclampf zNear, GLclampf zFar); + void detachShader(WebGLProgram program, WebGLShader shader); + void disable(GLenum cap); + void disableVertexAttribArray(GLuint index); + void drawArrays(GLenum mode, GLint first, GLsizei count); + void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset); + + void enable(GLenum cap); + void enableVertexAttribArray(GLuint index); + void finish(); + void flush(); + void framebufferRenderbuffer(GLenum target, GLenum attachment, + GLenum renderbuffertarget, + WebGLRenderbuffer? renderbuffer); + void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, + WebGLTexture? texture, GLint level); + void frontFace(GLenum mode); + + void 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); + + void 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); + void lineWidth(GLfloat width); + void linkProgram(WebGLProgram program); + void pixelStorei(GLenum pname, GLint param); + void polygonOffset(GLfloat factor, GLfloat units); + + void renderbufferStorage(GLenum target, GLenum internalformat, + GLsizei width, GLsizei height); + void sampleCoverage(GLclampf value, GLboolean invert); + void scissor(GLint x, GLint y, GLsizei width, GLsizei height); + + void shaderSource(WebGLShader shader, DOMString source); + + void stencilFunc(GLenum func, GLint ref, GLuint mask); + void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + void stencilMask(GLuint mask); + void stencilMaskSeparate(GLenum face, GLuint mask); + void stencilOp(GLenum fail, GLenum zfail, GLenum zpass); + void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + + void texParameterf(GLenum target, GLenum pname, GLfloat param); + void texParameteri(GLenum target, GLenum pname, GLint param); + + void uniform1f(WebGLUniformLocation? location, GLfloat x); + void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); + void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z); + void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + + void uniform1i(WebGLUniformLocation? location, GLint x); + void uniform2i(WebGLUniformLocation? location, GLint x, GLint y); + void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z); + void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); + + void useProgram(WebGLProgram? program); + void validateProgram(WebGLProgram program); + + void vertexAttrib1f(GLuint indx, GLfloat x); + void vertexAttrib1fv(GLuint indx, Float32List values); + void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); + void vertexAttrib2fv(GLuint indx, Float32List values); + void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); + void vertexAttrib3fv(GLuint indx, Float32List values); + void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void vertexAttrib4fv(GLuint indx, Float32List values); + void vertexAttribPointer(GLuint indx, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, GLintptr offset); + + void viewport(GLint x, GLint y, GLsizei width, GLsizei height); +}; + +[Exposed=(Window,Worker), + Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"] +interface WebGLRenderingContext { + // bufferData has WebGL2 overloads. + void bufferData(GLenum target, GLsizeiptr size, GLenum usage); + void bufferData(GLenum target, [AllowShared] ArrayBuffer? data, GLenum usage); + void bufferData(GLenum target, [AllowShared] ArrayBufferView data, GLenum usage); + // bufferSubData has WebGL2 overloads. + void bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBuffer data); + void bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBufferView data); + + // compressedTexImage2D has WebGL2 overloads. + void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, + GLsizei width, GLsizei height, GLint border, + [AllowShared] ArrayBufferView data); + // compressedTexSubImage2D has WebGL2 overloads. + void compressedTexSubImage2D(GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, GLenum format, + [AllowShared] ArrayBufferView data); + + // readPixels has WebGL2 overloads. + [Throws, NeedsCallerType] + void 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. + void 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. + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, ImageBitmap pixels); + [Throws] // Can't actually throw. + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, ImageData pixels); + [Throws] + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException + [Throws] + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException + [Throws] + void texImage2D(GLenum target, GLint level, GLint internalformat, + GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException + + // texSubImage2D has WebGL2 overloads. + [Throws] // Can't actually throw. + void 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. + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageBitmap pixels); + [Throws] // Can't actually throw. + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, ImageData pixels); + [Throws] + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException + [Throws] + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException + [Throws] + void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, + GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException + + // uniform*fv have WebGL2 overloads, or rather extensions, that are not + // distinguishable from the WebGL1 versions when called with two arguments. + void uniform1fv(WebGLUniformLocation? location, Float32List data); + void uniform2fv(WebGLUniformLocation? location, Float32List data); + void uniform3fv(WebGLUniformLocation? location, Float32List data); + void 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. + void uniform1iv(WebGLUniformLocation? location, Int32List data); + void uniform2iv(WebGLUniformLocation? location, Int32List data); + void uniform3iv(WebGLUniformLocation? location, Int32List data); + void 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. + void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data); + void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data); + void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data); +}; + +WebGLRenderingContext includes WebGLRenderingContextBase; + +// For OffscreenCanvas +// Reference: https://wiki.whatwg.org/wiki/OffscreenCanvas +[Exposed=(Window,Worker)] +partial interface WebGLRenderingContext { + [Pref="gfx.offscreencanvas.enabled"] + void commit(); +}; + +//////////////////////////////////////// +// specific extension interfaces + +[NoInterfaceObject, + Exposed=Window] +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; +}; + +[NoInterfaceObject, + Exposed=Window] +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/ +[NoInterfaceObject, + Exposed=Window] +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; +}; + +[NoInterfaceObject, + Exposed=Window] +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; +}; + +[NoInterfaceObject, + Exposed=Window] +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; +}; + +[NoInterfaceObject, + Exposed=Window] +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(); +}; + +[NoInterfaceObject, + Exposed=Window] +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; +}; + +[NoInterfaceObject, + Exposed=Window] +interface WEBGL_compressed_texture_etc1 +{ + const GLenum COMPRESSED_RGB_ETC1_WEBGL = 0x8D64; +}; + +[NoInterfaceObject, + Exposed=Window] +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; +}; + +[NoInterfaceObject, + Exposed=Window] +interface WEBGL_debug_renderer_info +{ + const GLenum UNMASKED_VENDOR_WEBGL = 0x9245; + const GLenum UNMASKED_RENDERER_WEBGL = 0x9246; +}; + +[NoInterfaceObject, + Exposed=Window] +interface WEBGL_debug_shaders +{ + DOMString getTranslatedShaderSource(WebGLShader shader); +}; + +[NoInterfaceObject, + Exposed=Window] +interface WEBGL_depth_texture +{ + const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA; +}; + +[NoInterfaceObject, + Exposed=Window] +interface OES_element_index_uint +{ +}; + +[NoInterfaceObject, + Exposed=Window] +interface EXT_frag_depth +{ +}; + +[NoInterfaceObject, + Exposed=Window] +interface WEBGL_lose_context { + void loseContext(); + void restoreContext(); +}; + +[NoInterfaceObject, + Exposed=Window] +interface EXT_texture_filter_anisotropic +{ + const GLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; + const GLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; +}; + +[NoInterfaceObject, + Exposed=Window] +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; +}; + +[NoInterfaceObject, + Exposed=Window] +interface OES_standard_derivatives { + const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; +}; + +[NoInterfaceObject, + Exposed=Window] +interface OES_texture_float +{ +}; + +[NoInterfaceObject, + Exposed=Window] +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; + + void drawBuffersWEBGL(sequence<GLenum> buffers); +}; + +[NoInterfaceObject, + Exposed=Window] +interface OES_texture_float_linear +{ +}; + +[NoInterfaceObject, + Exposed=Window] +interface EXT_shader_texture_lod +{ +}; + +[NoInterfaceObject, + Exposed=Window] +interface OES_texture_half_float +{ + const GLenum HALF_FLOAT_OES = 0x8D61; +}; + +[NoInterfaceObject, + Exposed=Window] +interface OES_texture_half_float_linear +{ +}; + +[NoInterfaceObject, + Exposed=Window] +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; +}; + +[NoInterfaceObject, + Exposed=Window] +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; +}; + +[NoInterfaceObject, + Exposed=Window] +interface OES_vertex_array_object { + const GLenum VERTEX_ARRAY_BINDING_OES = 0x85B5; + + WebGLVertexArrayObject? createVertexArrayOES(); + void deleteVertexArrayOES(WebGLVertexArrayObject? arrayObject); + [WebGLHandlesContextLoss] GLboolean isVertexArrayOES(WebGLVertexArrayObject? arrayObject); + void bindVertexArrayOES(WebGLVertexArrayObject? arrayObject); +}; + +[NoInterfaceObject, + Exposed=Window] +interface ANGLE_instanced_arrays { + const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE; + + void drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount); + void drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount); + void vertexAttribDivisorANGLE(GLuint index, GLuint divisor); +}; + +[NoInterfaceObject, + Exposed=Window] +interface EXT_blend_minmax { + const GLenum MIN_EXT = 0x8007; + const GLenum MAX_EXT = 0x8008; +}; + +[Exposed=Window] +interface WebGLQuery { +}; + +[NoInterfaceObject, + Exposed=Window] +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(); + void deleteQueryEXT(WebGLQuery? query); + [WebGLHandlesContextLoss] boolean isQueryEXT(WebGLQuery? query); + void beginQueryEXT(GLenum target, WebGLQuery query); + void endQueryEXT(GLenum target); + void queryCounterEXT(WebGLQuery query, GLenum target); + any getQueryEXT(GLenum target, GLenum pname); + any getQueryObjectEXT(WebGLQuery query, GLenum pname); +}; + +[NoInterfaceObject, + Exposed=Window] +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); +}; + +[NoInterfaceObject, + Exposed=Window] +interface EXT_float_blend { +}; + +[NoInterfaceObject, + Exposed=Window] +interface OES_fbo_render_mipmap { +}; + +[NoInterfaceObject, + Exposed=Window] +interface WEBGL_explicit_present { + void present(); +}; + +// 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<void> makeXRCompatible(); +}; diff --git a/dom/webidl/WebGPU.webidl b/dom/webidl/WebGPU.webidl new file mode 100644 index 0000000000..8e702341b9 --- /dev/null +++ b/dom/webidl/WebGPU.webidl @@ -0,0 +1,1009 @@ +/* -*- 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/ + */ + + + +typedef [EnforceRange] unsigned long GPUBufferDynamicOffset; +typedef [EnforceRange] unsigned long long GPUFenceValue; +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; + +dictionary GPUColorDict { + required double r; + required double g; + required double b; + required double a; +}; + +dictionary GPUOrigin2DDict { + GPUIntegerCoordinate x = 0; + GPUIntegerCoordinate y = 0; +}; + +dictionary GPUOrigin3DDict { + GPUIntegerCoordinate x = 0; + GPUIntegerCoordinate y = 0; + GPUIntegerCoordinate z = 0; +}; + +dictionary GPUExtent3DDict { + required GPUIntegerCoordinate width; + required GPUIntegerCoordinate height; + required GPUIntegerCoordinate depth; +}; + +typedef (sequence<double> or GPUColorDict) GPUColor; +typedef (sequence<GPUIntegerCoordinate> or GPUOrigin2DDict) GPUOrigin2D; +typedef (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict) GPUOrigin3D; +typedef (sequence<GPUIntegerCoordinate> or GPUExtent3DDict) GPUExtent3D; + +interface mixin GPUObjectBase { + attribute DOMString? label; +}; + +dictionary GPUObjectDescriptorBase { + DOMString? label; +}; + +// **************************************************************************** +// INITIALIZATION +// **************************************************************************** + +[ + Pref="dom.webgpu.enabled", + Exposed=Window +] +interface GPU { + // May reject with DOMException + [NewObject] + Promise<GPUAdapter> requestAdapter(optional GPURequestAdapterOptions options = {}); +}; + +// Add a "webgpu" member to Navigator/Worker that contains the global instance of a "WebGPU" +interface mixin GPUProvider { + [SameObject, Replaceable, Pref="dom.webgpu.enabled", Exposed=Window] readonly attribute GPU gpu; +}; + +enum GPUPowerPreference { + "low-power", + "high-performance" +}; + +dictionary GPURequestAdapterOptions { + GPUPowerPreference powerPreference; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUAdapter { + readonly attribute DOMString name; + //GPUExtensions getExtensions(); + //readonly attribute GPULimits limits; Don't expose higher limits for now. + + // May reject with DOMException + [NewObject] + Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {}); +}; +GPUAdapter includes GPUObjectBase; + +dictionary GPUExtensions { +}; + +dictionary GPULimits { + GPUSize32 maxBindGroups = 4; + GPUSize32 maxDynamicUniformBuffersPerPipelineLayout = 8; + GPUSize32 maxDynamicStorageBuffersPerPipelineLayout = 4; + GPUSize32 maxSampledTexturesPerShaderStage = 16; + GPUSize32 maxSamplersPerShaderStage = 16; + GPUSize32 maxStorageBuffersPerShaderStage = 4; + GPUSize32 maxStorageTexturesPerShaderStage = 4; + GPUSize32 maxUniformBuffersPerShaderStage = 12; + GPUSize32 maxUniformBufferBindingSize = 16384; +}; + +// Device +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUDevice { + //GPUExtensions getExtensions(); + //GPULimits getLimits(); + //readonly attribute GPUAdapter adapter; + + [SameObject] readonly attribute GPUQueue defaultQueue; + + [NewObject, Throws] + GPUBuffer createBuffer(GPUBufferDescriptor descriptor); + [NewObject] + GPUTexture createTexture(GPUTextureDescriptor descriptor); + [NewObject] + GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {}); + + GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor); + GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor); + GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor); + + GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor); + GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor); + GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor); + + [NewObject] + GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {}); + //GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor); +}; +GPUDevice includes GPUObjectBase; + +dictionary GPUDeviceDescriptor { + GPUExtensions extensions; + GPULimits limits; + + // TODO are other things configurable like queues? +}; + + +// **************************************************************************** +// ERROR HANDLING +// **************************************************************************** + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUDeviceLostInfo { + readonly attribute DOMString message; +}; + +enum GPUErrorFilter { + "none", + "out-of-memory", + "validation" +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUOutOfMemoryError { + //constructor(); +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUValidationError { + constructor(DOMString message); + readonly attribute DOMString message; +}; + +typedef (GPUOutOfMemoryError or GPUValidationError) GPUError; + +partial interface GPUDevice { + //readonly attribute Promise<GPUDeviceLostInfo> lost; + //void pushErrorScope(GPUErrorFilter filter); + //Promise<GPUError?> popErrorScope(); + [Exposed=Window] + attribute EventHandler onuncapturederror; +}; + +// **************************************************************************** +// SHADER RESOURCES (buffer, textures, texture views, samples) +// **************************************************************************** + +// Buffer +typedef unsigned long GPUBufferUsageFlags; +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUBufferUsage { + const GPUBufferUsageFlags MAP_READ = 0x0001; + const GPUBufferUsageFlags MAP_WRITE = 0x0002; + const GPUBufferUsageFlags COPY_SRC = 0x0004; + const GPUBufferUsageFlags COPY_DST = 0x0008; + const GPUBufferUsageFlags INDEX = 0x0010; + const GPUBufferUsageFlags VERTEX = 0x0020; + const GPUBufferUsageFlags UNIFORM = 0x0040; + const GPUBufferUsageFlags STORAGE = 0x0080; + const GPUBufferUsageFlags INDIRECT = 0x0100; + const GPUBufferUsageFlags QUERY_RESOLVE = 0x0200; +}; + +dictionary GPUBufferDescriptor : GPUObjectDescriptorBase { + required GPUSize64 size; + required GPUBufferUsageFlags usage; + boolean mappedAtCreation = false; +}; + +typedef unsigned long GPUMapModeFlags; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUMapMode + { + const GPUMapModeFlags READ = 0x0001; + const GPUMapModeFlags WRITE = 0x0002; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUBuffer { + [NewObject] + Promise<void> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); + [NewObject, Throws] + ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size); + [Throws] + void unmap(); + + void destroy(); +}; +GPUBuffer includes GPUObjectBase; + +typedef sequence<any> GPUMappedBuffer; + +// Texture +enum GPUTextureDimension { + "1d", + "2d", + "3d", +}; + +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 + "rgb10a2unorm", + "rg11b10float", + + // 64-bit formats + "rg32uint", + "rg32sint", + "rg32float", + "rgba16uint", + "rgba16sint", + "rgba16float", + + // 128-bit formats + "rgba32uint", + "rgba32sint", + "rgba32float", + + // Depth and stencil formats + "depth32float", + "depth24plus", + "depth24plus-stencil8" +}; + +typedef unsigned long GPUTextureUsageFlags; +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUTextureUsage { + const GPUTextureUsageFlags COPY_SRC = 0x01; + const GPUTextureUsageFlags COPY_DST = 0x02; + const GPUTextureUsageFlags SAMPLED = 0x04; + const GPUTextureUsageFlags STORAGE = 0x08; + const GPUTextureUsageFlags OUTPUT_ATTACHMENT = 0x10; +}; + +dictionary GPUTextureDescriptor : GPUObjectDescriptorBase { + required GPUExtent3D size; + GPUIntegerCoordinate mipLevelCount = 1; + GPUSize32 sampleCount = 1; + GPUTextureDimension dimension = "2d"; + required GPUTextureFormat format; + required GPUTextureUsageFlags usage; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUTexture { + [NewObject] + GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); + + void destroy(); +}; +GPUTexture includes GPUObjectBase; + +// Texture view +enum GPUTextureViewDimension { + "1d", + "2d", + "2d-array", + "cube", + "cube-array", + "3d" +}; + +enum GPUTextureAspect { + "all", + "stencil-only", + "depth-only" +}; + +dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase { + GPUTextureFormat format; + GPUTextureViewDimension dimension; + GPUTextureAspect aspect = "all"; + GPUIntegerCoordinate baseMipLevel = 0; + GPUIntegerCoordinate mipLevelCount; + GPUIntegerCoordinate baseArrayLayer = 0; + GPUIntegerCoordinate arrayLayerCount; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUTextureView { +}; +GPUTextureView includes GPUObjectBase; + +// Sampler +enum GPUAddressMode { + "clamp-to-edge", + "repeat", + "mirror-repeat" +}; + +enum GPUFilterMode { + "nearest", + "linear", +}; + +enum GPUCompareFunction { + "never", + "less", + "equal", + "less-equal", + "greater", + "not-equal", + "greater-equal", + "always" +}; + +dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase { + GPUAddressMode addressModeU = "clamp-to-edge"; + GPUAddressMode addressModeV = "clamp-to-edge"; + GPUAddressMode addressModeW = "clamp-to-edge"; + GPUFilterMode magFilter = "nearest"; + GPUFilterMode minFilter = "nearest"; + GPUFilterMode mipmapFilter = "nearest"; + float lodMinClamp = 0; + float lodMaxClamp = 1000.0; //TODO? + GPUCompareFunction compare; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUSampler { +}; +GPUSampler includes GPUObjectBase; + +enum GPUTextureComponentType { + "float", + "sint", + "uint", + "depth-comparison" +}; + +// **************************************************************************** +// BINDING MODEL (bindgroup layout, bindgroup) +// **************************************************************************** + +// PipelineLayout +dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase { + required sequence<GPUBindGroupLayout> bindGroupLayouts; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUPipelineLayout { +}; +GPUPipelineLayout includes GPUObjectBase; + +// BindGroupLayout +typedef unsigned long GPUShaderStageFlags; +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUShaderStage { + const GPUShaderStageFlags VERTEX = 1; + const GPUShaderStageFlags FRAGMENT = 2; + const GPUShaderStageFlags COMPUTE = 4; +}; + +enum GPUBindingType { + "uniform-buffer", + "storage-buffer", + "readonly-storage-buffer", + "sampler", + "comparison-sampler", + "sampled-texture", + "readonly-storage-texture", + "writeonly-storage-texture", +}; + +dictionary GPUBindGroupLayoutEntry { + required GPUIndex32 binding; + required GPUShaderStageFlags visibility; + required GPUBindingType type; + GPUTextureViewDimension viewDimension; + GPUTextureComponentType textureComponentType; + boolean multisampled = false; + boolean hasDynamicOffset = false; + GPUTextureFormat storageTextureFormat; +}; + +dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase { + required sequence<GPUBindGroupLayoutEntry> entries; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUBindGroupLayout { +}; +GPUBindGroupLayout includes GPUObjectBase; + +// BindGroup +dictionary GPUBufferBinding { + required GPUBuffer buffer; + GPUSize64 offset = 0; + GPUSize64 size; +}; + +typedef (GPUSampler or GPUTextureView or GPUBufferBinding) GPUBindingResource; + +dictionary GPUBindGroupEntry { + required GPUIndex32 binding; + required GPUBindingResource resource; +}; + +dictionary GPUBindGroupDescriptor : GPUObjectDescriptorBase { + required GPUBindGroupLayout layout; + required sequence<GPUBindGroupEntry> entries; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUBindGroup { +}; +GPUBindGroup includes GPUObjectBase; + +// **************************************************************************** +// PIPELINE CREATION (blend state, DS state, ..., pipelines) +// **************************************************************************** + +// BlendState +enum GPUBlendFactor { + "zero", + "one", + "src-color", + "one-minus-src-color", + "src-alpha", + "one-minus-src-alpha", + "dst-color", + "one-minus-dst-color", + "dst-alpha", + "one-minus-dst-alpha", + "src-alpha-saturated", + "blend-color", + "one-minus-blend-color", +}; + +enum GPUBlendOperation { + "add", + "subtract", + "reverse-subtract", + "min", + "max" +}; + +dictionary GPUBlendDescriptor { + GPUBlendFactor srcFactor = "one"; + GPUBlendFactor dstFactor = "zero"; + GPUBlendOperation operation = "add"; +}; + +typedef unsigned long GPUColorWriteFlags; +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUColorWrite { + const GPUColorWriteFlags RED = 0x1; + const GPUColorWriteFlags GREEN = 0x2; + const GPUColorWriteFlags BLUE = 0x4; + const GPUColorWriteFlags ALPHA = 0x8; + const GPUColorWriteFlags ALL = 0xF; +}; + +dictionary GPUColorStateDescriptor { + required GPUTextureFormat format; + + GPUBlendDescriptor alphaBlend = {}; + GPUBlendDescriptor colorBlend = {}; + GPUColorWriteFlags writeMask = 0xF; +}; + +// DepthStencilState +enum GPUStencilOperation { + "keep", + "zero", + "replace", + "invert", + "increment-clamp", + "decrement-clamp", + "increment-wrap", + "decrement-wrap" +}; + +dictionary GPUStencilStateFaceDescriptor { + GPUCompareFunction compare = "always"; + GPUStencilOperation failOp = "keep"; + GPUStencilOperation depthFailOp = "keep"; + GPUStencilOperation passOp = "keep"; +}; + +dictionary GPUDepthStencilStateDescriptor { + required GPUTextureFormat format; + + boolean depthWriteEnabled = false; + GPUCompareFunction depthCompare = "always"; + + GPUStencilStateFaceDescriptor stencilFront = {}; + GPUStencilStateFaceDescriptor stencilBack = {}; + + GPUStencilValue stencilReadMask = 0xFFFFFFFF; + GPUStencilValue stencilWriteMask = 0xFFFFFFFF; +}; + +// InputState +enum GPUIndexFormat { + "uint16", + "uint32", +}; + +enum GPUVertexFormat { + "uchar2", + "uchar4", + "char2", + "char4", + "uchar2norm", + "uchar4norm", + "char2norm", + "char4norm", + "ushort2", + "ushort4", + "short2", + "short4", + "ushort2norm", + "ushort4norm", + "short2norm", + "short4norm", + "half2", + "half4", + "float", + "float2", + "float3", + "float4", + "uint", + "uint2", + "uint3", + "uint4", + "int", + "int2", + "int3", + "int4", +}; + +enum GPUInputStepMode { + "vertex", + "instance", +}; + +dictionary GPUVertexAttributeDescriptor { + required GPUVertexFormat format; + required GPUSize64 offset; + required GPUIndex32 shaderLocation; +}; + +dictionary GPUVertexBufferLayoutDescriptor { + required GPUSize64 arrayStride; + GPUInputStepMode stepMode = "vertex"; + required sequence<GPUVertexAttributeDescriptor> attributes; +}; + +dictionary GPUVertexStateDescriptor { + GPUIndexFormat indexFormat = "uint32"; + sequence<GPUVertexBufferLayoutDescriptor?> vertexBuffers = []; +}; + +// ShaderModule +typedef (Uint32Array or DOMString) GPUShaderCode; + +dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { + required GPUShaderCode code; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUShaderModule { +}; +GPUShaderModule includes GPUObjectBase; + +// Common stuff for ComputePipeline and RenderPipeline +dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase { + GPUPipelineLayout layout; +}; + +interface mixin GPUPipelineBase { + GPUBindGroupLayout getBindGroupLayout(unsigned long index); +}; + +dictionary GPUProgrammableStageDescriptor { + required GPUShaderModule module; + required DOMString entryPoint; +}; + +// ComputePipeline +dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase { + required GPUProgrammableStageDescriptor computeStage; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUComputePipeline { +}; +GPUComputePipeline includes GPUObjectBase; +GPUComputePipeline includes GPUPipelineBase; + +// GPURenderPipeline +enum GPUPrimitiveTopology { + "point-list", + "line-list", + "line-strip", + "triangle-list", + "triangle-strip" +}; + +dictionary GPURasterizationStateDescriptor { + GPUFrontFace frontFace = "ccw"; + GPUCullMode cullMode = "none"; + + GPUDepthBias depthBias = 0; + float depthBiasSlopeScale = 0; + float depthBiasClamp = 0; +}; + +enum GPUFrontFace { + "ccw", + "cw" +}; + +enum GPUCullMode { + "none", + "front", + "back" +}; + +dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase { + required GPUProgrammableStageDescriptor vertexStage; + GPUProgrammableStageDescriptor fragmentStage; + + required GPUPrimitiveTopology primitiveTopology; + GPURasterizationStateDescriptor rasterizationState = {}; + required sequence<GPUColorStateDescriptor> colorStates; + GPUDepthStencilStateDescriptor depthStencilState; + GPUVertexStateDescriptor vertexState = {}; + + GPUSize32 sampleCount = 1; + GPUSampleMask sampleMask = 0xFFFFFFFF; + boolean alphaToCoverageEnabled = false; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPURenderPipeline { +}; +GPURenderPipeline includes GPUObjectBase; +GPURenderPipeline includes GPUPipelineBase; + +// **************************************************************************** +// COMMAND RECORDING (Command buffer and all relevant structures) +// **************************************************************************** + +enum GPULoadOp { + "load" +}; + +enum GPUStoreOp { + "store", + "clear" +}; + +dictionary GPURenderPassColorAttachmentDescriptor { + required GPUTextureView attachment; + GPUTextureView resolveTarget; + + required (GPULoadOp or GPUColor) loadValue; + GPUStoreOp storeOp = "store"; +}; + +dictionary GPURenderPassDepthStencilAttachmentDescriptor { + required GPUTextureView attachment; + + required (GPULoadOp or float) depthLoadValue; + required GPUStoreOp depthStoreOp; + + required (GPULoadOp or GPUStencilValue) stencilLoadValue; + required GPUStoreOp stencilStoreOp; +}; + +dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase { + required sequence<GPURenderPassColorAttachmentDescriptor> colorAttachments; + GPURenderPassDepthStencilAttachmentDescriptor depthStencilAttachment; +}; + +dictionary GPUTextureDataLayout { + GPUSize64 offset = 0; + required GPUSize32 bytesPerRow; + GPUSize32 rowsPerImage = 0; +}; + +dictionary GPUBufferCopyView : GPUTextureDataLayout { + required GPUBuffer buffer; +}; + +dictionary GPUTextureCopyView { + required GPUTexture texture; + GPUIntegerCoordinate mipLevel = 0; + GPUOrigin3D origin; +}; + +dictionary GPUImageBitmapCopyView { + //required ImageBitmap imageBitmap; //TODO + GPUOrigin2D origin; +}; + +dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUCommandEncoder { + [NewObject] + GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {}); + [NewObject] + GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); + + void copyBufferToBuffer( + GPUBuffer source, + GPUSize64 sourceOffset, + GPUBuffer destination, + GPUSize64 destinationOffset, + GPUSize64 size); + + void copyBufferToTexture( + GPUBufferCopyView source, + GPUTextureCopyView destination, + GPUExtent3D copySize); + + void copyTextureToBuffer( + GPUTextureCopyView source, + GPUBufferCopyView destination, + GPUExtent3D copySize); + + void copyTextureToTexture( + GPUTextureCopyView source, + GPUTextureCopyView destination, + GPUExtent3D copySize); + + /* + void copyImageBitmapToTexture( + GPUImageBitmapCopyView source, + GPUTextureCopyView destination, + GPUExtent3D copySize); + */ + + //void pushDebugGroup(DOMString groupLabel); + //void popDebugGroup(); + //void insertDebugMarker(DOMString markerLabel); + + [NewObject] + GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {}); +}; +GPUCommandEncoder includes GPUObjectBase; + +interface mixin GPUProgrammablePassEncoder { + void setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, + optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []); + + //void pushDebugGroup(DOMString groupLabel); + //void popDebugGroup(); + //void insertDebugMarker(DOMString markerLabel); +}; + +// Render Pass +interface mixin GPURenderEncoderBase { + void setPipeline(GPURenderPipeline pipeline); + + void setIndexBuffer(GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size = 0); + void setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size = 0); + + void draw(GPUSize32 vertexCount, + optional GPUSize32 instanceCount = 1, + optional GPUSize32 firstVertex = 0, + optional GPUSize32 firstInstance = 0); + void drawIndexed(GPUSize32 indexCount, + optional GPUSize32 instanceCount = 1, + optional GPUSize32 firstIndex = 0, + optional GPUSignedOffset32 baseVertex = 0, + optional GPUSize32 firstInstance = 0); + + void drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); + void drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPURenderPassEncoder { + //void setViewport(float x, float y, + // float width, float height, + // float minDepth, float maxDepth); + + //void setScissorRect(u32 x, u32 y, u32 width, u32 height); + + //void setBlendColor(GPUColor color); + //void setStencilReference(u32 reference); + + //void executeBundles(sequence<GPURenderBundle> bundles); + [Throws] + void endPass(); +}; +GPURenderPassEncoder includes GPUObjectBase; +GPURenderPassEncoder includes GPUProgrammablePassEncoder; +GPURenderPassEncoder includes GPURenderEncoderBase; + +// Compute Pass +dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase { +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUComputePassEncoder { + void setPipeline(GPUComputePipeline pipeline); + void dispatch(GPUSize32 x, optional GPUSize32 y = 1, optional GPUSize32 z = 1); + void dispatchIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); + + [Throws] + void endPass(); +}; +GPUComputePassEncoder includes GPUObjectBase; +GPUComputePassEncoder includes GPUProgrammablePassEncoder; + +// Command Buffer +dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase { +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUCommandBuffer { +}; +GPUCommandBuffer includes GPUObjectBase; + +dictionary GPURenderBundleEncoderDescriptor : GPUObjectDescriptorBase { + required sequence<GPUTextureFormat> colorFormats; + GPUTextureFormat depthStencilFormat; + GPUSize32 sampleCount = 1; +}; + +// Render Bundle +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPURenderBundleEncoder { + //GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); +}; +GPURenderBundleEncoder includes GPUObjectBase; +//GPURenderBundleEncoder includes GPURenderEncoderBase; + +dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase { +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPURenderBundle { +}; +GPURenderBundle includes GPUObjectBase; + +// **************************************************************************** +// OTHER (Fence, Queue SwapChain, Device) +// **************************************************************************** + +// Fence +dictionary GPUFenceDescriptor : GPUObjectDescriptorBase { + GPUFenceValue initialValue = 0; +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUFence { + //GPUFenceValue getCompletedValue(); + //Promise<void> onCompletion(GPUFenceValue completionValue); +}; +GPUFence includes GPUObjectBase; + +// Queue +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUQueue { + void submit(sequence<GPUCommandBuffer> buffers); + + //GPUFence createFence(optional GPUFenceDescriptor descriptor = {}); + //void signal(GPUFence fence, GPUFenceValue signalValue); + + [Throws] + void writeBuffer( + GPUBuffer buffer, + GPUSize64 bufferOffset, + [AllowShared] ArrayBuffer data, + optional GPUSize64 dataOffset = 0, + optional GPUSize64 size); + + [Throws] + void writeTexture( + GPUTextureCopyView destination, + [AllowShared] ArrayBuffer data, + GPUTextureDataLayout dataLayout, + GPUExtent3D size); +}; +GPUQueue includes GPUObjectBase; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUSwapChain { + GPUTexture getCurrentTexture(); +}; +GPUSwapChain includes GPUObjectBase; + +dictionary GPUSwapChainDescriptor : GPUObjectDescriptorBase { + required GPUDevice device; + required GPUTextureFormat format; + GPUTextureUsageFlags usage = 0x10; //GPUTextureUsage.OUTPUT_ATTACHMENT +}; + +[Pref="dom.webgpu.enabled", + Exposed=Window] +interface GPUCanvasContext { + // Calling configureSwapChain a second time invalidates the previous one, + // and all of the textures it's produced. + [Throws] + GPUSwapChain configureSwapChain(GPUSwapChainDescriptor descriptor); + + //Promise<GPUTextureFormat> getSwapChainPreferredFormat(GPUDevice device); +}; diff --git a/dom/webidl/WebSocket.webidl b/dom/webidl/WebSocket.webidl new file mode 100644 index 0000000000..6953ff0f66 --- /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] + void close(optional [Clamp] unsigned short code, optional DOMString reason); + + // messaging + + attribute EventHandler onmessage; + + attribute BinaryType binaryType; + + [Throws] + void send(DOMString data); + + [Throws] + void send(Blob data); + + [Throws] + void send(ArrayBuffer data); + + [Throws] + void 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/WebXR.webidl b/dom/webidl/WebXR.webidl new file mode 100644 index 0000000000..89345128db --- /dev/null +++ b/dom/webidl/WebXR.webidl @@ -0,0 +1,237 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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 + [Throws] + 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; + + // Methods + [Throws] + void updateRenderState(optional XRRenderStateInit state = {}); + [NewObject] + Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type); + + [Throws] + long requestAnimationFrame(XRFrameRequestCallback callback); + [Throws] + void cancelAnimationFrame(long handle); + + [Throws] + Promise<void> 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 = void (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/WebrtcDeprecated.webidl b/dom/webidl/WebrtcDeprecated.webidl new file mode 100644 index 0000000000..4b0fe1b512 --- /dev/null +++ b/dom/webidl/WebrtcDeprecated.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/. + * + * This file includes all the deprecated mozRTC prefixed interfaces. + * + * The declaration of each should match the declaration of the real, unprefixed + * interface. These aliases will be removed at some point (Bug 1155923). + */ + +[Deprecated="WebrtcDeprecatedPrefix", + Pref="media.peerconnection.enabled", + JSImplementation="@mozilla.org/dom/rtcicecandidate;1", + Exposed=Window] +interface mozRTCIceCandidate : RTCIceCandidate { + [Throws] + constructor(optional RTCIceCandidateInit candidateInitDict = {}); +}; + +[Deprecated="WebrtcDeprecatedPrefix", + Pref="media.peerconnection.enabled", + JSImplementation="@mozilla.org/dom/peerconnection;1", + Exposed=Window] +interface mozRTCPeerConnection : RTCPeerConnection { + [Throws] + constructor(optional RTCConfiguration configuration = {}, + optional object? constraints); +}; + +[Deprecated="WebrtcDeprecatedPrefix", + Pref="media.peerconnection.enabled", + JSImplementation="@mozilla.org/dom/rtcsessiondescription;1", + Exposed=Window] +interface mozRTCSessionDescription : RTCSessionDescription { + [Throws] + constructor(optional RTCSessionDescriptionInit descriptionInitDict = {}); +}; diff --git a/dom/webidl/WebrtcGlobalInformation.webidl b/dom/webidl/WebrtcGlobalInformation.webidl new file mode 100644 index 0000000000..8c4149d1d5 --- /dev/null +++ b/dom/webidl/WebrtcGlobalInformation.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/. + */ + +dictionary WebrtcGlobalStatisticsReport { + sequence<RTCStatsReportInternal> reports = []; +}; + +callback WebrtcGlobalStatisticsCallback = void (WebrtcGlobalStatisticsReport reports); +callback WebrtcGlobalLoggingCallback = void (sequence<DOMString> logMessages); + +[ChromeOnly, Exposed=Window] +namespace WebrtcGlobalInformation { + + [Throws] + void getAllStats(WebrtcGlobalStatisticsCallback callback, + optional DOMString pcIdFilter); + + void clearAllStats(); + + [Throws] + void getLogging(DOMString pattern, WebrtcGlobalLoggingCallback callback); + + void clearLogging(); + + // NSPR WebRTC Trace debug level (0 - 65535) + // + // Notes: + // - Setting a non-zero debug level turns on gathering of log for file output. + // - Subsequently setting a zero debug level writes that log to disk. + + attribute long debugLevel; + + // 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..48586b7933 --- /dev/null +++ b/dom/webidl/WheelEvent.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/. + * + * 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; + + [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/WidevineCDMManifest.webidl b/dom/webidl/WidevineCDMManifest.webidl new file mode 100644 index 0000000000..198e66cb1e --- /dev/null +++ b/dom/webidl/WidevineCDMManifest.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/.
+ */
+
+[GenerateInitFromJSON] +dictionary WidevineCDMManifest {
+ required DOMString name;
+ required DOMString description;
+ required DOMString version;
+ required DOMString x-cdm-module-versions;
+ required DOMString x-cdm-interface-versions;
+ required DOMString x-cdm-host-versions;
+ required DOMString x-cdm-codecs;
+};
diff --git a/dom/webidl/Window.webidl b/dom/webidl/Window.webidl new file mode 100644 index 0000000000..2f9840cac8 --- /dev/null +++ b/dom/webidl/Window.webidl @@ -0,0 +1,802 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was 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 nsIBrowserDOMWindow; +interface XULControllers; +interface nsIDOMWindowUtils; +interface nsIPrintSettings; + +typedef OfflineResourceList ApplicationCache; + +// http://www.whatwg.org/specs/web-apps/current-work/ +[Global, LegacyUnenumerableNamedProperties, NeedResolve, + Exposed=Window, + InstrumentedProps=(AbsoluteOrientationSensor, + Accelerometer, + ApplicationCache, + ApplicationCacheErrorEvent, + Atomics, + AudioParamMap, + AudioWorklet, + AudioWorkletNode, + BackgroundFetchManager, + BackgroundFetchRecord, + BackgroundFetchRegistration, + BeforeInstallPromptEvent, + Bluetooth, + BluetoothCharacteristicProperties, + BluetoothDevice, + BluetoothRemoteGATTCharacteristic, + BluetoothRemoteGATTDescriptor, + BluetoothRemoteGATTServer, + BluetoothRemoteGATTService, + BluetoothUUID, + CanvasCaptureMediaStreamTrack, + chrome, + clientInformation, + ClipboardItem, + CSSImageValue, + CSSKeywordValue, + CSSMathInvert, + CSSMathMax, + CSSMathMin, + CSSMathNegate, + CSSMathProduct, + CSSMathSum, + CSSMathValue, + CSSMatrixComponent, + CSSNumericArray, + CSSNumericValue, + CSSPerspective, + CSSPositionValue, + 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, + EnterPictureInPictureEvent, + External, + FederatedCredential, + Gyroscope, + HTMLContentElement, + HTMLDialogElement, + HTMLShadowElement, + ImageCapture, + InputDeviceCapabilities, + InputDeviceInfo, + Keyboard, + KeyboardLayoutMap, + LinearAccelerationSensor, + Lock, + LockManager, + MediaMetadata, + MediaSession, + MediaSettingsRange, + MIDIAccess, + MIDIConnectionEvent, + MIDIInput, + MIDIInputMap, + MIDIMessageEvent, + MIDIOutput, + MIDIOutputMap, + MIDIPort, + NavigationPreloadManager, + NetworkInformation, + offscreenBuffering, + OffscreenCanvas, + OffscreenCanvasRenderingContext2D, + onbeforeinstallprompt, + oncancel, + ondeviceorientationabsolute, + onmousewheel, + onsearch, + onselectionchange, + openDatabase, + OrientationSensor, + OverconstrainedError, + PasswordCredential, + PaymentAddress, + PaymentInstruments, + PaymentManager, + PaymentMethodChangeEvent, + PaymentRequest, + PaymentRequestUpdateEvent, + PaymentResponse, + PerformanceEventTiming, + PerformanceLongTaskTiming, + PerformancePaintTiming, + PhotoCapabilities, + PictureInPictureWindow, + Presentation, + PresentationAvailability, + PresentationConnection, + PresentationConnectionAvailableEvent, + PresentationConnectionCloseEvent, + PresentationConnectionList, + PresentationReceiver, + PresentationRequest, + RelativeOrientationSensor, + RemotePlayback, + ReportingObserver, + RTCDtlsTransport, + RTCError, + RTCErrorEvent, + RTCIceTransport, + RTCSctpTransport, + Sensor, + SensorErrorEvent, + SharedArrayBuffer, + styleMedia, + StylePropertyMap, + StylePropertyMapReadOnly, + SVGDiscardElement, + SyncManager, + TaskAttributionTiming, + TextDecoderStream, + TextEncoderStream, + TextEvent, + Touch, + TouchEvent, + TouchList, + TransformStream, + USB, + USBAlternateInterface, + USBConfiguration, + USBConnectionEvent, + USBDevice, + USBEndpoint, + USBInterface, + USBInTransferResult, + USBIsochronousInTransferPacket, + USBIsochronousInTransferResult, + USBIsochronousOutTransferPacket, + USBIsochronousOutTransferResult, + USBOutTransferResult, + UserActivation, + visualViewport, + webkitCancelAnimationFrame, + webkitMediaStream, + WebKitMutationObserver, + webkitRequestAnimationFrame, + webkitRequestFileSystem, + webkitResolveLocalFileSystemURL, + webkitRTCPeerConnection, + webkitSpeechGrammar, + webkitSpeechGrammarList, + webkitSpeechRecognition, + webkitSpeechRecognitionError, + webkitSpeechRecognitionEvent, + webkitStorageInfo, + Worklet, + WritableStream)] +/*sealed*/ interface Window : EventTarget { + // the current browsing context + [Unforgeable, Constant, StoreInSlot, + CrossOriginReadable] readonly attribute WindowProxy window; + [Replaceable, Constant, StoreInSlot, + CrossOriginReadable] readonly attribute WindowProxy self; + [Unforgeable, StoreInSlot, Pure] readonly attribute Document? document; + [Throws] attribute DOMString name; + [PutForwards=href, Unforgeable, 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] void close(); + [Throws, CrossOriginReadable] readonly attribute boolean closed; + [Throws] void stop(); + [Throws, CrossOriginCallable, NeedsCallerType] void focus(); + [Throws, CrossOriginCallable] void blur(); + [Replaceable, Pref="dom.window.event.enabled"] readonly attribute any 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; + [Unforgeable, 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 [TreatNullAs=EmptyString] DOMString features = ""); + getter object (DOMString name); + + // the user agent + readonly attribute Navigator navigator; +#ifdef HAVE_SIDEBAR + [Replaceable, Throws] readonly attribute External external; +#endif + [Throws, SecureContext, Pref="browser.cache.offline.enable"] readonly attribute ApplicationCache applicationCache; + + // user prompts + [Throws, NeedsSubjectPrincipal] void alert(); + [Throws, NeedsSubjectPrincipal] void alert(DOMString message); + [Throws, NeedsSubjectPrincipal] boolean confirm(optional DOMString message = ""); + [Throws, NeedsSubjectPrincipal] DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); + [Throws, Pref="dom.enable_window_print"] + void 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"] + void postMessage(any message, DOMString targetOrigin, optional sequence<object> transfer = []); + [Throws, CrossOriginCallable, NeedsSubjectPrincipal, + BinaryName="postMessageMoz"] + void 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 { + void captureEvents(); + void releaseEvents(); +}; + +// https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html +partial interface Window { + //[Throws] Selection getSelection(); + [Throws] Selection? getSelection(); +}; + +// http://dev.w3.org/csswg/cssom/ +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); + // Per spec, screen is SameObject, but we don't actually guarantee that given + // nsGlobalWindow::Cleanup. :( + //[SameObject, Replaceable, Throws] readonly attribute Screen screen; + [Replaceable, Throws] readonly attribute Screen screen; + + // browsing context + //[Throws] void moveTo(double x, double y); + //[Throws] void moveBy(double x, double y); + //[Throws] void resizeTo(double x, double y); + //[Throws] void resizeBy(double x, double y); + [Throws, NeedsCallerType] void moveTo(long x, long y); + [Throws, NeedsCallerType] void moveBy(long x, long y); + [Throws, NeedsCallerType] void resizeTo(long x, long y); + [Throws, NeedsCallerType] void resizeBy(long x, long y); + + // viewport + // These are writable because we allow chrome to write them. And they need + // to use 'any' as the type, because non-chrome writing them needs to act + // like a [Replaceable] attribute would, which needs the original JS value. + //[Replaceable, Throws] readonly attribute double innerWidth; + //[Replaceable, Throws] readonly attribute double innerHeight; + [Throws, NeedsCallerType] attribute any innerWidth; + [Throws, NeedsCallerType] attribute any innerHeight; + + // viewport scrolling + void scroll(unrestricted double x, unrestricted double y); + void scroll(optional ScrollToOptions options = {}); + void scrollTo(unrestricted double x, unrestricted double y); + void scrollTo(optional ScrollToOptions options = {}); + void scrollBy(unrestricted double x, unrestricted double y); + void scrollBy(optional ScrollToOptions options = {}); + // mozScrollSnap is used by chrome to perform scroll snapping after the + // user performs actions that may affect scroll position + // mozScrollSnap is deprecated, to be replaced by a web accessible API, such + // as an extension to the ScrollOptions dictionary. See bug 1137937. + [ChromeOnly] void mozScrollSnap(); + // 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 + // These are writable because we allow chrome to write them. And they need + // to use 'any' as the type, because non-chrome writing them needs to act + // like a [Replaceable] attribute would, which needs the original JS value. + //[Replaceable, Throws] readonly attribute double screenX; + //[Replaceable, Throws] readonly attribute double screenY; + //[Replaceable, Throws] readonly attribute double outerWidth; + //[Replaceable, Throws] readonly attribute double outerHeight; + [Throws, NeedsCallerType] attribute any screenX; + [Throws, NeedsCallerType] attribute any screenY; + [Throws, NeedsCallerType] attribute any outerWidth; + [Throws, NeedsCallerType] attribute any outerHeight; +}; + +// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html +partial interface Window { + [Throws] long requestAnimationFrame(FrameRequestCallback callback); + [Throws] void cancelAnimationFrame(long handle); +}; +callback FrameRequestCallback = void (DOMHighResTimeStamp time); + +// 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; + +// https://fidoalliance.org/specifications/download/ +Window includes GlobalU2F; + +#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. + */ + void scrollByLines(long numLines, optional ScrollOptions options = {}); + + /** + * Method for scrolling this window by a number of pages. + */ + void scrollByPages(long numPages, optional ScrollOptions options = {}); + + /** + * Method for sizing this window to the content in the window. + */ + [Throws, NeedsCallerType] void sizeToContent(); + + // XXX Shouldn't this be in nsIDOMChromeWindow? + [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; + + /* 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; + + // XXX Should this be in nsIDOMChromeWindow? + void updateCommands(DOMString action, + optional Selection? sel = null, + optional short reason = 0); + + /* 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); + + /** + * Returns the number of times this document for this window has + * been painted to the screen. + * + * If you need this for tests use nsIDOMWindowUtils.paintCount instead. + */ + [Throws, Pref="dom.mozPaintCount.enabled"] readonly attribute unsigned long long mozPaintCount; + + attribute EventHandler ondevicemotion; + attribute EventHandler ondeviceorientation; + attribute EventHandler onabsolutedeviceorientation; + attribute EventHandler ondeviceproximity; + attribute EventHandler onuserproximity; + attribute EventHandler ondevicelight; + + void dump(DOMString str); + + /** + * This method is here for backwards compatibility with 4.x only, + * its implementation is a no-op + */ + void 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); + + [Func="nsGlobalWindowInner::ContentPropertyEnabled", + 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] + readonly attribute InstallTriggerImpl? InstallTrigger; + + /** + * Get the nsIDOMWindowUtils for this window. + */ + [Constant, Throws, ChromeOnly] + readonly attribute nsIDOMWindowUtils windowUtils; + + [Pure, ChromeOnly] + readonly attribute WindowGlobalChild? windowGlobalChild; +}; + +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 + +#ifdef HAVE_SIDEBAR +// Mozilla extension +// Sidebar is deprecated and it will be removed in the next cycles. See bug 1640138. +partial interface Window { + [Replaceable, Throws, UseCounter] + readonly attribute (External or WindowProxy) sidebar; +}; +#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"] + void getAttention(); + + [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + void getAttentionWithCycleCount(long aCycleCount); + + [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + void setCursor(UTF8String cursor); + + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + void maximize(); + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + void minimize(); + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + void restore(); + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + DOMString getWorkspaceID(); + [Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + void moveToWorkspace(DOMString workspaceID); + + /** + * Notify a default button is loaded on a dialog or a wizard. + * defaultButton is the default button. + */ + [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + void 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} + */ + [Throws, Func="nsGlobalWindowInner::IsPrivilegedChromeWindow"] + Promise<any> promiseDocumentFlushed(PromiseDocumentFlushedCallback callback); + + [ChromeOnly] + readonly attribute boolean isChromeWindow; + +#ifdef MOZ_GLEAN + [ChromeOnly] + readonly attribute GleanImpl Glean; + [ChromeOnly] + readonly attribute GleanPingsImpl GleanPings; +#endif +}; + +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; +}; + +// https://drafts.css-houdini.org/css-paint-api-1/#dom-window-paintworklet +partial interface Window { + [Pref="dom.paintWorklet.enabled", Throws] + readonly attribute Worklet paintWorklet; +}; + +Window includes WindowOrWorkerGlobalScope; + +partial interface Window { + [Throws, Func="nsGlobalWindowInner::IsRequestIdleCallbackEnabled"] + unsigned long requestIdleCallback(IdleRequestCallback callback, + optional IdleRequestOptions options = {}); + [Func="nsGlobalWindowInner::IsRequestIdleCallbackEnabled"] + void cancelIdleCallback(unsigned long handle); +}; + +dictionary IdleRequestOptions { + unsigned long timeout; +}; + +callback IdleRequestCallback = void (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, Pref="dom.visualviewport.enabled", Replaceable] + readonly attribute VisualViewport visualViewport; + +}; + +dictionary WindowPostMessageOptions : PostMessageOptions { + USVString targetOrigin = "/"; +}; diff --git a/dom/webidl/WindowOrWorkerGlobalScope.webidl b/dom/webidl/WindowOrWorkerGlobalScope.webidl new file mode 100644 index 0000000000..8cff7b714f --- /dev/null +++ b/dom/webidl/WindowOrWorkerGlobalScope.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://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; + + // 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); + void 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); + void clearInterval(optional long handle = 0); + + // microtask queuing + void queueMicrotask(VoidFunction callback); + + // ImageBitmap + [Throws] + Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage); + [Throws] + Promise<ImageBitmap> createImageBitmap(ImageBitmapSource aImage, long aSx, long aSy, long aSw, long aSh); +}; + +// 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; + [Throws] + readonly attribute IDBFactory? indexedDB; +}; + +// https://w3c.github.io/ServiceWorker/#self-caches +partial interface mixin WindowOrWorkerGlobalScope { + [Throws, Pref="dom.caches.enabled", SameObject] + readonly attribute CacheStorage caches; +}; diff --git a/dom/webidl/WindowRoot.webidl b/dom/webidl/WindowRoot.webidl new file mode 100644 index 0000000000..71f0bff1dc --- /dev/null +++ b/dom/webidl/WindowRoot.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/. + */ + +[ChromeOnly, + Exposed=Window] +interface WindowRoot : EventTarget { +}; diff --git a/dom/webidl/Worker.webidl b/dom/webidl/Worker.webidl new file mode 100644 index 0000000000..eb318ac693 --- /dev/null +++ b/dom/webidl/Worker.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://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 = {}); + + void terminate(); + + [Throws] + void postMessage(any message, sequence<object> transfer); + [Throws] + void postMessage(any message, optional PostMessageOptions aOptions = {}); + + attribute EventHandler onmessage; + attribute EventHandler onmessageerror; +}; + +Worker includes AbstractWorker; + +dictionary WorkerOptions { + // WorkerType type = "classic"; TODO: Bug 1247687 + // RequestCredentials credentials = "omit"; // credentials is only used if type is "module" TODO: Bug 1247687 + DOMString name = ""; +}; + +[Func="mozilla::dom::ChromeWorker::WorkerAvailable", + Exposed=(Window,DedicatedWorker,SharedWorker)] +interface ChromeWorker : Worker { + [Throws] + constructor(USVString scriptURL); +}; diff --git a/dom/webidl/WorkerDebuggerGlobalScope.webidl b/dom/webidl/WorkerDebuggerGlobalScope.webidl new file mode 100644 index 0000000000..4bf7abc156 --- /dev/null +++ b/dom/webidl/WorkerDebuggerGlobalScope.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/. */ + +[Global=(WorkerDebugger), Exposed=WorkerDebugger] +interface WorkerDebuggerGlobalScope : EventTarget { + [Throws] + readonly attribute object global; + + [Throws] + object createSandbox(DOMString name, object prototype); + + [Throws] + void loadSubScript(DOMString url, optional object sandbox); + + void enterEventLoop(); + + void leaveEventLoop(); + + void postMessage(DOMString message); + + attribute EventHandler onmessage; + + attribute EventHandler onmessageerror; + + [Throws] + void setImmediate(Function handler); + + void reportError(DOMString message); + + [Throws] + sequence<any> retrieveConsoleEvents(); + + [Throws] + void setConsoleEventHandler(AnyCallback? handler); + + // base64 utility methods + [Throws] + DOMString btoa(DOMString btoa); + [Throws] + DOMString atob(DOMString atob); +}; + +// So you can debug while you debug +partial interface WorkerDebuggerGlobalScope { + void dump(optional DOMString string); +}; diff --git a/dom/webidl/WorkerGlobalScope.webidl b/dom/webidl/WorkerGlobalScope.webidl new file mode 100644 index 0000000000..0b77a43031 --- /dev/null +++ b/dom/webidl/WorkerGlobalScope.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://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] + void 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 WindowOrWorkerGlobalScope; + +// Not implemented yet: bug 1072107. +// WorkerGlobalScope implements FontFaceSource; + +// Mozilla extensions +partial interface WorkerGlobalScope { + + void 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..b2e9f2bb2a --- /dev/null +++ b/dom/webidl/WorkerNavigator.webidl @@ -0,0 +1,28 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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] +interface WorkerNavigator { +}; + +WorkerNavigator includes NavigatorID; +WorkerNavigator includes NavigatorLanguage; +WorkerNavigator includes NavigatorOnLine; +WorkerNavigator includes NavigatorConcurrentHardware; +WorkerNavigator includes NavigatorStorage; + +// 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; +}; diff --git a/dom/webidl/Worklet.webidl b/dom/webidl/Worklet.webidl new file mode 100644 index 0000000000..aff60267c2 --- /dev/null +++ b/dom/webidl/Worklet.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://drafts.css-houdini.org/worklets/#idl-index + */ + +[SecureContext, Pref="dom.worklet.enabled", + Exposed=Window] +interface Worklet { + [NewObject, Throws, NeedsCallerType] + Promise<void> 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..c4b684d206 --- /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 { + void dump(optional DOMString str); +}; 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..d6aab9c0e0 --- /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] + void open(ByteString method, USVString url); + [Throws] + void open(ByteString method, USVString url, boolean async, + optional USVString? user=null, optional USVString? password=null); + [Throws] + void setRequestHeader(ByteString header, ByteString value); + + [SetterThrows] + attribute unsigned long timeout; + + [SetterThrows] + attribute boolean withCredentials; + + [Throws] + readonly attribute XMLHttpRequestUpload upload; + + [Throws] + void send(optional (Document or XMLHttpRequestBodyInit)? body = null); + + [Throws] + void 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] + void 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] + void setOriginAttributes(optional OriginAttributesDictionary originAttributes = {}); + + [ChromeOnly, Throws] + void 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..0e7e7655c2 --- /dev/null +++ b/dom/webidl/XMLSerializer.webidl @@ -0,0 +1,40 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://domparsing.spec.whatwg.org/#the-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] + void 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..8334ef08eb --- /dev/null +++ b/dom/webidl/XSLTProcessor.webidl @@ -0,0 +1,111 @@ +/* -*- 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/. */ + +interface nsIVariant; + +[Exposed=Window] +interface XSLTProcessor { + 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] + void 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] + void setParameter([TreatNullAs=EmptyString] DOMString namespaceURI, + DOMString localName, + any 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 nsIVariant The value of the XSLT parameter + */ + [Throws] + nsIVariant? getParameter([TreatNullAs=EmptyString] 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] + void removeParameter([TreatNullAs=EmptyString] 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. + */ + void clearParameters(); + + /** + * Remove all parameters and stylesheets from this XSLTProcessor. + */ + void 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/XULCommandEvent.webidl b/dom/webidl/XULCommandEvent.webidl new file mode 100644 index 0000000000..9bfd8ffa57 --- /dev/null +++ b/dom/webidl/XULCommandEvent.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/. + */ + +/** + * This interface is supported by command events, which are dispatched to + * XUL elements as a result of mouse or keyboard activation. + */ +[ChromeOnly, + Exposed=Window] +interface XULCommandEvent : UIEvent +{ + /** + * Command events support the same set of modifier keys as mouse and key + * events. + */ + readonly attribute boolean ctrlKey; + readonly attribute boolean shiftKey; + readonly attribute boolean altKey; + readonly attribute boolean metaKey; + + /** + * The input source, if this event was triggered by a mouse event. + */ + readonly attribute unsigned short inputSource; + + /** + * If the command event was redispatched because of a command= attribute + * on the original target, sourceEvent will be set to the original DOM Event. + * Otherwise, sourceEvent is null. + */ + readonly attribute Event? sourceEvent; + + /** + * Creates a new command event with the given attributes. + */ + [Throws] + void initCommandEvent(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 Event? sourceEvent = null, + optional unsigned short inputSource = 0); +}; diff --git a/dom/webidl/XULElement.webidl b/dom/webidl/XULElement.webidl new file mode 100644 index 0000000000..1df2043334 --- /dev/null +++ b/dom/webidl/XULElement.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/. + */ + +interface XULControllers; + +[ChromeOnly, + Exposed=Window] +interface XULElement : Element { + [HTMLConstructor] constructor(); + + // Layout properties + [SetterThrows] + attribute DOMString flex; + + // Properties for hiding elements. + attribute boolean hidden; + attribute boolean collapsed; + + // Property for hooking up to broadcasters + [SetterThrows] + attribute DOMString observes; + + // Properties for hooking up to popups + [SetterThrows] + attribute DOMString menu; + [SetterThrows] + attribute DOMString contextMenu; + [SetterThrows] + attribute DOMString tooltip; + + // Width/height properties + [SetterThrows] + attribute DOMString width; + [SetterThrows] + attribute DOMString height; + [SetterThrows] + attribute DOMString minWidth; + [SetterThrows] + attribute DOMString minHeight; + [SetterThrows] + attribute DOMString maxWidth; + [SetterThrows] + attribute DOMString maxHeight; + + // Return the screen coordinates of the element. + readonly attribute long screenX; + readonly attribute long screenY; + + // Tooltip + [SetterThrows] + attribute DOMString tooltipText; + + // Properties for images + [SetterThrows] + attribute DOMString src; + + attribute boolean allowEvents; + + [Throws, ChromeOnly] + readonly attribute XULControllers controllers; + + [NeedsCallerType] + void click(); + void doCommand(); + + // Returns true if this is a menu-type element that has a menu + // frame associated with it. + boolean hasMenu(); + + // If this is a menu-type element, opens or closes the menu + // depending on the argument passed. + void openMenu(boolean open); +}; + +XULElement includes GlobalEventHandlers; +XULElement includes HTMLOrForeignElement; +XULElement includes ElementCSSInlineStyle; +XULElement includes TouchEventHandlers; +XULElement includes OnErrorEventHandlerForNodes; diff --git a/dom/webidl/XULPopupElement.webidl b/dom/webidl/XULPopupElement.webidl new file mode 100644 index 0000000000..8cd78b0e13 --- /dev/null +++ b/dom/webidl/XULPopupElement.webidl @@ -0,0 +1,184 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 OpenPopupOptions { + // manner in which to anchor the popup to node + DOMString position = ""; + // horizontal offset + long x = 0; + // vertical offset + long y = 0; + // isContextMenu true for context menus, false for other popups + boolean isContextMenu = false; + // true if popup node attributes override position + boolean attributesOverride = false; + // triggerEvent the event that triggered this popup (mouse click for example) + Event? triggerEvent = null; +}; + +typedef (DOMString or OpenPopupOptions) StringOrOpenPopupOptions; + +[ChromeOnly, + Exposed=Window] +interface XULPopupElement : XULElement +{ + [HTMLConstructor] constructor(); + + /** + * Allow the popup to automatically position itself. + */ + attribute boolean autoPosition; + + /** + * Open the popup relative to a specified node at a specific location. + * + * The popup may be either anchored to another node or opened freely. + * To anchor a popup to a node, supply an anchor node and set the position + * to a string indicating the manner in which the popup should be anchored. + * Possible values for position are: + * before_start, before_end, after_start, after_end, + * start_before, start_after, end_before, end_after, + * overlap, after_pointer + * + * The anchor node does not need to be in the same document as the popup. + * + * If the attributesOverride argument is true, the popupanchor, popupalign + * and position attributes on the popup node override the position value + * argument. If attributesOverride is false, the attributes are only used + * if position is empty. + * + * For an anchored popup, the x and y arguments may be used to offset the + * popup from its anchored position by some distance, measured in CSS pixels. + * x increases to the right and y increases down. Negative values may also + * be used to move to the left and upwards respectively. + * + * Unanchored popups may be created by supplying null as the anchor node. + * An unanchored popup appears at the position specified by x and y, + * relative to the viewport of the document containing the popup node. In + * this case, position and attributesOverride are ignored. + * + * @param anchorElement the node to anchor the popup to, may be null + * @param options either options to use, or a string position + * @param x horizontal offset + * @param y vertical offset + * @param isContextMenu true for context menus, false for other popups + * @param attributesOverride true if popup node attributes override position + * @param triggerEvent the event that triggered this popup (mouse click for example) + */ + void openPopup(optional Element? anchorElement = null, + optional StringOrOpenPopupOptions options = {}, + optional long x = 0, + optional long y = 0, + optional boolean isContextMenu = false, + optional boolean attributesOverride = false, + optional Event? triggerEvent = null); + + /** + * Open the popup at a specific screen position specified by x and y. This + * position may be adjusted if it would cause the popup to be off of the + * screen. The x and y coordinates are measured in CSS pixels, and like all + * screen coordinates, are given relative to the top left of the primary + * screen. + * + * @param isContextMenu true for context menus, false for other popups + * @param x horizontal screen position + * @param y vertical screen position + * @param triggerEvent the event that triggered this popup (mouse click for example) + */ + void openPopupAtScreen(optional long x = 0, optional long y = 0, + optional boolean isContextMenu = false, + optional Event? triggerEvent = null); + + /** + * Open the popup anchored at a specific screen rectangle. This function is + * similar to openPopup except that that rectangle of the anchor is supplied + * rather than an element. The anchor rectangle arguments are screen + * coordinates. + */ + void openPopupAtScreenRect(optional DOMString position = "", + optional long x = 0, + optional long y = 0, + optional long width = 0, + optional long height = 0, + optional boolean isContextMenu = false, + optional boolean attributesOverride = false, + optional Event? triggerEvent = null); + + /** + * Hide the popup if it is open. The cancel argument is used as a hint that + * the popup is being closed because it has been cancelled, rather than + * something being selected within the panel. + * + * @param cancel if true, then the popup is being cancelled. + */ + void hidePopup(optional boolean cancel = false); + + /** + * Attribute getter and setter for label. + */ + [SetterThrows] + attribute DOMString label; + + /** + * Attribute getter and setter for position. + */ + [SetterThrows] + attribute DOMString position; + + /** + * Returns the state of the popup: + * closed - the popup is closed + * open - the popup is open + * showing - the popup is in the process of being shown + * hiding - the popup is in the process of being hidden + */ + readonly attribute DOMString state; + + /** + * The node that triggered the popup. If the popup is not open, will return + * null. + */ + readonly attribute Node? triggerNode; + + /** + * True if the popup is anchored to a point or rectangle. False if it + * appears at a fixed screen coordinate. + */ + readonly attribute boolean isAnchored; + + /** + * Retrieve the anchor that was specified to openPopup or for menupopups in a + * menu, the parent menu. + */ + readonly attribute Element? anchorNode; + + /** + * Retrieve the screen rectangle of the popup, including the area occupied by + * any titlebar or borders present. + */ + DOMRect getOuterScreenRect(); + + /** + * Move the popup to a point on screen in CSS pixels. + */ + void moveTo(long left, long top); + + /** + * Move an open popup to the given anchor position. The arguments have the same + * meaning as the corresponding argument to openPopup. This method has no effect + * on popups that are not open. + */ + void moveToAnchor(optional Element? anchorElement = null, + optional DOMString position = "", + optional long x = 0, optional long y = 0, + optional boolean attributesOverride = false); + + /** + * Size the popup to the given dimensions + */ + void sizeTo(long width, long height); + + void setConstraintRect(DOMRectReadOnly rect); +}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build new file mode 100644 index 0000000000..a40b3bf612 --- /dev/null +++ b/dom/webidl/moz.build @@ -0,0 +1,1147 @@ +# -*- 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", "Canvas: 2D") + +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: UI Events & Focus Handling") + +with Files("ClipboardEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling") + +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("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: Drag & Drop") + +with Files("DragEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: 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("FakePluginTagInit.webidl"): + BUG_COMPONENT = ("Core", "Plug-ins") + +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("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("HiddenPluginEvent.webidl"): + BUG_COMPONENT = ("Core", "Plug-ins") + +with Files("IDB*"): + BUG_COMPONENT = ("Core", "Storage: IndexedDB") + +with Files("IIRFilterNode.webidl"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("Image*"): + BUG_COMPONENT = ("Core", "DOM: Core & HTML") + +with Files("ImageBitmap*"): + BUG_COMPONENT = ("Core", "Canvas: 2D") + +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("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("NativeOSFileInternals.webidl"): + BUG_COMPONENT = ("Toolkit", "OS.File") + +with Files("Net*"): + BUG_COMPONENT = ("Core", "Networking") + +with Files("OfflineAudio*"): + BUG_COMPONENT = ("Core", "Web Audio") + +with Files("OffscreenCanvas.webidl"): + BUG_COMPONENT = ("Core", "Canvas: 2D") + +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("ProfileTimelineMarker.webidl"): + BUG_COMPONENT = ("DevTools", "Performance Tools (Profiler/Timeline)") + +with Files("ProgressEvent.webidl"): + BUG_COMPONENT = ("Core", "DOM: Events") + +with Files("Push*"): + BUG_COMPONENT = ("Core", "DOM: Push 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: Device Interfaces") + +with Files("SourceBuffer*"): + BUG_COMPONENT = ("Core", "Audio/Video") + +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: Device Interfaces") + +with Files("TextTrack*"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("TrackEvent.webidl"): + BUG_COMPONENT = ("Core", "Audio/Video") + +with Files("U2F.webidl"): + BUG_COMPONENT = ("Core", "DOM: Device Interfaces") + +with Files("UDP*"): + BUG_COMPONENT = ("Core", "DOM: Device Interfaces") + +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: Device Interfaces") + +with Files("WebGL*"): + BUG_COMPONENT = ("Core", "Canvas: WebGL") + +with Files("WebGPU*"): + BUG_COMPONENT = ("Core", "Canvas: WebGL") + +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("WidevineCDMManifest.webidl"): + BUG_COMPONENT = ("Core", "Audio/Video: Playback") + +with Files("WindowOrWorkerGlobalScope.webidl"): + BUG_COMPONENT = ("Core", "DOM: Workers") + +with Files("Worker*"): + BUG_COMPONENT = ("Core", "DOM: Workers") + +GENERATED_WEBIDL_FILES = [ + "CSS2Properties.webidl", +] + +PREPROCESSED_WEBIDL_FILES = [ + "Animation.webidl", + "Node.webidl", + "Window.webidl", +] + +WEBIDL_FILES = [ + "AbortController.webidl", + "AbortSignal.webidl", + "AbstractRange.webidl", + "AbstractWorker.webidl", + "AccessibilityRole.webidl", + "AddonManager.webidl", + "AnalyserNode.webidl", + "Animatable.webidl", + "AnimationEffect.webidl", + "AnimationEvent.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", + "ChildSHistory.webidl", + "ChromeNodeList.webidl", + "Client.webidl", + "Clients.webidl", + "Clipboard.webidl", + "ClipboardEvent.webidl", + "CommandEvent.webidl", + "Comment.webidl", + "CompositionEvent.webidl", + "Console.webidl", + "ConstantSourceNode.webidl", + "ConvolverNode.webidl", + "CreateOfferRequest.webidl", + "CredentialManagement.webidl", + "Crypto.webidl", + "CSPDictionaries.webidl", + "CSPReport.webidl", + "CSS.webidl", + "CSSAnimation.webidl", + "CSSConditionRule.webidl", + "CSSCounterStyleRule.webidl", + "CSSFontFaceRule.webidl", + "CSSFontFeatureValuesRule.webidl", + "CSSGroupingRule.webidl", + "CSSImportRule.webidl", + "CSSKeyframeRule.webidl", + "CSSKeyframesRule.webidl", + "CSSMediaRule.webidl", + "CSSMozDocumentRule.webidl", + "CSSNamespaceRule.webidl", + "CSSPageRule.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", + "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", + "Event.webidl", + "EventHandler.webidl", + "EventListener.webidl", + "EventSource.webidl", + "EventTarget.webidl", + "ExtendableEvent.webidl", + "ExtendableMessageEvent.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", + "FileSystemDirectoryReader.webidl", + "FileSystemEntry.webidl", + "FileSystemFileEntry.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", + "Geolocation.webidl", + "GeolocationCoordinates.webidl", + "GeolocationPosition.webidl", + "GeolocationPositionError.webidl", + "GeometryUtils.webidl", + "GetUserMediaRequest.webidl", + "Grid.webidl", + "Headers.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", + "HTMLMenuItemElement.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", + "IDBFileHandle.webidl", + "IDBFileRequest.webidl", + "IDBIndex.webidl", + "IDBKeyRange.webidl", + "IDBMutableFile.webidl", + "IDBObjectStore.webidl", + "IDBOpenDBRequest.webidl", + "IDBRequest.webidl", + "IDBTransaction.webidl", + "IDBVersionChangeEvent.webidl", + "IdleDeadline.webidl", + "IIRFilterNode.webidl", + "ImageBitmap.webidl", + "ImageBitmapRenderingContext.webidl", + "ImageCapture.webidl", + "ImageData.webidl", + "ImageDocument.webidl", + "InputEvent.webidl", + "IntersectionObserver.webidl", + "IntlUtils.webidl", + "IterableIterator.webidl", + "KeyAlgorithm.webidl", + "KeyboardEvent.webidl", + "KeyEvent.webidl", + "KeyframeAnimationOptions.webidl", + "KeyframeEffect.webidl", + "KeyIdsInitData.webidl", + "LinkStyle.webidl", + "LoadURIOptions.webidl", + "Localization.webidl", + "Location.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", + "NativeOSFileInternals.webidl", + "Navigator.webidl", + "NetErrorInfo.webidl", + "NetworkInformation.webidl", + "NetworkOptions.webidl", + "NodeFilter.webidl", + "NodeIterator.webidl", + "NodeList.webidl", + "Notification.webidl", + "NotificationEvent.webidl", + "NotifyPaintEvent.webidl", + "OfflineAudioContext.webidl", + "OfflineResourceList.webidl", + "OffscreenCanvas.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", + "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", + "Presentation.webidl", + "PresentationAvailability.webidl", + "PresentationConnection.webidl", + "PresentationConnectionList.webidl", + "PresentationReceiver.webidl", + "PresentationRequest.webidl", + "ProcessingInstruction.webidl", + "ProfileTimelineMarker.webidl", + "Promise.webidl", + "PushEvent.webidl", + "PushManager.webidl", + "PushManager.webidl", + "PushMessageData.webidl", + "PushSubscription.webidl", + "PushSubscriptionOptions.webidl", + "RadioNodeList.webidl", + "Range.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", + "ShadowRoot.webidl", + "SharedWorker.webidl", + "SharedWorkerGlobalScope.webidl", + "SimpleGestureEvent.webidl", + "SocketCommon.webidl", + "SourceBuffer.webidl", + "SourceBufferList.webidl", + "StaticRange.webidl", + "StereoPannerNode.webidl", + "Storage.webidl", + "StorageEvent.webidl", + "StorageManager.webidl", + "StorageType.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", + "Text.webidl", + "TextClause.webidl", + "TextDecoder.webidl", + "TextEncoder.webidl", + "TextTrack.webidl", + "TextTrackCue.webidl", + "TextTrackCueList.webidl", + "TextTrackList.webidl", + "TimeEvent.webidl", + "TimeRanges.webidl", + "Touch.webidl", + "TouchEvent.webidl", + "TouchList.webidl", + "TransitionEvent.webidl", + "TreeColumn.webidl", + "TreeColumns.webidl", + "TreeContentView.webidl", + "TreeView.webidl", + "TreeWalker.webidl", + "U2F.webidl", + "UDPMessageEvent.webidl", + "UDPSocket.webidl", + "UIEvent.webidl", + "URL.webidl", + "URLSearchParams.webidl", + "ValidityState.webidl", + "VideoPlaybackQuality.webidl", + "VideoTrack.webidl", + "VideoTrackList.webidl", + "VisualViewport.webidl", + "VRDisplay.webidl", + "VRDisplayEvent.webidl", + "VRServiceTest.webidl", + "VTTCue.webidl", + "VTTRegion.webidl", + "WaveShaperNode.webidl", + "WebAuthentication.webidl", + "WebComponents.webidl", + "WebGL2RenderingContext.webidl", + "WebGLRenderingContext.webidl", + "WebGPU.webidl", + "WebSocket.webidl", + "WebXR.webidl", + "WheelEvent.webidl", + "WidevineCDMManifest.webidl", + "WindowOrWorkerGlobalScope.webidl", + "WindowRoot.webidl", + "Worker.webidl", + "WorkerDebuggerGlobalScope.webidl", + "WorkerGlobalScope.webidl", + "WorkerLocation.webidl", + "WorkerNavigator.webidl", + "Worklet.webidl", + "WorkletGlobalScope.webidl", + "XMLDocument.webidl", + "XMLHttpRequest.webidl", + "XMLHttpRequestEventTarget.webidl", + "XMLHttpRequestUpload.webidl", + "XMLSerializer.webidl", + "XPathEvaluator.webidl", + "XPathExpression.webidl", + "XPathNSResolver.webidl", + "XPathResult.webidl", + "XSLTProcessor.webidl", + "XULCommandEvent.webidl", + "XULElement.webidl", + "XULPopupElement.webidl", +] + +if CONFIG["MOZ_WEBRTC"]: + WEBIDL_FILES += [ + "PeerConnectionImpl.webidl", + "PeerConnectionObserver.webidl", + "PeerConnectionObserverEnums.webidl", + "RTCCertificate.webidl", + "RTCConfiguration.webidl", + "RTCDataChannel.webidl", + "RTCDtlsTransport.webidl", + "RTCDTMFSender.webidl", + "RTCIceCandidate.webidl", + "RTCIdentityAssertion.webidl", + "RTCIdentityProvider.webidl", + "RTCPeerConnection.webidl", + "RTCPeerConnectionStatic.webidl", + "RTCRtpReceiver.webidl", + "RTCRtpSender.webidl", + "RTCRtpSources.webidl", + "RTCRtpTransceiver.webidl", + "RTCSessionDescription.webidl", + "RTCStatsReport.webidl", + "TransceiverImpl.webidl", + "WebrtcDeprecated.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 += [ + "CloseEvent.webidl", + "CustomEvent.webidl", + "DeviceOrientationEvent.webidl", + "HashChangeEvent.webidl", + "PageTransitionEvent.webidl", + "PopStateEvent.webidl", + "PopupBlockedEvent.webidl", + "ProgressEvent.webidl", + "StyleSheetApplicableStateChangeEvent.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", + ] + +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", + "DeviceLightEvent.webidl", + "DeviceOrientationEvent.webidl", + "DeviceProximityEvent.webidl", + "ErrorEvent.webidl", + "FontFaceSetLoadEvent.webidl", + "FormDataEvent.webidl", + "FrameCrashedEvent.webidl", + "GamepadAxisMoveEvent.webidl", + "GamepadButtonEvent.webidl", + "GamepadEvent.webidl", + "GPUUncapturedErrorEvent.webidl", + "HashChangeEvent.webidl", + "HiddenPluginEvent.webidl", + "ImageCaptureErrorEvent.webidl", + "MediaQueryListEvent.webidl", + "MediaRecorderErrorEvent.webidl", + "MediaStreamEvent.webidl", + "MediaStreamTrackEvent.webidl", + "MIDIConnectionEvent.webidl", + "OfflineAudioCompletionEvent.webidl", + "PageTransitionEvent.webidl", + "PerformanceEntryEvent.webidl", + "PluginCrashedEvent.webidl", + "PopStateEvent.webidl", + "PopupBlockedEvent.webidl", + "PopupPositionedEvent.webidl", + "PositionStateEvent.webidl", + "PresentationConnectionAvailableEvent.webidl", + "PresentationConnectionCloseEvent.webidl", + "ProgressEvent.webidl", + "PromiseRejectionEvent.webidl", + "ScrollViewChangeEvent.webidl", + "SecurityPolicyViolationEvent.webidl", + "StyleSheetApplicableStateChangeEvent.webidl", + "SubmitEvent.webidl", + "TCPServerSocketEvent.webidl", + "TCPSocketErrorEvent.webidl", + "TCPSocketEvent.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", + ] + +if CONFIG["MOZ_WEBSPEECH"]: + GENERATED_EVENTS_WEBIDL_FILES += [ + "SpeechRecognitionEvent.webidl", + "SpeechSynthesisErrorEvent.webidl", + "SpeechSynthesisEvent.webidl", + ] + +if CONFIG["MOZ_BUILD_APP"] in ["browser", "comm/mail", "mobile/android", "xulrunner"]: + WEBIDL_FILES += [ + "External.webidl", + ] + +if CONFIG["ACCESSIBILITY"]: + WEBIDL_FILES += [ + "AccessibleNode.webidl", + ] |