Skip to content

Truly independent web browser

1.9 KB
Raw Blame
dictionary WebAssemblyInstantiatedSource {
    required Module module;
    required Instance instance;
};

// https://webassembly.github.io/spec/js-api/#dictdef-webassemblycompileoptions
dictionary WebAssemblyCompileOptions {
    USVString? importedStringConstants = null;
    sequence<USVString> builtins = [];
};

// https://webassembly.github.io/spec/js-api/#webassembly-namespace
// https://webassembly.github.io/spec/web-api/index.html#streaming-modules
[Exposed=*, WithInitializer, ImplementedIn=Rust]
namespace WebAssembly {
    // FIXME: Streaming APIs are supposed to be only exposed to Window, Worker

    // FIXME: Bytes should be an AllowSharedBufferSource;
    [NeedsCallerRealm] boolean validate(BufferSource bytes, optional WebAssemblyCompileOptions options = {});
    // FIXME: Bytes should be an AllowSharedBufferSource;
    [NeedsCallerRealm] Promise<Module> compile(BufferSource bytes, optional WebAssemblyCompileOptions options = {});
    [NeedsCallerRealm] Promise<Module> compileStreaming(Promise<Response> source, optional WebAssemblyCompileOptions options = {});

    // FIXME: Bytes should be an AllowSharedBufferSource;
    [NeedsCallerRealm, ImplementedAs=instantiate_bytes] Promise<WebAssemblyInstantiatedSource> instantiate(BufferSource bytes, optional object importObject, optional WebAssemblyCompileOptions options = {});
    [NeedsCallerRealm] Promise<WebAssemblyInstantiatedSource> instantiateStreaming(Promise<Response> source, optional object importObject, optional WebAssemblyCompileOptions options = {});
    // INTEROP: A Module is instantiated even with a third argument, which other implementations ignore. Overload
    //          resolution would pick the BufferSource overload for three arguments, and throw a TypeError.
    [NeedsCallerRealm, ImplementedAs=instantiate_module] Promise<Instance> instantiate(Module moduleObject, optional object importObject, optional any ignored);

    readonly attribute Tag JSTag;
};