Skip to content
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

chore: overload deprecated AccessorSignatures #943

Merged
merged 2 commits into from
Oct 10, 2022

Conversation

VerteDinde
Copy link
Contributor

AccessorSignatures was removed in https://chromium-review.googlesource.com/c/v8/v8/+/3654096 . This PR overloads the SetAccessor method, removing the default parameters, and also includes the original method with the signature param removed. This should allow older versions of Node to use signature, but fixes nan for newer versions of Node and Electron

Supersedes: #941
Fixes: #942

@kkoopa This PR attempts to address the feedback left here: #941 (comment) If this doesn't encompass what you were thinking, let me know, happy to make adjustments!

@alexciarlillo
Copy link

I am trying this out since the branch for #941 (which was working) no longer exists. I am wondering where the choice of node module version 18 comes from. I am on node 16.15.0 and trying to compile a module against electron 20 (also 16.15.0) and the version check here doesn't work for me. If I modify it to NODE_16_0_MODULE_VERSION it works as expected.

@MRayermannMSFT
Copy link

@alexciarlillo what errors did you get when trying out this branch? I got errors like

error C2665: 'v8::ObjectTemplate::SetAccessor': none of the 2 overloads could convert all the argument types

Which like you, I did not get with the changes from the previous PR.

@alexciarlillo
Copy link

I'm not sure if I got that error but IIRC I was also still getting

error: ‘AccessorSignature’ is not a member of ‘v8’

Sorry I should have kept better track and posted more details. I have just been in dependency hell for like a week trying to do an electron upgrade and my brain was a bit fried. But I can confirm this fix doesn't work for me on Node 16.15.x where the previous one did.

@sebastianrath
Copy link

Same here, it reports this one as still being used:

https://github.com/VerteDinde/nan/blob/1719071c1b74e569f7e6f57c589fc9e5020a3f6e/nan.h#L2546-L2556

    npm ERR! In file included from ../../nan/nan.h:180:
    npm ERR! ../../nan/nan_callbacks.h:55:23: error: no member named 'AccessorSignature' in namespace 'v8'
    npm ERR! typedef v8::Local<v8::AccessorSignature> Sig;
    npm ERR!                   ~~~~^
    npm ERR! In file included from ../src/functions.cpp:20:
    npm ERR! In file included from ../src/functions.h:4:
    npm ERR! ../../nan/nan.h:2546:8: error: no matching member function for call to 'SetAccessor'
    npm ERR!   tpl->SetAccessor(

Built on macOS for:
Local node: v16.15.0
Electron v19.0.15

@kkoopa
Copy link
Collaborator

kkoopa commented Sep 10, 2022

Yes, something like this was what I had in mind, API-wise.

@kkoopa
Copy link
Collaborator

kkoopa commented Sep 10, 2022

As for the AccessorSignature, having a dummy one as Data should work.

@@ -53,7 +53,9 @@ typedef void(*IndexQueryCallback)(

 namespace imp {
 #if (NODE_MODULE_VERSION < NODE_18_0_MODULE_VERSION)
-NAN_DEPRECATED typedef v8::Local<v8::AccessorSignature> Sig;
+typedef v8::Local<v8::AccessorSignature> Sig;
+#else
+typedef v8::Local<v8::Data> Sig;
 #endif

 static const int kDataIndex =                    0;

weedz added a commit to weedz/nan that referenced this pull request Sep 10, 2022
See nodejs#941

The replacement pull request, nodejs#943, does not seem to work with electron 20.
Ovenoboyo added a commit to Moosync/Moosync that referenced this pull request Sep 11, 2022
nodejs/nan#941 was closed in favor of nodejs/nan#943

Signed-off-by: Ovenoboyo <ovenoboyo@gmail.com>
@miniak
Copy link

miniak commented Sep 16, 2022

Can we expedite merging this fix and releasing a new version? We cannot build our node modules using NaN for Electron 20, which has been out for over a month

@segmentedcontrol
Copy link

@kkoopa
image

@VerteDinde
Copy link
Contributor Author

@kkoopa Done, thanks! Added the dummy sig as suggested.

@MRayermannMSFT
Copy link

@VerteDinde this branch appears to work well for me now. :)

oleavr added a commit to frida/frida-node that referenced this pull request Sep 29, 2022
- Temporarily use @frida/nan, which has nodejs/nan#943 merged.
- Move away from the deprecated Nan::SetAccessor() overload.
- Ensure `-std` is placed in the C++ flags, where it belongs, so it ends
  up *after* the `-std` flag from Electron's common.gypi.
@michalzaq12
Copy link

image

@miniak
Copy link

miniak commented Sep 30, 2022

FYI Electron 21 was released in the meantime

@devinbinnie
Copy link

Any idea when this will get merged? Trying to upgrade my app to Electron v20 and am currently blocked on this :(

@alejandroclaro
Copy link

Any update?

@alejandroclaro
Copy link

In case someone is looking for a temporal workaround: electron/electron#35193

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

I might be missing something but why replicate SetAccessor() in its entirety when the only thing that's different is the disappearance of the signature argument?

@miniak
Copy link

miniak commented Oct 10, 2022

Looks like it's faster for us to just replace the usage of NaN with pure V8 calls than to wait for the fix :(

@RaisinTen
Copy link

I might be missing something but why replicate SetAccessor() in its entirety when the only thing that's different is the disappearance of the signature argument?

@bnoordhuis I think that's because of @kkoopa's review comment in the previous PR - #941 (comment).

@kkoopa
Copy link
Collaborator

kkoopa commented Oct 10, 2022

Sorry, completely forgot about this during vacation. I'll go through it now.

@kkoopa
Copy link
Collaborator

kkoopa commented Oct 10, 2022

Yes, this looks like what I had in mind and it seems to pass the tests. I need to add some more entries to the test matrix and do some maintenance before I can push a new release. Thank you all.

@kkoopa kkoopa merged commit 888ed50 into nodejs:main Oct 10, 2022
@kkoopa
Copy link
Collaborator

kkoopa commented Oct 10, 2022

New release published. Hopefully this resolves all problems.

@segmentedcontrol
Copy link

all hail benjamin!

@MRayermannMSFT
Copy link

thanks-a-bunch-thankyou

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.

nan_callbacks.h:55:23: error: ‘AccessorSignature’ is not a member of ‘v8’