Skip to content

Conversation

@gabrielschulhof
Copy link
Contributor

Fixes: nodejs/abi-stable-node#51

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

n-api

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Sep 6, 2017
@gabrielschulhof gabrielschulhof added the node-api Issues and PRs related to the Node-API. label Sep 6, 2017
doc/api/n-api.md Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Make it clear that this is in UTF-8? Or just take a string napi_value instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe it'd be easier to take a napi_value instead.

doc/api/n-api.md Outdated
Copy link
Member

Choose a reason for hiding this comment

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

… encoded as UTF-8 and null-terminated?

Copy link
Member

Choose a reason for hiding this comment

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

don’t we technically need to free() this?

Copy link
Member

Choose a reason for hiding this comment

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

Pointer star goes with the type.

Copy link
Member

Choose a reason for hiding this comment

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

We’re inconsistent about that in this file, and I think this can pass as “idiomatic for C code”

Copy link
Member

Choose a reason for hiding this comment

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

ditto

doc/api/n-api.md Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Alphabetical order

@gabrielschulhof
Copy link
Contributor Author

gabrielschulhof commented Sep 6, 2017

Switched script parameter to napi_value, made sure that the script ->IsString(), and added a test to make sure it throws if it isn't.

@gabrielschulhof gabrielschulhof force-pushed the napi-run-script branch 2 times, most recently from 07920bb to c7d03d4 Compare September 6, 2017 12:27
Copy link
Member

@TimothyGu TimothyGu left a comment

Choose a reason for hiding this comment

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

In the future we might want to have an equivalent for V8's Script or UnboundScript, but this LGTM and should suffice for now.

doc/api/n-api.md Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid the use of you in the docs.

N-API allows the execution of a JavaScript string using the underlying JavaScript engine.

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM once comment from @jasnell is addressed

@gabrielschulhof
Copy link
Contributor Author

@jasnell I have reworded the sentence.

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

thank you!

@BridgeAR
Copy link
Member

BridgeAR commented Sep 9, 2017

@gabrielschulhof
Copy link
Contributor Author

@gabrielschulhof
Copy link
Contributor Author

@gabrielschulhof gabrielschulhof deleted the napi-run-script branch September 9, 2017 23:16
@gabrielschulhof
Copy link
Contributor Author

Landed in 61e9ba1.

@MylesBorins MylesBorins mentioned this pull request Sep 10, 2017
@digitalinfinity
Copy link
Contributor

@gabrielschulhof sorry, missed reviewing this PR. @MSLaguana and I were looking at it for implementation in node-chakracore and we had a question- if someone was debugging their script and a script executed from this API was on the stack- what is the "filename" they expect to see? Dynamic code or something equivalent? Should there be a way of modules identifying themselves to the debugger? Or should these frames be considered "library code" and hidden from the debugger?

@gabrielschulhof
Copy link
Contributor Author

gabrielschulhof commented Sep 15, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. node-api Issues and PRs related to the Node-API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NODE_EXTERN napi_value napi_run_script(napi_env e, const char *script);