You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1854 lines
71 KiB

diff --git a/.travis.yml b/.travis.yml
index 32c6656dd2..6530d2cb5f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -89,27 +89,17 @@ matrix:
dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=javascript ENGINE=node VER=0.10
- sudo: required
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=node VER=4 CPP11=1
- sudo: required
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=node VER=6 CPP11=1
+ env: SWIGLANG=javascript ENGINE=node VER=10 CPP11=1
sudo: required
dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=javascript ENGINE=node VER=8 CPP11=1
+ env: SWIGLANG=javascript ENGINE=node VER=12 CPP11=1
sudo: required
dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=javascript ENGINE=node VER=10 CPP11=1
+ env: SWIGLANG=javascript ENGINE=node VER=13 CPP11=1
sudo: required
dist: xenial
- compiler: gcc
@@ -117,11 +107,6 @@ matrix:
env: SWIGLANG=javascript ENGINE=jsc
sudo: required
dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=v8
- sudo: required
- dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=lua
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 6fbca29db5..dadb012bf9 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -674,8 +674,8 @@ java_clean:
# create a configuration for a new example.
ROOT_DIR = @ROOT_DIR@
-JSINCLUDES = @JSCOREINC@ @JSV8INC@
-JSDYNAMICLINKING = @JSCOREDYNAMICLINKING@ @JSV8DYNAMICLINKING@
+JSINCLUDES = @JSCOREINC@
+JSDYNAMICLINKING = @JSCOREDYNAMICLINKING@
NODEJS = @NODEJS@
NODEGYP = @NODEGYP@
@@ -710,7 +710,7 @@ javascript: $(SRCDIR_SRCS) javascript_custom_interpreter
ifeq (jsc, $(ENGINE))
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(JSINCLUDES)
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
-else # (v8 | node) # v8 and node must be compiled as c++
+else # (node) # node must be compiled as c++
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(JSINCLUDES)
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
endif
@@ -759,9 +759,6 @@ ifeq (jsc, $(ENGINE))
echo "Unknown JavascriptCore version."; \
fi
endif
-ifeq (v8, $(ENGINE))
- echo "Unknown v8 version."
-endif
# -----------------------------------------------------------------
# Cleaning the Javascript examples
diff --git a/Examples/javascript/example.mk b/Examples/javascript/example.mk
index 3ef012aa82..beafd6f3fb 100644
--- a/Examples/javascript/example.mk
+++ b/Examples/javascript/example.mk
@@ -7,19 +7,13 @@ else
JSENGINE=node
endif
-ifneq (, $(V8_VERSION))
- JSV8_VERSION=$(V8_VERSION)
-else
- JSV8_VERSION=0x031110
-endif
-
EXAMPLES_TOP = ../..
SWIG_TOP = ../../..
SWIGEXE = $(SWIG_TOP)/swig
SWIG_LIB_DIR = $(SWIG_TOP)/$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = example
INTERFACE = example.i
-SWIGOPT = -$(JSENGINE) -DV8_VERSION=$(JSV8_VERSION)
+SWIGOPT = -$(JSENGINE)
check: build
$(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' JSENGINE='$(JSENGINE)' TARGET='$(TARGET)' javascript_run
diff --git a/Examples/javascript/native/example.i b/Examples/javascript/native/example.i
index 8c61600606..e94f18118b 100644
--- a/Examples/javascript/native/example.i
+++ b/Examples/javascript/native/example.i
@@ -15,7 +15,7 @@ int placeholder() { return 0; }
static SwigV8ReturnValue JavaScript_do_work(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
const int MY_MAGIC_NUMBER = 5;
- v8::Handle<v8::Value> jsresult =
+ v8::Local<v8::Value> jsresult =
SWIG_From_int(static_cast< int >(MY_MAGIC_NUMBER));
if (args.Length() != 0)
SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments.");
diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in
index 8127415f12..ce16f2ec0d 100644
--- a/Examples/test-suite/javascript/Makefile.in
+++ b/Examples/test-suite/javascript/Makefile.in
@@ -22,16 +22,8 @@ else
JSENGINE=node
endif
-ifneq (, $(V8_VERSION))
- JSV8_VERSION=$(V8_VERSION)
-else
- JSV8_VERSION=0x031110
-endif
-
include $(srcdir)/../common.mk
-SWIGOPT += -DV8_VERSION=$(JSV8_VERSION)
-
_setup = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $* (with run test)" ; \
diff --git a/Examples/test-suite/native_directive.i b/Examples/test-suite/native_directive.i
index 9ae76e0b7f..99089af507 100644
--- a/Examples/test-suite/native_directive.i
+++ b/Examples/test-suite/native_directive.i
@@ -53,7 +53,7 @@ extern "C" JNIEXPORT jint JNICALL Java_native_1directive_native_1directiveJNI_Co
static SwigV8ReturnValue JavaScript_alpha_count(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
char *arg1 = (char *)0;
int res1;
char *buf1 = 0;
diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
index c4aaf3db0c..b470e2aeeb 100644
--- a/Lib/javascript/v8/javascriptcode.swg
+++ b/Lib/javascript/v8/javascriptcode.swg
@@ -11,7 +11,7 @@
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> self = args.Holder();
+ v8::Local<v8::Object> self = args.Holder();
$jslocals
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
@@ -53,7 +53,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
OverloadErrorHandler errorHandler;
- v8::Handle<v8::Value> self;
+ v8::Local<v8::Value> self;
// switch all cases by means of series of if-returns.
$jsdispatchcases
@@ -78,7 +78,7 @@ fail:
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> self = args.Holder();
+ v8::Local<v8::Object> self = args.Holder();
$jslocals
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
@@ -103,17 +103,10 @@ fail:
%{
if(args.Length() == $jsargcount) {
errorHandler.err.Clear();
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- self = $jswrapper(args, errorHandler);
- if(errorHandler.err.IsEmpty()) {
- SWIGV8_ESCAPE(self);
- }
-#else
$jswrapper(args, errorHandler);
if(errorHandler.err.IsEmpty()) {
return;
}
-#endif
}
%}
@@ -124,23 +117,8 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment ("js_dtor", "templates")
%{
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-static void $jswrapper(v8::Persistent< v8::Value > object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
-static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) {
-#elif (V8_MAJOR_VERSION-0) < 5
-static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
- v8::Local<v8::Object> object = data.GetValue();
- SWIGV8_Proxy *proxy = data.GetParameter();
-#else
static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
-#endif
if(proxy->swigCMemOwn && proxy->swigCObject) {
#ifdef SWIGRUNTIME_DEBUG
@@ -149,20 +127,6 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
$jsfree proxy->swigCObject;
}
delete proxy;
-
-#if (V8_MAJOR_VERSION-0) < 5
- object.Clear();
-#endif
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- object.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- object.Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- object->Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 5
- object->Dispose();
-#endif
}
%}
@@ -174,40 +138,14 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
* ----------------------------------------------------------------------------- */
%fragment ("js_dtoroverride", "templates")
%{
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-static void $jswrapper(v8::Persistent<v8::Value> object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
-static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
-#elif (V8_MAJOR_VERSION-0) < 5
-static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
- v8::Local<v8::Object> object = data.GetValue();
- SWIGV8_Proxy *proxy = data.GetParameter();
-#else
static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
-#endif
if(proxy->swigCMemOwn && proxy->swigCObject) {
$jstype arg1 = ($jstype)proxy->swigCObject;
${destructor_action}
}
delete proxy;
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- object.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- object.Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- object->Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- object->Dispose();
-#elif (V8_MAJOR_VERSION-0) < 5
- object.Clear();
-#endif
}
%}
@@ -219,14 +157,10 @@ static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
* ----------------------------------------------------------------------------- */
%fragment("js_getter", "templates")
%{
-#if (V8_MAJOR_VERSION-0) < 5
-static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
-#else
static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8PropertyCallbackInfo &info) {
-#endif
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
$jslocals
$jscode
SWIGV8_RETURN_INFO(jsresult, info);
@@ -245,11 +179,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("js_setter", "templates")
%{
-#if (V8_MAJOR_VERSION-0) < 5
-static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
-#else
static void $jswrapper(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
-#endif
SWIGV8_HANDLESCOPE();
$jslocals
@@ -271,7 +201,7 @@ fail:
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
$jslocals
if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
@@ -296,7 +226,7 @@ fail:
static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
OverloadErrorHandler errorHandler;
$jscode
@@ -320,7 +250,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler
{
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
$jslocals
$jscode
SWIGV8_RETURN(jsresult);
@@ -342,17 +272,10 @@ fail:
if(args.Length() == $jsargcount) {
errorHandler.err.Clear();
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- jsresult = $jswrapper(args, errorHandler);
- if(errorHandler.err.IsEmpty()) {
- SWIGV8_ESCAPE(jsresult);
- }
-#else
$jswrapper(args, errorHandler);
if(errorHandler.err.IsEmpty()) {
return;
}
-#endif
}
%}
@@ -374,7 +297,7 @@ fail:
%fragment("jsv8_define_class_template", "templates")
%{
/* Name: $jsmangledname, Type: $jsmangledtype, Dtor: $jsdtor */
- v8::Handle<v8::FunctionTemplate> $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
+ v8::Local<v8::FunctionTemplate> $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
SWIGV8_SET_CLASS_TEMPL($jsmangledname_clientData.class_templ, $jsmangledname_class);
$jsmangledname_clientData.dtor = $jsdtor;
if (SWIGTYPE_$jsmangledtype->clientdata == 0) {
@@ -392,15 +315,11 @@ fail:
%{
if (SWIGTYPE_p$jsbaseclass->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ.IsEmpty()))
{
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- $jsmangledname_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ);
-#else
$jsmangledname_class->Inherit(
v8::Local<v8::FunctionTemplate>::New(
v8::Isolate::GetCurrent(),
static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ)
);
-#endif
#ifdef SWIGRUNTIME_DEBUG
printf("Inheritance successful $jsmangledname $jsbaseclass\n");
@@ -420,11 +339,10 @@ fail:
%fragment("jsv8_create_class_instance", "templates")
%{
/* Class: $jsname ($jsmangledname) */
- v8::Handle<v8::FunctionTemplate> $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
+ v8::Local<v8::FunctionTemplate> $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
$jsmangledname_class_0->SetCallHandler($jsctor);
$jsmangledname_class_0->Inherit($jsmangledname_class);
- $jsmangledname_class_0->SetHiddenPrototype(true);
- v8::Handle<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+ v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
%}
/* -----------------------------------------------------------------------------
@@ -435,7 +353,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_class", "templates")
%{
- $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
+ $jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
%}
/* -----------------------------------------------------------------------------
@@ -444,7 +362,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_create_namespace", "templates")
%{
- v8::Handle<v8::Object> $jsmangledname_obj = SWIGV8_OBJECT_NEW();
+ v8::Local<v8::Object> $jsmangledname_obj = SWIGV8_OBJECT_NEW();
%}
/* -----------------------------------------------------------------------------
@@ -455,7 +373,7 @@ fail:
* ----------------------------------------------------------------------------- */
%fragment("jsv8_register_namespace", "templates")
%{
- $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
+ $jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
%}
/* -----------------------------------------------------------------------------
diff --git a/Lib/javascript/v8/javascriptcomplex.swg b/Lib/javascript/v8/javascriptcomplex.swg
index d3b4aaffa6..533e548131 100644
--- a/Lib/javascript/v8/javascriptcomplex.swg
+++ b/Lib/javascript/v8/javascriptcomplex.swg
@@ -12,7 +12,7 @@
%fragment(SWIG_From_frag(Type),"header",
fragment=SWIG_From_frag(double))
{
-SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIGINTERNINLINE v8::Local<v8::Value>
SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
{
SWIGV8_HANDLESCOPE_ESC();
@@ -32,12 +32,12 @@ SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
fragment=SWIG_AsVal_frag(double))
{
SWIGINTERN int
-SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
+SWIG_AsVal_dec(Type) (v8::Local<v8::Value> o, Type* val)
{
SWIGV8_HANDLESCOPE();
if (o->IsArray()) {
- v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
+ v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(o);
if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
double re, im;
@@ -74,12 +74,12 @@ SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
%fragment(SWIG_AsVal_frag(Type),"header",
fragment=SWIG_AsVal_frag(float)) {
SWIGINTERN int
-SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
+SWIG_AsVal_dec(Type) (v8::Local<v8::Value> o, Type* val)
{
SWIGV8_HANDLESCOPE();
if (o->IsArray()) {
- v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
+ v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(o);
if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
double re, im;
diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
index 80fbd7aa1a..d722581552 100644
--- a/Lib/javascript/v8/javascripthelpers.swg
+++ b/Lib/javascript/v8/javascripthelpers.swg
@@ -1,39 +1,26 @@
%insert(runtime) %{
-// Note: since 3.19 there are new CallBack types, since 03.21.9 the old ones have been removed
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
-typedef v8::InvocationCallback SwigV8FunctionCallback;
-typedef v8::AccessorGetter SwigV8AccessorGetterCallback;
-typedef v8::AccessorSetter SwigV8AccessorSetterCallback;
-typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid;
-#elif (V8_MAJOR_VERSION-0) < 5
-typedef v8::FunctionCallback SwigV8FunctionCallback;
-typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback;
-typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback;
-typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
-#else
typedef v8::FunctionCallback SwigV8FunctionCallback;
typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback;
typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback;
typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
-#endif
/**
* Creates a class template for a class with specified initialization function.
*/
-SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
+SWIGRUNTIME v8::Local<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
SWIGV8_HANDLESCOPE_ESC();
v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
- v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
inst_templ->SetInternalFieldCount(1);
- v8::Handle<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
+ v8::Local<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals));
- v8::Handle<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
+ v8::Local<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
SWIGV8_ESCAPE(class_templ);
@@ -42,55 +29,47 @@ SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const ch
/**
* Registers a class method with given name for a given class template.
*/
-SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Local<v8::FunctionTemplate> class_templ, const char* symbol,
SwigV8FunctionCallback _func) {
- v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
+ v8::Local<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func));
}
/**
* Registers a class property with given name for a given class template.
*/
-SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Local<v8::FunctionTemplate> class_templ, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
- v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
}
/**
* Registers a class method with given name for a given object.
*/
-SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Local<v8::Object> obj, const char* symbol,
const SwigV8FunctionCallback& _func) {
- obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
+#if (NODE_MODULE_VERSION < 72)
+ obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked());
+#else
+ obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked());
+#endif
}
/**
* Registers a class method with given name for a given object.
*/
-SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Local<v8::Object> obj, const char* symbol,
SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
-#if (V8_MAJOR_VERSION-0) < 5
- obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
-#else
obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter);
-#endif
}
-#if (V8_MAJOR_VERSION-0) < 5
-SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
-#else
SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
-#endif
{
char buffer[256];
char msg[512];
int res;
-#if (V8_MAJOR_VERSION-0) < 5
- property->WriteUtf8(buffer, 256);
- res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
-#else
v8::Local<v8::String> sproperty;
if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) {
SWIGV8_WRITE_UTF8(sproperty, buffer, 256);
@@ -99,7 +78,6 @@ SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8
else {
res = -1;
}
-#endif
if(res<0) {
SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg
index 8faf2dd8e1..5f6c219dcc 100644
--- a/Lib/javascript/v8/javascriptinit.swg
+++ b/Lib/javascript/v8/javascriptinit.swg
@@ -68,16 +68,16 @@ SWIG_V8_GetModule(void *) {
// TODO: is it ok to do that?
extern "C"
#if (NODE_MODULE_VERSION < 0x000C)
-void SWIGV8_INIT (v8::Handle<v8::Object> exports)
+void SWIGV8_INIT (v8::Local<v8::Object> exports)
#else
-void SWIGV8_INIT (v8::Handle<v8::Object> exports, v8::Handle<v8::Object> /*module*/)
+void SWIGV8_INIT (v8::Local<v8::Object> exports, v8::Local<v8::Object> /*module*/)
#endif
{
SWIG_InitializeModule(static_cast<void *>(&exports));
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> exports_obj = exports;
+ v8::Local<v8::Object> exports_obj = exports;
%}
diff --git a/Lib/javascript/v8/javascriptprimtypes.swg b/Lib/javascript/v8/javascriptprimtypes.swg
index f76be983b1..41635e9d2d 100644
--- a/Lib/javascript/v8/javascriptprimtypes.swg
+++ b/Lib/javascript/v8/javascriptprimtypes.swg
@@ -6,7 +6,7 @@
%fragment(SWIG_From_frag(bool),"header") {
SWIGINTERNINLINE
-v8::Handle<v8::Value>
+v8::Local<v8::Value>
SWIG_From_dec(bool)(bool value)
{
return SWIGV8_BOOLEAN_NEW(value);
@@ -16,7 +16,7 @@ SWIG_From_dec(bool)(bool value)
%fragment(SWIG_AsVal_frag(bool),"header",
fragment=SWIG_AsVal_frag(long)) {
SWIGINTERN
-int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
+int SWIG_AsVal_dec(bool)(v8::Local<v8::Value> obj, bool *val)
{
if(!obj->IsBoolean()) {
return SWIG_ERROR;
@@ -31,7 +31,7 @@ int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
%fragment(SWIG_From_frag(int),"header") {
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
+v8::Local<v8::Value> SWIG_From_dec(int)(int value)
{
return SWIGV8_INT32_NEW(value);
}
@@ -39,7 +39,7 @@ v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
%fragment(SWIG_AsVal_frag(int),"header") {
SWIGINTERN
-int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
+int SWIG_AsVal_dec(int)(v8::Local<v8::Value> valRef, int* val)
{
if (!valRef->IsNumber()) {
return SWIG_TypeError;
@@ -54,7 +54,7 @@ int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
%fragment(SWIG_From_frag(long),"header") {
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
+v8::Local<v8::Value> SWIG_From_dec(long)(long value)
{
return SWIGV8_NUMBER_NEW(value);
}
@@ -63,7 +63,7 @@ v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
%fragment(SWIG_AsVal_frag(long),"header",
fragment="SWIG_CanCastAsInteger") {
SWIGINTERN
-int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
+int SWIG_AsVal_dec(long)(v8::Local<v8::Value> obj, long* val)
{
if (!obj->IsNumber()) {
return SWIG_TypeError;
@@ -79,7 +79,7 @@ int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
%fragment(SWIG_From_frag(unsigned long),"header",
fragment=SWIG_From_frag(long)) {
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
+v8::Local<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
{
return (value > LONG_MAX) ?
SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
@@ -89,7 +89,7 @@ v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
%fragment(SWIG_AsVal_frag(unsigned long),"header",
fragment="SWIG_CanCastAsInteger") {
SWIGINTERN
-int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
+int SWIG_AsVal_dec(unsigned long)(v8::Local<v8::Value> obj, unsigned long *val)
{
if(!obj->IsNumber()) {
return SWIG_TypeError;
@@ -115,7 +115,7 @@ int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
+v8::Local<v8::Value> SWIG_From_dec(long long)(long long value)
{
return SWIGV8_NUMBER_NEW(value);
}
@@ -128,7 +128,7 @@ v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERN
-int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
+int SWIG_AsVal_dec(long long)(v8::Local<v8::Value> obj, long long* val)
{
if (!obj->IsNumber()) {
return SWIG_TypeError;
@@ -148,7 +148,7 @@ int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERNINLINE
-v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value)
+v8::Local<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value)
{
return (value > LONG_MAX) ?
SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
@@ -162,7 +162,7 @@ v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value
fragment="SWIG_LongLongAvailable") {
%#ifdef SWIG_LONG_LONG_AVAILABLE
SWIGINTERN
-int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long long *val)
+int SWIG_AsVal_dec(unsigned long long)(v8::Local<v8::Value> obj, unsigned long long *val)
{
if(!obj->IsNumber()) {
return SWIG_TypeError;
@@ -185,7 +185,7 @@ int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long
%fragment(SWIG_From_frag(double),"header") {
SWIGINTERN
-v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
+v8::Local<v8::Value> SWIG_From_dec(double) (double val)
{
return SWIGV8_NUMBER_NEW(val);
}
@@ -193,7 +193,7 @@ v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
%fragment(SWIG_AsVal_frag(double),"header") {
SWIGINTERN
-int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
+int SWIG_AsVal_dec(double)(v8::Local<v8::Value> obj, double *val)
{
if(!obj->IsNumber()) {
return SWIG_TypeError;
@@ -203,4 +203,3 @@ int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
return SWIG_OK;
}
}
-
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
index 2452f4040d..2023d023da 100644
--- a/Lib/javascript/v8/javascriptrun.swg
+++ b/Lib/javascript/v8/javascriptrun.swg
@@ -5,70 +5,37 @@
// First v8 version that uses "SetWeak" and not "MakeWeak"
-#define SWIGV8_SETWEAK_VERSION 0x032224
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803)
-#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len)
-#else
+#if (NODE_MODULE_VERSION < 72)
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len)
+#else
+#define SWIGV8_STRING_NEW2(cstr, len) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::NewStringType::kNormal, len)).ToLocalChecked()
#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
-typedef v8::Handle<v8::Value> SwigV8ReturnValue;
-typedef v8::Arguments SwigV8Arguments;
-typedef v8::AccessorInfo SwigV8PropertyCallbackInfo;
-#define SWIGV8_RETURN(val) return scope.Close(val)
-#define SWIGV8_RETURN_INFO(val, info) return scope.Close(val)
-#else
typedef void SwigV8ReturnValue;
typedef v8::FunctionCallbackInfo<v8::Value> SwigV8Arguments;
typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_RETURN(val) args.GetReturnValue().Set(val); return
#define SWIGV8_RETURN_INFO(val, info) info.GetReturnValue().Set(val); return
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032117)
-#define SWIGV8_HANDLESCOPE() v8::HandleScope scope
-#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope
-#define SWIGV8_ESCAPE(val) return scope.Close(val)
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224)
-#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
-#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope(v8::Isolate::GetCurrent());
-#define SWIGV8_ESCAPE(val) return scope.Close(val)
-#else
#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
#define SWIGV8_HANDLESCOPE_ESC() v8::EscapableHandleScope scope(v8::Isolate::GetCurrent());
#define SWIGV8_ESCAPE(val) return scope.Escape(val)
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224)
-#define SWIGV8_ADJUST_MEMORY(size) v8::V8::AdjustAmountOfExternalAllocatedMemory(size)
-#define SWIGV8_CURRENT_CONTEXT() v8::Context::GetCurrent()
-#define SWIGV8_THROW_EXCEPTION(err) v8::ThrowException(err)
-#define SWIGV8_STRING_NEW(str) v8::String::New(str)
-#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewSymbol(sym)
+#if (NODE_MODULE_VERSION < 72)
+#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
+#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
+#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
+#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str, v8::String::kNormalString)
+#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym, v8::String::kNormalString)
#else
#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
-#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
-#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
+#define SWIGV8_STRING_NEW(str) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str, v8::NewStringType::kNormal)).ToLocalChecked()
+#define SWIGV8_SYMBOL_NEW(sym) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym, v8::NewStringType::kNormal)).ToLocalChecked()
#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
-#define SWIGV8_ARRAY_NEW() v8::Array::New()
-#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(bool)
-#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(val)
-#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(func)
-#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New()
-#define SWIGV8_INT32_NEW(num) v8::Int32::New(num)
-#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(num)
-#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(num)
-#define SWIGV8_NUMBER_NEW(num) v8::Number::New(num)
-#define SWIGV8_OBJECT_NEW() v8::Object::New()
-#define SWIGV8_UNDEFINED() v8::Undefined()
-#define SWIGV8_NULL() v8::Null()
-#else
+
#define SWIGV8_ARRAY_NEW() v8::Array::New(v8::Isolate::GetCurrent())
#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(v8::Isolate::GetCurrent(), bool)
#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(v8::Isolate::GetCurrent(), val)
@@ -81,15 +48,8 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_OBJECT_NEW() v8::Object::New(v8::Isolate::GetCurrent())
#define SWIGV8_UNDEFINED() v8::Undefined(v8::Isolate::GetCurrent())
#define SWIGV8_NULL() v8::Null(v8::Isolate::GetCurrent())
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(class);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), class);
-#else
#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class);
-#endif
#ifdef NODE_VERSION
#if NODE_VERSION_AT_LEAST(10, 12, 0)
@@ -98,23 +58,17 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#endif
//Necessary to check Node.js version because V8 API changes are backported in Node.js
-#if (defined(NODE_VERSION) && !defined(SWIG_NODE_AT_LEAST_1012)) || \
- (!defined(NODE_VERSION) && (V8_MAJOR_VERSION-0) < 7)
-#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject()
-#define SWIGV8_TO_STRING(handle) (handle)->ToString()
-#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue()
-#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue()
-#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue()
-#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(buffer, len)
-#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length()
-#else
#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
-#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
+
+#if (NODE_MODULE_VERSION < 72)
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
+#else
+#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(v8::Isolate::GetCurrent())
#endif
/* ---------------------------------------------------------------------------
@@ -163,7 +117,7 @@ public:
SWIGV8_THROW_EXCEPTION(err);
}
}
- v8::Handle<v8::Value> err;
+ v8::Local<v8::Value> err;
};
/* ---------------------------------------------------------------------------
@@ -182,23 +136,8 @@ public:
};
~SWIGV8_Proxy() {
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- handle.ClearWeak();
- handle.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- handle.ClearWeak(v8::Isolate::GetCurrent());
- handle.Dispose(v8::Isolate::GetCurrent());
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- handle.ClearWeak();
- handle.Dispose();
-#else
handle.ClearWeak();
handle.Reset();
-#endif
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- handle.Clear();
-#endif
SWIGV8_ADJUST_MEMORY(-SWIGV8_AVG_OBJ_SIZE);
}
@@ -213,32 +152,17 @@ class SWIGV8_ClientData {
public:
v8::Persistent<v8::FunctionTemplate> class_templ;
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- void (*dtor) (v8::Persistent< v8::Value> object, void *parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy);
-#elif (V8_MAJOR_VERSION-0) < 5
- void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data);
-#else
void (*dtor) (const v8::WeakCallbackInfo<SWIGV8_Proxy> &data);
-#endif
};
SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ;
-SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Local<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
SWIGV8_HANDLESCOPE();
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
- SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
-#else
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
-#endif
if(cdata == NULL) {
return SWIG_ERROR;
@@ -261,39 +185,21 @@ SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void *
}
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Persistent< v8::Value > object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Value > object, void *parameter) {
- SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
-SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) {
-#elif (V8_MAJOR_VERSION-0) < 5
-SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
- SWIGV8_Proxy *proxy = data.GetParameter();
-#else
SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
SWIGV8_Proxy *proxy = data.GetParameter();
-#endif
delete proxy;
}
-SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr) {
+SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Local<v8::Value> valRef, void **ptr) {
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
- SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
-#else
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
-#endif
if(cdata == NULL) {
return SWIG_ERROR;
@@ -304,70 +210,31 @@ SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr)
return SWIG_OK;
}
-SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Local<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
SWIGV8_Proxy *cdata = new SWIGV8_Proxy();
cdata->swigCObject = ptr;
cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
cdata->info = info;
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- obj->SetPointerInInternalField(0, cdata);
-#else
obj->SetAlignedPointerInInternalField(0, cdata);
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- cdata->handle = v8::Persistent<v8::Object>::New(obj);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj);
-#else
cdata->handle.Reset(v8::Isolate::GetCurrent(), obj);
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- // clientdata must be set for owned data as we need to register the dtor
- if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
- cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
- } else {
- cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
- }
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918)
- if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
- cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
- } else {
- cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, SWIGV8_Proxy_DefaultDtor);
- }
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
- cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
- } else {
- cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
- }
-#elif (V8_MAJOR_VERSION-0) < 5
- if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
- cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
- } else {
- cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor);
- }
-#else
if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter);
} else {
cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter);
}
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- cdata->handle.MarkIndependent();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
-#else
+#if (NODE_MODULE_VERSION < 72)
cdata->handle.MarkIndependent();
+// Looks like future versions do not require that anymore:
+// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
#endif
}
-SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Local<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
SWIGV8_HANDLESCOPE();
/* special case: JavaScript null => C NULL pointer */
@@ -378,31 +245,20 @@ SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swi
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
}
-SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
+SWIGRUNTIME v8::Local<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
SWIGV8_HANDLESCOPE_ESC();
- v8::Handle<v8::FunctionTemplate> class_templ;
+ v8::Local<v8::FunctionTemplate> class_templ;
if (ptr == NULL) {
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- SWIGV8_ESCAPE(SWIGV8_NULL());
-#else
v8::Local<v8::Primitive> result = SWIGV8_NULL();
SWIGV8_ESCAPE(result);
-#endif
}
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- if(info->clientdata != 0) {
- class_templ = ((SWIGV8_ClientData*) info->clientdata)->class_templ;
- } else {
- class_templ = SWIGV8_SWIGTYPE_Proxy_class_templ;
- }
-#else
v8::Isolate *isolate = v8::Isolate::GetCurrent();
if(info->clientdata != 0) {
@@ -410,10 +266,13 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
} else {
class_templ = v8::Local<v8::FunctionTemplate>::New(isolate, SWIGV8_SWIGTYPE_Proxy_class_templ);
}
-#endif
-// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
+#if (NODE_MODULE_VERSION < 72)
v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
+#else
+ v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
+#endif
+
SWIGV8_SetPrivateData(result, ptr, info, flags);
SWIGV8_ESCAPE(result);
@@ -433,7 +292,7 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
void *arg1 = (void *) 0 ;
void *arg2 = (void *) 0 ;
bool result;
@@ -463,7 +322,7 @@ fail:
SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Value> jsresult;
+ v8::Local<v8::Value> jsresult;
void *arg1 = (void *) 0 ;
long result;
int res1;
@@ -502,37 +361,29 @@ public:
};
SWIGRUNTIMEINLINE
-int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
+int SwigV8Packed_Check(v8::Local<v8::Value> valRef) {
SWIGV8_HANDLESCOPE();
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
if(objRef->InternalFieldCount() < 1) return false;
-#if (V8_MAJOR_VERSION-0) < 5
- v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
-#else
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
v8::Local<v8::Value> flag;
if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag))
return false;
-#endif
+
return (flag->IsBoolean() && SWIGV8_BOOLEAN_VALUE(flag));
}
SWIGRUNTIME
-swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr, size_t size) {
+swig_type_info *SwigV8Packed_UnpackData(v8::Local<v8::Value> valRef, void *ptr, size_t size) {
if (SwigV8Packed_Check(valRef)) {
SWIGV8_HANDLESCOPE();
SwigV8PackedData *sobj;
- v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
- sobj = static_cast<SwigV8PackedData*>(v8::External::Unwrap(cdataRef));
-#else
sobj = static_cast<SwigV8PackedData*>(objRef->GetAlignedPointerFromInternalField(0));
-#endif
if (sobj == NULL || sobj->size != size) return 0;
memcpy(ptr, sobj->data, size);
return sobj->type;
@@ -542,7 +393,7 @@ swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr,
}
SWIGRUNTIME
-int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
+int SWIGV8_ConvertPacked(v8::Local<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz);
if (!to) return SWIG_ERROR;
if (ty) {
@@ -555,89 +406,32 @@ int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swi
return SWIG_OK;
}
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
-SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Persistent< v8::Value > object, void *parameter) {
- SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) {
- SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
-SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) {
-#elif (V8_MAJOR_VERSION-0) < 5
-SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) {
- v8::Local<v8::Object> object = data.GetValue();
- SwigV8PackedData *cdata = data.GetParameter();
-#else
SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8PackedData> &data) {
SwigV8PackedData *cdata = data.GetParameter();
-#endif
delete cdata;
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- object.Clear();
- object.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- object.Clear();
- object.Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- object->Dispose(isolate);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- object->Dispose();
-#elif (V8_MAJOR_VERSION-0) < 5
- object.Clear();
-#endif
}
SWIGRUNTIME
-v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
+v8::Local<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
SWIGV8_HANDLESCOPE_ESC();
SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type);
-// v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW();
v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW();
-#if (V8_MAJOR_VERSION-0) < 5
- obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true));
-#else
v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true));
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
- obj->SetPointerInInternalField(0, cdata);
-#else
obj->SetAlignedPointerInInternalField(0, cdata);
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- cdata->handle = v8::Persistent<v8::Object>::New(obj);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj);
-#else
cdata->handle.Reset(v8::Isolate::GetCurrent(), obj);
-#endif
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918)
- cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete);
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
- cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
-#elif (V8_MAJOR_VERSION-0) < 5
- cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete);
-// v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete);
-#else
cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter);
-#endif
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- cdata->handle.MarkIndependent();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
- cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
-#else
+#if (NODE_MODULE_VERSION < 72)
cdata->handle.MarkIndependent();
+// Looks like future versions do not require that anymore:
+// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
#endif
SWIGV8_ESCAPE(obj);
@@ -654,22 +448,18 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
SWIGRUNTIME
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
-v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Handle<v8::Value> result, v8::Handle<v8::Value> obj) {
-#else
-v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handle<v8::Value> obj) {
-#endif
+v8::Local<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Local<v8::Value> obj) {
SWIGV8_HANDLESCOPE_ESC();
if (result->IsUndefined()) {
result = SWIGV8_ARRAY_NEW();
}
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
- v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(result);
-#else
v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(result);
-#endif
+#if (NODE_MODULE_VERSION < 72)
arr->Set(arr->Length(), obj);
+#else
+ arr->Set(SWIGV8_CURRENT_CONTEXT(), arr->Length(), obj);
+#endif
SWIGV8_ESCAPE(arr);
}
diff --git a/Lib/javascript/v8/javascriptstrings.swg b/Lib/javascript/v8/javascriptstrings.swg
index e767a6d662..61a937fa52 100644
--- a/Lib/javascript/v8/javascriptstrings.swg
+++ b/Lib/javascript/v8/javascriptstrings.swg
@@ -4,10 +4,10 @@
* ------------------------------------------------------------ */
%fragment("SWIG_AsCharPtrAndSize", "header", fragment="SWIG_pchar_descriptor") {
SWIGINTERN int
-SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
+SWIG_AsCharPtrAndSize(v8::Local<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
{
if(valRef->IsString()) {
- v8::Handle<v8::String> js_str = SWIGV8_TO_STRING(valRef);
+ v8::Local<v8::String> js_str = SWIGV8_TO_STRING(valRef);
size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1;
char* cstr = new char[len];
@@ -20,7 +20,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
return SWIG_OK;
} else {
if(valRef->IsObject()) {
- v8::Handle<v8::Object> obj = SWIGV8_TO_OBJECT(valRef);
+ v8::Local<v8::Object> obj = SWIGV8_TO_OBJECT(valRef);
// try if the object is a wrapped char[]
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
if (pchar_descriptor) {
@@ -41,7 +41,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
}
%fragment("SWIG_FromCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") {
-SWIGINTERNINLINE v8::Handle<v8::Value>
+SWIGINTERNINLINE v8::Local<v8::Value>
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
if (carray) {
@@ -49,7 +49,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
// TODO: handle extra long strings
return SWIGV8_UNDEFINED();
} else {
- v8::Handle<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
+ v8::Local<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
return js_str;
}
} else {
diff --git a/Lib/javascript/v8/javascripttypemaps.swg b/Lib/javascript/v8/javascripttypemaps.swg
index 4601698e03..fbe7849cd2 100644
--- a/Lib/javascript/v8/javascripttypemaps.swg
+++ b/Lib/javascript/v8/javascripttypemaps.swg
@@ -25,7 +25,7 @@
/* Javascript types */
-#define SWIG_Object v8::Handle<v8::Value>
+#define SWIG_Object v8::Local<v8::Value>
#define VOID_Object SWIGV8_UNDEFINED()
/* Overload of the output/constant/exception/dirout handling */
diff --git a/Tools/javascript/Makefile.in b/Tools/javascript/Makefile.in
index 5eeec07857..21088a8fad 100644
--- a/Tools/javascript/Makefile.in
+++ b/Tools/javascript/Makefile.in
@@ -3,12 +3,9 @@
# ----------------------------------------------------------------
#
# Note:
-# There is no common CLI Javascript interpreter.
-# V8 comes with one 'd8' which however does not provide a means
-# to load extensions. Therefore, by default we use nodejs as
-# environment.
-# For testing native v8 and jsc extensions we provide our own
-# interpreter (see 'Tools/javascript').
+# There is no common CLI Javascript interpreter. By default we
+# use nodejs as environment. For testing jsc extensions we
+# provide our own interpreter (see 'Tools/javascript').
#
# ----------------------------------------------------------------
all: javascript
@@ -24,37 +21,25 @@ LDFLAGS =
LINKFLAGS = @JSINTERPRETERLINKFLAGS@
ROOT_DIR = @ROOT_DIR@
-JSINCLUDES = @JSCOREINC@ @JSV8INC@
-JSDYNAMICLINKING = @JSCOREDYNAMICLINKING@ @JSV8DYNAMICLINKING@
-JSV8ENABLED = @JSV8ENABLED@
+JSINCLUDES = @JSCOREINC@
+JSDYNAMICLINKING = @JSCOREDYNAMICLINKING@
JSCENABLED = @JSCENABLED@
srcdir = @srcdir@
-
-ifneq (, $(V8_VERSION))
- JSV8_VERSION=$(V8_VERSION)
-else
- JSV8_VERSION=0x031110
-endif
-
# Regenerate Makefile if Makefile.in or config.status have changed.
Makefile: $(srcdir)/Makefile.in ../../config.status
cd ../.. && $(SHELL) ./config.status Tools/javascript/Makefile
# These settings are provided by 'configure' (see '/configure.in')
-ifeq (1, $(JSV8ENABLED))
-JS_INTERPRETER_SRC_V8 = v8_shell.cxx
-JS_INTERPRETER_ENABLE_V8 = -DENABLE_V8 -DSWIG_V8_VERSION=$(JSV8_VERSION) -DV8_DEPRECATION_WARNINGS
-endif
ifeq (1, $(JSCENABLED))
JS_INTERPRETER_SRC_JSC = jsc_shell.cxx
JS_INTERPRETER_ENABLE_JSC = -DENABLE_JSC
endif
-JS_INTERPRETER_DEFINES = $(JS_INTERPRETER_ENABLE_JSC) $(JS_INTERPRETER_ENABLE_V8)
-JS_INTERPRETER_SRC = javascript.cxx js_shell.cxx $(JS_INTERPRETER_SRC_JSC) $(JS_INTERPRETER_SRC_V8)
+JS_INTERPRETER_DEFINES = $(JS_INTERPRETER_ENABLE_JSC)
+JS_INTERPRETER_SRC = javascript.cxx js_shell.cxx $(JS_INTERPRETER_SRC_JSC)
JS_INTERPRETER_OBJS = $(JS_INTERPRETER_SRC:.cxx=.o)
diff --git a/Tools/javascript/v8_shell.cxx b/Tools/javascript/v8_shell.cxx
deleted file mode 100644
index 5001bc25a6..0000000000
--- a/Tools/javascript/v8_shell.cxx
+++ /dev/null
@@ -1,388 +0,0 @@
-#include <assert.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <v8.h>
-#include <vector>
-
-#include "js_shell.h"
-
-typedef int (*V8ExtensionInitializer) (v8::Handle<v8::Object> module);
-
-// Note: these typedefs and defines are used to deal with v8 API changes since version 3.19.00
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
-typedef v8::Handle<v8::Value> SwigV8ReturnValue;
-typedef v8::Arguments SwigV8Arguments;
-typedef v8::AccessorInfo SwigV8PropertyCallbackInfo;
-#define SWIGV8_RETURN(val) return scope.Close(val)
-#define SWIGV8_RETURN_INFO(val, info) return scope.Close(val)
-#else
-typedef void SwigV8ReturnValue;
-typedef v8::FunctionCallbackInfo<v8::Value> SwigV8Arguments;
-typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
-#define SWIGV8_RETURN(val) args.GetReturnValue().Set(val); return
-#define SWIGV8_RETURN_INFO(val, info) info.GetReturnValue().Set(val); return
-#endif
-
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032117)
-#define SWIGV8_HANDLESCOPE() v8::HandleScope scope
-#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope
-#define SWIGV8_ESCAPE(val) return scope.Close(val)
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
-#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
-#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope(v8::Isolate::GetCurrent());
-#define SWIGV8_ESCAPE(val) return scope.Close(val)
-#else
-#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent());
-#define SWIGV8_HANDLESCOPE_ESC() v8::EscapableHandleScope scope(v8::Isolate::GetCurrent());
-#define SWIGV8_ESCAPE(val) return scope.Escape(val)
-#endif
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
-#define SWIGV8_CURRENT_CONTEXT() v8::Context::GetCurrent()
-#define SWIGV8_STRING_NEW(str) v8::String::New(str)
-#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(func)
-#define SWIGV8_OBJECT_NEW() v8::Object::New()
-#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(val)
-#define SWIGV8_UNDEFINED() v8::Undefined()
-#else
-#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
-#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
-#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(v8::Isolate::GetCurrent(), func)
-#define SWIGV8_OBJECT_NEW() v8::Object::New(v8::Isolate::GetCurrent())
-#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(v8::Isolate::GetCurrent(), val)
-#define SWIGV8_UNDEFINED() v8::Undefined(v8::Isolate::GetCurrent())
-#endif
-
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
-typedef v8::Persistent<v8::Context> SwigV8Context;
-#else
-typedef v8::Local<v8::Context> SwigV8Context;
-#endif
-
-class V8Shell: public JSShell {
-
-public:
- V8Shell();
-
- virtual ~V8Shell();
-
- virtual bool RunScript(const std::string &scriptPath);
-
- virtual bool RunShell();
-
-
-protected:
-
- virtual bool InitializeEngine();
-
- virtual bool ExecuteScript(const std::string &source, const std::string &scriptPath);
-
- virtual bool DisposeEngine();
-
-private:
-
- v8::Handle<v8::Value> Import(const std::string &moduleName);
-
- SwigV8Context CreateShellContext();
-
- void ReportException(v8::TryCatch *handler);
-
- static SwigV8ReturnValue Print(const SwigV8Arguments &args);
-
- static SwigV8ReturnValue Require(const SwigV8Arguments &args);
-
- static SwigV8ReturnValue Quit(const SwigV8Arguments &args);
-
- static SwigV8ReturnValue Version(const SwigV8Arguments &args);
-
- static const char* ToCString(const v8::String::Utf8Value &value);
-
-};
-
-#ifdef __GNUC__
-#include <dlfcn.h>
-#define LOAD_SYMBOL(handle, name) dlsym(handle, name)
-#else
-#error "implement dll loading"
-#endif
-
-V8Shell::V8Shell() {}
-
-V8Shell::~V8Shell() {}
-
-bool V8Shell::RunScript(const std::string &scriptPath) {
- std::string source = ReadFile(scriptPath);
-
- v8::Isolate *isolate = v8::Isolate::New();
- v8::Isolate::Scope isolate_scope(isolate);
-
- SWIGV8_HANDLESCOPE();
-
- SwigV8Context context = CreateShellContext();
-
- if (context.IsEmpty()) {
- printf("Could not create context.\n");
- return false;
- }
-
- context->Enter();
-
- // Store a pointer to this shell for later use
-
- v8::Handle<v8::Object> global = context->Global();
- v8::Local<v8::External> __shell__ = SWIGV8_EXTERNAL_NEW((void*) (long) this);
-
- global->SetHiddenValue(SWIGV8_STRING_NEW("__shell__"), __shell__);
-
- // Node.js compatibility: make `print` available as `console.log()`
- ExecuteScript("var console = {}; console.log = print;", "<console>");
-
- bool success = ExecuteScript(source, scriptPath);
-
- // Cleanup
-
- context->Exit();
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- context.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- context.Dispose(v8::Isolate::GetCurrent());
-#else
-// context.Dispose();
-#endif
-
-// v8::V8::Dispose();
-
- return success;
-}
-
-bool V8Shell::RunShell() {
- SWIGV8_HANDLESCOPE();
-
- SwigV8Context context = CreateShellContext();
-
- if (context.IsEmpty()) {
- printf("Could not create context.\n");
- return false;
- }
-
- context->Enter();
-
- v8::Context::Scope context_scope(context);
-
- ExecuteScript("var console = {}; console.log = print;", "<console>");
-
- static const int kBufferSize = 1024;
- while (true) {
- char buffer[kBufferSize];
- printf("> ");
- char *str = fgets(buffer, kBufferSize, stdin);
- if (str == NULL) break;
- std::string source(str);
- ExecuteScript(source, "(shell)");
- }
- printf("\n");
-
- // Cleanup
-
- context->Exit();
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
- context.Dispose();
-#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- context.Dispose(v8::Isolate::GetCurrent());
-#else
-// context.Dispose();
-#endif
-
-// v8::V8::Dispose();
-
- return true;
-}
-
-
-bool V8Shell::InitializeEngine() {
- return true;
-}
-
-bool V8Shell::ExecuteScript(const std::string &source, const std::string &name) {
- SWIGV8_HANDLESCOPE();
-
- v8::TryCatch try_catch;
- v8::Handle<v8::Script> script = v8::Script::Compile(SWIGV8_STRING_NEW(source.c_str()), SWIGV8_STRING_NEW(name.c_str()));
-
- // Stop if script is empty
- if (script.IsEmpty()) {
- // Print errors that happened during compilation.
- ReportException(&try_catch);
- return false;
- }
-
- v8::Handle<v8::Value> result = script->Run();
-
- // Print errors that happened during execution.
- if (try_catch.HasCaught()) {
- ReportException(&try_catch);
- return false;
- } else {
- return true;
- }
-}
-
-bool V8Shell::DisposeEngine() {
- return true;
-}
-
-SwigV8Context V8Shell::CreateShellContext() {
- // Create a template for the global object.
- v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
-
- // Bind global functions
- global->Set(SWIGV8_STRING_NEW("print"), SWIGV8_FUNCTEMPLATE_NEW(V8Shell::Print));
- global->Set(SWIGV8_STRING_NEW("quit"), SWIGV8_FUNCTEMPLATE_NEW(V8Shell::Quit));
- global->Set(SWIGV8_STRING_NEW("require"), SWIGV8_FUNCTEMPLATE_NEW(V8Shell::Require));
- global->Set(SWIGV8_STRING_NEW("version"), SWIGV8_FUNCTEMPLATE_NEW(V8Shell::Version));
-
-#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900)
- SwigV8Context context = v8::Context::New(NULL, global);
- return context;
-#else
- SwigV8Context context = v8::Context::New(v8::Isolate::GetCurrent(), NULL, global);
- return context;
-#endif
-}
-
-v8::Handle<v8::Value> V8Shell::Import(const std::string &module_path)
-{
- SWIGV8_HANDLESCOPE_ESC();
-
- HANDLE library;
- std::string module_name = LoadModule(module_path, &library);
-
- std::string symname = std::string(module_name).append("_initialize");
-
- V8ExtensionInitializer init_function = reinterpret_cast<V8ExtensionInitializer>((long) LOAD_SYMBOL(library, symname.c_str()));
-
- if(init_function == 0) {
- printf("Could not find initializer function.");
-
- return SWIGV8_UNDEFINED();
- }
-
- v8::Local<v8::Object> module = SWIGV8_OBJECT_NEW();
- init_function(module);
-
- SWIGV8_ESCAPE(module);
-}
-
-SwigV8ReturnValue V8Shell::Print(const SwigV8Arguments &args) {
- SWIGV8_HANDLESCOPE();
-
- bool first = true;
- for (int i = 0; i < args.Length(); i++) {
-
- if (first) {
- first = false;
- } else {
- printf(" ");
- }
- v8::String::Utf8Value str(args[i]);
- const char *cstr = V8Shell::ToCString(str);
- printf("%s", cstr);
- }
- printf("\n");
- fflush(stdout);
-
- SWIGV8_RETURN(SWIGV8_UNDEFINED());
-}
-
-SwigV8ReturnValue V8Shell::Require(const SwigV8Arguments &args) {
- SWIGV8_HANDLESCOPE();
-
- if (args.Length() != 1) {
- printf("Illegal arguments for `require`");
- };
-
- v8::String::Utf8Value str(args[0]);
- const char *cstr = V8Shell::ToCString(str);
- std::string moduleName(cstr);
-
- v8::Local<v8::Object> global = SWIGV8_CURRENT_CONTEXT()->Global();
-
- v8::Local<v8::Value> hidden = global->GetHiddenValue(SWIGV8_STRING_NEW("__shell__"));
- v8::Local<v8::External> __shell__ = v8::Local<v8::External>::Cast(hidden);
- V8Shell *_this = (V8Shell *) (long) __shell__->Value();
-
- v8::Handle<v8::Value> module = _this->Import(moduleName);
-
- SWIGV8_RETURN(module);
-}
-
-SwigV8ReturnValue V8Shell::Quit(const SwigV8Arguments &args) {
- SWIGV8_HANDLESCOPE();
-
- int exit_code = args[0]->Int32Value();
- fflush(stdout);
- fflush(stderr);
- exit(exit_code);
-
- SWIGV8_RETURN(SWIGV8_UNDEFINED());
-}
-
-SwigV8ReturnValue V8Shell::Version(const SwigV8Arguments &args) {
- SWIGV8_HANDLESCOPE();
- SWIGV8_RETURN(SWIGV8_STRING_NEW(v8::V8::GetVersion()));
-}
-
-void V8Shell::ReportException(v8::TryCatch *try_catch) {
- SWIGV8_HANDLESCOPE();
-
- v8::String::Utf8Value exception(try_catch->Exception());
- const char *exception_string = V8Shell::ToCString(exception);
- v8::Handle<v8::Message> message = try_catch->Message();
- if (message.IsEmpty()) {
- // V8 didn't provide any extra information about this error; just
- // print the exception.
- printf("%s\n", exception_string);
- } else {
- // Print (filename):(line number): (message).
- v8::String::Utf8Value filename(message->GetScriptResourceName());
- const char *filename_string = V8Shell::ToCString(filename);
- int linenum = message->GetLineNumber();
- printf("%s:%i: %s\n", filename_string, linenum, exception_string);
- // Print line of source code.
- v8::String::Utf8Value sourceline(message->GetSourceLine());
- const char *sourceline_string = V8Shell::ToCString(sourceline);
- printf("%s\n", sourceline_string);
- // Print wavy underline (GetUnderline is deprecated).
- int start = message->GetStartColumn();
- for (int i = 0; i < start; i++) {
- printf(" ");
- }
- int end = message->GetEndColumn();
- for (int i = start; i < end; i++) {
- printf("^");
- }
- printf("\n");
- v8::String::Utf8Value stack_trace(try_catch->StackTrace());
- if (stack_trace.length() > 0) {
- const char *stack_trace_string = V8Shell::ToCString(stack_trace);
- printf("%s\n", stack_trace_string);
- }
- }
-}
-
-// Extracts a C string from a V8 Utf8Value.
-const char *V8Shell::ToCString(const v8::String::Utf8Value &value) {
- return *value ? *value : "<string conversion failed>";
-}
-
-JSShell *V8Shell_Create() {
- return new V8Shell();
-}
diff --git a/Tools/travis-linux-install.sh b/Tools/travis-linux-install.sh
index c8347d27a4..2427d08230 100755
--- a/Tools/travis-linux-install.sh
+++ b/Tools/travis-linux-install.sh
@@ -39,22 +39,12 @@
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
travis_retry nvm install ${VER}
nvm use ${VER}
- if [ "$VER" == "0.10" ] || [ "$VER" == "0.12" ] || [ "$VER" == "4" ] || [ "$VER" == "6" ] ; then
-# travis_retry sudo apt-get install -qq nodejs node-gyp
- travis_retry npm install -g node-gyp@$VER
- elif [ "$VER" == "8" ] ; then
- travis_retry npm install -g node-gyp@6
- else
- travis_retry npm install -g node-gyp
- fi
+ travis_retry npm install -g node-gyp
;;
"jsc")
travis_retry sudo apt-get install -qq libwebkitgtk-dev
;;
- "v8")
- travis_retry sudo apt-get install -qq libv8-dev
- ;;
- esac
+
;;
"guile")
travis_retry sudo apt-get -qq install guile-2.0-dev