Skip to content

Commit 754df2b

Browse files
author
Orta Therox
authored
Merge pull request #1175 from saschanaz/securecontext
Add comment for secure-context-only types
2 parents 96f25cf + 741a57d commit 754df2b

9 files changed

+292
-57
lines changed

baselines/audioworklet.generated.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ declare var TransformStreamDefaultController: {
357357
new(): TransformStreamDefaultController;
358358
};
359359

360+
/** Available only in secure contexts. */
360361
interface WorkletGlobalScope {
361362
}
362363

baselines/dom.generated.d.ts

Lines changed: 133 additions & 24 deletions
Large diffs are not rendered by default.

baselines/dom.iterable.generated.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ interface NamedNodeMap {
135135
}
136136

137137
interface Navigator {
138+
/** Available only in secure contexts. */
138139
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: Iterable<MediaKeySystemConfiguration>): Promise<MediaKeySystemAccess>;
139140
vibrate(pattern: Iterable<number>): boolean;
140141
}

baselines/serviceworker.generated.d.ts

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,10 @@ declare var ByteLengthQueuingStrategy: {
741741
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
742742
};
743743

744-
/** 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. */
744+
/**
745+
* 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.
746+
* Available only in secure contexts.
747+
*/
745748
interface Cache {
746749
add(request: RequestInfo): Promise<void>;
747750
addAll(requests: RequestInfo[]): Promise<void>;
@@ -757,7 +760,10 @@ declare var Cache: {
757760
new(): Cache;
758761
};
759762

760-
/** The storage for Cache objects. */
763+
/**
764+
* The storage for Cache objects.
765+
* Available only in secure contexts.
766+
*/
761767
interface CacheStorage {
762768
delete(cacheName: string): Promise<boolean>;
763769
has(cacheName: string): Promise<boolean>;
@@ -865,6 +871,7 @@ declare var CountQueuingStrategy: {
865871

866872
/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
867873
interface Crypto {
874+
/** Available only in secure contexts. */
868875
readonly subtle: SubtleCrypto;
869876
getRandomValues<T extends ArrayBufferView | null>(array: T): T;
870877
}
@@ -874,7 +881,10 @@ declare var Crypto: {
874881
new(): Crypto;
875882
};
876883

877-
/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */
884+
/**
885+
* The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
886+
* Available only in secure contexts.
887+
*/
878888
interface CryptoKey {
879889
readonly algorithm: KeyAlgorithm;
880890
readonly extractable: boolean;
@@ -2085,6 +2095,7 @@ interface NavigatorOnLine {
20852095
readonly onLine: boolean;
20862096
}
20872097

2098+
/** Available only in secure contexts. */
20882099
interface NavigatorStorage {
20892100
readonly storage: StorageManager;
20902101
}
@@ -2379,7 +2390,10 @@ declare var PromiseRejectionEvent: {
23792390
new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent;
23802391
};
23812392

2382-
/** 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. */
2393+
/**
2394+
* 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.
2395+
* Available only in secure contexts.
2396+
*/
23832397
interface PushEvent extends ExtendableEvent {
23842398
readonly data: PushMessageData | null;
23852399
}
@@ -2389,7 +2403,10 @@ declare var PushEvent: {
23892403
new(type: string, eventInitDict?: PushEventInit): PushEvent;
23902404
};
23912405

2392-
/** This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */
2406+
/**
2407+
* This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications.
2408+
* Available only in secure contexts.
2409+
*/
23932410
interface PushManager {
23942411
getSubscription(): Promise<PushSubscription | null>;
23952412
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
@@ -2402,7 +2419,10 @@ declare var PushManager: {
24022419
readonly supportedContentEncodings: ReadonlyArray<string>;
24032420
};
24042421

2405-
/** This Push API interface provides methods which let you retrieve the push data sent by a server in various formats. */
2422+
/**
2423+
* This Push API interface provides methods which let you retrieve the push data sent by a server in various formats.
2424+
* Available only in secure contexts.
2425+
*/
24062426
interface PushMessageData {
24072427
arrayBuffer(): ArrayBuffer;
24082428
blob(): Blob;
@@ -2415,7 +2435,10 @@ declare var PushMessageData: {
24152435
new(): PushMessageData;
24162436
};
24172437

2418-
/** This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. */
2438+
/**
2439+
* This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service.
2440+
* Available only in secure contexts.
2441+
*/
24192442
interface PushSubscription {
24202443
readonly endpoint: string;
24212444
readonly options: PushSubscriptionOptions;
@@ -2429,6 +2452,7 @@ declare var PushSubscription: {
24292452
new(): PushSubscription;
24302453
};
24312454

2455+
/** Available only in secure contexts. */
24322456
interface PushSubscriptionOptions {
24332457
readonly applicationServerKey: ArrayBuffer | null;
24342458
}
@@ -2560,7 +2584,10 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap {
25602584
"statechange": Event;
25612585
}
25622586

2563-
/** 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. */
2587+
/**
2588+
* 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.
2589+
* Available only in secure contexts.
2590+
*/
25642591
interface ServiceWorker extends EventTarget, AbstractWorker {
25652592
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
25662593
readonly scriptURL: string;
@@ -2584,7 +2611,10 @@ interface ServiceWorkerContainerEventMap {
25842611
"messageerror": MessageEvent;
25852612
}
25862613

2587-
/** 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. */
2614+
/**
2615+
* 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.
2616+
* Available only in secure contexts.
2617+
*/
25882618
interface ServiceWorkerContainer extends EventTarget {
25892619
readonly controller: ServiceWorker | null;
25902620
oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null;
@@ -2645,7 +2675,10 @@ interface ServiceWorkerRegistrationEventMap {
26452675
"updatefound": Event;
26462676
}
26472677

2648-
/** 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. */
2678+
/**
2679+
* 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.
2680+
* Available only in secure contexts.
2681+
*/
26492682
interface ServiceWorkerRegistration extends EventTarget {
26502683
readonly active: ServiceWorker | null;
26512684
readonly installing: ServiceWorker | null;
@@ -2669,6 +2702,7 @@ declare var ServiceWorkerRegistration: {
26692702
new(): ServiceWorkerRegistration;
26702703
};
26712704

2705+
/** Available only in secure contexts. */
26722706
interface StorageManager {
26732707
estimate(): Promise<StorageEstimate>;
26742708
persisted(): Promise<boolean>;
@@ -2679,7 +2713,10 @@ declare var StorageManager: {
26792713
new(): StorageManager;
26802714
};
26812715

2682-
/** 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). */
2716+
/**
2717+
* 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).
2718+
* Available only in secure contexts.
2719+
*/
26832720
interface SubtleCrypto {
26842721
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<any>;
26852722
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
@@ -4954,6 +4991,7 @@ declare var WindowClient: {
49544991
};
49554992

49564993
interface WindowOrWorkerGlobalScope {
4994+
/** Available only in secure contexts. */
49574995
readonly caches: CacheStorage;
49584996
readonly crossOriginIsolated: boolean;
49594997
readonly crypto: Crypto;
@@ -5317,6 +5355,7 @@ declare function importScripts(...urls: (string | URL)[]): void;
53175355
/** 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. */
53185356
declare function dispatchEvent(event: Event): boolean;
53195357
declare var fonts: FontFaceSet;
5358+
/** Available only in secure contexts. */
53205359
declare var caches: CacheStorage;
53215360
declare var crossOriginIsolated: boolean;
53225361
declare var crypto: Crypto;

baselines/sharedworker.generated.d.ts

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,10 @@ declare var ByteLengthQueuingStrategy: {
713713
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
714714
};
715715

716-
/** 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. */
716+
/**
717+
* 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.
718+
* Available only in secure contexts.
719+
*/
717720
interface Cache {
718721
add(request: RequestInfo): Promise<void>;
719722
addAll(requests: RequestInfo[]): Promise<void>;
@@ -729,7 +732,10 @@ declare var Cache: {
729732
new(): Cache;
730733
};
731734

732-
/** The storage for Cache objects. */
735+
/**
736+
* The storage for Cache objects.
737+
* Available only in secure contexts.
738+
*/
733739
interface CacheStorage {
734740
delete(cacheName: string): Promise<boolean>;
735741
has(cacheName: string): Promise<boolean>;
@@ -809,6 +815,7 @@ declare var CountQueuingStrategy: {
809815

810816
/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
811817
interface Crypto {
818+
/** Available only in secure contexts. */
812819
readonly subtle: SubtleCrypto;
813820
getRandomValues<T extends ArrayBufferView | null>(array: T): T;
814821
}
@@ -818,7 +825,10 @@ declare var Crypto: {
818825
new(): Crypto;
819826
};
820827

821-
/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */
828+
/**
829+
* The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
830+
* Available only in secure contexts.
831+
*/
822832
interface CryptoKey {
823833
readonly algorithm: KeyAlgorithm;
824834
readonly extractable: boolean;
@@ -2005,6 +2015,7 @@ interface NavigatorOnLine {
20052015
readonly onLine: boolean;
20062016
}
20072017

2018+
/** Available only in secure contexts. */
20082019
interface NavigatorStorage {
20092020
readonly storage: StorageManager;
20102021
}
@@ -2288,7 +2299,10 @@ declare var PromiseRejectionEvent: {
22882299
new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent;
22892300
};
22902301

2291-
/** This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */
2302+
/**
2303+
* This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications.
2304+
* Available only in secure contexts.
2305+
*/
22922306
interface PushManager {
22932307
getSubscription(): Promise<PushSubscription | null>;
22942308
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
@@ -2301,7 +2315,10 @@ declare var PushManager: {
23012315
readonly supportedContentEncodings: ReadonlyArray<string>;
23022316
};
23032317

2304-
/** This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. */
2318+
/**
2319+
* This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service.
2320+
* Available only in secure contexts.
2321+
*/
23052322
interface PushSubscription {
23062323
readonly endpoint: string;
23072324
readonly options: PushSubscriptionOptions;
@@ -2315,6 +2332,7 @@ declare var PushSubscription: {
23152332
new(): PushSubscription;
23162333
};
23172334

2335+
/** Available only in secure contexts. */
23182336
interface PushSubscriptionOptions {
23192337
readonly applicationServerKey: ArrayBuffer | null;
23202338
}
@@ -2446,7 +2464,10 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap {
24462464
"statechange": Event;
24472465
}
24482466

2449-
/** 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. */
2467+
/**
2468+
* 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.
2469+
* Available only in secure contexts.
2470+
*/
24502471
interface ServiceWorker extends EventTarget, AbstractWorker {
24512472
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
24522473
readonly scriptURL: string;
@@ -2470,7 +2491,10 @@ interface ServiceWorkerContainerEventMap {
24702491
"messageerror": MessageEvent;
24712492
}
24722493

2473-
/** 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. */
2494+
/**
2495+
* 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.
2496+
* Available only in secure contexts.
2497+
*/
24742498
interface ServiceWorkerContainer extends EventTarget {
24752499
readonly controller: ServiceWorker | null;
24762500
oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null;
@@ -2496,7 +2520,10 @@ interface ServiceWorkerRegistrationEventMap {
24962520
"updatefound": Event;
24972521
}
24982522

2499-
/** 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. */
2523+
/**
2524+
* 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.
2525+
* Available only in secure contexts.
2526+
*/
25002527
interface ServiceWorkerRegistration extends EventTarget {
25012528
readonly active: ServiceWorker | null;
25022529
readonly installing: ServiceWorker | null;
@@ -2541,6 +2568,7 @@ declare var SharedWorkerGlobalScope: {
25412568
new(): SharedWorkerGlobalScope;
25422569
};
25432570

2571+
/** Available only in secure contexts. */
25442572
interface StorageManager {
25452573
estimate(): Promise<StorageEstimate>;
25462574
persisted(): Promise<boolean>;
@@ -2551,7 +2579,10 @@ declare var StorageManager: {
25512579
new(): StorageManager;
25522580
};
25532581

2554-
/** 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). */
2582+
/**
2583+
* 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).
2584+
* Available only in secure contexts.
2585+
*/
25552586
interface SubtleCrypto {
25562587
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<any>;
25572588
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
@@ -4815,6 +4846,7 @@ declare var WebSocket: {
48154846
};
48164847

48174848
interface WindowOrWorkerGlobalScope {
4849+
/** Available only in secure contexts. */
48184850
readonly caches: CacheStorage;
48194851
readonly crossOriginIsolated: boolean;
48204852
readonly crypto: Crypto;
@@ -5340,6 +5372,7 @@ declare function importScripts(...urls: (string | URL)[]): void;
53405372
/** 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. */
53415373
declare function dispatchEvent(event: Event): boolean;
53425374
declare var fonts: FontFaceSet;
5375+
/** Available only in secure contexts. */
53435376
declare var caches: CacheStorage;
53445377
declare var crossOriginIsolated: boolean;
53455378
declare var crypto: Crypto;

0 commit comments

Comments
 (0)