Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e3ea2a4

Browse filesBrowse files
bnoordhuisMylesBorins
authored andcommitted
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: #15681 Refs: nodejs/node-addon-api#142 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent e865fcb commit e3ea2a4
Copy full SHA for e3ea2a4

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Open diff view settings
Collapse file

‎test/addons/new-target/binding.cc‎

Copy file name to clipboardExpand all lines: test/addons/new-target/binding.cc
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
namespace {
55

6-
inline void NewClass(const v8::FunctionCallbackInfo<v8::Value>&) {}
6+
inline void NewClass(const v8::FunctionCallbackInfo<v8::Value>& args) {
7+
// this != new.target since we are being invoked through super().
8+
assert(args.IsConstructCall());
9+
assert(!args.This()->StrictEquals(args.NewTarget()));
10+
}
711

812
inline void Initialize(v8::Local<v8::Object> binding) {
913
auto isolate = binding->GetIsolate();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.