From 33b9a3bdacfc82612afe7f0c0f67411f10adcf2c Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 3 Oct 2021 23:09:33 +0200 Subject: [PATCH 1/3] Add comment for secure-context-only types --- baselines/audioworklet.generated.d.ts | 1 + baselines/dom.generated.d.ts | 157 +++++++++++++++++++++---- baselines/dom.iterable.generated.d.ts | 1 + baselines/serviceworker.generated.d.ts | 61 ++++++++-- baselines/sharedworker.generated.d.ts | 51 ++++++-- baselines/webworker.generated.d.ts | 61 ++++++++-- src/build/emitter.ts | 11 +- src/build/types.d.ts | 3 + src/build/widlprocess.ts | 3 + 9 files changed, 292 insertions(+), 57 deletions(-) diff --git a/baselines/audioworklet.generated.d.ts b/baselines/audioworklet.generated.d.ts index 3e35cbdf6..1d90e8188 100644 --- a/baselines/audioworklet.generated.d.ts +++ b/baselines/audioworklet.generated.d.ts @@ -357,6 +357,7 @@ declare var TransformStreamDefaultController: { new(): TransformStreamDefaultController; }; +/** Available only on secure context. */ interface WorkletGlobalScope { } diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 3fe407002..1446336a1 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -2214,6 +2214,7 @@ declare var AudioScheduledSourceNode: { new(): AudioScheduledSourceNode; }; +/** Available only on secure context. */ interface AudioWorklet extends Worklet { } @@ -2226,6 +2227,7 @@ interface AudioWorkletNodeEventMap { "processorerror": Event; } +/** Available only on secure context. */ 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 on secure context. */ interface AuthenticatorAssertionResponse extends AuthenticatorResponse { readonly authenticatorData: ArrayBuffer; readonly signature: ArrayBuffer; @@ -2252,6 +2255,7 @@ declare var AuthenticatorAssertionResponse: { new(): AuthenticatorAssertionResponse; }; +/** Available only on secure context. */ interface AuthenticatorAttestationResponse extends AuthenticatorResponse { readonly attestationObject: ArrayBuffer; } @@ -2261,6 +2265,7 @@ declare var AuthenticatorAttestationResponse: { new(): AuthenticatorAttestationResponse; }; +/** Available only on secure context. */ interface AuthenticatorResponse { readonly clientDataJSON: ArrayBuffer; } @@ -2284,6 +2289,7 @@ interface BaseAudioContextEventMap { } interface BaseAudioContext extends EventTarget { + /** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ interface CacheStorage { delete(cacheName: string): Promise; has(cacheName: string): Promise; @@ -3437,6 +3449,7 @@ interface ChildNode extends Node { interface ClientRect extends DOMRect { } +/** Available only on secure context. */ interface Clipboard extends EventTarget { read(): Promise; readText(): Promise; @@ -3540,6 +3553,7 @@ declare var CountQueuingStrategy: { new(init: QueuingStrategyInit): CountQueuingStrategy; }; +/** Available only on secure context. */ interface Credential { readonly id: string; readonly type: string; @@ -3550,6 +3564,7 @@ declare var Credential: { new(): Credential; }; +/** Available only on secure context. */ 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 on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. */ interface DeviceMotionEventAcceleration { readonly x: number | null; readonly y: number | null; readonly z: number | null; } +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ interface GamepadEvent extends Event { readonly gamepad: Gamepad; } @@ -5250,6 +5286,7 @@ declare var Geolocation: { new(): Geolocation; }; +/** Available only on secure context. */ interface GeolocationCoordinates { readonly accuracy: number; readonly altitude: number | null; @@ -5265,6 +5302,7 @@ declare var GeolocationCoordinates: { new(): GeolocationCoordinates; }; +/** Available only on secure context. */ 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 on secure context. */ 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 on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. */ readonly clipboard: Clipboard; + /** Available only on secure context. */ readonly credentials: CredentialsContainer; readonly doNotTrack: string | null; readonly geolocation: Geolocation; readonly maxTouchPoints: number; readonly mediaCapabilities: MediaCapabilities; + /** Available only on secure context. */ readonly mediaDevices: MediaDevices; readonly mediaSession: MediaSession; readonly permissions: Permissions; + /** Available only on secure context. */ readonly serviceWorker: ServiceWorkerContainer; + /** Available only on secure context. */ canShare(data?: ShareData): boolean; getGamepads(): (Gamepad | null)[]; + /** Available only on secure context. */ requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise; sendBeacon(url: string | URL, data?: BodyInit | null): boolean; + /** Available only on secure context. */ share(data?: ShareData): Promise; vibrate(pattern: VibratePattern): boolean; } @@ -9492,6 +9560,7 @@ interface NavigatorConcurrentHardware { } interface NavigatorContentUtils { + /** Available only on secure context. */ registerProtocolHandler(scheme: string, url: string | URL): void; } @@ -9540,6 +9609,7 @@ interface NavigatorPlugins { javaEnabled(): boolean; } +/** Available only on secure context. */ interface NavigatorStorage { readonly storage: StorageManager; } @@ -9967,6 +10037,7 @@ declare var Path2D: { new(path?: Path2D | string): Path2D; }; +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. */ getCoalescedEvents(): PointerEvent[]; getPredictedEvents(): PointerEvent[]; } @@ -10463,6 +10544,7 @@ declare var PromiseRejectionEvent: { new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent; }; +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ interface PushSubscription { readonly endpoint: string; readonly options: PushSubscriptionOptions; @@ -10502,6 +10590,7 @@ declare var PushSubscription: { new(): PushSubscription; }; +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. */ 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 on secure context. + */ 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 on secure context. */ ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null; + /** Available only on secure context. */ 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 on secure context. */ 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 on secure context. */ 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 on secure context. */ declare var ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null; +/** Available only on secure context. */ 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 on secure context. */ 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..d3ab53a42 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 on secure context. */ 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..31ce3f44e 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. */ 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 on secure context. + */ interface CryptoKey { readonly algorithm: KeyAlgorithm; readonly extractable: boolean; @@ -2085,6 +2095,7 @@ interface NavigatorOnLine { readonly onLine: boolean; } +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ interface PushSubscription { readonly endpoint: string; readonly options: PushSubscriptionOptions; @@ -2429,6 +2452,7 @@ declare var PushSubscription: { new(): PushSubscription; }; +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; readonly installing: ServiceWorker | null; @@ -2669,6 +2702,7 @@ declare var ServiceWorkerRegistration: { new(): ServiceWorkerRegistration; }; +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. */ 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 on secure context. */ 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..55a8b0b35 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. */ 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 on secure context. + */ interface CryptoKey { readonly algorithm: KeyAlgorithm; readonly extractable: boolean; @@ -2005,6 +2015,7 @@ interface NavigatorOnLine { readonly onLine: boolean; } +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ interface PushSubscription { readonly endpoint: string; readonly options: PushSubscriptionOptions; @@ -2315,6 +2332,7 @@ declare var PushSubscription: { new(): PushSubscription; }; +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; readonly installing: ServiceWorker | null; @@ -2541,6 +2568,7 @@ declare var SharedWorkerGlobalScope: { new(): SharedWorkerGlobalScope; }; +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. */ 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 on secure context. */ 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..8d92ddf9f 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. */ 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 on secure context. + */ interface CryptoKey { readonly algorithm: KeyAlgorithm; readonly extractable: boolean; @@ -2137,6 +2147,7 @@ interface NavigatorOnLine { readonly onLine: boolean; } +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ interface PushSubscription { readonly endpoint: string; readonly options: PushSubscriptionOptions; @@ -2481,6 +2504,7 @@ declare var PushSubscription: { new(): PushSubscription; }; +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. + */ 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 on secure context. + */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; readonly installing: ServiceWorker | null; @@ -2742,6 +2775,7 @@ declare var SharedWorkerGlobalScope: { new(): SharedWorkerGlobalScope; }; +/** Available only on secure context. */ 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 on secure context. + */ 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 on secure context. */ 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 on secure context. */ 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..786157953 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 on secure context."); + } 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"), }; } From 9db8b4687b02e1ce17cfdfb42cd9c5ff4b35998c Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 4 Oct 2021 13:26:23 +0200 Subject: [PATCH 2/3] Update src/build/emitter.ts Co-authored-by: Orta Therox --- src/build/emitter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build/emitter.ts b/src/build/emitter.ts index 786157953..7a3e2d8e6 100644 --- a/src/build/emitter.ts +++ b/src/build/emitter.ts @@ -853,7 +853,7 @@ export function emitWebIdl( comments.push(deprecated); } if (entity.secureContext) { - comments.push("Available only on secure context."); + comments.push("Available only in secure contexts."); } if (comments.length > 1) { From 741a57d5d23d10abb14b15b77d7890b3f825f5f8 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 4 Oct 2021 13:46:21 +0200 Subject: [PATCH 3/3] suggested --- baselines/audioworklet.generated.d.ts | 2 +- baselines/dom.generated.d.ts | 122 ++++++++++++------------- baselines/dom.iterable.generated.d.ts | 2 +- baselines/serviceworker.generated.d.ts | 34 +++---- baselines/sharedworker.generated.d.ts | 30 +++--- baselines/webworker.generated.d.ts | 34 +++---- 6 files changed, 112 insertions(+), 112 deletions(-) diff --git a/baselines/audioworklet.generated.d.ts b/baselines/audioworklet.generated.d.ts index 1d90e8188..9c7b88423 100644 --- a/baselines/audioworklet.generated.d.ts +++ b/baselines/audioworklet.generated.d.ts @@ -357,7 +357,7 @@ declare var TransformStreamDefaultController: { new(): TransformStreamDefaultController; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface WorkletGlobalScope { } diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 1446336a1..46b4bc3bf 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -2214,7 +2214,7 @@ declare var AudioScheduledSourceNode: { new(): AudioScheduledSourceNode; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface AudioWorklet extends Worklet { } @@ -2227,7 +2227,7 @@ interface AudioWorkletNodeEventMap { "processorerror": Event; } -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface AudioWorkletNode extends AudioNode { onprocessorerror: ((this: AudioWorkletNode, ev: Event) => any) | null; readonly parameters: AudioParamMap; @@ -2243,7 +2243,7 @@ declare var AudioWorkletNode: { new(context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface AuthenticatorAssertionResponse extends AuthenticatorResponse { readonly authenticatorData: ArrayBuffer; readonly signature: ArrayBuffer; @@ -2255,7 +2255,7 @@ declare var AuthenticatorAssertionResponse: { new(): AuthenticatorAssertionResponse; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface AuthenticatorAttestationResponse extends AuthenticatorResponse { readonly attestationObject: ArrayBuffer; } @@ -2265,7 +2265,7 @@ declare var AuthenticatorAttestationResponse: { new(): AuthenticatorAttestationResponse; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface AuthenticatorResponse { readonly clientDataJSON: ArrayBuffer; } @@ -2289,7 +2289,7 @@ interface BaseAudioContextEventMap { } interface BaseAudioContext extends EventTarget { - /** Available only on secure context. */ + /** Available only in secure contexts. */ readonly audioWorklet: AudioWorklet; readonly currentTime: number; readonly destination: AudioDestinationNode; @@ -3197,7 +3197,7 @@ declare var 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. - * Available only on secure context. + * Available only in secure contexts. */ interface Cache { add(request: RequestInfo): Promise; @@ -3216,7 +3216,7 @@ declare var Cache: { /** * The storage for Cache objects. - * Available only on secure context. + * Available only in secure contexts. */ interface CacheStorage { delete(cacheName: string): Promise; @@ -3449,7 +3449,7 @@ interface ChildNode extends Node { interface ClientRect extends DOMRect { } -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface Clipboard extends EventTarget { read(): Promise; readText(): Promise; @@ -3553,7 +3553,7 @@ declare var CountQueuingStrategy: { new(init: QueuingStrategyInit): CountQueuingStrategy; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface Credential { readonly id: string; readonly type: string; @@ -3564,7 +3564,7 @@ declare var Credential: { new(): Credential; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface CredentialsContainer { create(options?: CredentialCreationOptions): Promise; get(options?: CredentialRequestOptions): Promise; @@ -3579,7 +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 on secure context. */ + /** Available only in secure contexts. */ readonly subtle: SubtleCrypto; getRandomValues(array: T): T; } @@ -3591,7 +3591,7 @@ declare var Crypto: { /** * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. - * Available only on secure context. + * Available only in secure contexts. */ interface CryptoKey { readonly algorithm: KeyAlgorithm; @@ -4102,7 +4102,7 @@ declare var DelayNode: { /** * The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation. - * Available only on secure context. + * Available only in secure contexts. */ interface DeviceMotionEvent extends Event { readonly acceleration: DeviceMotionEventAcceleration | null; @@ -4116,14 +4116,14 @@ declare var DeviceMotionEvent: { new(type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface DeviceMotionEventAcceleration { readonly x: number | null; readonly y: number | null; readonly z: number | null; } -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface DeviceMotionEventRotationRate { readonly alpha: number | null; readonly beta: number | null; @@ -4132,7 +4132,7 @@ interface DeviceMotionEventRotationRate { /** * The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page. - * Available only on secure context. + * Available only in secure contexts. */ interface DeviceOrientationEvent extends Event { readonly absolute: boolean; @@ -5213,7 +5213,7 @@ declare var GainNode: { /** * 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 on secure context. + * Available only in secure contexts. */ interface Gamepad { readonly axes: ReadonlyArray; @@ -5233,7 +5233,7 @@ declare var 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. - * Available only on secure context. + * Available only in secure contexts. */ interface GamepadButton { readonly pressed: boolean; @@ -5248,7 +5248,7 @@ declare var 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. - * Available only on secure context. + * Available only in secure contexts. */ interface GamepadEvent extends Event { readonly gamepad: Gamepad; @@ -5286,7 +5286,7 @@ declare var Geolocation: { new(): Geolocation; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface GeolocationCoordinates { readonly accuracy: number; readonly altitude: number | null; @@ -5302,7 +5302,7 @@ declare var GeolocationCoordinates: { new(): GeolocationCoordinates; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface GeolocationPosition { readonly coords: GeolocationCoordinates; readonly timestamp: DOMTimeStamp; @@ -6989,7 +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 on secure context. */ + /** 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; @@ -7027,7 +7027,7 @@ interface HTMLMediaElement extends HTMLElement { pause(): void; /** Loads and starts playback of a media resource. */ play(): Promise; - /** Available only on secure context. */ + /** Available only in secure contexts. */ setMediaKeys(mediaKeys: MediaKeys | null): Promise; readonly HAVE_CURRENT_DATA: number; readonly HAVE_ENOUGH_DATA: number; @@ -8858,7 +8858,7 @@ declare var MediaCapabilities: { /** * The MediaDevicesInfo interface contains information that describes a single media input or output device. - * Available only on secure context. + * Available only in secure contexts. */ interface MediaDeviceInfo { readonly deviceId: string; @@ -8879,7 +8879,7 @@ interface MediaDevicesEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface MediaDevices extends EventTarget { ondevicechange: ((this: MediaDevices, ev: Event) => any) | null; @@ -8939,7 +8939,7 @@ declare var MediaError: { /** * This EncryptedMediaExtensions API interface contains the content and related data when the content decryption module generates a message for the session. - * Available only on secure context. + * Available only in secure contexts. */ interface MediaKeyMessageEvent extends Event { readonly message: ArrayBuffer; @@ -8958,7 +8958,7 @@ interface MediaKeySessionEventMap { /** * This EncryptedMediaExtensions API interface represents a context for message exchange with a content decryption module (CDM). - * Available only on secure context. + * Available only in secure contexts. */ interface MediaKeySession extends EventTarget { readonly closed: Promise; @@ -8985,7 +8985,7 @@ declare var MediaKeySession: { /** * This EncryptedMediaExtensions API interface is a read-only map of media key statuses by key IDs. - * Available only on secure context. + * Available only in secure contexts. */ interface MediaKeyStatusMap { readonly size: number; @@ -9001,7 +9001,7 @@ declare var 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. - * Available only on secure context. + * Available only in secure contexts. */ interface MediaKeySystemAccess { readonly keySystem: string; @@ -9016,7 +9016,7 @@ declare var MediaKeySystemAccess: { /** * 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 on secure context. + * Available only in secure contexts. */ interface MediaKeys { createSession(sessionType?: MediaKeySessionType): MediaKeySession; @@ -9521,27 +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 on secure context. */ + /** Available only in secure contexts. */ readonly clipboard: Clipboard; - /** Available only on secure context. */ + /** Available only in secure contexts. */ readonly credentials: CredentialsContainer; readonly doNotTrack: string | null; readonly geolocation: Geolocation; readonly maxTouchPoints: number; readonly mediaCapabilities: MediaCapabilities; - /** Available only on secure context. */ + /** Available only in secure contexts. */ readonly mediaDevices: MediaDevices; readonly mediaSession: MediaSession; readonly permissions: Permissions; - /** Available only on secure context. */ + /** Available only in secure contexts. */ readonly serviceWorker: ServiceWorkerContainer; - /** Available only on secure context. */ + /** Available only in secure contexts. */ canShare(data?: ShareData): boolean; getGamepads(): (Gamepad | null)[]; - /** Available only on secure context. */ + /** Available only in secure contexts. */ requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): Promise; sendBeacon(url: string | URL, data?: BodyInit | null): boolean; - /** Available only on secure context. */ + /** Available only in secure contexts. */ share(data?: ShareData): Promise; vibrate(pattern: VibratePattern): boolean; } @@ -9560,7 +9560,7 @@ interface NavigatorConcurrentHardware { } interface NavigatorContentUtils { - /** Available only on secure context. */ + /** Available only in secure contexts. */ registerProtocolHandler(scheme: string, url: string | URL): void; } @@ -9609,7 +9609,7 @@ interface NavigatorPlugins { javaEnabled(): boolean; } -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface NavigatorStorage { readonly storage: StorageManager; } @@ -10037,7 +10037,7 @@ declare var Path2D: { new(path?: Path2D | string): Path2D; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface PaymentMethodChangeEvent extends PaymentRequestUpdateEvent { readonly methodDetails: any; readonly methodName: string; @@ -10054,7 +10054,7 @@ interface PaymentRequestEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface PaymentRequest extends EventTarget { readonly id: string; @@ -10075,7 +10075,7 @@ declare var PaymentRequest: { /** * This Payment Request API interface enables a web page to update the details of a PaymentRequest in response to a user action. - * Available only on secure context. + * Available only in secure contexts. */ interface PaymentRequestUpdateEvent extends Event { updateWith(detailsPromise: PaymentDetailsUpdate | PromiseLike): void; @@ -10088,7 +10088,7 @@ declare var PaymentRequestUpdateEvent: { /** * This Payment Request API interface is returned after a user selects a payment method and approves a payment request. - * Available only on secure context. + * Available only in secure contexts. */ interface PaymentResponse extends EventTarget { readonly details: any; @@ -10489,7 +10489,7 @@ interface PointerEvent extends MouseEvent { readonly tiltY: number; readonly twist: number; readonly width: number; - /** Available only on secure context. */ + /** Available only in secure contexts. */ getCoalescedEvents(): PointerEvent[]; getPredictedEvents(): PointerEvent[]; } @@ -10544,7 +10544,7 @@ declare var PromiseRejectionEvent: { new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface PublicKeyCredential extends Credential { readonly rawId: ArrayBuffer; readonly response: AuthenticatorResponse; @@ -10559,7 +10559,7 @@ declare var PublicKeyCredential: { /** * This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. - * Available only on secure context. + * Available only in secure contexts. */ interface PushManager { getSubscription(): Promise; @@ -10575,7 +10575,7 @@ declare var PushManager: { /** * This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. - * Available only on secure context. + * Available only in secure contexts. */ interface PushSubscription { readonly endpoint: string; @@ -10590,7 +10590,7 @@ declare var PushSubscription: { new(): PushSubscription; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; } @@ -12972,7 +12972,7 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorker extends EventTarget, AbstractWorker { onstatechange: ((this: ServiceWorker, ev: Event) => any) | null; @@ -12999,7 +12999,7 @@ interface ServiceWorkerContainerEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; @@ -13028,7 +13028,7 @@ interface ServiceWorkerRegistrationEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; @@ -13347,7 +13347,7 @@ declare var StorageEvent: { new(type: string, eventInitDict?: StorageEventInit): StorageEvent; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface StorageManager { estimate(): Promise; persist(): Promise; @@ -13405,7 +13405,7 @@ declare var 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). - * Available only on secure context. + * Available only in secure contexts. */ interface SubtleCrypto { decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; @@ -16116,9 +16116,9 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler readonly menubar: BarProp; name: string; readonly navigator: Navigator; - /** Available only on secure context. */ + /** Available only in secure contexts. */ ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null; - /** Available only on secure context. */ + /** Available only in secure contexts. */ ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null; /** @deprecated */ onorientationchange: ((this: Window, ev: Event) => any) | null; @@ -16266,7 +16266,7 @@ interface WindowLocalStorage { } interface WindowOrWorkerGlobalScope { - /** Available only on secure context. */ + /** Available only in secure contexts. */ readonly caches: CacheStorage; readonly crossOriginIsolated: boolean; readonly crypto: Crypto; @@ -16315,7 +16315,7 @@ declare var Worker: { new(scriptURL: string | URL, options?: WorkerOptions): Worker; }; -/** Available only on secure context. */ +/** 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. @@ -17157,9 +17157,9 @@ declare var menubar: BarProp; /** @deprecated */ declare const name: void; declare var navigator: Navigator; -/** Available only on secure context. */ +/** Available only in secure contexts. */ declare var ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null; -/** Available only on secure context. */ +/** Available only in secure contexts. */ declare var ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null; /** @deprecated */ declare var onorientationchange: ((this: Window, ev: Event) => any) | null; @@ -17540,7 +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 on secure context. */ +/** 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 d3ab53a42..4f609d3d6 100644 --- a/baselines/dom.iterable.generated.d.ts +++ b/baselines/dom.iterable.generated.d.ts @@ -135,7 +135,7 @@ interface NamedNodeMap { } interface Navigator { - /** Available only on secure context. */ + /** 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 31ce3f44e..a08a00ed5 100644 --- a/baselines/serviceworker.generated.d.ts +++ b/baselines/serviceworker.generated.d.ts @@ -743,7 +743,7 @@ declare var 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. - * Available only on secure context. + * Available only in secure contexts. */ interface Cache { add(request: RequestInfo): Promise; @@ -762,7 +762,7 @@ declare var Cache: { /** * The storage for Cache objects. - * Available only on secure context. + * Available only in secure contexts. */ interface CacheStorage { delete(cacheName: string): Promise; @@ -871,7 +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 on secure context. */ + /** Available only in secure contexts. */ readonly subtle: SubtleCrypto; getRandomValues(array: T): T; } @@ -883,7 +883,7 @@ declare var Crypto: { /** * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. - * Available only on secure context. + * Available only in secure contexts. */ interface CryptoKey { readonly algorithm: KeyAlgorithm; @@ -2095,7 +2095,7 @@ interface NavigatorOnLine { readonly onLine: boolean; } -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface NavigatorStorage { readonly storage: StorageManager; } @@ -2392,7 +2392,7 @@ declare var 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. - * Available only on secure context. + * Available only in secure contexts. */ interface PushEvent extends ExtendableEvent { readonly data: PushMessageData | null; @@ -2405,7 +2405,7 @@ declare var PushEvent: { /** * This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. - * Available only on secure context. + * Available only in secure contexts. */ interface PushManager { getSubscription(): Promise; @@ -2421,7 +2421,7 @@ declare var PushManager: { /** * This Push API interface provides methods which let you retrieve the push data sent by a server in various formats. - * Available only on secure context. + * Available only in secure contexts. */ interface PushMessageData { arrayBuffer(): ArrayBuffer; @@ -2437,7 +2437,7 @@ declare var PushMessageData: { /** * This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. - * Available only on secure context. + * Available only in secure contexts. */ interface PushSubscription { readonly endpoint: string; @@ -2452,7 +2452,7 @@ declare var PushSubscription: { new(): PushSubscription; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; } @@ -2586,7 +2586,7 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorker extends EventTarget, AbstractWorker { onstatechange: ((this: ServiceWorker, ev: Event) => any) | null; @@ -2613,7 +2613,7 @@ interface ServiceWorkerContainerEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; @@ -2677,7 +2677,7 @@ interface ServiceWorkerRegistrationEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; @@ -2702,7 +2702,7 @@ declare var ServiceWorkerRegistration: { new(): ServiceWorkerRegistration; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface StorageManager { estimate(): Promise; persisted(): Promise; @@ -2715,7 +2715,7 @@ declare var 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). - * Available only on secure context. + * Available only in secure contexts. */ interface SubtleCrypto { decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; @@ -4991,7 +4991,7 @@ declare var WindowClient: { }; interface WindowOrWorkerGlobalScope { - /** Available only on secure context. */ + /** Available only in secure contexts. */ readonly caches: CacheStorage; readonly crossOriginIsolated: boolean; readonly crypto: Crypto; @@ -5355,7 +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 on secure context. */ +/** 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 55a8b0b35..a7831745e 100644 --- a/baselines/sharedworker.generated.d.ts +++ b/baselines/sharedworker.generated.d.ts @@ -715,7 +715,7 @@ declare var 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. - * Available only on secure context. + * Available only in secure contexts. */ interface Cache { add(request: RequestInfo): Promise; @@ -734,7 +734,7 @@ declare var Cache: { /** * The storage for Cache objects. - * Available only on secure context. + * Available only in secure contexts. */ interface CacheStorage { delete(cacheName: string): Promise; @@ -815,7 +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 on secure context. */ + /** Available only in secure contexts. */ readonly subtle: SubtleCrypto; getRandomValues(array: T): T; } @@ -827,7 +827,7 @@ declare var Crypto: { /** * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. - * Available only on secure context. + * Available only in secure contexts. */ interface CryptoKey { readonly algorithm: KeyAlgorithm; @@ -2015,7 +2015,7 @@ interface NavigatorOnLine { readonly onLine: boolean; } -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface NavigatorStorage { readonly storage: StorageManager; } @@ -2301,7 +2301,7 @@ declare var PromiseRejectionEvent: { /** * This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. - * Available only on secure context. + * Available only in secure contexts. */ interface PushManager { getSubscription(): Promise; @@ -2317,7 +2317,7 @@ declare var PushManager: { /** * This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. - * Available only on secure context. + * Available only in secure contexts. */ interface PushSubscription { readonly endpoint: string; @@ -2332,7 +2332,7 @@ declare var PushSubscription: { new(): PushSubscription; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; } @@ -2466,7 +2466,7 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorker extends EventTarget, AbstractWorker { onstatechange: ((this: ServiceWorker, ev: Event) => any) | null; @@ -2493,7 +2493,7 @@ interface ServiceWorkerContainerEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; @@ -2522,7 +2522,7 @@ interface ServiceWorkerRegistrationEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; @@ -2568,7 +2568,7 @@ declare var SharedWorkerGlobalScope: { new(): SharedWorkerGlobalScope; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface StorageManager { estimate(): Promise; persisted(): Promise; @@ -2581,7 +2581,7 @@ declare var 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). - * Available only on secure context. + * Available only in secure contexts. */ interface SubtleCrypto { decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; @@ -4846,7 +4846,7 @@ declare var WebSocket: { }; interface WindowOrWorkerGlobalScope { - /** Available only on secure context. */ + /** Available only in secure contexts. */ readonly caches: CacheStorage; readonly crossOriginIsolated: boolean; readonly crypto: Crypto; @@ -5372,7 +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 on secure context. */ +/** 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 8d92ddf9f..8c0141a0f 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -754,7 +754,7 @@ declare var 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. - * Available only on secure context. + * Available only in secure contexts. */ interface Cache { add(request: RequestInfo): Promise; @@ -773,7 +773,7 @@ declare var Cache: { /** * The storage for Cache objects. - * Available only on secure context. + * Available only in secure contexts. */ interface CacheStorage { delete(cacheName: string): Promise; @@ -882,7 +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 on secure context. */ + /** Available only in secure contexts. */ readonly subtle: SubtleCrypto; getRandomValues(array: T): T; } @@ -894,7 +894,7 @@ declare var Crypto: { /** * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. - * Available only on secure context. + * Available only in secure contexts. */ interface CryptoKey { readonly algorithm: KeyAlgorithm; @@ -2147,7 +2147,7 @@ interface NavigatorOnLine { readonly onLine: boolean; } -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface NavigatorStorage { readonly storage: StorageManager; } @@ -2444,7 +2444,7 @@ declare var 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. - * Available only on secure context. + * Available only in secure contexts. */ interface PushEvent extends ExtendableEvent { readonly data: PushMessageData | null; @@ -2457,7 +2457,7 @@ declare var PushEvent: { /** * This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. - * Available only on secure context. + * Available only in secure contexts. */ interface PushManager { getSubscription(): Promise; @@ -2473,7 +2473,7 @@ declare var PushManager: { /** * This Push API interface provides methods which let you retrieve the push data sent by a server in various formats. - * Available only on secure context. + * Available only in secure contexts. */ interface PushMessageData { arrayBuffer(): ArrayBuffer; @@ -2489,7 +2489,7 @@ declare var PushMessageData: { /** * This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. - * Available only on secure context. + * Available only in secure contexts. */ interface PushSubscription { readonly endpoint: string; @@ -2504,7 +2504,7 @@ declare var PushSubscription: { new(): PushSubscription; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; } @@ -2638,7 +2638,7 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorker extends EventTarget, AbstractWorker { onstatechange: ((this: ServiceWorker, ev: Event) => any) | null; @@ -2665,7 +2665,7 @@ interface ServiceWorkerContainerEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorkerContainer extends EventTarget { readonly controller: ServiceWorker | null; @@ -2729,7 +2729,7 @@ interface ServiceWorkerRegistrationEventMap { /** * 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 on secure context. + * Available only in secure contexts. */ interface ServiceWorkerRegistration extends EventTarget { readonly active: ServiceWorker | null; @@ -2775,7 +2775,7 @@ declare var SharedWorkerGlobalScope: { new(): SharedWorkerGlobalScope; }; -/** Available only on secure context. */ +/** Available only in secure contexts. */ interface StorageManager { estimate(): Promise; persisted(): Promise; @@ -2788,7 +2788,7 @@ declare var 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). - * Available only on secure context. + * Available only in secure contexts. */ interface SubtleCrypto { decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; @@ -5066,7 +5066,7 @@ declare var WindowClient: { }; interface WindowOrWorkerGlobalScope { - /** Available only on secure context. */ + /** Available only in secure contexts. */ readonly caches: CacheStorage; readonly crossOriginIsolated: boolean; readonly crypto: Crypto; @@ -5600,7 +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 on secure context. */ +/** Available only in secure contexts. */ declare var caches: CacheStorage; declare var crossOriginIsolated: boolean; declare var crypto: Crypto;