Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add augmentable PermissionNameMap #1573

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 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 Down