Merge pull request #2409 from lissyx/electrons-6

Add ElectronJS v6.0
This commit is contained in:
lissyx 2019-10-10 14:33:34 +02:00 committed by GitHub
commit 42726b3612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 188 additions and 110 deletions

View File

@ -1,22 +1,23 @@
From cbec3f33bc1dbefc9833e721332b1ff46a801458 Mon Sep 17 00:00:00 2001 From 203493e23f55f38c35e296e4a72334e1710ed85c Mon Sep 17 00:00:00 2001
From: Alexandre Lissy <lissyx@lissyx.dyndns.org> From: Alexandre Lissy <lissyx@lissyx.dyndns.org>
Date: Thu, 25 Apr 2019 12:29:19 +0200 Date: Thu, 25 Apr 2019 12:29:19 +0200
Subject: [PATCH 1/3] Move from v8::Handle to v8::Local Subject: [PATCH] Upgrade SWIG to support NodeJS v12 / V8 v7.6 runtime
--- ---
Lib/javascript/v8/javascriptcode.swg | 22 ++++++------- Lib/javascript/v8/javascriptcode.swg | 26 ++++----
Lib/javascript/v8/javascriptcomplex.swg | 10 +++--- Lib/javascript/v8/javascriptcomplex.swg | 10 ++--
Lib/javascript/v8/javascripthelpers.swg | 20 ++++++------ Lib/javascript/v8/javascripthelpers.swg | 24 ++++----
Lib/javascript/v8/javascriptinit.swg | 4 +-- Lib/javascript/v8/javascriptinit.swg | 4 +-
Lib/javascript/v8/javascriptprimtypes.swg | 28 ++++++++--------- Lib/javascript/v8/javascriptprimtypes.swg | 28 ++++-----
Lib/javascript/v8/javascriptrun.swg | 38 +++++++++++------------ Lib/javascript/v8/javascriptrun.swg | 73 +++++++++++++++--------
Lib/javascript/v8/javascriptstrings.swg | 10 +++--- Lib/javascript/v8/javascriptruntime.swg | 4 ++
Lib/javascript/v8/javascriptstrings.swg | 10 ++--
Lib/javascript/v8/javascripttypemaps.swg | 2 +- Lib/javascript/v8/javascripttypemaps.swg | 2 +-
Tools/javascript/v8_shell.cxx | 18 +++++------ Tools/javascript/v8_shell.cxx | 18 +++---
9 files changed, 76 insertions(+), 76 deletions(-) 10 files changed, 118 insertions(+), 81 deletions(-)
diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
index c4aaf3db0..86963c1ed 100644 index c4aaf3db0..c6a813bbb 100644
--- a/Lib/javascript/v8/javascriptcode.swg --- a/Lib/javascript/v8/javascriptcode.swg
+++ b/Lib/javascript/v8/javascriptcode.swg +++ b/Lib/javascript/v8/javascriptcode.swg
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
@ -91,7 +92,7 @@ index c4aaf3db0..86963c1ed 100644
SWIGV8_SET_CLASS_TEMPL($jsmangledname_clientData.class_templ, $jsmangledname_class); SWIGV8_SET_CLASS_TEMPL($jsmangledname_clientData.class_templ, $jsmangledname_class);
$jsmangledname_clientData.dtor = $jsdtor; $jsmangledname_clientData.dtor = $jsdtor;
if (SWIGTYPE_$jsmangledtype->clientdata == 0) { if (SWIGTYPE_$jsmangledtype->clientdata == 0) {
@@ -420,11 +420,11 @@ fail: @@ -420,11 +420,15 @@ fail:
%fragment("jsv8_create_class_instance", "templates") %fragment("jsv8_create_class_instance", "templates")
%{ %{
/* Class: $jsname ($jsmangledname) */ /* Class: $jsname ($jsmangledname) */
@ -99,13 +100,17 @@ index c4aaf3db0..86963c1ed 100644
+ v8::Local<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->SetCallHandler($jsctor);
$jsmangledname_class_0->Inherit($jsmangledname_class); $jsmangledname_class_0->Inherit($jsmangledname_class);
+#if (SWIG_V8_VERSION < 0x0705)
$jsmangledname_class_0->SetHiddenPrototype(true); $jsmangledname_class_0->SetHiddenPrototype(true);
- v8::Handle<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(); - v8::Handle<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+ v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(); + v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+#else
+ v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
+#endif
%} %}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
@@ -444,7 +444,7 @@ fail: @@ -444,7 +448,7 @@ fail:
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
%fragment("jsv8_create_namespace", "templates") %fragment("jsv8_create_namespace", "templates")
%{ %{
@ -158,7 +163,7 @@ index d3b4aaffa..533e54813 100644
if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
double re, im; double re, im;
diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
index 80fbd7aa1..c610f5196 100644 index 80fbd7aa1..fa33e9762 100644
--- a/Lib/javascript/v8/javascripthelpers.swg --- a/Lib/javascript/v8/javascripthelpers.swg
+++ b/Lib/javascript/v8/javascripthelpers.swg +++ b/Lib/javascript/v8/javascripthelpers.swg
@@ -21,19 +21,19 @@ typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid; @@ -21,19 +21,19 @@ typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
@ -185,7 +190,7 @@ index 80fbd7aa1..c610f5196 100644
cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr)); cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
SWIGV8_ESCAPE(class_templ); SWIGV8_ESCAPE(class_templ);
@@ -42,25 +42,25 @@ SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const ch @@ -42,33 +42,37 @@ SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const ch
/** /**
* Registers a class method with given name for a given class template. * Registers a class method with given name for a given class template.
*/ */
@ -214,9 +219,13 @@ index 80fbd7aa1..c610f5196 100644
-SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol, -SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
+SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Local<v8::Object> obj, const char* symbol, +SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Local<v8::Object> obj, const char* symbol,
const SwigV8FunctionCallback& _func) { const SwigV8FunctionCallback& _func) {
+#if (SWIG_V8_VERSION < 0x0705)
obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction()); obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
+#else
+ obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked());
+#endif
} }
@@ -68,7 +68,7 @@ SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char
/** /**
* Registers a class method with given name for a given object. * Registers a class method with given name for a given object.
*/ */
@ -377,10 +386,66 @@ index f76be983b..24f5daf7c 100644
if(!obj->IsNumber()) { if(!obj->IsNumber()) {
return SWIG_TypeError; return SWIG_TypeError;
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
index 2452f4040..866cdb331 100644 index 2452f4040..99587943b 100644
--- a/Lib/javascript/v8/javascriptrun.swg --- a/Lib/javascript/v8/javascriptrun.swg
+++ b/Lib/javascript/v8/javascriptrun.swg +++ b/Lib/javascript/v8/javascriptrun.swg
@@ -163,7 +163,7 @@ public: @@ -10,7 +10,11 @@
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803)
#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len)
#else
+#if (SWIG_V8_VERSION < 0x0706)
#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
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
@@ -47,12 +51,18 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#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)
-#else
+#elif (SWIG_V8_VERSION < 0x0706)
#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)
+#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)).ToLocalChecked()
+#define SWIGV8_SYMBOL_NEW(sym) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)).ToLocalChecked()
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
@@ -107,7 +117,7 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#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
+#elif (SWIG_V8_VERSION < 0x0706)
#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()
@@ -115,6 +125,14 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#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())
+#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(v8::Isolate::GetCurrent())
+#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
+#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
#endif
/* ---------------------------------------------------------------------------
@@ -163,7 +181,7 @@ public:
SWIGV8_THROW_EXCEPTION(err); SWIGV8_THROW_EXCEPTION(err);
} }
} }
@ -389,7 +454,7 @@ index 2452f4040..866cdb331 100644
}; };
/* --------------------------------------------------------------------------- /* ---------------------------------------------------------------------------
@@ -228,13 +228,13 @@ public: @@ -228,13 +246,13 @@ public:
SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ; SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ;
@ -405,7 +470,7 @@ index 2452f4040..866cdb331 100644
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef)); SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
#else #else
SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0)); SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
@@ -280,11 +280,11 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Prox @@ -280,11 +298,11 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Prox
delete proxy; delete proxy;
} }
@ -419,7 +484,7 @@ index 2452f4040..866cdb331 100644
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR; if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
@@ -304,7 +304,7 @@ SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr) @@ -304,7 +322,7 @@ SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr)
return SWIG_OK; return SWIG_OK;
} }
@ -428,7 +493,16 @@ index 2452f4040..866cdb331 100644
SWIGV8_Proxy *cdata = new SWIGV8_Proxy(); SWIGV8_Proxy *cdata = new SWIGV8_Proxy();
cdata->swigCObject = ptr; cdata->swigCObject = ptr;
cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0; cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
@@ -367,7 +367,7 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw @@ -361,13 +379,15 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw
cdata->handle.MarkIndependent();
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
-#else
+#elif (SWIG_V8_VERSION < 0x0706)
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
} }
@ -437,7 +511,7 @@ index 2452f4040..866cdb331 100644
SWIGV8_HANDLESCOPE(); SWIGV8_HANDLESCOPE();
/* special case: JavaScript null => C NULL pointer */ /* special case: JavaScript null => C NULL pointer */
@@ -378,14 +378,14 @@ SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swi @@ -378,14 +398,14 @@ SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swi
if(!valRef->IsObject()) { if(!valRef->IsObject()) {
return SWIG_TypeError; return SWIG_TypeError;
} }
@ -455,7 +529,20 @@ index 2452f4040..866cdb331 100644
if (ptr == NULL) { if (ptr == NULL) {
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
@@ -433,7 +433,7 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf @@ -412,8 +432,11 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
}
#endif
-// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
+#if (SWIG_V8_VERSION < 0x0705)
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 +456,7 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) { SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE(); SWIGV8_HANDLESCOPE();
@ -464,7 +551,7 @@ index 2452f4040..866cdb331 100644
void *arg1 = (void *) 0 ; void *arg1 = (void *) 0 ;
void *arg2 = (void *) 0 ; void *arg2 = (void *) 0 ;
bool result; bool result;
@@ -463,7 +463,7 @@ fail: @@ -463,7 +486,7 @@ fail:
SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) { SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) {
SWIGV8_HANDLESCOPE(); SWIGV8_HANDLESCOPE();
@ -473,7 +560,7 @@ index 2452f4040..866cdb331 100644
void *arg1 = (void *) 0 ; void *arg1 = (void *) 0 ;
long result; long result;
int res1; int res1;
@@ -502,10 +502,10 @@ public: @@ -502,10 +525,10 @@ public:
}; };
SWIGRUNTIMEINLINE SWIGRUNTIMEINLINE
@ -486,7 +573,7 @@ index 2452f4040..866cdb331 100644
if(objRef->InternalFieldCount() < 1) return false; if(objRef->InternalFieldCount() < 1) return false;
#if (V8_MAJOR_VERSION-0) < 5 #if (V8_MAJOR_VERSION-0) < 5
v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__")); v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
@@ -519,13 +519,13 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) { @@ -519,13 +542,13 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
} }
SWIGRUNTIME SWIGRUNTIME
@ -502,7 +589,7 @@ index 2452f4040..866cdb331 100644
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0); v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
@@ -542,7 +542,7 @@ swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr, @@ -542,7 +565,7 @@ swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr,
} }
SWIGRUNTIME SWIGRUNTIME
@ -511,7 +598,7 @@ index 2452f4040..866cdb331 100644
swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz); swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz);
if (!to) return SWIG_ERROR; if (!to) return SWIG_ERROR;
if (ty) { if (ty) {
@@ -590,7 +590,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8 @@ -590,7 +613,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8
} }
SWIGRUNTIME SWIGRUNTIME
@ -520,7 +607,19 @@ index 2452f4040..866cdb331 100644
SWIGV8_HANDLESCOPE_ESC(); SWIGV8_HANDLESCOPE_ESC();
SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type); SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type);
@@ -657,7 +657,7 @@ SWIGRUNTIME @@ -636,8 +659,10 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
cdata->handle.MarkIndependent();
#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
-#else
+#elif (SWIG_V8_VERSION < 0x0706)
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);
@@ -657,7 +682,7 @@ SWIGRUNTIME
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) #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) { v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Handle<v8::Value> result, v8::Handle<v8::Value> obj) {
#else #else
@ -529,6 +628,21 @@ index 2452f4040..866cdb331 100644
#endif #endif
SWIGV8_HANDLESCOPE_ESC(); SWIGV8_HANDLESCOPE_ESC();
diff --git a/Lib/javascript/v8/javascriptruntime.swg b/Lib/javascript/v8/javascriptruntime.swg
index c78e04efb..e7941d657 100644
--- a/Lib/javascript/v8/javascriptruntime.swg
+++ b/Lib/javascript/v8/javascriptruntime.swg
@@ -56,6 +56,10 @@
%insert(runtime) %{
#include <v8.h>
+#if defined(V8_MAJOR_VERSION) && defined(V8_MINOR_VERSION)
+#define SWIG_V8_VERSION (V8_MAJOR_VERSION * 256 + V8_MINOR_VERSION)
+#endif
+
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
diff --git a/Lib/javascript/v8/javascriptstrings.swg b/Lib/javascript/v8/javascriptstrings.swg diff --git a/Lib/javascript/v8/javascriptstrings.swg b/Lib/javascript/v8/javascriptstrings.swg
index e767a6d66..61a937fa5 100644 index e767a6d66..61a937fa5 100644
--- a/Lib/javascript/v8/javascriptstrings.swg --- a/Lib/javascript/v8/javascriptstrings.swg

View File

@ -1,29 +0,0 @@
From d6901084c695117379991e59460a81ab37562eb5 Mon Sep 17 00:00:00 2001
From: Alexandre Lissy <lissyx@lissyx.dyndns.org>
Date: Thu, 25 Apr 2019 12:43:09 +0200
Subject: [PATCH 2/3] Move to new MaybeLocal based NewInstance()
---
Lib/javascript/v8/javascriptrun.swg | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
index 866cdb331..3efe8783d 100644
--- a/Lib/javascript/v8/javascriptrun.swg
+++ b/Lib/javascript/v8/javascriptrun.swg
@@ -412,8 +412,11 @@ SWIGRUNTIME v8::Local<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info
}
#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);
--
2.20.1

