-
-
Notifications
You must be signed in to change notification settings - Fork 31
Create TypeError
s and Promise
s in the correct realm
#242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create TypeError
s and Promise
s in the correct realm
#242
Conversation
Error
s, Array
s and Promise
s in the correct realm
Error
s, Array
s and Promise
s in the correct realmTypeError
s and Promise
s in the correct realm
There was a problem hiding this 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 } |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
.
Closes #242 by superseding it.
Closes #242 by superseding it.
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.
This makes it so that
TypeError
s andPromise
s are created with the correct prototype chain.Depends on: