diff --git a/baselines/audioworklet.generated.d.ts b/baselines/audioworklet.generated.d.ts index 3e35cbdf6..9c7b88423 100644 --- a/baselines/audioworklet.generated.d.ts +++ b/baselines/audioworklet.generated.d.ts @@ -357,6 +357,7 @@ declare var TransformStreamDefaultController: { new(): TransformStreamDefaultController; }; +/** Available only in secure contexts. */ interface WorkletGlobalScope { } diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 3fe407002..46b4bc3bf 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -2214,6 +2214,7 @@ declare var AudioScheduledSourceNode: { new(): AudioScheduledSourceNode; }; +/** Available only in secure contexts. */ interface AudioWorklet extends Worklet { } @@ -2226,6 +2227,7 @@ interface AudioWorkletNodeEventMap { "processorerror": Event; } +/** Available only in secure contexts. */ interface AudioWorkletNode extends AudioNode { onprocessorerror: ((this: AudioWorkletNode, ev: Event) => any) | null; readonly parameters: AudioParamMap; @@ -2241,6 +2243,7 @@ declare var AudioWorkletNode: { new(context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode; }; +/** Available only in secure contexts. */ interface AuthenticatorAssertionResponse extends AuthenticatorResponse { readonly authenticatorData: ArrayBuffer; readonly signature: ArrayBuffer; @@ -2252,6 +2255,7 @@ declare var AuthenticatorAssertionResponse: { new(): AuthenticatorAssertionResponse; }; +/** Available only in secure contexts. */ interface AuthenticatorAttestationResponse extends AuthenticatorResponse { readonly attestationObject: ArrayBuffer; } @@ -2261,6 +2265,7 @@ declare var AuthenticatorAttestationResponse: { new(): AuthenticatorAttestationResponse; }; +/** Available only in secure contexts. */ interface AuthenticatorResponse { readonly clientDataJSON: ArrayBuffer; } @@ -2284,6 +2289,7 @@ interface BaseAudioContextEventMap { } interface BaseAudioContext extends EventTarget { + /** Available only in secure contexts. */ readonly audioWorklet: AudioWorklet; readonly currentTime: number; readonly destination: AudioDestinationNode; @@ -3189,7 +3195,10 @@ declare var CSSTransition: { new(): CSSTransition; }; -/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */ +/** + * Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. + * Available only in secure contexts. + */ interface Cache { add(request: RequestInfo): Promise; addAll(requests: RequestInfo[]): Promise; @@ -3205,7 +3214,10 @@ declare var Cache: { new(): Cache; }; -/** The storage for Cache objects. */ +/** + * The storage for Cache objects. + * Available only in secure contexts. + */ interface CacheStorage { delete(cacheName: string): Promise; has(cacheName: string): Promise; @@ -3437,6 +3449,7 @@ interface ChildNode extends Node { interface ClientRect extends DOMRect { } +/** Available only in secure contexts. */ interface Clipboard extends EventTarget { read(): Promise; readText(): Promise; @@ -3540,6 +3553,7 @@ declare var CountQueuingStrategy: { new(init: QueuingStrategyInit): CountQueuingStrategy; }; +/** Available only in secure contexts. */ interface Credential { readonly id: string; readonly type: string; @@ -3550,6 +3564,7 @@ declare var Credential: { new(): Credential; }; +/** Available only in secure contexts. */ interface CredentialsContainer { create(options?: CredentialCreationOptions): Promise; get(options?: CredentialRequestOptions): Promise; @@ -3564,6 +3579,7 @@ declare var CredentialsContainer: { /** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ interface Crypto { + /** Available only in secure contexts. */ readonly subtle: SubtleCrypto; getRandomValues(array: T): T; } @@ -3573,7 +3589,10 @@ declare var Crypto: { new(): Crypto; }; -/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */ +/** + * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. + * Available only in secure contexts. + */ interface CryptoKey { readonly algorithm: KeyAlgorithm; readonly extractable: boolean; @@ -4081,7 +4100,10 @@ declare var DelayNode: { new(context: BaseAudioContext, options?: DelayOptions): DelayNode; }; -/** The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation. */ +/** + * The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation. + * Available only in secure contexts. + */ interface DeviceMotionEvent extends Event { readonly acceleration: DeviceMotionEventAcceleration | null; readonly accelerationIncludingGravity: DeviceMotionEventAcceleration | null; @@ -4094,19 +4116,24 @@ declare var DeviceMotionEvent: { new(type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; }; +/** Available only in secure contexts. */ interface DeviceMotionEventAcceleration { readonly x: number | null; readonly y: number | null; readonly z: number | null; } +/** Available only in secure contexts. */ interface DeviceMotionEventRotationRate { readonly alpha: number | null; readonly beta: number | null; readonly gamma: number | null; } -/** The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page. */ +/** + * The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page. + * Available only in secure contexts. + */ interface DeviceOrientationEvent extends Event { readonly absolute: boolean; readonly alpha: number | null; @@ -5184,7 +5211,10 @@ declare var GainNode: { new(context: BaseAudioContext, options?: GainOptions): GainNode; }; -/** This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. */ +/** + * This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. + * Available only in secure contexts. + */ interface Gamepad { readonly axes: ReadonlyArray; readonly buttons: ReadonlyArray; @@ -5201,7 +5231,10 @@ declare var Gamepad: { new(): Gamepad; }; -/** An individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device. */ +/** + * An individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device. + * Available only in secure contexts. + */ interface GamepadButton { readonly pressed: boolean; readonly touched: boolean; @@ -5213,7 +5246,10 @@ declare var GamepadButton: { new(): GamepadButton; }; -/** This Gamepad API interface contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. */ +/** + * This Gamepad API interface contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. + * Available only in secure contexts. + */ interface GamepadEvent extends Event { readonly gamepad: Gamepad; } @@ -5250,6 +5286,7 @@ declare var Geolocation: { new(): Geolocation; }; +/** Available only in secure contexts. */ interface GeolocationCoordinates { readonly accuracy: number; readonly altitude: number | null; @@ -5265,6 +5302,7 @@ declare var GeolocationCoordinates: { new(): GeolocationCoordinates; }; +/** Available only in secure contexts. */ interface GeolocationPosition { readonly coords: GeolocationCoordinates; readonly timestamp: DOMTimeStamp; @@ -6951,6 +6989,7 @@ interface HTMLMediaElement extends HTMLElement { readonly error: MediaError | null; /** Gets or sets a flag to specify whether playback should restart after it completes. */ loop: boolean; + /** Available only in secure contexts. */ readonly mediaKeys: MediaKeys | null; /** Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. */ muted: boolean; @@ -6988,6 +7027,7 @@ interface HTMLMediaElement extends HTMLElement { pause(): void; /** Loads and starts playback of a media resource. */ play(): Promise; + /** Available only in secure contexts. */ setMediaKeys(mediaKeys: MediaKeys | null): Promise; readonly HAVE_CURRENT_DATA: number; readonly HAVE_ENOUGH_DATA: number; @@ -8816,7 +8856,10 @@ declare var MediaCapabilities: { new(): MediaCapabilities; }; -/** The MediaDevicesInfo interface contains information that describes a single media input or output device. */ +/** + * The MediaDevicesInfo interface contains information that describes a single media input or output device. + * Available only in secure contexts. + */ interface MediaDeviceInfo { readonly deviceId: string; readonly groupId: string; @@ -8834,7 +8877,10 @@ interface MediaDevicesEventMap { "devicechange": Event; } -/** Provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data. */ +/** + * Provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data. + * Available only in secure contexts. + */ interface MediaDevices extends EventTarget { ondevicechange: ((this: MediaDevices, ev: Event) => any) | null; enumerateDevices(): Promise; @@ -8891,7 +8937,10 @@ declare var MediaError: { readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; }; -/** This EncryptedMediaExtensions API interface contains the content and related data when the content decryption module generates a message for the session. */ +/** + * This EncryptedMediaExtensions API interface contains the content and related data when the content decryption module generates a message for the session. + * Available only in secure contexts. + */ interface MediaKeyMessageEvent extends Event { readonly message: ArrayBuffer; readonly messageType: MediaKeyMessageType; @@ -8907,7 +8956,10 @@ interface MediaKeySessionEventMap { "message": MediaKeyMessageEvent; } -/** This EncryptedMediaExtensions API interface represents a context for message exchange with a content decryption module (CDM). */ +/** + * This EncryptedMediaExtensions API interface represents a context for message exchange with a content decryption module (CDM). + * Available only in secure contexts. + */ interface MediaKeySession extends EventTarget { readonly closed: Promise; readonly expiration: number; @@ -8931,7 +8983,10 @@ declare var MediaKeySession: { new(): MediaKeySession; }; -/** This EncryptedMediaExtensions API interface is a read-only map of media key statuses by key IDs. */ +/** + * This EncryptedMediaExtensions API interface is a read-only map of media key statuses by key IDs. + * Available only in secure contexts. + */ interface MediaKeyStatusMap { readonly size: number; get(keyId: BufferSource): MediaKeyStatus | undefined; @@ -8944,7 +8999,10 @@ declare var MediaKeyStatusMap: { new(): MediaKeyStatusMap; }; -/** This EncryptedMediaExtensions API interface provides access to a Key System for decryption and/or a content protection provider. You can request an instance of this object using the Navigator.requestMediaKeySystemAccess method. */ +/** + * This EncryptedMediaExtensions API interface provides access to a Key System for decryption and/or a content protection provider. You can request an instance of this object using the Navigator.requestMediaKeySystemAccess method. + * Available only in secure contexts. + */ interface MediaKeySystemAccess { readonly keySystem: string; createMediaKeys(): Promise; @@ -8956,7 +9014,10 @@ declare var MediaKeySystemAccess: { new(): MediaKeySystemAccess; }; -/** This EncryptedMediaExtensions API interface the represents a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback. */ +/** + * This EncryptedMediaExtensions API interface the represents a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback. + * Available only in secure contexts. + */ interface MediaKeys { createSession(sessionType?: MediaKeySessionType): MediaKeySession; setServerCertificate(serverCertificate: BufferSource): Promise; @@ -9460,20 +9521,27 @@ declare var NamedNodeMap: { /** The state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. */ interface Navigator extends NavigatorAutomationInformation, NavigatorConcurrentHardware, NavigatorContentUtils, NavigatorCookies, NavigatorID, NavigatorLanguage, NavigatorNetworkInformation, NavigatorOnLine, NavigatorPlugins, NavigatorStorage { + /** Available only in secure contexts. */ readonly clipboard: Clipboard; + /** Available only in secure contexts. */ readonly credentials: CredentialsContainer; readonly doNotTrack: string | null; readonly geolocation: Geolocation; readonly maxTouchPoints: number; readonly mediaCapabilities: MediaCapabilities; + /** Available only in secure contexts. */ readonly mediaDevices: MediaDevices; readonly mediaSession: MediaSession; readonly permissions: Permissions; + /** Available only in secure contexts. */ readonly serviceWorker: ServiceWorkerContainer; + /** Available only in secure contexts. */ canShare(data?: ShareData): boolean; getGamepads(): (Gamepad | null)[]; + /** Available only in secure contexts. */ requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise; sendBeacon(url: string | URL, data?: BodyInit | null): boolean; + /** Available only in secure contexts. */ share(data?: ShareData): Promise; vibrate(pattern: VibratePattern): boolean; } @@ -9492,6 +9560,7 @@ interface NavigatorConcurrentHardware { } interface NavigatorContentUtils { + /** Available only in secure contexts. */ registerProtocolHandler(scheme: string, url: string | URL): void; } @@ -9540,6 +9609,7 @@ interface NavigatorPlugins { javaEnabled(): boolean; } +/** Available only in secure contexts. */ interface NavigatorStorage { readonly storage: StorageManager; } @@ -9967,6 +10037,7 @@ declare var Path2D: { new(path?: Path2D | string): Path2D; }; +/** Available only in secure contexts. */ interface PaymentMethodChangeEvent extends PaymentRequestUpdateEvent { readonly methodDetails: any; readonly methodName: string; @@ -9981,7 +10052,10 @@ interface PaymentRequestEventMap { "paymentmethodchange": Event; } -/** This Payment Request API interface is the primary access point into the API, and lets web content and apps accept payments from the end user. */ +/** + * This Payment Request API interface is the primary access point into the API, and lets web content and apps accept payments from the end user. + * Available only in secure contexts. + */ interface PaymentRequest extends EventTarget { readonly id: string; onpaymentmethodchange: ((this: PaymentRequest, ev: Event) => any) | null; @@ -9999,7 +10073,10 @@ declare var PaymentRequest: { new(methodData: PaymentMethodData[], details: PaymentDetailsInit): PaymentRequest; }; -/** This Payment Request API interface enables a web page to update the details of a PaymentRequest in response to a user action. */ +/** + * This Payment Request API interface enables a web page to update the details of a PaymentRequest in response to a user action. + * Available only in secure contexts. + */ interface PaymentRequestUpdateEvent extends Event { updateWith(detailsPromise: PaymentDetailsUpdate | PromiseLike): void; } @@ -10009,7 +10086,10 @@ declare var PaymentRequestUpdateEvent: { new(type: string, eventInitDict?: PaymentRequestUpdateEventInit): PaymentRequestUpdateEvent; }; -/** This Payment Request API interface is returned after a user selects a payment method and approves a payment request. */ +/** + * This Payment Request API interface is returned after a user selects a payment method and approves a payment request. + * Available only in secure contexts. + */ interface PaymentResponse extends EventTarget { readonly details: any; readonly methodName: string; @@ -10409,6 +10489,7 @@ interface PointerEvent extends MouseEvent { readonly tiltY: number; readonly twist: number; readonly width: number; + /** Available only in secure contexts. */ getCoalescedEvents(): PointerEvent[]; getPredictedEvents(): PointerEvent[]; } @@ -10463,6 +10544,7 @@ declare var PromiseRejectionEvent: { new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent; }; +/** Available only in secure contexts. */ interface PublicKeyCredential extends Credential { readonly rawId: ArrayBuffer; readonly response: AuthenticatorResponse; @@ -10475,7 +10557,10 @@ declare var PublicKeyCredential: { isUserVerifyingPlatformAuthenticatorAvailable(): Promise; }; -/** This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */ +/** + * This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. + * Available only in secure contexts. + */ interface PushManager { getSubscription(): Promise; permissionState(options?: PushSubscriptionOptionsInit): Promise; @@ -10488,7 +10573,10 @@ declare var PushManager: { readonly supportedContentEncodings: ReadonlyArray; }; -/** This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. */ +/** + * This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. + * Available only in secure contexts. + */ interface PushSubscription { readonly endpoint: string; readonly options: PushSubscriptionOptions; @@ -10502,6 +10590,7 @@ declare var PushSubscription: { new(): PushSubscription; }; +/** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; } @@ -12881,7 +12970,10 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap { "statechange": Event; } -/** This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */ +/** + * This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. + * Available only in secure contexts. + */ interface ServiceWorker extends EventTarget, AbstractWorker { onstatechange: ((this: ServiceWorker, ev: Event) => any) | null; readonly scriptURL: string; @@ -12905,7 +12997,10 @@ interface ServiceWorkerContainerEventMap { "messageerror": MessageEvent; } -/** The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. */ +/** + * The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. + * Available only in secure contexts. + */ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null; @@ -12931,7 +13026,10 @@ interface ServiceWorkerRegistrationEventMap { "updatefound": Event; } -/** This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */ +/** + * This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. + * Available only in secure contexts. + */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; readonly installing: ServiceWorker | null; @@ -13249,6 +13347,7 @@ declare var StorageEvent: { new(type: string, eventInitDict?: StorageEventInit): StorageEvent; }; +/** Available only in secure contexts. */ interface StorageManager { estimate(): Promise; persist(): Promise; @@ -13304,7 +13403,10 @@ declare var SubmitEvent: { new(type: string, eventInitDict?: SubmitEventInit): SubmitEvent; }; -/** This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). */ +/** + * This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). + * Available only in secure contexts. + */ interface SubtleCrypto { decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise; @@ -16014,7 +16116,9 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler readonly menubar: BarProp; name: string; readonly navigator: Navigator; + /** Available only in secure contexts. */ ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null; + /** Available only in secure contexts. */ ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null; /** @deprecated */ onorientationchange: ((this: Window, ev: Event) => any) | null; @@ -16162,6 +16266,7 @@ interface WindowLocalStorage { } interface WindowOrWorkerGlobalScope { + /** Available only in secure contexts. */ readonly caches: CacheStorage; readonly crossOriginIsolated: boolean; readonly crypto: Crypto; @@ -16210,6 +16315,7 @@ declare var Worker: { new(scriptURL: string | URL, options?: WorkerOptions): Worker; }; +/** Available only in secure contexts. */ interface Worklet { /** * Loads and executes the module script given by moduleURL into all of worklet's global scopes. It can also create additional global scopes as part of this process, depending on the worklet type. The returned promise will fulfill once the script has been successfully loaded and run in all global scopes. @@ -17051,7 +17157,9 @@ declare var menubar: BarProp; /** @deprecated */ declare const name: void; declare var navigator: Navigator; +/** Available only in secure contexts. */ declare var ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null; +/** Available only in secure contexts. */ declare var ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null; /** @deprecated */ declare var onorientationchange: ((this: Window, ev: Event) => any) | null; @@ -17432,6 +17540,7 @@ declare var onstorage: ((this: Window, ev: StorageEvent) => any) | null; declare var onunhandledrejection: ((this: Window, ev: PromiseRejectionEvent) => any) | null; declare var onunload: ((this: Window, ev: Event) => any) | null; declare var localStorage: Storage; +/** Available only in secure contexts. */ declare var caches: CacheStorage; declare var crossOriginIsolated: boolean; declare var crypto: Crypto; diff --git a/baselines/dom.iterable.generated.d.ts b/baselines/dom.iterable.generated.d.ts index 641a76a4f..4f609d3d6 100644 --- a/baselines/dom.iterable.generated.d.ts +++ b/baselines/dom.iterable.generated.d.ts @@ -135,6 +135,7 @@ interface NamedNodeMap { } interface Navigator { + /** Available only in secure contexts. */ requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: Iterable): Promise; vibrate(pattern: Iterable): boolean; } diff --git a/baselines/serviceworker.generated.d.ts b/baselines/serviceworker.generated.d.ts index 633419af8..a08a00ed5 100644 --- a/baselines/serviceworker.generated.d.ts +++ b/baselines/serviceworker.generated.d.ts @@ -741,7 +741,10 @@ declare var ByteLengthQueuingStrategy: { new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; }; -/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */ +/** + * Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. + * Available only in secure contexts. + */ interface Cache { add(request: RequestInfo): Promise; addAll(requests: RequestInfo[]): Promise; @@ -757,7 +760,10 @@ declare var Cache: { new(): Cache; }; -/** The storage for Cache objects. */ +/** + * The storage for Cache objects. + * Available only in secure contexts. + */ interface CacheStorage { delete(cacheName: string): Promise; has(cacheName: string): Promise; @@ -865,6 +871,7 @@ declare var CountQueuingStrategy: { /** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ interface Crypto { + /** Available only in secure contexts. */ readonly subtle: SubtleCrypto; getRandomValues(array: T): T; } @@ -874,7 +881,10 @@ declare var Crypto: { new(): Crypto; }; -/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */ +/** + * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. + * Available only in secure contexts. + */ interface CryptoKey { readonly algorithm: KeyAlgorithm; readonly extractable: boolean; @@ -2085,6 +2095,7 @@ interface NavigatorOnLine { readonly onLine: boolean; } +/** Available only in secure contexts. */ interface NavigatorStorage { readonly storage: StorageManager; } @@ -2379,7 +2390,10 @@ declare var PromiseRejectionEvent: { new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent; }; -/** This Push API interface represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. */ +/** + * This Push API interface represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. + * Available only in secure contexts. + */ interface PushEvent extends ExtendableEvent { readonly data: PushMessageData | null; } @@ -2389,7 +2403,10 @@ declare var PushEvent: { new(type: string, eventInitDict?: PushEventInit): PushEvent; }; -/** This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */ +/** + * This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. + * Available only in secure contexts. + */ interface PushManager { getSubscription(): Promise; permissionState(options?: PushSubscriptionOptionsInit): Promise; @@ -2402,7 +2419,10 @@ declare var PushManager: { readonly supportedContentEncodings: ReadonlyArray; }; -/** This Push API interface provides methods which let you retrieve the push data sent by a server in various formats. */ +/** + * This Push API interface provides methods which let you retrieve the push data sent by a server in various formats. + * Available only in secure contexts. + */ interface PushMessageData { arrayBuffer(): ArrayBuffer; blob(): Blob; @@ -2415,7 +2435,10 @@ declare var PushMessageData: { new(): PushMessageData; }; -/** This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. */ +/** + * This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. + * Available only in secure contexts. + */ interface PushSubscription { readonly endpoint: string; readonly options: PushSubscriptionOptions; @@ -2429,6 +2452,7 @@ declare var PushSubscription: { new(): PushSubscription; }; +/** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; } @@ -2560,7 +2584,10 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap { "statechange": Event; } -/** This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */ +/** + * This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. + * Available only in secure contexts. + */ interface ServiceWorker extends EventTarget, AbstractWorker { onstatechange: ((this: ServiceWorker, ev: Event) => any) | null; readonly scriptURL: string; @@ -2584,7 +2611,10 @@ interface ServiceWorkerContainerEventMap { "messageerror": MessageEvent; } -/** The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. */ +/** + * The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. + * Available only in secure contexts. + */ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null; @@ -2645,7 +2675,10 @@ interface ServiceWorkerRegistrationEventMap { "updatefound": Event; } -/** This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */ +/** + * This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. + * Available only in secure contexts. + */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; readonly installing: ServiceWorker | null; @@ -2669,6 +2702,7 @@ declare var ServiceWorkerRegistration: { new(): ServiceWorkerRegistration; }; +/** Available only in secure contexts. */ interface StorageManager { estimate(): Promise; persisted(): Promise; @@ -2679,7 +2713,10 @@ declare var StorageManager: { new(): StorageManager; }; -/** This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). */ +/** + * This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). + * Available only in secure contexts. + */ interface SubtleCrypto { decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise; @@ -4954,6 +4991,7 @@ declare var WindowClient: { }; interface WindowOrWorkerGlobalScope { + /** Available only in secure contexts. */ readonly caches: CacheStorage; readonly crossOriginIsolated: boolean; readonly crypto: Crypto; @@ -5317,6 +5355,7 @@ declare function importScripts(...urls: (string | URL)[]): void; /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ declare function dispatchEvent(event: Event): boolean; declare var fonts: FontFaceSet; +/** Available only in secure contexts. */ declare var caches: CacheStorage; declare var crossOriginIsolated: boolean; declare var crypto: Crypto; diff --git a/baselines/sharedworker.generated.d.ts b/baselines/sharedworker.generated.d.ts index 0659591f8..a7831745e 100644 --- a/baselines/sharedworker.generated.d.ts +++ b/baselines/sharedworker.generated.d.ts @@ -713,7 +713,10 @@ declare var ByteLengthQueuingStrategy: { new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; }; -/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */ +/** + * Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. + * Available only in secure contexts. + */ interface Cache { add(request: RequestInfo): Promise; addAll(requests: RequestInfo[]): Promise; @@ -729,7 +732,10 @@ declare var Cache: { new(): Cache; }; -/** The storage for Cache objects. */ +/** + * The storage for Cache objects. + * Available only in secure contexts. + */ interface CacheStorage { delete(cacheName: string): Promise; has(cacheName: string): Promise; @@ -809,6 +815,7 @@ declare var CountQueuingStrategy: { /** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ interface Crypto { + /** Available only in secure contexts. */ readonly subtle: SubtleCrypto; getRandomValues(array: T): T; } @@ -818,7 +825,10 @@ declare var Crypto: { new(): Crypto; }; -/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */ +/** + * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. + * Available only in secure contexts. + */ interface CryptoKey { readonly algorithm: KeyAlgorithm; readonly extractable: boolean; @@ -2005,6 +2015,7 @@ interface NavigatorOnLine { readonly onLine: boolean; } +/** Available only in secure contexts. */ interface NavigatorStorage { readonly storage: StorageManager; } @@ -2288,7 +2299,10 @@ declare var PromiseRejectionEvent: { new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent; }; -/** This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */ +/** + * This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. + * Available only in secure contexts. + */ interface PushManager { getSubscription(): Promise; permissionState(options?: PushSubscriptionOptionsInit): Promise; @@ -2301,7 +2315,10 @@ declare var PushManager: { readonly supportedContentEncodings: ReadonlyArray; }; -/** This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. */ +/** + * This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. + * Available only in secure contexts. + */ interface PushSubscription { readonly endpoint: string; readonly options: PushSubscriptionOptions; @@ -2315,6 +2332,7 @@ declare var PushSubscription: { new(): PushSubscription; }; +/** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; } @@ -2446,7 +2464,10 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap { "statechange": Event; } -/** This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */ +/** + * This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. + * Available only in secure contexts. + */ interface ServiceWorker extends EventTarget, AbstractWorker { onstatechange: ((this: ServiceWorker, ev: Event) => any) | null; readonly scriptURL: string; @@ -2470,7 +2491,10 @@ interface ServiceWorkerContainerEventMap { "messageerror": MessageEvent; } -/** The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. */ +/** + * The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. + * Available only in secure contexts. + */ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null; @@ -2496,7 +2520,10 @@ interface ServiceWorkerRegistrationEventMap { "updatefound": Event; } -/** This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */ +/** + * This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. + * Available only in secure contexts. + */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; readonly installing: ServiceWorker | null; @@ -2541,6 +2568,7 @@ declare var SharedWorkerGlobalScope: { new(): SharedWorkerGlobalScope; }; +/** Available only in secure contexts. */ interface StorageManager { estimate(): Promise; persisted(): Promise; @@ -2551,7 +2579,10 @@ declare var StorageManager: { new(): StorageManager; }; -/** This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). */ +/** + * This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). + * Available only in secure contexts. + */ interface SubtleCrypto { decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise; @@ -4815,6 +4846,7 @@ declare var WebSocket: { }; interface WindowOrWorkerGlobalScope { + /** Available only in secure contexts. */ readonly caches: CacheStorage; readonly crossOriginIsolated: boolean; readonly crypto: Crypto; @@ -5340,6 +5372,7 @@ declare function importScripts(...urls: (string | URL)[]): void; /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ declare function dispatchEvent(event: Event): boolean; declare var fonts: FontFaceSet; +/** Available only in secure contexts. */ declare var caches: CacheStorage; declare var crossOriginIsolated: boolean; declare var crypto: Crypto; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index d014dc30d..8c0141a0f 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -752,7 +752,10 @@ declare var ByteLengthQueuingStrategy: { new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; }; -/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */ +/** + * Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. + * Available only in secure contexts. + */ interface Cache { add(request: RequestInfo): Promise; addAll(requests: RequestInfo[]): Promise; @@ -768,7 +771,10 @@ declare var Cache: { new(): Cache; }; -/** The storage for Cache objects. */ +/** + * The storage for Cache objects. + * Available only in secure contexts. + */ interface CacheStorage { delete(cacheName: string): Promise; has(cacheName: string): Promise; @@ -876,6 +882,7 @@ declare var CountQueuingStrategy: { /** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ interface Crypto { + /** Available only in secure contexts. */ readonly subtle: SubtleCrypto; getRandomValues(array: T): T; } @@ -885,7 +892,10 @@ declare var Crypto: { new(): Crypto; }; -/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */ +/** + * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. + * Available only in secure contexts. + */ interface CryptoKey { readonly algorithm: KeyAlgorithm; readonly extractable: boolean; @@ -2137,6 +2147,7 @@ interface NavigatorOnLine { readonly onLine: boolean; } +/** Available only in secure contexts. */ interface NavigatorStorage { readonly storage: StorageManager; } @@ -2431,7 +2442,10 @@ declare var PromiseRejectionEvent: { new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent; }; -/** This Push API interface represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. */ +/** + * This Push API interface represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. + * Available only in secure contexts. + */ interface PushEvent extends ExtendableEvent { readonly data: PushMessageData | null; } @@ -2441,7 +2455,10 @@ declare var PushEvent: { new(type: string, eventInitDict?: PushEventInit): PushEvent; }; -/** This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */ +/** + * This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. + * Available only in secure contexts. + */ interface PushManager { getSubscription(): Promise; permissionState(options?: PushSubscriptionOptionsInit): Promise; @@ -2454,7 +2471,10 @@ declare var PushManager: { readonly supportedContentEncodings: ReadonlyArray; }; -/** This Push API interface provides methods which let you retrieve the push data sent by a server in various formats. */ +/** + * This Push API interface provides methods which let you retrieve the push data sent by a server in various formats. + * Available only in secure contexts. + */ interface PushMessageData { arrayBuffer(): ArrayBuffer; blob(): Blob; @@ -2467,7 +2487,10 @@ declare var PushMessageData: { new(): PushMessageData; }; -/** This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. */ +/** + * This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. + * Available only in secure contexts. + */ interface PushSubscription { readonly endpoint: string; readonly options: PushSubscriptionOptions; @@ -2481,6 +2504,7 @@ declare var PushSubscription: { new(): PushSubscription; }; +/** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; } @@ -2612,7 +2636,10 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap { "statechange": Event; } -/** This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */ +/** + * This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. + * Available only in secure contexts. + */ interface ServiceWorker extends EventTarget, AbstractWorker { onstatechange: ((this: ServiceWorker, ev: Event) => any) | null; readonly scriptURL: string; @@ -2636,7 +2663,10 @@ interface ServiceWorkerContainerEventMap { "messageerror": MessageEvent; } -/** The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. */ +/** + * The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. + * Available only in secure contexts. + */ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null; @@ -2697,7 +2727,10 @@ interface ServiceWorkerRegistrationEventMap { "updatefound": Event; } -/** This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */ +/** + * This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. + * Available only in secure contexts. + */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; readonly installing: ServiceWorker | null; @@ -2742,6 +2775,7 @@ declare var SharedWorkerGlobalScope: { new(): SharedWorkerGlobalScope; }; +/** Available only in secure contexts. */ interface StorageManager { estimate(): Promise; persisted(): Promise; @@ -2752,7 +2786,10 @@ declare var StorageManager: { new(): StorageManager; }; -/** This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). */ +/** + * This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). + * Available only in secure contexts. + */ interface SubtleCrypto { decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise; @@ -5029,6 +5066,7 @@ declare var WindowClient: { }; interface WindowOrWorkerGlobalScope { + /** Available only in secure contexts. */ readonly caches: CacheStorage; readonly crossOriginIsolated: boolean; readonly crypto: Crypto; @@ -5562,6 +5600,7 @@ declare function importScripts(...urls: (string | URL)[]): void; /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ declare function dispatchEvent(event: Event): boolean; declare var fonts: FontFaceSet; +/** Available only in secure contexts. */ declare var caches: CacheStorage; declare var crossOriginIsolated: boolean; declare var crypto: Crypto; diff --git a/src/build/emitter.ts b/src/build/emitter.ts index 5a5b1ff04..7a3e2d8e6 100644 --- a/src/build/emitter.ts +++ b/src/build/emitter.ts @@ -835,19 +835,26 @@ export function emitWebIdl( } function emitComments( - entity: { comment?: string; deprecated?: boolean | string }, + entity: { + comment?: string; + deprecated?: boolean | string; + secureContext?: boolean; + }, print: (s: string) => void ) { + const comments = entity.comment?.split("\n") ?? []; const deprecated = typeof entity.deprecated === "string" ? `@deprecated ${entity.deprecated}` : entity.deprecated ? "@deprecated" : null; - const comments = entity.comment?.split("\n") ?? []; if (deprecated) { comments.push(deprecated); } + if (entity.secureContext) { + comments.push("Available only in secure contexts."); + } if (comments.length > 1) { print("/**"); diff --git a/src/build/types.d.ts b/src/build/types.d.ts index 429b674bb..ab4b13df8 100644 --- a/src/build/types.d.ts +++ b/src/build/types.d.ts @@ -58,6 +58,7 @@ export interface Property extends Typed { specs?: string; deprecated?: boolean; exposed?: string; + secureContext?: boolean; } export interface Event { @@ -86,6 +87,7 @@ export interface AnonymousMethod { exposed?: string; deprecated?: boolean; signature: Signature[]; + secureContext?: boolean; } export interface Method extends AnonymousMethod { @@ -191,6 +193,7 @@ export interface Interface { typedefs: TypeDef[]; }; deprecated?: boolean | string; + secureContext?: boolean; } export interface Iterator { diff --git a/src/build/widlprocess.ts b/src/build/widlprocess.ts index ea0b03654..0e966efd8 100644 --- a/src/build/widlprocess.ts +++ b/src/build/widlprocess.ts @@ -158,6 +158,7 @@ function convertInterfaceCommon( hasExtAttr(i.extAttrs, "NoInterfaceObject"), legacyWindowAlias: getExtAttr(i.extAttrs, "LegacyWindowAlias"), legacyNamespace: getExtAttr(i.extAttrs, "LegacyNamespace")[0], + secureContext: hasExtAttr(i.extAttrs, "SecureContext"), }; if (!result.exposed && i.type === "interface" && !i.partial) { result.exposed = "Window"; @@ -306,6 +307,7 @@ function convertOperation( exposed: getExtAttrConcatenated(operation.extAttrs, "Exposed") || inheritedExposure, + secureContext: hasExtAttr(operation.extAttrs, "SecureContext"), }; } @@ -354,6 +356,7 @@ function convertAttribute( getExtAttrConcatenated(attribute.extAttrs, "Exposed") || inheritedExposure, putForwards: getExtAttr(attribute.extAttrs, "PutForwards")[0], + secureContext: hasExtAttr(attribute.extAttrs, "SecureContext"), }; }