View File

@ -1,45 +0,0 @@
From 4e6df9ce197f2bb9ff34a6b584038a7dc7241126 Mon Sep 17 00:00:00 2001
From: Alexandre Lissy <lissyx@lissyx.dyndns.org>
Date: Thu, 25 Apr 2019 12:47:46 +0200
Subject: [PATCH 3/3] Move to new MaybeLocal based GetFunction()
---
Lib/javascript/v8/javascriptcode.swg | 4 ++++
Lib/javascript/v8/javascripthelpers.swg | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
index 86963c1ed..a707750b1 100644
--- a/Lib/javascript/v8/javascriptcode.swg
+++ b/Lib/javascript/v8/javascriptcode.swg
@@ -424,7 +424,11 @@ fail:
$jsmangledname_class_0->SetCallHandler($jsctor);
$jsmangledname_class_0->Inherit($jsmangledname_class);
$jsmangledname_class_0->SetHiddenPrototype(true);
+#if (NODE_MODULE_VERSION < 72)
v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
+#else
+ v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
+#endif
%}
/* -----------------------------------------------------------------------------
diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
index c610f5196..b0ecfafff 100644
--- a/Lib/javascript/v8/javascripthelpers.swg
+++ b/Lib/javascript/v8/javascripthelpers.swg
@@ -62,7 +62,11 @@ SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Local<v8::FunctionTemplate> class_
*/
SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Local<v8::Object> obj, const char* symbol,
const SwigV8FunctionCallback& _func) {
+#if (NODE_MODULE_VERSION < 72)
obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
+#else
+ obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked());
+#endif
}
/**
--
2.20.1

View File

@ -86,10 +86,8 @@ swig:
# patch of _0001 would require the reverse patch of _0002 to be already # patch of _0001 would require the reverse patch of _0002 to be already
# applied, and we don't want to. So just test that reversing _0002 in # applied, and we don't want to. So just test that reversing _0002 in
# dry-run. # dry-run.
osx_v12: '(if ! patch -R -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 -s -f --dry-run < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_0003-Move-to-new-MaybeLocal-based-GetFunction.patch ; then osx_v12: '(if ! patch -R -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 -s -f --dry-run < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-runtime.patch ; then
patch -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_0001-Move-from-v8-Handle-to-v8-Local.patch && patch -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds//native_client/swig_node_v12_0001-Upgrade-SWIG-to-support-NodeJS-v12-V8-v7.6-runtime.patch ;
patch -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_0002-Move-to-new-MaybeLocal-based-NewInstance.patch &&
patch -d $TASKCLUSTER_TASK_DIR/homebrew/Cellar/swig/*/share/swig/*/ -p2 < $TASKCLUSTER_TASK_DIR/DeepSpeech/ds/native_client/swig_node_v12_0003-Move-to-new-MaybeLocal-based-GetFunction.patch;
else else
echo "NO NODEJS v12 PATCH NEEDED"; echo "NO NODEJS v12 PATCH NEEDED";
fi)' fi)'

View File

@ -57,7 +57,7 @@ model_source_mmap="$(dirname "${model_source}")/${model_name_mmap}"
SUPPORTED_PYTHON_VERSIONS=${SUPPORTED_PYTHON_VERSIONS:-2.7.16:ucs2 2.7.16:ucs4 3.4.10:ucs4 3.5.7:ucs4 3.6.8:ucs4 3.7.3:ucs4} SUPPORTED_PYTHON_VERSIONS=${SUPPORTED_PYTHON_VERSIONS:-2.7.16:ucs2 2.7.16:ucs4 3.4.10:ucs4 3.5.7:ucs4 3.6.8:ucs4 3.7.3:ucs4}
SUPPORTED_NODEJS_VERSIONS=${SUPPORTED_NODEJS_VERSIONS:-4.9.1 5.12.0 6.17.1 7.10.1 8.16.0 9.11.2 10.16.0 11.15.0 12.5.0} SUPPORTED_NODEJS_VERSIONS=${SUPPORTED_NODEJS_VERSIONS:-4.9.1 5.12.0 6.17.1 7.10.1 8.16.0 9.11.2 10.16.0 11.15.0 12.5.0}
SUPPORTED_ELECTRONJS_VERSIONS=${SUPPORTED_ELECTRONJS_VERSIONS:-1.6.18 1.7.16 1.8.8 2.0.18 3.0.16 3.1.11 4.0.3 4.1.5 4.2.5 5.0.6} SUPPORTED_ELECTRONJS_VERSIONS=${SUPPORTED_ELECTRONJS_VERSIONS:-1.6.18 1.7.16 1.8.8 2.0.18 3.0.16 3.1.11 4.0.3 4.1.5 4.2.5 5.0.6 6.0.11}
strip() { strip() {
echo "$(echo $1 | sed -e 's/^[[:space:]]+//' -e 's/[[:space:]]+$//')" echo "$(echo $1 | sed -e 's/^[[:space:]]+//' -e 's/[[:space:]]+$//')"

View File

@ -0,0 +1,13 @@
build:
template_file: test-darwin-opt-base.tyml
dependencies:
- "node-package-cpu"
- "test-training_upstream-linux-amd64-py35m-opt"
system_setup:
>
${nodejs.brew.setup} && ${nodejs.brew.prep_12} && ${nodejs.brew.env}
args:
tests_cmdline: "$TASKCLUSTER_TASK_DIR/DeepSpeech/ds/taskcluster/tc-electron-tests.sh 12.x 6.0.11"
metadata:
name: "DeepSpeech OSX AMD64 CPU ElectronJS v6.0 tests"
description: "Testing DeepSpeech for OSX/AMD64 on ElectronJS v6.0, CPU only, optimized version"

View File

@ -0,0 +1,14 @@
build:
template_file: test-linux-opt-base.tyml
docker_image: "ubuntu:16.04"
dependencies:
- "node-package-cpu"
- "test-training_upstream-linux-amd64-py35m-opt"
system_setup:
>
${nodejs.packages_xenial.prep_12} && ${nodejs.packages_xenial.apt_pinning} && apt-get -qq update && apt-get -qq -y install ${nodejs.packages_xenial.apt} ${electronjs.packages_xenial.apt}
args:
tests_cmdline: "${system.homedir.linux}/DeepSpeech/ds/taskcluster/tc-electron-tests.sh 12.x 6.0.11"
metadata:
name: "DeepSpeech Linux AMD64 CPU ElectronJS v6.0 tests"
description: "Testing DeepSpeech for Linux/AMD64 on ElectronJS v6.0, CPU only, optimized version"

View File

@ -0,0 +1,13 @@
build:
template_file: test-win-opt-base.tyml
dependencies:
- "node-package-cpu"
- "test-training_upstream-linux-amd64-py35m-opt"
system_setup:
>
${system.sox_win} && ${nodejs.win.prep_12}
args:
tests_cmdline: "${system.homedir.win}/DeepSpeech/ds/taskcluster/tc-electron-tests.sh 12.x 6.0.11"
metadata:
name: "DeepSpeech Windows AMD64 CPU ElectronJS v6.0 tests"
description: "Testing DeepSpeech for Windows/AMD64 on ElectronJS v6.0, CPU only, optimized version"