serenity
serenity copied to clipboard
LibJS+LibWeb: Implement WebAssembly Native Errors
This pull request adds the CompileError, RuntimeError and LinkError native errors and exposes them on the WebAssembly object.
Initially I tried defining the errors outside LibJS, this however is non trivial as both we and the spec rely (?) on intrinsics knowing about them.
Ah I wasn't aware of the strict spec isolation (but it makes a whole lot of sense obviously). Sadly I don't really know where to begin with changing the architecture to support non LibJS native errors.
You can look at how the various DOMException
s are currently implemented, these basically follow the same concept.
looks like they're just PlatformObject
s now: https://github.com/SerenityOS/serenity/blob/master/Userland/Libraries/LibWeb/DOM/DOMException.h
These are different though and explicitly not platform objects, only things defined via WebIDL are.
They implement the NativeError object structure from ES, as described in the spec I linked. You might be able to use the existing DECLARE_NATIVE_ERROR
macros for this.
Right, I tried using DECLARE_NATIVE_ERROR{,_CONSTRUCTOR,_PROTOTYPE}
initially.
However implementing ConstructorName::construct
requires ordinary_create_from_constructor
which isn't really designed to take host specific prototypes:
-
The spec defines "Assert: intrinsicDefaultProto is this specification's name of an intrinsic object" as a step and
-
we require a member of
Intrinsics
to be passed.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This has conflicts.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!