mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
This web API is alternative API to `throw e`, which is why we can reuse a lot of the existing machinery. The one testcase that isn't passing yet is because it reports an empty `TypeError`. The current logic in `ErrorInfo` only retrieves the message data, but doesn't include the type of the exception. For that, we need to use `(*report)._base.errorNumber` and map that back to the original type codes. However, deferring that to a follow-up as that requires some more work in mozjs. Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
61 lines
2.2 KiB
Plaintext
61 lines
2.2 KiB
Plaintext
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
// https://html.spec.whatwg.org/multipage/#windoworworkerglobalscope
|
|
|
|
typedef (TrustedScript or DOMString or Function) TimerHandler;
|
|
|
|
[Exposed=(Window,Worker)]
|
|
interface mixin WindowOrWorkerGlobalScope {
|
|
[Replaceable] readonly attribute USVString origin;
|
|
|
|
undefined reportError(any e);
|
|
|
|
// base64 utility methods
|
|
[Throws] DOMString btoa(DOMString data);
|
|
[Throws] DOMString atob(DOMString data);
|
|
|
|
// timers
|
|
[Throws] long setTimeout(TimerHandler handler, optional long timeout = 0, any... arguments);
|
|
undefined clearTimeout(optional long handle = 0);
|
|
[Throws] long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments);
|
|
undefined clearInterval(optional long handle = 0);
|
|
|
|
// microtask queuing
|
|
undefined queueMicrotask(VoidFunction callback);
|
|
|
|
// ImageBitmap
|
|
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options = {});
|
|
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh,
|
|
optional ImageBitmapOptions options = {});
|
|
|
|
// structured cloning
|
|
[Throws]
|
|
any structuredClone(any value, optional StructuredSerializeOptions options = {});
|
|
};
|
|
|
|
// https://w3c.github.io/hr-time/#the-performance-attribute
|
|
partial interface mixin WindowOrWorkerGlobalScope {
|
|
[Replaceable]
|
|
readonly attribute Performance performance;
|
|
};
|
|
|
|
// https://w3c.github.io/webappsec-secure-contexts/#monkey-patching-global-object
|
|
partial interface mixin WindowOrWorkerGlobalScope {
|
|
readonly attribute boolean isSecureContext;
|
|
};
|
|
|
|
// https://www.w3.org/TR/trusted-types/#extensions-to-the-windoworworkerglobalscope-interface
|
|
partial interface mixin WindowOrWorkerGlobalScope {
|
|
readonly attribute TrustedTypePolicyFactory trustedTypes;
|
|
};
|
|
|
|
// https://fetch.spec.whatwg.org/#fetch-method
|
|
partial interface mixin WindowOrWorkerGlobalScope {
|
|
[NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init = {});
|
|
};
|
|
|
|
Window includes WindowOrWorkerGlobalScope;
|
|
WorkerGlobalScope includes WindowOrWorkerGlobalScope;
|