serenity icon indicating copy to clipboard operation
serenity copied to clipboard

LibJS+LibWeb: Implement WebAssembly Native Errors

Open networkException opened this issue 2 years ago • 5 comments

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.

networkException avatar Sep 14 '22 20:09 networkException

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.

networkException avatar Sep 21 '22 21:09 networkException

You can look at how the various DOMExceptions are currently implemented, these basically follow the same concept.

looks like they're just PlatformObjects now: https://github.com/SerenityOS/serenity/blob/master/Userland/Libraries/LibWeb/DOM/DOMException.h

alimpfard avatar Sep 21 '22 21:09 alimpfard

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.

linusg avatar Sep 21 '22 21:09 linusg

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.

networkException avatar Sep 22 '22 13:09 networkException

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!

stale[bot] avatar Oct 14 '22 02:10 stale[bot]

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!

stale[bot] avatar Nov 05 '22 05:11 stale[bot]

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!

stale[bot] avatar Nov 27 '22 01:11 stale[bot]

This has conflicts.

AtkinsSJ avatar Dec 06 '22 15:12 AtkinsSJ

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!

stale[bot] avatar Dec 27 '22 18:12 stale[bot]

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!

stale[bot] avatar Jan 03 '23 21:01 stale[bot]