Andy Polyakov
b0c01ea851
Lib/javascript/v8: use context-aware initialization.
...
Context-aware initialization allows to instantiate add-ons multiple
times, most importantly in multiple Workers' contexts. Workers made
first appearance in v10.5. Context-aware initialization was option
earlier than that, even before supported minimum v6.x, yet condition
is chosen more conservatively as NODE_MODULE_VERSION >= 64, a.k.a.
v10.0.
2021-03-02 15:31:28 +01:00
William S Fulton
30216c4fb8
Merge branch 'js-fix-626'
...
* js-fix-626:
Added check to prevent crash on illegal constructor call
2021-02-28 22:00:55 +00:00
William S Fulton
0e36b5d6fd
Fixes for node v12.0-12.5
2021-02-27 22:18:27 +00:00
William S Fulton
7cb719ee67
-Wunused-result fixes for Node < 12
...
Fix 0533fc26c which adds in calls to Check(), which was added in Node 12.
Also fix e6315eedd which calls the new Set() and Check() method.
2021-02-27 22:17:59 +00:00
William S Fulton
0533fc26ca
Fix -Wunused-result warnings in node wrappers
2021-02-26 22:23:57 +00:00
tungpham25
36960396ba
Revert "Merge pull request #3 from tungntpham/new-node-fixes-refactor"
...
This reverts commit 35f05bd541 , reversing
changes made to 0ea6a3bdbf .
2021-01-28 21:48:45 +00:00
TungPham51D
4ce34742a7
OPTIM: Restructured the code where it checks for V8 version, removing duplicate code and potentially improving the readability.
2021-01-14 13:48:19 +00:00
Yegor Yefremov
113d78a083
Add support for Node.js v12
2020-04-07 15:23:31 +02:00
Yegor Yefremov
26fc996ad6
Replace Handle with Local depending on Node.js version
...
Use newly introduced macros like SWIGV8_VALUE to use v8::Handle or
v8::Local depending on the selected Node.js version where possible.
2020-04-07 14:13:12 +02:00
Patrick Schneider
9ce8d7e7c9
Remove warnings on Node 6.x aka V8 5.0 and 5.1
...
The proposed changes targetted at 5.2 (or 5.4 to be more precise, since there is no Node release with V8 5.2 or 5.3) work for lower versions as well and bust the deprecation warnings there.
2017-04-13 19:39:44 +02:00
Patrick Schneider
f768fd2b9d
Added check to prevent crash on illegal constructor call
...
Constructors not called as part of object instantiation (using "new" or via inheritance) will not crash the VM anymore.
2017-04-13 17:31:00 +02:00
Patrick Schneider
f08d7a63a9
Add Node 7.x aka V8 5.2+ support
...
* Use WeakCallbackInfo instead of WeakCallbackData
* Use GetPrivate instead of GetHiddenValue
* Adopted new signature for SetWeak to support destructor calling
* SetAccessor deprecation fixed
* Proper version checks where applicable
2017-04-13 15:02:53 +02:00
Olly Betts
b138f054e5
[Javascript] Fix SWIG_exception() macro ( #792 )
...
Fix SWIG_exception() macro to return from the current function.
Fixes #789 , reported by Julien Dutriaux.
2016-09-17 17:29:42 +12:00
Olly Betts
b3bedc210c
[Javascript] For v8 >= 4.3.0, use V8_MAJOR_VERSION.
...
Fixes https://github.com/swig/swig/issues/561 .
2016-01-12 09:33:13 +13:00
Richard
00457b6599
Making generated code more readable
2014-09-30 12:33:49 -03:00
Richard
0dfc1b090f
Fix duplicate symbol linker errors for Javascript/v8
2014-09-09 10:08:30 -03:00
Richard
911fd761b0
Minor improvements
2014-08-28 19:46:52 -05:00
Richard
eeb4b5497e
Fixes for v8 3.24.17 (0x032417)
2014-08-28 19:46:51 -05:00
Richard
fee5748499
Fixes for 3.23.18 (0x032318)
2014-08-28 19:46:51 -05:00
Richard
d4920591d4
Fixes for v8 3.24.3 (0x032403)
2014-08-28 19:46:51 -05:00
Richard
e0c0670540
Partially fixed for 3.25.30 (0x032530) - unfinished
2014-08-28 19:46:50 -05:00
Richard
e98a659246
Fixes for v8 3.21.17 (0x032117)
2014-08-28 19:46:50 -05:00
Richard
013fb3d22d
Fixes for v8 3.19.2 (0x031902)
2014-08-28 19:46:50 -05:00
Richard
8829230641
Fixes for v8 3.17.10 (0x031710)
2014-08-28 19:46:49 -05:00
William S Fulton
9587c133c5
Fix typo in Javascript exception
2014-04-19 15:55:12 +01:00
Oliver Buchtala
0528fd3ac3
Bugfix for Javascript generator.
2013-09-16 11:46:00 +02:00
Oliver Buchtala
1f07195812
Rearrange generation of init block to have custom init code within the initializer body.
2013-09-16 03:53:00 +02:00
Oliver Buchtala
dd84e6f9e0
Some fixes and cleanup in Javascript generator.
...
- v8 generator uses the correct mangled name for class templates
- removed symbols for template variables in favor of using the string
literals directly, as it is easier to understand when debugging.
2013-09-10 14:16:36 +03:00
Oliver Buchtala
be35d94fdb
Add support for PackedData to Javascript generator.
2013-09-10 11:53:12 +03:00
Oliver Buchtala
8408e9b193
Merge pull request #19 from whoozle/devel
...
fixed deprecation warnings for v8-3.21
2013-09-06 19:50:51 -07:00
Oliver Buchtala
29ccb270af
Renamed object provided to JS initializers.
...
JSC initializer create a new module object.
V8 initializer fill a provided 'exports' object.
2013-09-06 00:40:29 +03:00
Vladimir Menshakov
b49da78b0a
fixed deprecation warnings for v8-3.21
2013-09-05 19:50:15 +04:00
Vladimir Menshakov
2a39abebb6
moved common swig v8 definitions in javascriptruntime.swg, fixed obsoleted api calls
2013-09-04 20:10:42 +04:00
Vladimir Menshakov
b7db2a84c9
fixed return values and added missing newer v8 dtor wrapper.
2013-09-04 19:33:48 +04:00
Oliver Buchtala
14a137adca
Fix regression.
2013-09-03 06:27:14 +02:00
Oliver Buchtala
a48438c562
Better v8 version handling.
...
You should start to specify a version on command line, e.g.,
swig -javascript -v8 -DSWIG_V8_VERSION=0x032007
2013-09-03 05:39:37 +02:00
Vladimir Menshakov
cb5f4dc47e
ported to newer, more efficient v8 api
2013-08-31 05:00:32 +02:00
Oliver Buchtala
32f9cce600
Merged whoozle branch with ewmailing branch.
...
Conflicts:
Lib/javascript/v8/javascriptcode.swg
2013-08-31 03:47:43 +02:00
Oliver Buchtala
306b265af9
Merge branch 'devel' of git://github.com/oliver----/swig-v8 into devel
...
Conflicts:
Lib/javascript/v8/javascriptcode.swg
2013-08-31 03:47:08 +02:00
Eric Wing
65a0be8876
v8: variable name bug fix in my template modifications for pointers to structs.
2013-08-31 03:46:07 +02:00
Eric Wing
f8feeacb68
v8: Removed the extern "C" around the initialize function because it makes no sense since it requires a C++ templates object as a parameter.
2013-08-31 03:46:07 +02:00
Eric Wing
ed729f7d3a
This brings over the memory leak fixes for pointers to structs with a %extend destructor from my Neha fork. The generator was not generating and connecting the needed code for the requested destructor to the v8 dtor finalizer.
...
I did not realize this branch has some JavaScriptCore stuff in it too. Unfortunately, it seems to have its own unique problems (like creating C++ files when it should be generating C files). My changes are targeted for v8, and I don't think my JSCore changes fully reach in this JSCore implementation so more work would need to be done to get this branch working. I think my Neha fork is in better shape at the moment.
Also, I did port over the 'NULL out the dtor function pointer' in the %nodefaultdtor fix to v8.
Usage case:
struct MyData {
%extend {
~MyData() {
FreeData($self);
}
}
};
%newobject CreateData;
struct MyData* CreateData(void);
%delobject FreeData;
void FreeData(struct MyData* the_data);
where the use case is something like:
var my_data = example.CreateData();
my_data = null;
2013-08-31 03:46:07 +02:00
Eric Wing
d5df0bb721
Added #if defined guard for V8_3_14 to allow users from the original SWIG v8 implementation to continue using the new changes. It works similarly to the BUILDING_NODE_EXTENSION in all but two places. This define must be explicitly set by users because there is no way to auto detect. (Perhaps a command line switch can be added to generate this on request?)
2013-08-31 03:46:06 +02:00
Jason Turner
046ca7686b
Adjust for v8::Persistent API which was deprecated @ 3.19.16
...
https://groups.google.com/forum/#!topic/v8-users/oBE_DTpRC08
2013-08-31 03:46:06 +02:00
Jason Turner
cf9b7e89ac
Get memory updates working with Node.js again.
2013-08-31 03:46:06 +02:00
Oliver Buchtala
868803ce2a
Merge replayed as done by c778d16abed35829b103d607a53c8f88e3b2d595
2013-08-31 03:44:44 +02:00
Vladimir Menshakov
45bfc97ef4
converted function templates to the persistent ones (fixed crash on large wrappers)
2013-08-31 03:34:39 +02:00
Vladimir Menshakov
9111773400
generate v8-3.19.x compatible code
2013-08-31 03:34:39 +02:00
Oliver Buchtala
b511e33121
Remove std::iostream relicts from generated v8 wrapper code.
2013-08-31 03:34:38 +02:00
Oliver Buchtala
d3aa8e06fb
Bugfix: treat persistent V8 references correctly.
...
V8 is somewhat inconvenient regarding invoke of destructors for C++ proxies.
2013-08-31 03:34:38 +02:00