Skip to content

Commit

Permalink
Add augmentable PermissionNameMap
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Jun 15, 2023
1 parent 2d110ad commit ee941b3
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 25 deletions.
9 changes: 9 additions & 0 deletions baselines/audioworklet.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ interface MessageEventInit<T = any> extends EventInit {
source?: MessageEventSource | null;
}

interface PermissionNameMap {
"persistent-storage": "persistent-storage";
"screen-wake-lock": "screen-wake-lock";
"xr-spatial-tracking": "xr-spatial-tracking";
geolocation: "geolocation";
notifications: "notifications";
push: "push";
}

interface PromiseRejectionEventInit extends EventInit {
promise: Promise<any>;
reason?: any;
Expand Down
11 changes: 10 additions & 1 deletion baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,15 @@ interface PermissionDescriptor {
name: PermissionName;
}

interface PermissionNameMap {
"persistent-storage": "persistent-storage";
"screen-wake-lock": "screen-wake-lock";
"xr-spatial-tracking": "xr-spatial-tracking";
geolocation: "geolocation";
notifications: "notifications";
push: "push";
}

interface PictureInPictureEventInit extends EventInit {
pictureInPictureWindow: PictureInPictureWindow;
}
Expand Down Expand Up @@ -27977,6 +27986,7 @@ type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmap
type OnBeforeUnloadEventHandler = OnBeforeUnloadEventHandlerNonNull | null;
type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
type PerformanceEntryList = PerformanceEntry[];
type PermissionName = keyof PermissionNameMap;
type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBYOBReader;
Expand Down Expand Up @@ -28087,7 +28097,6 @@ type OscillatorType = "custom" | "sawtooth" | "sine" | "square" | "triangle";
type OverSampleType = "2x" | "4x" | "none";
type PanningModelType = "HRTF" | "equalpower";
type PaymentComplete = "fail" | "success" | "unknown";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock" | "xr-spatial-tracking";
type PermissionState = "denied" | "granted" | "prompt";
type PlaybackDirection = "alternate" | "alternate-reverse" | "normal" | "reverse";
type PositionAlignSetting = "auto" | "center" | "line-left" | "line-right";
Expand Down
11 changes: 10 additions & 1 deletion baselines/serviceworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,15 @@ interface PermissionDescriptor {
name: PermissionName;
}

interface PermissionNameMap {
"persistent-storage": "persistent-storage";
"screen-wake-lock": "screen-wake-lock";
"xr-spatial-tracking": "xr-spatial-tracking";
geolocation: "geolocation";
notifications: "notifications";
push: "push";
}

interface ProgressEventInit extends EventInit {
lengthComputable?: boolean;
loaded?: number;
Expand Down Expand Up @@ -8532,6 +8541,7 @@ type NamedCurve = string;
type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
type PerformanceEntryList = PerformanceEntry[];
type PermissionName = keyof PermissionNameMap;
type PushMessageDataInit = BufferSource | string;
type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
Expand Down Expand Up @@ -8585,7 +8595,6 @@ type MediaEncodingType = "record" | "webrtc";
type NotificationDirection = "auto" | "ltr" | "rtl";
type NotificationPermission = "default" | "denied" | "granted";
type OffscreenRenderingContextId = "2d" | "bitmaprenderer" | "webgl" | "webgl2" | "webgpu";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock" | "xr-spatial-tracking";
type PermissionState = "denied" | "granted" | "prompt";
type PredefinedColorSpace = "display-p3" | "srgb";
type PremultiplyAlpha = "default" | "none" | "premultiply";
Expand Down
11 changes: 10 additions & 1 deletion baselines/sharedworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,15 @@ interface PermissionDescriptor {
name: PermissionName;
}

interface PermissionNameMap {
"persistent-storage": "persistent-storage";
"screen-wake-lock": "screen-wake-lock";
"xr-spatial-tracking": "xr-spatial-tracking";
geolocation: "geolocation";
notifications: "notifications";
push: "push";
}

interface ProgressEventInit extends EventInit {
lengthComputable?: boolean;
loaded?: number;
Expand Down Expand Up @@ -8541,6 +8550,7 @@ type NamedCurve = string;
type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
type PerformanceEntryList = PerformanceEntry[];
type PermissionName = keyof PermissionNameMap;
type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBYOBReader;
Expand Down Expand Up @@ -8591,7 +8601,6 @@ type MediaEncodingType = "record" | "webrtc";
type NotificationDirection = "auto" | "ltr" | "rtl";
type NotificationPermission = "default" | "denied" | "granted";
type OffscreenRenderingContextId = "2d" | "bitmaprenderer" | "webgl" | "webgl2" | "webgpu";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock" | "xr-spatial-tracking";
type PermissionState = "denied" | "granted" | "prompt";
type PredefinedColorSpace = "display-p3" | "srgb";
type PremultiplyAlpha = "default" | "none" | "premultiply";
Expand Down
11 changes: 10 additions & 1 deletion baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ interface PermissionDescriptor {
name: PermissionName;
}

interface PermissionNameMap {
"persistent-storage": "persistent-storage";
"screen-wake-lock": "screen-wake-lock";
"xr-spatial-tracking": "xr-spatial-tracking";
geolocation: "geolocation";
notifications: "notifications";
push: "push";
}

interface PlaneLayout {
offset: number;
stride: number;
Expand Down Expand Up @@ -9213,6 +9222,7 @@ type NamedCurve = string;
type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext;
type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
type PerformanceEntryList = PerformanceEntry[];
type PermissionName = keyof PermissionNameMap;
type PushMessageDataInit = BufferSource | string;
type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
Expand Down Expand Up @@ -9272,7 +9282,6 @@ type MediaEncodingType = "record" | "webrtc";
type NotificationDirection = "auto" | "ltr" | "rtl";
type NotificationPermission = "default" | "denied" | "granted";
type OffscreenRenderingContextId = "2d" | "bitmaprenderer" | "webgl" | "webgl2" | "webgpu";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock" | "xr-spatial-tracking";
type PermissionState = "denied" | "granted" | "prompt";
type PredefinedColorSpace = "display-p3" | "srgb";
type PremultiplyAlpha = "default" | "none" | "premultiply";
Expand Down
73 changes: 52 additions & 21 deletions inputfiles/addedTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -331,27 +331,6 @@
"color",
"luminosity"
]
},
"PermissionName": {
"name": "PermissionName",
// This is a subset of the permissions defined in the spec:
// https://w3c.github.io/powerful-features-registry/#registry-table-of-powerful-features
// Please add a feature only when it's supported by multiple engines.
"value": [
// https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API#browser_compatibility
"geolocation",
// https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API#browser_compatibility
"notifications",
// https://developer.mozilla.org/en-US/docs/Web/API/Storage_API#browser_compatibility
"persistent-storage",
// https://developer.mozilla.org/en-US/docs/Web/API/Push_API#browser_compatibility
"push",
// https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API#browser_compatibility
"screen-wake-lock",
// WebXR is also actually Blink-only
// https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API#browser_compatibility
"xr-spatial-tracking"
]
}
}
},
Expand Down Expand Up @@ -1312,6 +1291,54 @@
}
}
}
},
// This is a subset of the permissions defined in the spec:
// https://w3c.github.io/powerful-features-registry/#registry-table-of-powerful-features
// Please add a feature only when it's supported by multiple engines.,
"PermissionNameMap": {
"name": "PermissionNameMap",
"exposed": "Window Worker Worklet",
"members": {
"member": {
// https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API#browser_compatibility
"geolocation": {
"name": "geolocation",
"overrideType": "\"geolocation\"",
"required": 1
},
// https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API#browser_compatibility
"notifications": {
"name": "notifications",
"overrideType": "\"notifications\"",
"required": 1
},
// https://developer.mozilla.org/en-US/docs/Web/API/Storage_API#browser_compatibility
"\"persistent-storage\"": {
"name": "\"persistent-storage\"",
"overrideType": "\"persistent-storage\"",
"required": 1
},
// https://developer.mozilla.org/en-US/docs/Web/API/Push_API#browser_compatibility
"push": {
"name": "push",
"overrideType": "\"push\"",
"required": 1
},
// https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API#browser_compatibility
"\"screen-wake-lock\"": {
"name": "\"screen-wake-lock\"",
"overrideType": "\"screen-wake-lock\"",
"required": 1
},
// WebXR is also actually Blink-only
// https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API#browser_compatibility
"\"xr-spatial-tracking\"": {
"name": "\"xr-spatial-tracking\"",
"overrideType": "\"xr-spatial-tracking\"",
"required": 1
}
}
}
}
}
},
Expand Down Expand Up @@ -1422,6 +1449,10 @@
{
"name": "EventListenerOrEventListenerObject",
"overrideType": "EventListener | EventListenerObject"
},
{
"name": "PermissionName",
"overrideType": "keyof PermissionNameMap"
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions inputfiles/knownTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"Keyframe",
"MutationRecordType",
"NamedCurve",
"PermissionNameMap",
"Pbkdf2Params",
"PropertyIndexedKeyframes",
"RsaHashedImportParams",
Expand Down Expand Up @@ -75,6 +76,7 @@
"ImageBitmapRenderingContextSettings",
"ImportMeta",
"NamedCurve",
"PermissionNameMap",
"Pbkdf2Params",
"RsaHashedImportParams",
"RsaHashedKeyGenParams",
Expand All @@ -86,6 +88,7 @@
],
"Worklet": [
"EventListenerOrEventListenerObject",
"PermissionNameMap",
"Transferable",
"ValueTypeMap"
]
Expand Down

0 comments on commit ee941b3

Please sign in to comment.