-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bugfix/Node.js 18 -> Assertion failed: (object->InternalFieldCount() > 0) #2133
Conversation
…wrap, file nan_object_wrap.h, line 32.
@zbjornson I reimplemented everything on the prototype and added some custom checks if the current |
What a pain to have to do this in every method 🥴 but this looks correct, thank you! Will review closely soon. |
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.
I read through the V8 change and this indeed seems correct.
Looks good but we can save a lot of lines with a macro (see below). I'm hoping to work on prebuilds this weekend since v18 is becoming LTS soon. If you don't have time, I might make this style change tonight (Pacific) or tomorrow.
Thanks again!
if (!Canvas::constructor.Get(info.GetIsolate())->HasInstance(info.This())) { | ||
Nan::ThrowTypeError("Method Canvas.GetType called on incompatible receiver"); | ||
return; | ||
} |
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.
We can save quite a few lines of code by doing:
#define CHECK_RECEIVER(prop) \
if (!Canvas::constructor.Get(info.GetIsolate())->HasInstance(info.This())) {
Nan::ThrowTypeError("Method " #prop " called on incompatible receiver");
return;
}
NAN_GETTER(Canvas::GetType) {
CHECK_RECEIVER(GetType)
}
Looking forward for this. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
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.
Thanks again! I'll do the macro change after merging.
* commit '4c276e07f570ee6a727f88dcc67251823895c671': fix incorrect text width with newer (1.43?) Pango fix macos CI Add canvas property to CanvasRenderingContext2D type v2.11.0 use tailored types instead of extending DOM v2.10.2 src: shorten receiver checks src: shorten copy assignment operator decl for Point Bugfix/Node.js 18 -> Assertion failed: (object->InternalFieldCount() > 0) (Automattic#2133) # Conflicts: # package.json
This PR fixes the error
Assertion failed: (object->InternalFieldCount() > 0)
when building withnode-canvas
with a Node.js version > 18