-
Notifications
You must be signed in to change notification settings - Fork 34
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
Try catch chakracore #43
Closed
gabrielschulhof
wants to merge
22
commits into
nodejs:api-prototype-chakracore-7.x
from
gabrielschulhof:try-catch-chakracore
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
768006f
Makefile: Copy instructions related to test-addons to test-addons-abi
a44e1a8
Change naming addon-abi to addons-abi
0f1df31
Apply commits f6680a0...a5e7cf7 as pertaining to test/addons-abi
b0af536
Fix the free error due to malloc in napi_get_string
sampsongao 9ace7fd
Apply commits Apply commits Apply commits db2a981...47d9a7d as pertai…
bef0dd8
Change variable name napi_env to env
sampsongao 4f7c9ce
Add tests for symbol
sampsongao 79941c7
Add more test cases to test number and modify the test format
sampsongao b239127
Replace type error throws api calls
sampsongao 993140e
Add test for testing napi_create_object
sampsongao 664015a
Add tests for object napi_get_propertynames
sampsongao e330002
modify tests for function
sampsongao 157659b
Modify tests for string
sampsongao 2d2010b
Add tests for string length
sampsongao c8e904a
Replace array get/set methods with object's
sampsongao 1c9fbe0
Cleanup code to pass lint tests
sampsongao 4233b35
Fix typo in test_object.cc
sampsongao 4ecc5ff
test: remove reference to v8 in abi version of test so it an compile
mhdawson dbb3291
Fix some inconsistency addons tests build files
sampsongao b2f08e6
src/node_jsvmapi.h: Include node.h for the CTOR definition
5cd6adc
napi: implement exception handling
0c96f22
napi: add test for exception handling implementation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.buildstamp | ||
.docbuildstamp | ||
Makefile | ||
*.Makefile | ||
*.mk | ||
gyp-mac-tool | ||
/*/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <node_jsvmapi.h> | ||
|
||
void Method(napi_env env, napi_func_cb_info info) { | ||
napi_set_return_value( | ||
env, | ||
info, | ||
napi_create_string(env, "world")); | ||
} | ||
|
||
void Init(napi_env env, napi_value exports, napi_value module) { | ||
napi_set_property(env, exports, | ||
napi_property_name(env, "hello"), | ||
napi_create_function(env, Method)); | ||
} | ||
|
||
NODE_MODULE_ABI(addon, Init) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "binding", | ||
"sources": [ "binding.cc" ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
require('../../common'); | ||
var assert = require('assert'); | ||
var addon = require('./build/Release/binding'); | ||
|
||
assert.equal(addon.hello(), 'world'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <node_jsvmapi.h> | ||
|
||
void Add(napi_env env, napi_func_cb_info info) { | ||
if (napi_get_cb_args_length(env, info) < 2) { | ||
napi_throw_type_error(env, "Wrong number of arguments"); | ||
return; | ||
} | ||
|
||
napi_value args[2]; | ||
napi_get_cb_args(env, info, args, 2); | ||
|
||
if (napi_get_type_of_value(env, args[0]) != napi_number || | ||
napi_get_type_of_value(env, args[1]) != napi_number) { | ||
napi_throw_type_error(env, "Wrong arguments"); | ||
return; | ||
} | ||
|
||
double value = napi_get_number_from_value(env, args[0]) | ||
+ napi_get_number_from_value(env, args[1]); | ||
napi_value num = napi_create_number(env, value); | ||
|
||
napi_set_return_value(env, info, num); | ||
} | ||
|
||
|
||
void Init(napi_env env, napi_value exports, napi_value module) { | ||
napi_set_property(env, exports, | ||
napi_property_name(env, "add"), | ||
napi_create_function(env, Add)); | ||
} | ||
|
||
NODE_MODULE_ABI(addon, Init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "binding", | ||
"sources": [ "binding.cc" ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
require('../../common'); | ||
var assert = require('assert'); | ||
var addon = require('./build/Release/binding'); | ||
|
||
assert.equal(addon.add(3, 5), 8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <node_jsvmapi.h> | ||
|
||
void RunCallback(napi_env env, const napi_func_cb_info info) { | ||
napi_value args[1]; | ||
napi_get_cb_args(env, info, args, 1); | ||
napi_value cb = args[0]; | ||
|
||
napi_value argv[1]; | ||
argv[0] = napi_create_string(env, "hello world"); | ||
napi_call_function(env, napi_get_global_scope(env) , cb, 1, argv); | ||
} | ||
|
||
void Init(napi_env env, napi_value exports, napi_value module) { | ||
napi_set_property(env, module, | ||
napi_property_name(env, "exports"), | ||
napi_create_function(env, RunCallback)); | ||
} | ||
|
||
NODE_MODULE_ABI(addon, Init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "binding", | ||
"sources": [ "binding.cc" ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
require('../../common'); | ||
var assert = require('assert'); | ||
var addon = require('./build/Release/binding'); | ||
|
||
addon(function(msg) { | ||
assert.equal(msg, 'hello world'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <node_jsvmapi.h> | ||
|
||
void napi_create_object(napi_env env, const napi_func_cb_info info) { | ||
napi_value args[1]; | ||
napi_get_cb_args(env, info, args, 1); | ||
|
||
napi_value obj = napi_create_object(env); | ||
napi_set_property(env, obj, napi_property_name(env, "msg"), | ||
args[0]); | ||
|
||
napi_set_return_value(env, info, obj); | ||
} | ||
|
||
void Init(napi_env env, napi_value exports, napi_value module) { | ||
napi_set_property(env, module, | ||
napi_property_name(env, "exports"), | ||
napi_create_function(env, napi_create_object)); | ||
} | ||
|
||
NODE_MODULE_ABI(addon, Init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "binding", | ||
"sources": [ "binding.cc" ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
require('../../common'); | ||
var assert = require('assert'); | ||
var addon = require('./build/Release/binding'); | ||
|
||
var obj1 = addon('hello'); | ||
var obj2 = addon('world'); | ||
assert.equal(obj1.msg + ' ' + obj2.msg, 'hello world'); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as off-topic.
Sorry, something went wrong.