LibWeb: Extract the WindowOrWorkerGlobalScope IDL mixin

`Window` itself isn't generated from an IDL file so it doesn't get to
make use of this mixin, but it ideally would do so.
This commit is contained in:
Sam Atkins 2022-07-27 20:36:21 +01:00 committed by Linus Groh
parent 899fa30bdd
commit b456adcb59
Notes: sideshowbarker 2024-07-17 08:30:36 +09:00
2 changed files with 32 additions and 9 deletions

View File

@ -0,0 +1,28 @@
// https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
interface mixin WindowOrWorkerGlobalScope {
[Replaceable] readonly attribute USVString origin;
readonly attribute boolean isSecureContext;
readonly attribute boolean crossOriginIsolated;
// FIXME: undefined reportError(any e);
// base64 utility methods
DOMString btoa(DOMString data);
ByteString atob(DOMString data);
// timers
// FIXME: long setTimeout(TimerHandler handler, optional long timeout = 0, any... arguments);
// FIXME: undefined clearTimeout(optional long id = 0);
// FIXME: long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments);
// FIXME: undefined clearInterval(optional long id = 0);
// microtask queuing
// FIXME: undefined queueMicrotask(VoidFunction callback);
// ImageBitmap
// FIXME: Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options = {});
// FIXME: Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options = {});
// structured cloning
// FIXME: any structuredClone(any value, optional StructuredSerializeOptions options = {});
};

View File

@ -1,8 +1,10 @@
#import <DOM/EventTarget.idl>
#import <DOM/EventHandler.idl>
#import <HTML/WindowOrWorkerGlobalScope.idl>
#import <HTML/WorkerLocation.idl>
#import <HTML/WorkerNavigator.idl>
// https://html.spec.whatwg.org/multipage/workers.html#workerglobalscope
[Exposed=Worker]
interface WorkerGlobalScope : EventTarget {
readonly attribute WorkerGlobalScope self;
@ -16,13 +18,6 @@ interface WorkerGlobalScope : EventTarget {
attribute EventHandler ononline;
attribute EventHandler onrejectionhandled;
attribute EventHandler onunhandledrejection;
// FIXME: These should all come from a WindowOrWorkerGlobalScope mixin
[Replaceable] readonly attribute USVString origin;
readonly attribute boolean isSecureContext;
readonly attribute boolean crossOriginIsolated;
// base64 utility methods
DOMString btoa(DOMString data);
ByteString atob(DOMString data);
};
WorkerGlobalScope includes WindowOrWorkerGlobalScope;