Skip to content

Conversation

ExE-Boss
Copy link
Contributor

@ExE-Boss ExE-Boss commented Mar 23, 2021

This makes it so that TypeErrors and Promises are created with the correct prototype chain.

Depends on:

@ExE-Boss ExE-Boss changed the title Create errors in correct realm Create Errors, Arrays and Promises in the correct realm Mar 23, 2021
@ExE-Boss ExE-Boss changed the title Create Errors, Arrays and Promises in the correct realm Create TypeErrors and Promises in the correct realm Mar 23, 2021
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this isn't technically correct (as it uses the relevant realm, not the current realm), this is an exciting step in the right direction. Although we might, at some point, have to undo this work if we do something like we talked about in jsdom/jsdom#2727, it's still worthwhile in the meantime, I think.

value,
{
context = \\"The provided value\\",
ctorRegistry = { \\"%TypeError%\\": TypeError, \\"%Number%\\": Number, \\"%Promise%\\": Promise, \\"%String%\\": String }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I think it'd be a bit more uniform for consumers if the convert algorithm took a mandatory first-parameter global, similar to create() and friends.

}

// The result is used as the `globals` property of the `options` parameter for `webidl-conversions`:
function conversionGlobalsFromCtorRegistry(ctorRegistry) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's stop storing the intrinsics under "%TypeError" and instead store them under "TypeError". Then we can get rid of this function entirely and just pass the ctorRegistry.

domenic pushed a commit that referenced this pull request Sep 12, 2021
domenic added a commit that referenced this pull request Sep 12, 2021
@domenic domenic closed this in #251 Oct 6, 2021
domenic added a commit that referenced this pull request Oct 6, 2021
Closes #242 by superseding it.

This approach moves the ctorRegistry back to being mostly for the registration of WebIDL2JS-generated constructors. We use the globalObject variable to pass to webidl-conversions and to find our Promise and TypeError constructors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants