Commit graph

28 commits

Author SHA1 Message Date
luz.paz
60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04: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
William S Fulton
59ff3e6a3a C90 fixes for Javascript JSC 2015-02-11 23:32:45 +00:00
Mathieu Monney
ecdf692fc8 Fixed JSClassRef declaration not using the static one
The class descriptor is not assigned to the static variable but to a local one, which makes the global variable unused.
2014-07-02 11:27:27 +02:00
Eric Wing
e7b20624cc JavaScriptCore: Reverted 2 of the JSValueMakeUndefined replacements because those functions are tied to JSObjectRef instead of JSValueRef. The C compiler will allow this, but C++ will reject the conversion.
It is unclear what the correct handling is for JavaScriptCore. (Nobody bothers to document this in JSCore.) Unlike our other problem where we incorrectly assume JSObjectRef when the functions want JSValueRef, this time Apple is demanding the JSObjectRef. Like our other problem, I assume it is unsafe to try to convert Undefined into a JSObjectRef.

So reverting to NULL seems like the safer bet for this specific case. Perhaps the other alternative is to return an exception object or an error object. But I would like to see JSCore document this before trying.
2014-05-26 22:35:27 +02:00
Eric Wing
f1c331f2c5 JavaScriptCore: Returning NULL for wrapper functions that expect JSValueRef may crash program.
According to this:
http://parmanoir.com/Taming_JavascriptCore_within_and_without_WebView
Returning NULL instead of an actual JSValueRef for a return value of a function could lead to crashes. I think I have seen related weirdness in the past when I failed to return a proper type to JSCore which resulted in very hard to understand behavior.

So this patch changes those return NULLs to return JSValueMakeUndefined().

I thought about JSObjectMakeError, but I don't fully understand the intent of the Error object and can't find any relevant real world examples of it being used. However, everybody seems to be using JSValueMakeUndefined().

This patch should be low impact since this is only triggered on an error condition.
2014-05-26 22:35:27 +02:00
Oliver Buchtala
fcb4833660 JavascriptCore: fix cleanup code. 2014-05-18 21:27:54 +02:00
Eric Wing
b4534a481a JavaScriptCore: Bug fix for finalizer. The finalizer needs to be set on the objectDefinition, not the classDefinition. Otherwise, all the finalize callbacks get NULL back for the PrivateData and can't free the SwigPrivData, causing massive leakage. 2014-05-18 21:27:54 +02:00
Eric Wing
aa55154ccf JavaScript: Added missing static modifiers to avoid duplicate symbol problems with multiple SWIG modules. 2014-05-18 21:27:53 +02:00
William S Fulton
9587c133c5 Fix typo in Javascript exception 2014-04-19 15:55:12 +01: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
80ce36c445 Make JSC inheritance definition more robust. 2013-09-16 02:27:51 +02:00
Oliver Buchtala
be35d94fdb Add support for PackedData to Javascript generator. 2013-09-10 11:53:12 +03: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
Kota Iguchi
78a3cc9e3e Added the finalize callback (JSObjectFinalizeCallback) 2013-09-03 13:49:36 +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
Oliver Buchtala
2c4a90a37d Generate defines for initializer function. 2013-08-31 03:23:11 +02:00
Oliver Buchtala
fb9c4955fb Not a real change: removed some trailing spaces. 2013-08-31 03:23:11 +02:00
Oliver Buchtala
9d22644563 Rename a argument variable to avoid errors with overloaded functions. 2013-08-31 03:23:11 +02:00
Oliver Buchtala
86cb621466 Add comments to v8 code templates.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13829 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 01:16:42 +00:00
Oliver Buchtala
217ffb11d0 Fix regressions of latest commits.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13828 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 01:16:26 +00:00
Oliver Buchtala
131a106204 Improve names and comments of code templates for javascript emitters.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13826 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 01:15:51 +00:00
Oliver Buchtala
d13289cc91 Fix function dispatching for v8.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13812 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 01:12:18 +00:00
Oliver Buchtala
9b0c8dae83 Add argcount checking to functions and ctors.
Before argument counts were only checked for overloaded functions/ctors.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13791 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 01:06:26 +00:00
Oliver Buchtala
d5c5f7ebee Generalize ctor overloading.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13790 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 01:06:08 +00:00
Oliver Buchtala
8d72616e65 Refactor emitter and code templates to use defined template variables.
Also switched from "${...}" to $..., which is swig's common notation
of typemap variables.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13787 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 01:05:11 +00:00
Oliver Buchtala
07d5ec24ce Add support for type-based dispatching of overloaded functions.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13779 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 01:02:16 +00:00
Oliver Buchtala
050219d998 Merge branch 'devel' of https://github.com/Neha03/gsoc2012-javascript into devel
Conflicts:
	.project
	COPYRIGHT
	Doc/Manual/style.css
	Examples/Makefile.in
	Examples/test-suite/common.mk
	Lib/typemaps/strings.swg
	Makefile.in
	Source/DOH/fio.c
	Source/Makefile.am
	Source/Modules/emit.cxx
	Source/Modules/javascript.cxx
	configure.in

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13764 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 00:56:48 +00:00