mirror of https://github.com/nodejs/node.git
test: check that this != new.target in addon
Add two checks that are there for expository reasons as much as they are sanity checks. PR-URL: https://github.com/nodejs/node/pull/15681 Refs: https://github.com/nodejs/node-addon-api/issues/142 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>pull/15723/head
parent
c8a21436c9
commit
9e9c83ea95
|
@ -3,7 +3,11 @@
|
|||
|
||||
namespace {
|
||||
|
||||
inline void NewClass(const v8::FunctionCallbackInfo<v8::Value>&) {}
|
||||
inline void NewClass(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
// this != new.target since we are being invoked through super().
|
||||
assert(args.IsConstructCall());
|
||||
assert(!args.This()->StrictEquals(args.NewTarget()));
|
||||
}
|
||||
|
||||
inline void Initialize(v8::Local<v8::Object> binding) {
|
||||
auto isolate = binding->GetIsolate();
|
||||
|
|
Loading…
Reference in New Issue