#import <WebAssembly/Instance.idl>
#import <WebAssembly/Module.idl>

dictionary WebAssemblyInstantiatedSource {
    required Module module;
    required Instance instance;
};

// https://webassembly.github.io/spec/js-api/#webassembly-namespace
[Exposed=*, WithGCVisitor, WithFinalizer]
namespace WebAssembly {
    boolean validate(BufferSource bytes);
    Promise<Module> compile(BufferSource bytes);

    Promise<WebAssemblyInstantiatedSource> instantiate(BufferSource bytes, optional object importObject);
    Promise<Instance> instantiate(Module moduleObject, optional object importObject);
};
